update 2023.4.23

This commit is contained in:
lb
2023-04-23 15:06:39 +08:00
parent dfbc7e08f9
commit ea46739942
4 changed files with 68 additions and 33 deletions

View File

@@ -1,6 +1,6 @@
<!-- 表格页加上搜索条件 -->
<template>
<div class="list-view-with-head">
<div class="list-view-with-head" ref="pointer-loading-ref">
<!-- <head-form :form-config="headFormConfig" @headBtnClick="btnClick" /> -->
<BaseSearchForm :head-config="headConfig" @btn-click="handleBtnClick" />
@@ -21,6 +21,7 @@
:dialog-visible.sync="carPayloadDialogVisible" :configs="carPayloadDialogConfigs" @refreshDataList="getList" />
<DialogUpload ref="upload-dialog" v-if="uploadDialogVisible" title="导入配方" filename="bomTemplate.xlsx"
@refresh-list="getList" />
<Overlay v-if="overlayVisible" />
</div>
</template>
@@ -31,6 +32,7 @@ import DialogWithMenu from "@/components/DialogWithMenu.vue";
import DialogJustForm from "@/components/DialogJustForm.vue";
import DialogCarPayload from "@/components/DialogCarPayload.vue";
import DialogUpload from "@/components/DialogUpload.vue";
import Overlay from '@/components/Overlay.vue';
import moment from "moment";
const DIALOG_WITH_MENU = "DialogWithMenu";
@@ -39,7 +41,7 @@ const DIALOG_CARPAYLOAD = "DialogCarPayload";
export default {
name: "ListViewWithHead",
components: { BaseSearchForm, BaseListTable, DialogWithMenu, DialogJustForm, DialogCarPayload, DialogUpload },
components: { BaseSearchForm, BaseListTable, DialogWithMenu, DialogJustForm, DialogCarPayload, DialogUpload, Overlay },
props: {
tableConfig: {
type: Object,
@@ -110,6 +112,7 @@ export default {
tableLoading: false,
refreshLayoutKey: null,
uploadDialogVisible: false,
overlayVisible: false,
};
},
inject: ["urls"],
@@ -312,8 +315,22 @@ export default {
});
}
case "copy": {
//
let shouldShowOverlay = false
let payload = ''
console.log('copying...', type, data)
if (typeof data === 'object') {
const head = data.head
const copyOpt = ('options' in head && Array.isArray(head.options) && head.options.find(item => item.name === 'copy')) || null
if (copyOpt && 'showOverlay' in copyOpt && copyOpt.showOverlay) {
this.overlayVisible = true
shouldShowOverlay = true
payload = data.id
}
} else payload = data
return this.$http
.post(this.urls.copyUrl, data, {
.post(this.urls.copyUrl, payload, {
headers: {
"Content-Type": "application/json",
},
@@ -333,6 +350,7 @@ export default {
duration: 1500,
});
}
if (shouldShowOverlay) this.overlayVisible = false
})
.catch((errMsg) => {
this.$message({
@@ -340,6 +358,7 @@ export default {
type: "error",
duration: 1500,
});
if (shouldShowOverlay) this.overlayVisible = false
});
}
case "change-category": {
@@ -431,21 +450,38 @@ export default {
break;
}
case "sync": {
let shouldShowOverlay = false
let payload = ''
console.log('sync...', type, data)
if (typeof data === 'object') {
const head = data.head
const syncOpt = ('options' in head && Array.isArray(head.options) && head.options.find(item => item.name === 'sync')) || null
if (syncOpt && 'showOverlay' in syncOpt && syncOpt.showOverlay) {
this.overlayVisible = true
shouldShowOverlay = true
payload = data.id
}
} else payload = data
this.$message({
message: '正在发起同步...',
type: "success",
});
// 同步单个料仓数据
this.$http
.post(this.urls.syncSingleUrl, data, {
.post(this.urls.syncSingleUrl, payload, {
headers: {
"Content-Type": "application/json",
},
})
.then(({ data: res }) => {
if (res.code === 0) {
this.$message({
message: "同步成功",
type: "success",
});
this.getList();
}
this.$message({
message: res.msg,
type: res.code === 0 ? "success" : 'error',
});
this.getList();
if (shouldShowOverlay) this.overlayVisible = false
});
}
}
@@ -507,11 +543,9 @@ export default {
case "同步":
case "全部同步":
this.$http.post(this.urls.syncUrl).then(({ data: res }) => {
console.log("全部同步", res);
if (res.code === 0) {
this.$message({ message: "同步成功", type: "success" });
this.getList();
}
console.log("同步", res);
this.$message({ message: res.msg, type: res.code === 0 ? "success" : 'error' });
this.getList();
});
break;
}