|
|
@@ -1,116 +1,146 @@ |
|
|
|
import TableOperaionComponent from '@/components/noTemplateComponents/operationComponent' |
|
|
|
import TableTextComponent from '@/components/noTemplateComponents/detailComponent' |
|
|
|
import StatusComponent from '@/components/noTemplateComponents/statusComponent' |
|
|
|
import { timeFilter, dictFilter } from '@/utils/filters' |
|
|
|
import TableOperaionComponent from "@/components/noTemplateComponents/operationComponent"; |
|
|
|
import TableTextComponent from "@/components/noTemplateComponents/detailComponent"; |
|
|
|
import StatusComponent from "@/components/noTemplateComponents/statusComponent"; |
|
|
|
import { timeFilter, dictFilter } from "@/utils/filters"; |
|
|
|
|
|
|
|
export default function () { |
|
|
|
|
|
|
|
const tableProps = [ |
|
|
|
{ type: 'index', label: '序号' }, |
|
|
|
{ type: "index", label: "序号" }, |
|
|
|
{ prop: "createTime", label: "添加时间", filter: timeFilter }, |
|
|
|
{ prop: 'name', label: '产品名称' }, |
|
|
|
{ prop: 'code', label: '产品编码' }, |
|
|
|
{ prop: 'typeDictValue', label: '产品类型', filter: dictFilter('product_type') }, |
|
|
|
{ prop: 'specifications', label: '规格' }, |
|
|
|
{ prop: 'unitDictValue', label: '单位', filter: dictFilter('unit') }, |
|
|
|
{ prop: 'weight', label: '重量', filter: val => val ? val + ' kg' : '-' }, |
|
|
|
{ prop: 'processTime', label: '产线完成单位产品用时', width: 200, filter: val => val + ' s' }, |
|
|
|
{ prop: 'remark', label: '备注' }, |
|
|
|
{ prop: 'description', label: '附件信息', subcomponent: TableTextComponent, buttonContent: '查看附件' }, |
|
|
|
{ prop: "name", label: "产品名称" }, |
|
|
|
{ prop: "code", label: "产品编码" }, |
|
|
|
{ prop: "typeDictValue", label: "产品类型", filter: dictFilter("product_type") }, |
|
|
|
{ prop: "specifications", label: "规格" }, |
|
|
|
{ prop: "unitDictValue", label: "单位", filter: dictFilter("unit") }, |
|
|
|
{ prop: "weight", label: "重量", filter: (val) => (val ? val + " kg" : "-") }, |
|
|
|
{ prop: "processTime", label: "产线完成单位产品用时", width: 200, filter: (val) => val + " s" }, |
|
|
|
{ prop: "remark", label: "备注" }, |
|
|
|
{ prop: "description", label: "附件信息", subcomponent: TableTextComponent, buttonContent: "查看附件" }, |
|
|
|
{ |
|
|
|
prop: 'operations', |
|
|
|
name: '操作', |
|
|
|
fixed: 'right', |
|
|
|
prop: "operations", |
|
|
|
name: "操作", |
|
|
|
fixed: "right", |
|
|
|
width: 120, |
|
|
|
subcomponent: TableOperaionComponent, |
|
|
|
options: ['edit', { name: 'delete', permission: 'pms:product:delete' }] |
|
|
|
} |
|
|
|
] |
|
|
|
|
|
|
|
options: ["edit", { name: "delete", permission: "pms:product:delete" }], |
|
|
|
}, |
|
|
|
]; |
|
|
|
|
|
|
|
const headFormFields = [ |
|
|
|
{ |
|
|
|
label: '关键字', |
|
|
|
prop: 'key', |
|
|
|
label: "关键字", |
|
|
|
prop: "key", |
|
|
|
input: true, |
|
|
|
default: { value: '' }, |
|
|
|
bind: { placeholder: '请输入产品名称或编码' } |
|
|
|
default: { value: "" }, |
|
|
|
bind: { placeholder: "请输入产品名称或编码" }, |
|
|
|
}, |
|
|
|
{ |
|
|
|
button: { |
|
|
|
type: 'primary', |
|
|
|
name: '查询' |
|
|
|
} |
|
|
|
type: "primary", |
|
|
|
name: "查询", |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
button: { |
|
|
|
type: 'plain', |
|
|
|
name: '新增', |
|
|
|
permission: 'pms:product:save' |
|
|
|
} |
|
|
|
} |
|
|
|
] |
|
|
|
|
|
|
|
type: "plain", |
|
|
|
name: "新增", |
|
|
|
permission: "pms:product:save", |
|
|
|
}, |
|
|
|
}, |
|
|
|
]; |
|
|
|
|
|
|
|
const dictList = JSON.parse(localStorage.getItem('dictList') || {}) |
|
|
|
const dictList = JSON.parse(localStorage.getItem("dictList") || {}); |
|
|
|
const dialogConfigs = { |
|
|
|
menu: [{ name: '产品信息', key: 'info' }, { name: '产品属性信息', key: 'attr', onlyEditMode: true }, { name: '附件', key: 'attachment', onlyEditMode: true }], |
|
|
|
menu: [ |
|
|
|
{ name: "产品信息", key: "info" }, |
|
|
|
{ name: "产品属性信息", key: "attr", onlyEditMode: true }, |
|
|
|
{ |
|
|
|
name: "附件", |
|
|
|
key: "attachment", |
|
|
|
onlyEditMode: true, |
|
|
|
actionUrl: window.SITE_CONFIG["apiURL"] + "/pms/attachment/uploadFileFormData?typeCode=ProductAttachment", |
|
|
|
}, |
|
|
|
], |
|
|
|
form: { |
|
|
|
rows: [ |
|
|
|
[ |
|
|
|
{ input: true, label: '产品名称/砖型名称', prop: 'name', rules: { required: true, message: 'not empty', trigger: 'blur' }, elparams: { placeholder: '请输入设备名称' } }, |
|
|
|
{ input: true, label: '产品编码/砖型编码', prop: 'code', rules: { required: true, message: 'not empty', trigger: 'blur' }, elparams: { placeholder: '请输入设备编码' } }, |
|
|
|
{ |
|
|
|
input: true, |
|
|
|
label: "产品名称/砖型名称", |
|
|
|
prop: "name", |
|
|
|
rules: { required: true, message: "not empty", trigger: "blur" }, |
|
|
|
elparams: { placeholder: "请输入设备名称" }, |
|
|
|
}, |
|
|
|
{ |
|
|
|
input: true, |
|
|
|
label: "产品编码/砖型编码", |
|
|
|
prop: "code", |
|
|
|
rules: { required: true, message: "not empty", trigger: "blur" }, |
|
|
|
elparams: { placeholder: "请输入设备编码" }, |
|
|
|
}, |
|
|
|
// { input: true, label: '版本号', prop: 'version', elparams: { placeholder: '请输入版本号' } }, |
|
|
|
{ |
|
|
|
select: true, |
|
|
|
label: '产品类型', |
|
|
|
prop: 'typeDictValue', |
|
|
|
options: 'product_type' in dictList ? dictList['product_type'].map(item => ({ value: item.dictValue, label: item.dictLabel })) : [], |
|
|
|
elparams: { placeholder: '选择一个产品类型' } |
|
|
|
label: "产品类型", |
|
|
|
prop: "typeDictValue", |
|
|
|
options: "product_type" in dictList ? dictList["product_type"].map((item) => ({ value: item.dictValue, label: item.dictLabel })) : [], |
|
|
|
elparams: { placeholder: "选择一个产品类型" }, |
|
|
|
}, |
|
|
|
], |
|
|
|
[ |
|
|
|
// { input: true, label: '单位平方数', prop: 'code', rules: { required: true, message: 'not empty', trigger: 'blur' }, elparams: { placeholder: '请输入设备名称编码' } }, |
|
|
|
{ |
|
|
|
select: true, |
|
|
|
label: '单位', |
|
|
|
prop: 'unitDictValue', |
|
|
|
options: 'unit' in dictList ? dictList['unit'].map(item => ({ value: item.dictValue, label: item.dictLabel })) : [], |
|
|
|
elparams: { placeholder: '选择单位' } |
|
|
|
label: "单位", |
|
|
|
prop: "unitDictValue", |
|
|
|
options: "unit" in dictList ? dictList["unit"].map((item) => ({ value: item.dictValue, label: item.dictLabel })) : [], |
|
|
|
elparams: { placeholder: "选择单位" }, |
|
|
|
}, |
|
|
|
{ |
|
|
|
input: true, |
|
|
|
label: "规格", |
|
|
|
prop: "specifications", |
|
|
|
rules: { required: true, message: "not empty", trigger: "blur" }, |
|
|
|
elparams: { placeholder: "请输入规格" }, |
|
|
|
}, |
|
|
|
{ |
|
|
|
input: true, |
|
|
|
label: "产线完成单位产品用时(s)", |
|
|
|
prop: "processTime", |
|
|
|
rules: { required: true, message: "not empty", trigger: "blur" }, |
|
|
|
elparams: { placeholder: "请输入规格" }, |
|
|
|
}, |
|
|
|
{ input: true, label: '规格', prop: 'specifications', rules: { required: true, message: 'not empty', trigger: 'blur' }, elparams: { placeholder: '请输入规格' } }, |
|
|
|
{ input: true, label: '产线完成单位产品用时(s)', prop: 'processTime', rules: { required: true, message: 'not empty', trigger: 'blur' }, elparams: { placeholder: '请输入规格' } }, |
|
|
|
], |
|
|
|
[{ textarea: true, label: '备注', prop: 'remark', elparams: { placeholder: '备注' } }], |
|
|
|
[{ textarea: true, label: "备注", prop: "remark", elparams: { placeholder: "备注" } }], |
|
|
|
], |
|
|
|
operations: [ |
|
|
|
{ name: 'add', label: '保存', type: 'primary', permission: 'pms:product:save', showOnEdit: false }, |
|
|
|
{ name: 'update', label: '更新', type: 'primary', permission: 'pms:product:update', showOnEdit: true }, |
|
|
|
{ name: 'reset', label: '重置', type: 'warning', showAlways: true }, |
|
|
|
{ name: "add", label: "保存", type: "primary", permission: "pms:product:save", showOnEdit: false }, |
|
|
|
{ name: "update", label: "更新", type: "primary", permission: "pms:product:update", showOnEdit: true }, |
|
|
|
{ name: "reset", label: "重置", type: "warning", showAlways: true }, |
|
|
|
// { name: 'cancel', label: '取消', showAlways: true }, |
|
|
|
], |
|
|
|
}, |
|
|
|
table: { |
|
|
|
// extraParams: ['stepId'], |
|
|
|
extraParams: 'productId', |
|
|
|
extraParams: "productId", |
|
|
|
props: [ |
|
|
|
{ type: 'index', label: '序号' }, |
|
|
|
{ type: "index", label: "序号" }, |
|
|
|
{ prop: "createTime", label: "添加时间", filter: timeFilter }, |
|
|
|
// { prop: 'productId', label: '产品ID' }, |
|
|
|
{ prop: 'name', label: '属性名称', isEditField: true }, |
|
|
|
{ prop: 'value', label: '属性值', isEditField: true }, |
|
|
|
{ prop: 'remark', label: '备注', isEditField: true }, |
|
|
|
{ prop: "name", label: "属性名称", isEditField: true }, |
|
|
|
{ prop: "value", label: "属性值", isEditField: true }, |
|
|
|
{ prop: "remark", label: "备注", isEditField: true }, |
|
|
|
{ |
|
|
|
prop: 'operations', |
|
|
|
name: '操作', |
|
|
|
fixed: 'right', |
|
|
|
prop: "operations", |
|
|
|
name: "操作", |
|
|
|
fixed: "right", |
|
|
|
width: 120, |
|
|
|
subcomponent: TableOperaionComponent, |
|
|
|
options: [ |
|
|
|
{ name: 'edit', permission: 'pms:productArrt:update' }, |
|
|
|
{ name: 'delete', permission: 'pms:productArrt:delete' }, |
|
|
|
] |
|
|
|
} |
|
|
|
{ name: "edit", permission: "pms:productArrt:update" }, |
|
|
|
{ name: "delete", permission: "pms:productArrt:delete" }, |
|
|
|
], |
|
|
|
}, |
|
|
|
], |
|
|
|
data: [ |
|
|
|
// TOOD 暂时用不到,但获取可以考虑把拉取接口数据的函数迁移到此文件(没有太大必要) |
|
|
@@ -118,25 +148,34 @@ export default function () { |
|
|
|
}, |
|
|
|
|
|
|
|
subDialog: { |
|
|
|
extraParam: 'productId', |
|
|
|
extraParam: "productId", |
|
|
|
forceAttachCode: true, // 产品属性新增必填 code 字段...... |
|
|
|
rows: [ |
|
|
|
[ |
|
|
|
{ input: true, label: '属性名称', prop: 'name', rules: { required: true, message: 'not empty', trigger: 'blur' }, elparams: { placeholder: '请输入属性名称' } }, |
|
|
|
{ input: true, label: '属性值', prop: 'value', rules: { required: true, message: 'not empty', trigger: 'blur' }, elparams: { placeholder: '请输入属性值' } }, |
|
|
|
{ |
|
|
|
input: true, |
|
|
|
label: "属性名称", |
|
|
|
prop: "name", |
|
|
|
rules: { required: true, message: "not empty", trigger: "blur" }, |
|
|
|
elparams: { placeholder: "请输入属性名称" }, |
|
|
|
}, |
|
|
|
{ |
|
|
|
input: true, |
|
|
|
label: "属性值", |
|
|
|
prop: "value", |
|
|
|
rules: { required: true, message: "not empty", trigger: "blur" }, |
|
|
|
elparams: { placeholder: "请输入属性值" }, |
|
|
|
}, |
|
|
|
], |
|
|
|
[ |
|
|
|
{ textarea: true, label: '备注', prop: 'remark', elparams: { placeholder: '添加备注' } }, |
|
|
|
] |
|
|
|
[{ textarea: true, label: "备注", prop: "remark", elparams: { placeholder: "添加备注" } }], |
|
|
|
], |
|
|
|
operations: [ |
|
|
|
{ name: 'add', label: '保存', type: 'primary', permission: 'pms:productArrt:save', showOnEdit: false }, |
|
|
|
{ name: 'update', label: '更新', type: 'primary', permission: 'pms:productArrt:update', showOnEdit: true }, |
|
|
|
{ name: "add", label: "保存", type: "primary", permission: "pms:productArrt:save", showOnEdit: false }, |
|
|
|
{ name: "update", label: "更新", type: "primary", permission: "pms:productArrt:update", showOnEdit: true }, |
|
|
|
], |
|
|
|
}, |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
return { |
|
|
|
dialogConfigs, |
|
|
|
tableConfig: { |
|
|
@@ -145,13 +184,13 @@ export default function () { |
|
|
|
}, |
|
|
|
headFormConfigs: { |
|
|
|
rules: null, // 名称是由 BaseSearchForm.vue 组件固定的 |
|
|
|
fields: headFormFields // 名称是由 BaseSearchForm.vue 组件固定的 |
|
|
|
fields: headFormFields, // 名称是由 BaseSearchForm.vue 组件固定的 |
|
|
|
}, |
|
|
|
urls: { |
|
|
|
base: '/pms/product', |
|
|
|
page: '/pms/product/page', |
|
|
|
subase: '/pms/productArrt', |
|
|
|
subpage: '/pms/productArrt/page', |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
base: "/pms/product", |
|
|
|
page: "/pms/product/page", |
|
|
|
subase: "/pms/productArrt", |
|
|
|
subpage: "/pms/productArrt/page", |
|
|
|
}, |
|
|
|
}; |
|
|
|
} |