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;
}

View File

@ -27,18 +27,19 @@ export default function () {
actionName: "to-bom-detail",
emitFullData: true,
},
// {
// prop: "operations",
// name: "操作",
// fixed: "right",
// width: 120,
// subcomponent: TableOperaionComponent,
// options: [
// { name: "copy", label: "复制", icon: "copy-document" },
// { name: "edit", label: "编辑", icon: "edit-outline" },
// { name: "delete", icon: "delete", label: "删除", emitFull: true, permission: "pms:bom:delete" },
// ],
// },
{
prop: "operations",
name: "操作",
fixed: "right",
width: 120,
subcomponent: TableOperaionComponent,
options: [
{ name: "sync", label: "同步", icon: "refresh", emitFull: true, showOverlay: true }
// { name: "copy", label: "复制", icon: "copy-document" },
// { name: "edit", label: "编辑", icon: "edit-outline" },
// { name: "delete", icon: "delete", label: "删除", emitFull: true, permission: "pms:bom:delete" },
],
},
];
const headFormFields = [
@ -71,9 +72,8 @@ export default function () {
// },
// {
// button: {
// // type: "plain",
// type: "plain",
// name: "同步",
// type: 'primary'
// },
// },
];
@ -265,6 +265,7 @@ export default function () {
subpage: "/pms/bomMaterial/page",
importUrl: "/pms/order/importExcelBom", // 导入的api
templateUrl: "/importTemplates/bomImport.xlsx",
syncSingleUrl: "/pms/trans/bomSync"
},
};
}

View File

@ -28,7 +28,7 @@
:dialog-config="dialogConfigs"
@refresh-tables="handleRefreshTable"
/>
<ListSectionWithHead
<!-- <ListSectionWithHead
id="finished"
:refresh-key="keys.finished"
:extra-search-conditions="{ code: '' }"
@ -37,7 +37,7 @@
:head-config="{ title: '完成的订单', form: headFormConfigs.finishedTableSearch }"
:dialog-config="dialogConfigs"
@refresh-tables="handleRefreshTable"
/>
/> -->
</div>
</div>

View File

@ -21,7 +21,7 @@ export default function () {
width: 120,
subcomponent: TableOperaionComponent,
options: [
{ name: "copy", label: "复制", icon: "copy-document" },
{ name: "copy", label: "复制", icon: "copy-document", showOverlay: true, emitFull: true }, // showOverlay 和 emitFull 需同时使用
{ name: "edit", label: "编辑", icon: "edit-outline" },
{ name: "delete", icon: "delete", label: "删除", promptField: 'code', emitFull: true, permission: "pms:shapeStep:delete" }],
},