diff --git a/src/components/DialogJustForm.vue b/src/components/DialogJustForm.vue index 0bddb6a..99abf47 100644 --- a/src/components/DialogJustForm.vue +++ b/src/components/DialogJustForm.vue @@ -132,17 +132,31 @@ export default { this.configs.form.rows.forEach((row) => { row.forEach((col) => { - dataForm[col.prop] = col.default ?? null; + if (col.prop) dataForm[col.prop] = col.default ?? null; if (col.fetchData) col.fetchData().then(({ data: res }) => { console.log("[DialogJustForm fetchData -->]", res.data.list); - if (res.code === 0 && res.data.list) { - this.$set( - col, - "options", - res.data.list.map((i) => ({ label: i.name, value: col.optionValue ? i[col.optionValue] : i.id })) - ); + if (res.code === 0) { + if ("list" in res.data) { + this.$set( + col, + "options", + res.data.list.map((i) => ({ + label: col.optionLabel ? i[col.optionLabel] : 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.optionLabel ? i[col.optionLabel] : i.name, + value: col.optionValue ? i[col.optionValue] : i.id, + })) + ); + } // col.options = res.data.list; } else { col.options.splice(0); @@ -374,7 +388,7 @@ export default { /** 发送 */ return this.$http({ - url: this.urls.base, + url: this.urls.formUrl ? this.urls.formUrl : this.urls.base, method, data: httpPayload, }) diff --git a/src/views/modules/pms/palletizingLine/config.js b/src/views/modules/pms/palletizingLine/config.js index c0052b8..46b5c30 100644 --- a/src/views/modules/pms/palletizingLine/config.js +++ b/src/views/modules/pms/palletizingLine/config.js @@ -71,25 +71,65 @@ export default function () { rows: [ [ { - input: true, + select: true, + prop: "carId", label: "窑车号", - prop: "code", + options: [], + fetchData: () => this.$http.get('/pms/car/page', { params: { limit: 999, page: 1, code: '' } }), + optionLabel: 'code', rules: { required: true, message: "必填项不能为空", trigger: "blur" }, - elparams: { placeholder: "请输入窑车号" }, + elparams: { placeholder: "请选择窑车" }, }, - // { - // input: true, - // label: "编码", - // prop: "code", - // rules: { required: true, message: "必填项不能为空", trigger: "blur" }, - // elparams: { placeholder: "请输入料仓编码" }, - // }, + { + select: true, + label: "位置", + prop: "pos", + // options: [ + // { id: 0, value: 0 }, + // { id: 1, value: 1 }, + // { id: 2, value: 2 }, + // { id: 3, value: 3 }, + // { id: 4, value: 4 }, + // { id: 5, value: 5 }, + // { id: 6, value: 6 }, + // { id: 7, value: 7 }, + // ], + options: [], + fetchData: () => this.$http.post('/pms/carHandle/listPos', { limit: 999, page: 1 }), + rules: { required: true, message: "必填项不能为空", trigger: "blur" }, + elparams: { placeholder: "请选择窑车位置" }, + }, + ], + [ + { + datetime: true, + label: "开始时间", + prop: "startTime", + rules: { required: true, message: "必填项不能为空", trigger: "blur" }, + elparams: { placeholder: "请选择开始时间" }, + }, + { + datetime: true, + label: "结束时间", + prop: "endTime", + // rules: { required: true, message: "必填项不能为空", trigger: "blur" }, + elparams: { placeholder: "请选择结束时间" }, + }, + ], + [ + { + select: true, + label: "窑车状态", + prop: "stateDictValue", + options: [ + { value: 0, label: '正常' }, + { value: 1, label: '报废' } + ], + rules: { required: true, message: "必填项不能为空", trigger: "blur" }, + elparams: { placeholder: "请选择窑车状态" }, + }, + {} ], - // [{ component: QuillRichInput, label: "描述信息", prop: "description" }], - [{ - richInput: true, label: "描述信息", prop: "description" - }], - [{ input: true, label: "备注", prop: "remark", elparams: { placeholder: "备注" } }], ], operations: [ { name: "add", label: "保存", type: "primary", permission: "pms:car:save", showOnEdit: false }, @@ -137,7 +177,8 @@ export default function () { urls: { base: "/pms/carHandle", page: "/pms/carHandle/pageHis", - pageIsPostApi: true + pageIsPostApi: true, + formUrl: "/pms/trans/inputCurrent" // subase: '/pms/blenderStepParam', // subpage: '/pms/blenderStepParam/page', // more...