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> <template>
<div class="list-view-with-head"> <div class="list-view-with-head" ref="pointer-loading-ref">
<!-- <head-form :form-config="headFormConfig" @headBtnClick="btnClick" /> --> <!-- <head-form :form-config="headFormConfig" @headBtnClick="btnClick" /> -->
<BaseSearchForm :head-config="headConfig" @btn-click="handleBtnClick" /> <BaseSearchForm :head-config="headConfig" @btn-click="handleBtnClick" />
@ -21,6 +21,7 @@
:dialog-visible.sync="carPayloadDialogVisible" :configs="carPayloadDialogConfigs" @refreshDataList="getList" /> :dialog-visible.sync="carPayloadDialogVisible" :configs="carPayloadDialogConfigs" @refreshDataList="getList" />
<DialogUpload ref="upload-dialog" v-if="uploadDialogVisible" title="导入配方" filename="bomTemplate.xlsx" <DialogUpload ref="upload-dialog" v-if="uploadDialogVisible" title="导入配方" filename="bomTemplate.xlsx"
@refresh-list="getList" /> @refresh-list="getList" />
<Overlay v-if="overlayVisible" />
</div> </div>
</template> </template>
@ -31,6 +32,7 @@ import DialogWithMenu from "@/components/DialogWithMenu.vue";
import DialogJustForm from "@/components/DialogJustForm.vue"; import DialogJustForm from "@/components/DialogJustForm.vue";
import DialogCarPayload from "@/components/DialogCarPayload.vue"; import DialogCarPayload from "@/components/DialogCarPayload.vue";
import DialogUpload from "@/components/DialogUpload.vue"; import DialogUpload from "@/components/DialogUpload.vue";
import Overlay from '@/components/Overlay.vue';
import moment from "moment"; import moment from "moment";
const DIALOG_WITH_MENU = "DialogWithMenu"; const DIALOG_WITH_MENU = "DialogWithMenu";
@ -39,7 +41,7 @@ const DIALOG_CARPAYLOAD = "DialogCarPayload";
export default { export default {
name: "ListViewWithHead", name: "ListViewWithHead",
components: { BaseSearchForm, BaseListTable, DialogWithMenu, DialogJustForm, DialogCarPayload, DialogUpload }, components: { BaseSearchForm, BaseListTable, DialogWithMenu, DialogJustForm, DialogCarPayload, DialogUpload, Overlay },
props: { props: {
tableConfig: { tableConfig: {
type: Object, type: Object,
@ -110,6 +112,7 @@ export default {
tableLoading: false, tableLoading: false,
refreshLayoutKey: null, refreshLayoutKey: null,
uploadDialogVisible: false, uploadDialogVisible: false,
overlayVisible: false,
}; };
}, },
inject: ["urls"], inject: ["urls"],
@ -312,8 +315,22 @@ export default {
}); });
} }
case "copy": { 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 return this.$http
.post(this.urls.copyUrl, data, { .post(this.urls.copyUrl, payload, {
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
}, },
@ -333,6 +350,7 @@ export default {
duration: 1500, duration: 1500,
}); });
} }
if (shouldShowOverlay) this.overlayVisible = false
}) })
.catch((errMsg) => { .catch((errMsg) => {
this.$message({ this.$message({
@ -340,6 +358,7 @@ export default {
type: "error", type: "error",
duration: 1500, duration: 1500,
}); });
if (shouldShowOverlay) this.overlayVisible = false
}); });
} }
case "change-category": { case "change-category": {
@ -431,21 +450,38 @@ export default {
break; break;
} }
case "sync": { 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 this.$http
.post(this.urls.syncSingleUrl, data, { .post(this.urls.syncSingleUrl, payload, {
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
}, },
}) })
.then(({ data: res }) => { .then(({ data: res }) => {
if (res.code === 0) {
this.$message({ this.$message({
message: "同步成功", message: res.msg,
type: "success", type: res.code === 0 ? "success" : 'error',
}); });
this.getList(); this.getList();
} if (shouldShowOverlay) this.overlayVisible = false
}); });
} }
} }
@ -507,11 +543,9 @@ export default {
case "同步": case "同步":
case "全部同步": case "全部同步":
this.$http.post(this.urls.syncUrl).then(({ data: res }) => { this.$http.post(this.urls.syncUrl).then(({ data: res }) => {
console.log("全部同步", res); console.log("同步", res);
if (res.code === 0) { this.$message({ message: res.msg, type: res.code === 0 ? "success" : 'error' });
this.$message({ message: "同步成功", type: "success" });
this.getList(); this.getList();
}
}); });
break; break;
} }

View File

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

View File

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

View File

@ -21,7 +21,7 @@ export default function () {
width: 120, width: 120,
subcomponent: TableOperaionComponent, subcomponent: TableOperaionComponent,
options: [ 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: "edit", label: "编辑", icon: "edit-outline" },
{ name: "delete", icon: "delete", label: "删除", promptField: 'code', emitFull: true, permission: "pms:shapeStep:delete" }], { name: "delete", icon: "delete", label: "删除", promptField: 'code', emitFull: true, permission: "pms:shapeStep:delete" }],
}, },