update 混料订单编辑里加一个配方
This commit is contained in:
parent
d2c0978321
commit
0d8bd350fa
@ -32,9 +32,14 @@ export default function () {
|
|||||||
width: 90,
|
width: 90,
|
||||||
subcomponent: TableOperaionComponent,
|
subcomponent: TableOperaionComponent,
|
||||||
options: [
|
options: [
|
||||||
{ name:"edit", label: "编辑", icon: "edit-outline", enable: injectRow => { return 'task' in injectRow && injectRow.task === 'Manual' } },
|
// 只有 injectRow.task 为手动时,才允许编辑
|
||||||
{ name: 'delete', icon: 'delete', enable: injectRow => { return 'task' in injectRow && injectRow.task === 'Manual' } },
|
// { name:"edit", label: "编辑", icon: "edit-outline", enable: injectRow => { return 'task' in injectRow && injectRow.task === 'Manual' } },
|
||||||
] // 只有 injectRow.task 为手动时,才允许编辑
|
// { 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' } },
|
||||||
|
]
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -31,7 +31,8 @@
|
|||||||
:dialog-visible.sync="dialogVisible"
|
:dialog-visible.sync="dialogVisible"
|
||||||
:configs="dialogConfigs"
|
:configs="dialogConfigs"
|
||||||
@refreshDataList="getList"
|
@refreshDataList="getList"
|
||||||
/>
|
/>
|
||||||
|
<!-- :bom-code="dialogBomCode" -->
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -81,6 +82,7 @@ export default {
|
|||||||
dataList: [],
|
dataList: [],
|
||||||
tableLoading: false,
|
tableLoading: false,
|
||||||
refreshLayoutKey: null,
|
refreshLayoutKey: null,
|
||||||
|
dialogBomCode: "",
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
inject: ["urls"],
|
inject: ["urls"],
|
||||||
@ -209,13 +211,13 @@ export default {
|
|||||||
this.openDialog(data, true);
|
this.openDialog(data, true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'view-batch': {
|
case "view-batch": {
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
name: toRouter,
|
name: toRouter,
|
||||||
query: {
|
query: {
|
||||||
id: data // 混料订单id
|
id: data, // 混料订单id
|
||||||
}
|
},
|
||||||
})
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "detach": {
|
case "detach": {
|
||||||
@ -302,6 +304,11 @@ export default {
|
|||||||
openDialog(row_data) {
|
openDialog(row_data) {
|
||||||
this.dialogVisible = true;
|
this.dialogVisible = true;
|
||||||
|
|
||||||
|
// if ("bomCode" in row_data) {
|
||||||
|
// const { bomCode } = row_data;
|
||||||
|
// this.dialogBomCode = bomCode;
|
||||||
|
// }
|
||||||
|
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$refs["edit-dialog"].init(row_data);
|
this.$refs["edit-dialog"].init(row_data);
|
||||||
});
|
});
|
||||||
|
@ -85,7 +85,6 @@
|
|||||||
<script>
|
<script>
|
||||||
import { pick as __pick } from "@/utils/filters";
|
import { pick as __pick } from "@/utils/filters";
|
||||||
import Cookies from "js-cookie";
|
import Cookies from "js-cookie";
|
||||||
import moment from "moment";
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "DialogJustForm",
|
name: "DialogJustForm",
|
||||||
@ -102,43 +101,58 @@ export default {
|
|||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
|
// 特殊需求
|
||||||
|
// bomCode: {
|
||||||
|
// type: String,
|
||||||
|
// default: "x",
|
||||||
|
// },
|
||||||
},
|
},
|
||||||
inject: ["urls"],
|
inject: ["urls"],
|
||||||
data() {
|
data() {
|
||||||
const dataForm = {};
|
const dataForm = {};
|
||||||
|
const delayList = [];
|
||||||
|
|
||||||
this.configs.form.rows.forEach((row) => {
|
this.configs.form.rows.forEach((row) => {
|
||||||
row.forEach((col) => {
|
row.forEach((col) => {
|
||||||
dataForm[col.prop] = col.default ?? null;
|
dataForm[col.prop] = col.default ?? null;
|
||||||
|
|
||||||
if (col.fetchData)
|
if (col.fetchData && typeof col.fetchData === "function") {
|
||||||
col.fetchData().then(({ data: res }) => {
|
if (col.delayRequest) delayList.push(col);
|
||||||
if (res.code === 0) {
|
// let doRequest = null;
|
||||||
if ("list" in res.data) {
|
// if (col.fetchData.length) {
|
||||||
this.$set(
|
// console.log(`this.bomCode '${this.bomCode}'`);
|
||||||
col,
|
// // 如果有参数
|
||||||
"options",
|
// doRequest = col.fetchData.bind(this.bomCode);
|
||||||
res.data.list.map((i) => ({
|
// } else doRequest = col.fetchData;
|
||||||
label: col.optionLabelProp ? i[col.optionLabelProp] : i.name,
|
else
|
||||||
value: col.optionValue ? i[col.optionValue] : i.id,
|
col.fetchData().then(({ data: res }) => {
|
||||||
}))
|
if (res.code === 0) {
|
||||||
);
|
if ("list" in res.data) {
|
||||||
} else if (Array.isArray(res.data)) {
|
this.$set(
|
||||||
this.$set(
|
col,
|
||||||
col,
|
"options",
|
||||||
"options",
|
res.data.list.map((i) => ({
|
||||||
res.data.map((i) => ({
|
label: col.optionLabelProp ? i[col.optionLabelProp] : i.name,
|
||||||
label: col.optionLabelProp ? i[col.optionLabelProp] : i.name,
|
value: col.optionValue ? i[col.optionValue] : i.id,
|
||||||
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 {
|
} else {
|
||||||
console.log("请检查返回的数据类型");
|
col.options.splice(0);
|
||||||
}
|
}
|
||||||
} else {
|
});
|
||||||
col.options.splice(0);
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
return {
|
return {
|
||||||
@ -146,6 +160,7 @@ export default {
|
|||||||
dataForm,
|
dataForm,
|
||||||
detailMode: false,
|
detailMode: false,
|
||||||
baseDialogConfig: null,
|
baseDialogConfig: null,
|
||||||
|
delayList,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -200,18 +215,61 @@ export default {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
init({ id, code, blender }) {
|
init(row) {
|
||||||
// id 和 混料机 ID 混料订单号
|
this.loadingStatus = true;
|
||||||
|
// id 和 混料机 ID 混料订单号 和 配方id
|
||||||
|
const { id, code, blender, bomId } = row;
|
||||||
|
|
||||||
|
// console.log(" { id, code, blender } = row;", row);
|
||||||
|
|
||||||
if (this.$refs.dataForm) {
|
if (this.$refs.dataForm) {
|
||||||
this.$refs.dataForm.clearValidate();
|
this.$refs.dataForm.clearValidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.detailMode = false;
|
this.delayList.forEach((col) => {
|
||||||
this.$nextTick(() => {
|
// console.log("delay fetch", col);
|
||||||
this.dataForm.id = id || null;
|
// 需要延迟获取异步数据的 col 配置
|
||||||
this.dataForm.blender = blender;
|
if (col.fetchDataParam in row) {
|
||||||
this.dataForm.code = code;
|
// 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 */
|
/** handlers */
|
||||||
@ -234,9 +292,10 @@ export default {
|
|||||||
if (passed) {
|
if (passed) {
|
||||||
this.loadingStatus = true;
|
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 }) => {
|
.then(({ data: res }) => {
|
||||||
this.loadingStatus = false;
|
this.loadingStatus = false;
|
||||||
if (res.code === 0) {
|
if (res.code === 0) {
|
||||||
|
@ -9,8 +9,9 @@ export default function () {
|
|||||||
{ width: 160, prop: "createTime", label: "添加时间", filter: timeFilter },
|
{ width: 160, prop: "createTime", label: "添加时间", filter: timeFilter },
|
||||||
// { prop: "kilnCode", label: "窑炉" },
|
// { prop: "kilnCode", label: "窑炉" },
|
||||||
{ width: 160, prop: "orderCode", label: "主订单号" },
|
{ width: 160, prop: "orderCode", label: "主订单号" },
|
||||||
{ prop: "orderCate", label: "主订单子号" },
|
{ width: 60, prop: "orderCate", label: "子号" },
|
||||||
{ width: 160, prop: "code", label: "混料订单号" },
|
{ width: 160, prop: "code", label: "混料订单号" },
|
||||||
|
{ width: 60, prop: "percent", label: "进度", filter: (val) => (val !== null && val !== undefined ? val + " %" : "-") },
|
||||||
{
|
{
|
||||||
prop: "statusDictValue",
|
prop: "statusDictValue",
|
||||||
label: "订单状态",
|
label: "订单状态",
|
||||||
@ -20,8 +21,7 @@ export default function () {
|
|||||||
// { prop: "shapeCode", label: "砖型" },
|
// { prop: "shapeCode", label: "砖型" },
|
||||||
{ prop: "bomCode", label: "配方" },
|
{ prop: "bomCode", label: "配方" },
|
||||||
{ width: 120, prop: "qty", label: "混料总量 [kg]" },
|
{ width: 120, prop: "qty", label: "混料总量 [kg]" },
|
||||||
{ prop: "percent", label: "完成进度", filter: (val) => (val !== null && val !== undefined ? val + " %" : "-") },
|
{ width: 60, prop: "ai", label: "版本" },
|
||||||
{ prop: "ai", label: "版本号" },
|
|
||||||
{ prop: "blenderCode", label: "混料机" },
|
{ prop: "blenderCode", label: "混料机" },
|
||||||
// { width: 120, prop: "badqty", label: "不合格数量" },
|
// { width: 120, prop: "badqty", label: "不合格数量" },
|
||||||
// { prop: "remark", label: "备注" },
|
// { prop: "remark", label: "备注" },
|
||||||
@ -35,7 +35,7 @@ export default function () {
|
|||||||
width: 120,
|
width: 120,
|
||||||
subcomponent: TableOperaionComponent,
|
subcomponent: TableOperaionComponent,
|
||||||
options: [
|
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: "view-batch", label: "查看批次", color: "#ff8000", toRouter: 'pms-blenderBatch', icon: 'document-copy' }, // 路由跳转至 pms-blenderBatch
|
||||||
{ name: "detach", label: "下发", color: "#099", icon: 'bottom-right' },
|
{ name: "detach", label: "下发", color: "#099", icon: 'bottom-right' },
|
||||||
], // , url: '/pms/trans/pressDeli' }]
|
], // , url: '/pms/trans/pressDeli' }]
|
||||||
@ -96,6 +96,22 @@ export default function () {
|
|||||||
label: '混料订单号'
|
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,
|
select: true,
|
||||||
|
@ -20,20 +20,6 @@ export default {
|
|||||||
urls: this.allUrls,
|
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() {
|
data() {
|
||||||
const { tableConfig, headFormConfigs, urls, dialogConfigs } = initConfig.call(this);
|
const { tableConfig, headFormConfigs, urls, dialogConfigs } = initConfig.call(this);
|
||||||
return {
|
return {
|
||||||
|
Loading…
Reference in New Issue
Block a user