|
@@ -1,4 +1,15 @@
|
|
|
// 分类表
|
|
|
+function setTimeoutSync(handle, time) {
|
|
|
+ return new Promise(function (resolve, reject) {
|
|
|
+ setTimeout(function () {
|
|
|
+ if (handle && typeof handle === 'function') {
|
|
|
+ handle();
|
|
|
+ }
|
|
|
+ resolve();
|
|
|
+ }, time);
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
const CLASS_BOOK = (() => {
|
|
|
const setting = {
|
|
|
header: [{ headerName: '分类', headerWidth: $('#area-spread').width(), dataCode: 'name', dataType: 'String', hAlign: 'left', vAlign: 'center' }],
|
|
@@ -104,8 +115,10 @@ const CLASS_BOOK = (() => {
|
|
|
const $upMove = $('#tree-up-move');
|
|
|
const $calcPriceIndex = $('#calc-price-index');
|
|
|
const $matchSummary = $('#match-summary');
|
|
|
+ const $batchMatchSummary = $('#batch-match-summary');
|
|
|
const $showEmpty = $('#show-empty');
|
|
|
|
|
|
+
|
|
|
// 插入
|
|
|
let canInsert = true;
|
|
|
async function insert() {
|
|
@@ -457,6 +470,10 @@ const CLASS_BOOK = (() => {
|
|
|
|
|
|
}, DEBOUNCE_TIME, { leading: true }));
|
|
|
|
|
|
+ const doMatchSummary = async (libID, compilationID, areaID) => {
|
|
|
+ await ajaxPost('/priceInfo/matchSummary', { libID, compilationID, areaID }, 1000 * 60 * 10);
|
|
|
+ }
|
|
|
+
|
|
|
// 匹配总表
|
|
|
$matchSummary.click(_.debounce(async () => {
|
|
|
$.bootstrapLoading.progressStart('匹配总表', true);
|
|
@@ -464,7 +481,7 @@ const CLASS_BOOK = (() => {
|
|
|
try {
|
|
|
const matchAll = $('#match-all-input')[0].checked;
|
|
|
const areaID = matchAll ? '' : AREA_BOOK.curArea?.ID;
|
|
|
- await ajaxPost('/priceInfo/matchSummary', { libID, compilationID, areaID }, 1000 * 60 * 10);
|
|
|
+ await doMatchSummary(libID, compilationID, areaID);
|
|
|
setTimeout(() => {
|
|
|
$.bootstrapLoading.progressEnd();
|
|
|
window.location.reload()
|
|
@@ -476,6 +493,27 @@ const CLASS_BOOK = (() => {
|
|
|
}
|
|
|
}, DEBOUNCE_TIME, { leading: true }));
|
|
|
|
|
|
+ // 批量匹配总表
|
|
|
+ $batchMatchSummary.click(_.debounce(async () => {
|
|
|
+ $.bootstrapLoading.progressStart('批量匹配总表', true);
|
|
|
+ try {
|
|
|
+ const libs = await ajaxPost('/priceInfo/getAllLibs');
|
|
|
+ for (const lib of libs) {
|
|
|
+ $("#progress_modal_body").text(`${lib.name},正在匹配总表,请稍后(${libs.indexOf(lib) + 1}/${libs.length})...`);
|
|
|
+ await doMatchSummary(lib.ID, lib.compilationID, '');
|
|
|
+ await setTimeoutSync(() => { }, 100);
|
|
|
+ }
|
|
|
+ await setTimeoutSync(() => {
|
|
|
+ $.bootstrapLoading.progressEnd();
|
|
|
+ window.location.reload()
|
|
|
+ }, 1000);
|
|
|
+ } catch (error) {
|
|
|
+ alert(error)
|
|
|
+ console.log(error);
|
|
|
+ $.bootstrapLoading.progressEnd();
|
|
|
+ }
|
|
|
+ }, DEBOUNCE_TIME, { leading: true }));
|
|
|
+
|
|
|
// 显示空数据
|
|
|
$showEmpty.click(() => {
|
|
|
$('#empty-area').modal('show');
|