update 混料订单编辑里加一个配方

Cette révision appartient à :
lb 2023-03-27 17:01:11 +08:00
Parent d2c0978321
révision 0d8bd350fa
5 fichiers modifiés avec 137 ajouts et 64 suppressions

Voir le fichier

@ -32,9 +32,14 @@ export default function () {
width: 90,
subcomponent: TableOperaionComponent,
options: [
{ name:"edit", label: "编辑", icon: "edit-outline", enable: injectRow => { return 'task' in injectRow && injectRow.task === 'Manual' } },
{ name: 'delete', icon: 'delete', enable: injectRow => { return 'task' in injectRow && injectRow.task === 'Manual' } },
] // 只有 injectRow.task 为手动时,才允许编辑
// 只有 injectRow.task 为手动时,才允许编辑
// { name:"edit", label: "编辑", icon: "edit-outline", enable: injectRow => { return 'task' in injectRow && injectRow.task === 'Manual' } },
// { name: 'delete', icon: 'delete', enable: injectRow => { return 'task' in injectRow && injectRow.task === 'Manual' } },
// 只有 injectRow.status 为 waiting 时,才允许编辑
{ name:"edit", label: "编辑", icon: "edit-outline", enable: injectRow => { return 'status' in injectRow && injectRow.status === 'Waiting' } },
{ name: 'delete', icon: 'delete', emitFull: true, promptField: 'batchNo', enable: injectRow => { return 'status' in injectRow && injectRow.status === 'Waiting' } },
]
},
];

Voir le fichier

@ -31,7 +31,8 @@
:dialog-visible.sync="dialogVisible"
:configs="dialogConfigs"
@refreshDataList="getList"
/>
/>
<!-- :bom-code="dialogBomCode" -->
</div>
</template>
@ -81,6 +82,7 @@ export default {
dataList: [],
tableLoading: false,
refreshLayoutKey: null,
dialogBomCode: "",
};
},
inject: ["urls"],
@ -138,7 +140,7 @@ export default {
} else this.dataList = res.data.list;
this.totalPage = res.data.total;
}
}
} else {
this.$message({
message: `${res.code}: ${res.msg}`,
@ -209,13 +211,13 @@ export default {
this.openDialog(data, true);
break;
}
case 'view-batch': {
case "view-batch": {
this.$router.push({
name: toRouter,
query: {
id: data // id
}
})
query: {
id: data, // id
},
});
break;
}
case "detach": {
@ -302,6 +304,11 @@ export default {
openDialog(row_data) {
this.dialogVisible = true;
// if ("bomCode" in row_data) {
// const { bomCode } = row_data;
// this.dialogBomCode = bomCode;
// }
this.$nextTick(() => {
this.$refs["edit-dialog"].init(row_data);
});

Voir le fichier

@ -85,7 +85,6 @@
<script>
import { pick as __pick } from "@/utils/filters";
import Cookies from "js-cookie";
import moment from "moment";
export default {
name: "DialogJustForm",
@ -102,43 +101,58 @@ export default {
type: Boolean,
default: false,
},
//
// bomCode: {
// type: String,
// default: "x",
// },
},
inject: ["urls"],
data() {
const dataForm = {};
const delayList = [];
this.configs.form.rows.forEach((row) => {
row.forEach((col) => {
dataForm[col.prop] = col.default ?? null;
if (col.fetchData)
col.fetchData().then(({ data: res }) => {
if (res.code === 0) {
if ("list" in res.data) {
this.$set(
col,
"options",
res.data.list.map((i) => ({
label: col.optionLabelProp ? i[col.optionLabelProp] : i.name,
value: col.optionValue ? i[col.optionValue] : i.id,
}))
);
} else if (Array.isArray(res.data)) {
this.$set(
col,
"options",
res.data.map((i) => ({
label: col.optionLabelProp ? i[col.optionLabelProp] : i.name,
value: col.optionValue ? i[col.optionValue] : i.id,
}))
);
if (col.fetchData && typeof col.fetchData === "function") {
if (col.delayRequest) delayList.push(col);
// let doRequest = null;
// if (col.fetchData.length) {
// console.log(`this.bomCode '${this.bomCode}'`);
// //
// doRequest = col.fetchData.bind(this.bomCode);
// } else doRequest = col.fetchData;
else
col.fetchData().then(({ data: res }) => {
if (res.code === 0) {
if ("list" in res.data) {
this.$set(
col,
"options",
res.data.list.map((i) => ({
label: col.optionLabelProp ? i[col.optionLabelProp] : i.name,
value: col.optionValue ? i[col.optionValue] : i.id,
}))
);
} else if (Array.isArray(res.data)) {
this.$set(
col,
"options",
res.data.map((i) => ({
label: col.optionLabelProp ? i[col.optionLabelProp] : i.name,
value: col.optionValue ? i[col.optionValue] : i.id,
}))
);
} else {
console.log("请检查返回的数据类型");
}
} else {
console.log("请检查返回的数据类型");
col.options.splice(0);
}
} else {
col.options.splice(0);
}
});
});
}
});
});
return {
@ -146,6 +160,7 @@ export default {
dataForm,
detailMode: false,
baseDialogConfig: null,
delayList,
};
},
computed: {
@ -200,18 +215,61 @@ export default {
);
},
init({ id, code, blender }) {
// id ID
init(row) {
this.loadingStatus = true;
// id ID id
const { id, code, blender, bomId } = row;
// console.log(" { id, code, blender } = row;", row);
if (this.$refs.dataForm) {
this.$refs.dataForm.clearValidate();
}
this.detailMode = false;
this.$nextTick(() => {
this.dataForm.id = id || null;
this.dataForm.blender = blender;
this.dataForm.code = code;
this.delayList.forEach((col) => {
// console.log("delay fetch", col);
// col
if (col.fetchDataParam in row) {
// console.log("delay row ", row, row[col.fetchDataParam]);
col.fetchData(row[col.fetchDataParam]).then(({ data: res }) => {
if (res.code === 0) {
if ("list" in res.data) {
this.$set(
col,
"options",
res.data.list.map((i) => ({
label: col.optionLabelProp ? i[col.optionLabelProp] : i.name,
value: col.optionValue ? i[col.optionValue] : i.id,
}))
);
} else if (Array.isArray(res.data)) {
this.$set(
col,
"options",
res.data.map((i) => ({
label: col.optionLabelProp ? i[col.optionLabelProp] : i.name,
value: col.optionValue ? i[col.optionValue] : i.id,
}))
);
} else {
console.log("请检查返回的数据类型");
}
} else {
col.options.splice(0);
}
this.loadingStatus = false;
});
}
});
this.detailMode = false;
this.dataForm.id = id || null;
this.dataForm.blender = blender;
this.dataForm.code = code;
this.dataForm.bomId = bomId;
if (!this.delayList.length) this.loadingStatus = false;
},
/** handlers */
@ -234,9 +292,10 @@ export default {
if (passed) {
this.loadingStatus = true;
const { id, blender } = this.dataForm
const { id, blender, bomId } = this.dataForm;
return this.$http.get(this.urls.changeBlender, { params: { id, blender } })
return this.$http
.get(this.urls.changeBlender, { params: { id, blender, bomId } })
.then(({ data: res }) => {
this.loadingStatus = false;
if (res.code === 0) {

Voir le fichier

@ -9,8 +9,9 @@ export default function () {
{ width: 160, prop: "createTime", label: "添加时间", filter: timeFilter },
// { prop: "kilnCode", label: "窑炉" },
{ width: 160, prop: "orderCode", label: "主订单号" },
{ prop: "orderCate", label: "主订单子号" },
{ width: 60, prop: "orderCate", label: "子号" },
{ width: 160, prop: "code", label: "混料订单号" },
{ width: 60, prop: "percent", label: "进度", filter: (val) => (val !== null && val !== undefined ? val + " %" : "-") },
{
prop: "statusDictValue",
label: "订单状态",
@ -20,8 +21,7 @@ export default function () {
// { prop: "shapeCode", label: "砖型" },
{ prop: "bomCode", label: "配方" },
{ width: 120, prop: "qty", label: "混料总量 [kg]" },
{ prop: "percent", label: "完成进度", filter: (val) => (val !== null && val !== undefined ? val + " %" : "-") },
{ prop: "ai", label: "版本号" },
{ width: 60, prop: "ai", label: "版本" },
{ prop: "blenderCode", label: "混料机" },
// { width: 120, prop: "badqty", label: "不合格数量" },
// { prop: "remark", label: "备注" },
@ -35,7 +35,7 @@ export default function () {
width: 120,
subcomponent: TableOperaionComponent,
options: [
{ name:"edit", label: "编辑", emitFull: true, icon: 'edit-outline' },
{ name: "edit", label: "编辑", emitFull: true, icon: 'edit-outline' },
{ name: "view-batch", label: "查看批次", color: "#ff8000", toRouter: 'pms-blenderBatch', icon: 'document-copy' }, // 路由跳转至 pms-blenderBatch
{ name: "detach", label: "下发", color: "#099", icon: 'bottom-right' },
], // , url: '/pms/trans/pressDeli' }]
@ -96,6 +96,22 @@ export default function () {
label: '混料订单号'
},
],
[
{
select: true,
label: "配方",
prop: "bomId",
options: [],
optionLabelProp: 'code',
/** ====== */
fetchData: (bomCode) => this.$http.get('/pms/bom/pageVersion', { params: { key: bomCode, limit: 999, page: 1 } }),
fetchDataParam: 'bomCode',
delayRequest: true,
/** ====== */
rules: { required: true, message: "必填项不能为空", trigger: "blur" },
elparams: { clearable: true, filterable: true, placeholder: "请选择配方" },
},
],
[
{
select: true,

Voir le fichier

@ -20,20 +20,6 @@ export default {
urls: this.allUrls,
};
},
// urls: {
// type: Object,
// required: true,
// default: () => ({
// /** url **/ list: null,
// /** url **/ page: null,
// /** url **/ edit: null,
// /** url **/ delete: null,
// /** url **/ detail: null,
// /** url **/ export: null,
// /** url **/ import: null,
// /** url **/ other: null,
// }),
// },
data() {
const { tableConfig, headFormConfigs, urls, dialogConfigs } = initConfig.call(this);
return {