@@ -129,7 +129,7 @@ export default { | |||
}, | |||
methods: { | |||
handleSubEmitData(payload) { | |||
console.log("[component] BaseListTable handleSubEmitData(): ", payload); | |||
// console.log("[component] BaseListTable handleSubEmitData(): ", payload); | |||
this.$emit("operate-event", payload); | |||
}, | |||
loadSubClassFn(tree, treeNode, resolve) { | |||
@@ -0,0 +1,107 @@ | |||
<template> | |||
<el-dialog | |||
class="dialog-just-form" | |||
:fullscreen="fullscreen" | |||
:title="查看批次" | |||
:visible="visible" | |||
@close="handleClose" | |||
:destroy-on-close="false" | |||
:close-on-click-modal="configs.clickModalToClose ?? false"></el-dialog> | |||
</template> | |||
<script> | |||
import { pick as __pick } from "@/utils/filters"; | |||
export default { | |||
name: "DialogList", | |||
components: {}, | |||
props: { | |||
configs: { | |||
type: Object, | |||
default: () => ({ | |||
clickModalToClose: false, | |||
forms: null, | |||
}), | |||
}, | |||
}, | |||
data() { | |||
return { | |||
loadingStatus: false, | |||
dataForm, | |||
watchList, | |||
cachedList, | |||
detailMode: false, | |||
baseDialogConfig: null, | |||
visible: false, | |||
}; | |||
}, | |||
methods: { | |||
/** init **/ | |||
init(id, detailMode) { | |||
this.visible = true; | |||
// console.log("[DialogJustForm] init", this.dataForm, id, detailMode); | |||
if (this.$refs.dataForm) { | |||
// console.log("[DialogJustForm] clearing form validation..."); | |||
// 当不是首次渲染dialog的时候,一开始就清空验证信息,本组件的循环里只有一个 dataForm 所以只用取 [0] 即可 | |||
this.$refs.dataForm.clearValidate(); | |||
} | |||
this.detailMode = detailMode ?? false; | |||
this.$nextTick(() => { | |||
this.dataForm.id = id || null; | |||
if (this.dataForm.id) { | |||
// 如果是编辑 | |||
this.loadingStatus = true; | |||
// 获取基本信息 | |||
this.$http | |||
.get(this.urls.base + `/${this.dataForm.id}`) | |||
.then(({ data: res }) => { | |||
if (res && res.code === 0) { | |||
this.dataForm = __pick(res.data, Object.keys(this.dataForm)); | |||
/** 格式化文件上传列表 */ | |||
if (Array.isArray(this.dataForm.files)) { | |||
this.dataForm.files = this.dataForm.files.map((file) => ({ | |||
id: file.id, | |||
name: file.fileUrl.split("/").pop(), | |||
typeCode: file.typeCode, | |||
url: file.fileUrl, | |||
})); | |||
} | |||
// console.log("[DialogJustForm] init():", this.dataForm); | |||
} else { | |||
this.$message({ | |||
message: `${res.code}: ${res.msg}`, | |||
type: "error", | |||
duration: 1500, | |||
}); | |||
} | |||
this.loadingStatus = false; | |||
}) | |||
.catch((err) => { | |||
this.loadingStatus = false; | |||
this.$message({ | |||
message: `${err}`, | |||
type: "error", | |||
duration: 1500, | |||
}); | |||
}); | |||
} else { | |||
// 如果不是编辑 | |||
this.loadingStatus = false; | |||
} | |||
}); | |||
}, | |||
handleClose() { | |||
this.visible = false; | |||
setTimeout(() => { | |||
this.$emit("destroy-dialog"); | |||
// this.resetForm(); | |||
// this.$emit("update:dialogVisible", false); | |||
}, 200); | |||
}, | |||
}, | |||
}; | |||
</script> |
@@ -7,8 +7,7 @@ | |||
:column-config="tableConfig.column" | |||
:table-data="dataList" | |||
@operate-event="handleOperate" | |||
:refresh-layout-key="refreshLayoutKey" | |||
/> | |||
:refresh-layout-key="refreshLayoutKey" /> | |||
<el-pagination | |||
@size-change="handleSizeChange" | |||
@@ -17,17 +16,23 @@ | |||
:page-sizes="[1, 5, 10, 20]" | |||
:page-size="listQuery.limit" | |||
:total="totalPage" | |||
layout="total, prev, pager, next, jumper" | |||
></el-pagination> | |||
layout="total, prev, pager, next, jumper"></el-pagination> | |||
<!-- 编辑弹窗 --> | |||
<DialogJustForm ref="vdialog" v-if="false" /> | |||
<!-- 批次弹窗 --> | |||
<DialogList ref="dialogList" :configs="{}" /> | |||
</div> | |||
</template> | |||
<script> | |||
import BaseListTable from "./BaseListTable.vue"; | |||
import DialogJustForm from "./DialogJustForm.vue"; | |||
import DialogList from "./DialogList.vue"; | |||
export default { | |||
name: "TablePaginationComp", | |||
components: { BaseListTable }, | |||
components: { BaseListTable, DialogJustForm, DialogList }, | |||
props: { | |||
tableConfig: { | |||
type: Object, | |||
@@ -65,8 +70,55 @@ export default { | |||
this.getAList(); | |||
}, | |||
methods: { | |||
handleOperate({ type, data }) { | |||
console.log("payload", type, data); | |||
handleOperate({ type, data: id }) { | |||
console.log("payload", type, id); | |||
switch (type) { | |||
case "edit": | |||
// 编辑 | |||
this.$refs.vdialog.init(id); | |||
console.log("编辑"); | |||
break; | |||
case "view-batch": | |||
// 查看批次 | |||
console.log("查看批次"); | |||
break; | |||
case "detach": | |||
// 下发 | |||
return this.$confirm("是否下发?", "提示", { | |||
confirmButtonText: "确定", | |||
cancelButtonText: "取消", | |||
type: "warning", | |||
}) | |||
.then(() => { | |||
console.log("here"); | |||
this.$http | |||
.post(this.urls.detach, id /* { id: data } */, { headers: { "Content-Type": "application/json" } }) | |||
.then(({ data: res }) => { | |||
if (res.code === 0) { | |||
this.$message({ | |||
message: "下发成功", | |||
type: "success", | |||
duration: 1500, | |||
onClose: () => { | |||
this.getAList(); | |||
}, | |||
}); | |||
} else { | |||
this.$message({ | |||
message: `${res.code}: ${res.msg}`, | |||
type: "error", | |||
duration: 1500, | |||
}); | |||
} | |||
}); | |||
}) | |||
.catch(() => { | |||
this.$message({ | |||
type: "warning", | |||
message: "已取消下发", | |||
}); | |||
}); | |||
} | |||
}, | |||
handleSizeChange(newSize) { | |||
@@ -4,7 +4,7 @@ | |||
<el-col style="margin-bottom: 12px"> | |||
<!-- 混料订单 --> | |||
<TablePagi v-if="order !== null" :extra-query-fields="{ code: order.code, cate: order.cate }" | |||
:urls="{ page: '/pms/blenderOrder/pageView' }" :page-is-post="true" :table-config="{ | |||
:urls="{ page: '/pms/blenderOrder/pageView', detach: '/pms/trans/blenderDeli' }" :page-is-post="true" :table-config="{ | |||
table: null, | |||
column: blenderTableProps, | |||
}" /> | |||
@@ -12,7 +12,7 @@ | |||
<el-col style="margin-bottom: 12px"> | |||
<!-- 压制订单 --> | |||
<TablePagi v-if="order !== null" :extra-query-fields="{ code: order.code, cate: order.cate }" | |||
:urls="{ page: '/pms/pressOrder/pageView' }" :page-is-post="true" :table-config="{ | |||
:urls="{ page: '/pms/pressOrder/pageView', detach: '/pms/trans/pressDeli' }" :page-is-post="true" :table-config="{ | |||
table: null, | |||
column: pressTableProps, | |||
}" /> | |||
@@ -113,6 +113,13 @@ export default { | |||
], | |||
}, | |||
], | |||
blenderEditConfig: { | |||
form: { | |||
field: [ | |||
[], | |||
] | |||
} | |||
}, | |||
refreshLayoutKey1: "", | |||
// 压制 | |||
pressTableProps: [ | |||