|
@@ -75,6 +75,43 @@ const ExportView = (() => {
|
|
|
$('#exportCode').modal('show');
|
|
|
}
|
|
|
}
|
|
|
+ // 确定导出
|
|
|
+ async function handleExportConfirm() {
|
|
|
+ if (!spread || !_exportCache || !_exportCache.length) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (STATE.confirming) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ STATE.confirming = true;
|
|
|
+ let pr = new SCComponent.InitProgressBar();
|
|
|
+ try {
|
|
|
+ // 工程编号
|
|
|
+ let codes = getCodeFromSheet(spread.getSheet(0));
|
|
|
+ if (codes.includes('')) {
|
|
|
+ alert('单项、单位工程工程编号不可为空。');
|
|
|
+ STATE.confirming = false;
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if ([...new Set(codes)].length !== codes.length) {
|
|
|
+ alert('单项、单位工程工程编号必须唯一。');
|
|
|
+ STATE.confirming = false;
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ pr.start('导出数据接口', '正在导出文件,请稍候……');
|
|
|
+ // 导出文件
|
|
|
+ await _base.exportFile(codes, _exportCache, XMLStandard.resetContentCode, XMLStandard.saveAsFile);
|
|
|
+ } catch (err) {
|
|
|
+ console.log(err);
|
|
|
+ alert(err);
|
|
|
+ }
|
|
|
+ pr.end();
|
|
|
+ $('#exportCode').modal('hide');
|
|
|
+ $('#export').modal('hide');
|
|
|
+ setTimeout(() => {
|
|
|
+ STATE.confirming = false;
|
|
|
+ }, 300);
|
|
|
+ }
|
|
|
//事件监听
|
|
|
function exportListener() {
|
|
|
//导出接口-项目自检
|
|
@@ -189,41 +226,7 @@ const ExportView = (() => {
|
|
|
});
|
|
|
//设置完工程编号后,导出数据。如果选中多个文件,导出压缩包
|
|
|
$('#exportCode-confirm').click(async function () {
|
|
|
- if (!spread || !_exportCache || !_exportCache.length) {
|
|
|
- return false;
|
|
|
- }
|
|
|
- if (STATE.confirming) {
|
|
|
- return;
|
|
|
- }
|
|
|
- STATE.confirming = true;
|
|
|
- let pr = new SCComponent.InitProgressBar();
|
|
|
- try {
|
|
|
- // 工程编号
|
|
|
- let codes = getCodeFromSheet(spread.getSheet(0));
|
|
|
- if (codes.includes('')) {
|
|
|
- alert('单项、单位工程工程编号不可为空。');
|
|
|
- STATE.confirming = false;
|
|
|
- return false;
|
|
|
- }
|
|
|
- if ([...new Set(codes)].length !== codes.length) {
|
|
|
- alert('单项、单位工程工程编号必须唯一。');
|
|
|
- STATE.confirming = false;
|
|
|
- return false;
|
|
|
- }
|
|
|
- pr.start('导出数据接口', '正在导出文件,请稍候……');
|
|
|
- // 导出文件
|
|
|
- await _base.exportFile(codes, _exportCache, XMLStandard.resetContentCode, XMLStandard.saveAsFile);
|
|
|
- } catch (err) {
|
|
|
- console.log(err);
|
|
|
- alert(err);
|
|
|
- }
|
|
|
- pr.end();
|
|
|
- $('#exportCode').modal('hide');
|
|
|
- $('#export').modal('hide');
|
|
|
- setTimeout(() => {
|
|
|
- STATE.confirming = false;
|
|
|
- }, 300);
|
|
|
-
|
|
|
+ await handleExportConfirm();
|
|
|
});
|
|
|
//导出窗口--------
|
|
|
$('#export').on('hide.bs.modal', function() {
|