update 混料“

This commit is contained in:
lb 2023-02-22 17:04:11 +08:00
parent 38323fdecf
commit c534369ee2
3 changed files with 201 additions and 137 deletions

View File

@ -263,13 +263,15 @@ export default {
if (col.fetchData) if (col.fetchData)
col.fetchData().then(({ data: res }) => { col.fetchData().then(({ data: res }) => {
console.log("[Fetch Data]", res.data.list); console.log("[Fetch Data]", "list" in res.data, res.data, res.data.list);
if (res.code === 0 && res.data.list) { if (res.code === 0) {
if (!col.options || !col.options.length) if (!col.options || !col.options.length)
this.$set( this.$set(
col, col,
"options", "options",
res.data.list.map((i) => ({ label: i.name, value: i.id })) "list" in res.data
? res.data.list.map((i) => ({ label: i.name, value: i.id }))
: res.data.map((i) => ({ label: i.name, value: i.id }))
); );
// col.options = res.data.list; // col.options = res.data.list;
else if (col.options.length) { else if (col.options.length) {
@ -277,7 +279,9 @@ export default {
this.$set( this.$set(
col, col,
"options", "options",
res.data.list.map((i) => ({ label: i.name, value: i.id })) "list" in res.data
? res.data.list.map((i) => ({ label: i.name, value: i.id }))
: res.data.map((i) => ({ label: i.name, value: i.id }))
); );
} }
} else { } else {
@ -649,11 +653,23 @@ export default {
this.$set(this.dataForm, "fileIds", fileIds); this.$set(this.dataForm, "fileIds", fileIds);
} }
// id
let extraIds = {}
if (this.configs.extraIds && typeof this.configs.extraIds === 'object') {
// extraIds
Object.entries(this.configs.extraIds).forEach(([key, value]) => {
extraIds[key] = value
})
}
// //
this.$http({ this.$http({
url: this.urls.base, url: this.urls.base,
method, method,
data: this.dataForm, data: {
...extraIds,
...this.dataForm,
}
}) })
.then(({ data: res }) => { .then(({ data: res }) => {
console.log("[add&update] res is: ", res); console.log("[add&update] res is: ", res);
@ -759,7 +775,7 @@ export default {
switch (type) { switch (type) {
case "delete": { case "delete": {
// //
return this.$confirm(`是否删除条目: ${data.name ?? data.material ? data.material : data.id}`, "提示", { return this.$confirm(`是否删除条目: ${data.name ?? (data.material ? data.material : data.id)}`, "提示", {
confirmButtonText: "确认", confirmButtonText: "确认",
cancelButtonText: "我再想想", cancelButtonText: "我再想想",
type: "warning", type: "warning",

View File

@ -1,109 +1,136 @@
import TableOperaionComponent from '@/components/noTemplateComponents/operationComponent' import TableOperaionComponent from "@/components/noTemplateComponents/operationComponent";
import TableTextComponent from '@/components/noTemplateComponents/detailComponent' import TableTextComponent from "@/components/noTemplateComponents/detailComponent";
import StatusComponent from '@/components/noTemplateComponents/statusComponent' import StatusComponent from "@/components/noTemplateComponents/statusComponent";
import { timeFilter } from '@/utils/filters' import { timeFilter } from "@/utils/filters";
export default function () { export default function () {
const tableProps = [ const tableProps = [
{ type: 'index', label: '序号' }, { type: "index", label: "序号" },
{ prop: "createTime", label: "添加时间", filter: timeFilter }, { prop: "createTime", label: "添加时间", filter: timeFilter },
{ prop: 'name', label: '混料程序名称' }, { prop: "name", label: "工艺名称" },
{ prop: 'code', label: '程序编码' }, { prop: "code", label: "工艺编码" },
{ prop: 'version', label: '版本号' }, // { prop: 'version', label: '配方号' },
{ prop: 'status', label: '状态', subcomponent: StatusComponent }, // subcomponent { prop: "bomCode", label: "配方号" },
{ prop: 'remark', label: '备注' }, // { prop: 'status', label: '状态', subcomponent: StatusComponent }, // subcomponent
{ prop: 'description', label: '详情', subcomponent: TableTextComponent }, { prop: "description", label: "详情", subcomponent: TableTextComponent },
{ prop: "remark", label: "备注" },
{ {
prop: 'operations', prop: "operations",
name: '操作', name: "操作",
fixed: 'right', fixed: "right",
width: 120, width: 120,
subcomponent: TableOperaionComponent, subcomponent: TableOperaionComponent,
options: ['edit', { name: 'delete', permission: 'pms:blenderStep:delete' }] options: ["edit", { name: "delete", emitFull: true, permission: "pms:blenderStep:delete" }],
} },
] ];
const headFormFields = [ const headFormFields = [
{ {
label: '混料程序名称', prop: "key",
label: "工艺名称/编码",
input: true, input: true,
default: { value: '' } default: { value: "" },
bind: {
placeholder: "请输入工艺名称或编码",
},
},
{
prop: "bom",
label: "配方号",
input: true,
default: { value: "" },
bind: {
placeholder: "请输入配方号",
},
},
// {
// prop: 'bom',
// label: '配方号',
// input: true,
// default: { value: '' },
// bind: {
// placeholder: '请输入配方号'
// }
// },
{
button: {
type: "primary",
name: "查询",
},
}, },
{ {
button: { button: {
type: 'primary', type: "plain",
name: '查询' name: "新增",
} permission: "pms:blenderStep:save",
}, },
{ },
button: { ];
type: 'plain',
name: '新增',
permission: 'pms:blenderStep:save'
}
}
]
const dialogConfigs = { const dialogConfigs = {
menu: [{ name: '混料程序' }, { name: '参数明细', onlyEditMode: true }], extraIds: { wsId: 1 }, // 工艺管理里面的相关模块的 dialogWithMenu 需要额外的工序 id
menu: [
{ name: "混料程序", key: "info" },
{ name: "工艺参数", key: "attr", onlyEditMode: true },
],
form: { form: {
url: '/pms/blenderStep',
rows: [ rows: [
[ [
{ input: true, label: '混料程序名称', prop: 'name', rules: { required: true, message: '必填项不能为空', trigger: 'blur' }, elparams: { placeholder: '请输入混料程序名称' } }, {
{ input: true, label: '程序编码', prop: 'code', rules: { required: true, message: '必填项不能为空', trigger: 'blur' }, elparams: { placeholder: '请输入混料程序编码' } }, input: true,
{ input: true, label: '版本号', prop: 'version', elparams: { placeholder: '请输入版本号' } }, label: "工艺名称",
prop: "name",
rules: { required: true, message: "必填项不能为空", trigger: "blur" },
elparams: { placeholder: "请输入混料程序名称" },
},
{
input: true,
label: "工艺编码",
prop: "code",
rules: { required: true, message: "必填项不能为空", trigger: "blur" },
elparams: { placeholder: "请输入混料程序编码" },
},
{
select: true,
label: "配方",
prop: "bomId",
options: [],
elparams: { clearable: true, filterable: true, placeholder: "请选择配方" },
fetchData: () => this.$http.get("/pms/bom/listUnR", { params: { wsId: 1, externalCode: '', key: '' } }),
},
], ],
[ [{ textarea: true, label: "备注", prop: "remark", elparams: { placeholder: "备注" } }],
// {
// select: true,
// label: '城市',
// prop: 'city',
// options: [
// { label: '1', value: 1 },
// { label: '2', value: 2 },
// { label: '3', value: 3 },
// ],
// elparams: { placeholder: '请选择城市' }
// },
// { input: true, label: '程序号', prop: '', rules: { required: true, message: '必填项不能为空', trigger: 'blur' }, elparams: { placeholder: '请输入混料程序号' } },
],
// [{ switch: true, label: '状态', prop: 'enabled', default: 0 }],
[{ textarea: true, label: '备注', prop: 'remark', elparams: { placeholder: '备注' } }],
], ],
operations: [ operations: [
{ name: 'add', label: '保存', type: 'primary', permission: 'pms:blenderStep:save', showOnEdit: false }, { name: "add", label: "保存", type: "primary", permission: "pms:blenderStep:save", showOnEdit: false },
{ name: 'update', label: '更新', type: 'primary', permission: 'pms:blenderStep:update', showOnEdit: true }, { name: "update", label: "更新", type: "primary", permission: "pms:blenderStep:update", showOnEdit: true },
{ name: 'reset', label: '重置', type: 'warning', showAlways: true }, { name: "reset", label: "重置", type: "warning", showAlways: true },
// { name: 'cancel', label: '取消', showAlways: true }, // { name: 'cancel', label: '取消', showAlways: true },
], ],
}, },
table: { table: {
// extraParams: ['stepId'], extraParams: ["techId", "key"],
extraParams: 'stepId',
props: [ props: [
// { type: 'index', label: '序号' }, // { type: 'index', label: '序号' },
// { prop: "createTime", label: "添加时间", filter: timeFilter }, // { prop: "createTime", label: "添加时间", filter: timeFilter },
{ prop: 'sort', label: '步骤', isEditField: true }, { prop: "name", label: "参数名称", isEditField: true },
{ prop: 'name', label: '参数名称', isEditField: true }, { prop: "code", label: "参数编码", isEditField: true },
{ prop: 'description', label: '描述', isEditField: true }, // { prop: "specifications", label: "规格", isEditField: true },
{ prop: 'value', label: '设定值', isEditField: true }, { prop: "value", label: "设定值", isEditField: true },
{ prop: 'valueFloor', label: '值下限', isEditField: true }, { prop: "valueFloor", label: "值下限", isEditField: true },
{ prop: 'valueTop', label: '值上限', isEditField: true }, { prop: "valueTop", label: "值上限", isEditField: true },
{ prop: "description", label: "描述", isEditField: true },
{ {
prop: 'operations', prop: "operations",
name: '操作', name: "操作",
fixed: 'right', fixed: "right",
width: 120, width: 120,
subcomponent: TableOperaionComponent, subcomponent: TableOperaionComponent,
options: [ options: [
{ name: 'edit', permission: 'pms:blenderStepParam:update' }, { name: "edit", permission: "pms:blenderStepParam:update" },
{ name: 'delete', permission: 'pms:blenderStepParam:delete' }, { name: "delete", emitFull: true, permission: "pms:blenderStepParam:delete" },
] ],
} },
], ],
data: [ data: [
// TOOD 暂时用不到,但获取可以考虑把拉取接口数据的函数迁移到此文件(没有太大必要) // TOOD 暂时用不到,但获取可以考虑把拉取接口数据的函数迁移到此文件(没有太大必要)
@ -111,32 +138,48 @@ export default function () {
}, },
subDialog: { subDialog: {
extraParam: 'stepId', extraParam: "stepId",
rows: [ rows: [
[ [
{ input: true, label: '步骤', prop: 'sort', rules: { required: true, message: '必填项不能为空', trigger: 'blur' }, elparams: { placeholder: '请输入步骤' } }, {
{ input: true, label: '步骤描述', prop: 'description', rules: { required: true, message: '必填项不能为空', trigger: 'blur' }, elparams: { placeholder: '请输入描述' } }, input: true,
], [ label: "参数名称",
{ input: true, label: '参数名称', prop: 'name', elparams: { placeholder: '请输入参数名称' } }, prop: "name",
{ input: true, label: '参数编码', prop: 'code', rules: { required: true, message: '必填项不能为空', trigger: 'blur' }, elparams: { placeholder: '请输入描述' } }, rules: { required: true, message: "必填项不能为空", trigger: "blur" },
], [ elparams: { placeholder: "请输入参数名称" },
{ input: true, label: '参数值上限', prop: 'valueTop', elparams: { placeholder: '请输入参数值上限' } }, },
{ input: true, label: '参数值下限', prop: 'valueFloor', elparams: { placeholder: '请输入参数值下限' } }, {
input: true,
label: "参数编码",
prop: "code",
rules: { required: true, message: "必填项不能为空", trigger: "blur" },
elparams: { placeholder: "请输入描述" },
},
], ],
[ [
{ input: true, label: '参数值', prop: 'value', elparams: { placeholder: '请输入参数值' } }, { input: true, label: "参数值上限", prop: "valueTop", elparams: { placeholder: "请输入参数值上限" } },
] { input: true, label: "参数值下限", prop: "valueFloor", elparams: { placeholder: "请输入参数值下限" } },
],
[
{ input: true, label: "参数值", prop: "value", elparams: { placeholder: "请输入参数值" } },
{
input: true,
label: "描述",
prop: "description",
// rules: { required: true, message: "必填项不能为空", trigger: "blur" },
elparams: { placeholder: "请输入描述" },
},
],
], ],
operations: [ operations: [
{ name: 'add', label: '保存', type: 'primary', permission: 'pms:blenderStepParam:save', showOnEdit: false }, { name: "add", label: "保存", type: "primary", permission: "pms:blenderStepParam:save", showOnEdit: false },
{ name: 'update', label: '更新', type: 'primary', permission: 'pms:blenderStepParam:update', showOnEdit: true }, { name: "update", label: "更新", type: "primary", permission: "pms:blenderStepParam:update", showOnEdit: true },
// { name: 'reset', label: '重置', type: 'warning', showAlways: true }, // { name: 'reset', label: '重置', type: 'warning', showAlways: true },
// { name: 'cancel', label: '取消', showAlways: true }, // { name: 'cancel', label: '取消', showAlways: true },
], ],
}, },
}; };
return { return {
dialogConfigs, dialogConfigs,
tableConfig: { tableConfig: {
@ -145,14 +188,15 @@ export default function () {
}, },
headFormConfigs: { headFormConfigs: {
rules: null, // 名称是由 BaseSearchForm.vue 组件固定的 rules: null, // 名称是由 BaseSearchForm.vue 组件固定的
fields: headFormFields // 名称是由 BaseSearchForm.vue 组件固定的 fields: headFormFields, // 名称是由 BaseSearchForm.vue 组件固定的
}, },
urls: { urls: {
base: '/pms/blenderStep', base: "/pms/equipmentTech",
page: '/pms/blenderStep/page', page: "/pms/equipmentTech/pageView",
subase: '/pms/blenderStepParam', pageIsPostApi: true, // 使用post接口来获取page数据极少用目前基本上只有工艺管理模块里在用
subpage: '/pms/blenderStepParam/page', subase: "/pms/equipmentTechParam",
subpage: "/pms/equipmentTechParam/page",
// more... // more...
} },
} };
} }

View File

@ -1,19 +1,24 @@
<template> <template>
<ListViewWithHead :table-config="tableConfig" :head-config="headFormConfigs" :dialog-configs="dialogConfigs" /> <ListViewWithHead
:table-config="tableConfig"
:head-config="headFormConfigs"
:dialog-configs="dialogConfigs"
:list-query-extra="['key', 'bom', { wsId: 1 }]"
/>
</template> </template>
<script> <script>
import initConfig from './config'; import initConfig from "./config";
import ListViewWithHead from '@/views/atomViews/ListViewWithHead.vue'; import ListViewWithHead from "@/views/atomViews/ListViewWithHead.vue";
export default { export default {
name: 'BlenderView', name: "BlenderView",
components: { ListViewWithHead }, components: { ListViewWithHead },
provide() { provide() {
return { return {
urls: this.allUrls urls: this.allUrls,
} };
} },
// urls: { // urls: {
// type: Object, // type: Object,
// required: true, // required: true,
@ -28,7 +33,6 @@ export default {
// /** url **/ other: null, // /** url **/ other: null,
// }), // }),
// }, // },
,
data() { data() {
const { tableConfig, headFormConfigs, urls, dialogConfigs } = initConfig.call(this); const { tableConfig, headFormConfigs, urls, dialogConfigs } = initConfig.call(this);
return { return {