update material
This commit is contained in:
parent
70243b527f
commit
151f787f0a
@ -38,8 +38,8 @@
|
|||||||
<% if (process.env.VUE_APP_NODE_ENV === 'dev') { %>
|
<% if (process.env.VUE_APP_NODE_ENV === 'dev') { %>
|
||||||
<script>
|
<script>
|
||||||
// window.SITE_CONFIG['apiURL'] = 'http://192.168.1.103:8080/pms-am';
|
// window.SITE_CONFIG['apiURL'] = 'http://192.168.1.103:8080/pms-am';
|
||||||
// window.SITE_CONFIG['apiURL'] = 'http://192.168.1.49:8080/pms-am'; // tengyun
|
window.SITE_CONFIG['apiURL'] = 'http://192.168.1.49:8080/pms-am'; // tengyun
|
||||||
window.SITE_CONFIG['apiURL'] = 'http://192.168.1.62:8080/pms-am'; // tao
|
// window.SITE_CONFIG['apiURL'] = 'http://192.168.1.62:8080/pms-am'; // tao
|
||||||
</script>
|
</script>
|
||||||
<% } %>
|
<% } %>
|
||||||
<!-- 集成测试环境 -->
|
<!-- 集成测试环境 -->
|
||||||
|
@ -167,13 +167,15 @@ export default {
|
|||||||
method,
|
method,
|
||||||
data: {
|
data: {
|
||||||
...this.dataForm,
|
...this.dataForm,
|
||||||
...fields
|
...fields,
|
||||||
},
|
},
|
||||||
}).then(({ data: res }) => {
|
}).then(({ data: res }) => {
|
||||||
console.log("[add&update] res is: ", res);
|
console.log("[add&update] res is: ", res);
|
||||||
this.$message.success(payload.name === "add" ? "添加成功" : "更新成功");
|
if (res.code === 0) {
|
||||||
this.$emit("refreshDataList");
|
this.$message.success(payload.name === "add" ? "添加成功" : "更新成功");
|
||||||
this.handleClose();
|
this.$emit("refreshDataList");
|
||||||
|
this.handleClose();
|
||||||
|
} else this.$message.error(res.msg);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -101,12 +101,6 @@ export default {
|
|||||||
this.initDataWhenLoad && this.getList();
|
this.initDataWhenLoad && this.getList();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
/* 从dom移除对话框 */
|
|
||||||
destroyDialog() {
|
|
||||||
// console.log('[ListViewWithHead] destroyDialog')
|
|
||||||
this.dialogVisible = false;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 转换服务器数据的中间层
|
* 转换服务器数据的中间层
|
||||||
* 为了抹平真实服务器数据和我本地的测试服务器数据的差异
|
* 为了抹平真实服务器数据和我本地的测试服务器数据的差异
|
||||||
|
@ -30,8 +30,20 @@
|
|||||||
<!-- :current-page.sync="currentPage"
|
<!-- :current-page.sync="currentPage"
|
||||||
:page-size.sync="pageSize" -->
|
:page-size.sync="pageSize" -->
|
||||||
|
|
||||||
<DialogWithMenu ref="edit-dialog" v-if="dialogType === DIALOG_WITH_MENU && dialogVisible" :configs="dialogConfigs" @refreshDataList="getList" />
|
<DialogWithMenu
|
||||||
<DialogJustForm ref="edit-dialog" v-if="dialogType === DIALOG_JUST_FORM && dialogVisible" :configs="dialogConfigs" @refreshDataList="getList" />
|
ref="edit-dialog"
|
||||||
|
v-if="dialogType === DIALOG_WITH_MENU"
|
||||||
|
:dialog-visible.sync="dialogVisible"
|
||||||
|
:configs="dialogConfigs"
|
||||||
|
@refreshDataList="getList"
|
||||||
|
/>
|
||||||
|
<DialogJustForm
|
||||||
|
ref="edit-dialog"
|
||||||
|
v-if="dialogType === DIALOG_JUST_FORM"
|
||||||
|
:dialog-visible.sync="dialogVisible"
|
||||||
|
:configs="dialogConfigs"
|
||||||
|
@refreshDataList="getList"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -1,103 +1,169 @@
|
|||||||
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 InputArea from 'code-brick-zj'
|
import { timeFilter, dictFilter } from "@/utils/filters";
|
||||||
import { timeFilter } from '@/utils/filters'
|
|
||||||
|
|
||||||
export default function () {
|
export default function () {
|
||||||
|
|
||||||
const tableProps = [
|
const tableProps = [
|
||||||
{ prop: 'createTime', label: '添加时间', filter: timeFilter },
|
{ prop: "createTime", label: "添加时间", filter: timeFilter },
|
||||||
{ prop: 'name', label: '物料名称' },
|
{ prop: "name", label: "物料名称" },
|
||||||
{ prop: 'code', label: '物料编码' },
|
{ prop: "code", label: "物料编码" },
|
||||||
{ prop: 'typeDictValue', label: '类别' }, // subcomponent: {/** TODO: create a new component for this option */} },
|
{ prop: "typeDictValue", label: "类别", filter: dictFilter("material_category") }, // subcomponent: {/** TODO: create a new component for this option */} },
|
||||||
{ prop: 'type', label: '物料类型', },
|
{ prop: "type", label: "物料类型" },
|
||||||
{ prop: 'enName', label: '英文名称', },
|
{ prop: "enName", label: "英文名称" },
|
||||||
{ prop: 'enAb', label: '英文缩写', },
|
{ prop: "enAb", label: "英文缩写" },
|
||||||
{ prop: 'description', label: '详情', subcomponent: TableTextComponent },
|
{ prop: "description", label: "详情", subcomponent: TableTextComponent },
|
||||||
{ prop: 'remark', label: '备注' },
|
{ prop: "remark", label: "备注" },
|
||||||
/** TODO: parentId 是用来前端重构成树形结构的... */
|
/** TODO: parentId 是用来前端重构成树形结构的... */
|
||||||
{
|
{
|
||||||
prop: 'operations',
|
prop: "operations",
|
||||||
name: '操作',
|
name: "操作",
|
||||||
fixed: 'right',
|
fixed: "right",
|
||||||
width: 120,
|
width: 120,
|
||||||
subcomponent: TableOperaionComponent,
|
subcomponent: TableOperaionComponent,
|
||||||
options: ['edit', { name: 'delete', permission: '' }]
|
options: ["edit", { name: "delete", permission: "pms:material:save" }],
|
||||||
}
|
},
|
||||||
]
|
];
|
||||||
|
|
||||||
|
|
||||||
const headFormFields = [
|
const headFormFields = [
|
||||||
{
|
{
|
||||||
label: '物料名称/编码',
|
label: "物料名称/编码",
|
||||||
|
prop: "key",
|
||||||
input: true,
|
input: true,
|
||||||
default: { value: '' }
|
default: { value: "" },
|
||||||
|
bind: { placeholder: "请输入物料名称或编码" },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
button: {
|
button: {
|
||||||
type: 'primary',
|
type: "primary",
|
||||||
name: '查询'
|
name: "查询",
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
button: {
|
button: {
|
||||||
type: 'primary',
|
type: "primary",
|
||||||
name: '新增',
|
name: "新增",
|
||||||
permission: ''
|
permission: "",
|
||||||
},
|
},
|
||||||
bind: {
|
bind: {
|
||||||
plain: true,
|
plain: true,
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
]
|
];
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* dialog config 有两个版本,一个适用于 DialogWithMenu 组件,另一个适用于 DialogJustForm 组件
|
* dialog config 有两个版本,一个适用于 DialogWithMenu 组件,另一个适用于 DialogJustForm 组件
|
||||||
* 适用于 DialogWithMenu 组件的配置示例详见 blenderStep/config.js
|
* 适用于 DialogWithMenu 组件的配置示例详见 blenderStep/config.js
|
||||||
* 此为后者的配置:
|
* 此为后者的配置:
|
||||||
*/
|
*/
|
||||||
|
const dictList = JSON.parse(localStorage.getItem("dictList"));
|
||||||
const dialogConfigs = {
|
const dialogConfigs = {
|
||||||
menu: [{ name: '混料程序', key: 'info' }, { name: '参数明细', key: 'attr', onlyEditMode: true }],
|
menu: [
|
||||||
|
{ name: "物料信息", key: "info" },
|
||||||
|
{ name: "物料属性信息", key: "attr", onlyEditMode: true },
|
||||||
|
{ name: "子类", key: "add-sub", onlyEditMode: true },
|
||||||
|
],
|
||||||
form: {
|
form: {
|
||||||
url: '/pms/blenderStep',
|
|
||||||
rows: [
|
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,
|
||||||
{ input: true, label: '版本号', prop: 'version', elparams: { placeholder: '请输入版本号' } },
|
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: "请输入物料编码" },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
select: true,
|
||||||
|
label: "物料类型",
|
||||||
|
prop: "typeId",
|
||||||
|
rules: { required: true, message: "not empty", trigger: "blur" },
|
||||||
|
options: [],
|
||||||
|
fetchData: () => this.$http.get('/pms/materialType/page', { params: { page: 1, limit: 999 } }),
|
||||||
|
elparams: { placeholder: "请输入物料类型" },
|
||||||
|
},
|
||||||
],
|
],
|
||||||
[{ textarea: true, label: '备注', prop: 'remark', elparams: { placeholder: '备注' } }],
|
[
|
||||||
|
{
|
||||||
|
select: true,
|
||||||
|
label: "父级物料",
|
||||||
|
prop: "parentId",
|
||||||
|
rules: { required: true, message: "not empty", trigger: "blur" },
|
||||||
|
options: [],
|
||||||
|
fetchData: () => this.$http.get('/pms/material/page', { params: { page: 1, limit: 999, key: '' } }),
|
||||||
|
elparams: { placeholder: "请选择父级物料" },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
input: true,
|
||||||
|
label: "英文名称",
|
||||||
|
prop: "enName",
|
||||||
|
elparams: { placeholder: "请输入英文名称" },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
input: true,
|
||||||
|
label: "缩写",
|
||||||
|
prop: "enAb",
|
||||||
|
elparams: { placeholder: "请输入缩写" },
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// input: true,
|
||||||
|
// label: "设备类型",
|
||||||
|
// prop: "eqTypeId",
|
||||||
|
// rules: { required: true, message: "not empty", trigger: "blur" },
|
||||||
|
// elparams: { placeholder: "请输入设备类型" },
|
||||||
|
// },
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
select: true,
|
||||||
|
label: "物料类别",
|
||||||
|
prop: "typeDictValue",
|
||||||
|
options: dictList["material_category"].map((u) => ({ label: u.dictLabel, value: u.dictValue })),
|
||||||
|
elparams: { placeholder: "物料类别" },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
select: true,
|
||||||
|
label: "单位",
|
||||||
|
prop: "unitDictValue",
|
||||||
|
options: dictList["unit"].map((u) => ({ label: u.dictLabel, value: u.dictValue })),
|
||||||
|
elparams: { placeholder: "单位" },
|
||||||
|
},
|
||||||
|
{ input: true, label: "规格", prop: "description", elparams: { placeholder: "规格" } },
|
||||||
|
],
|
||||||
|
[{ 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:material:save", showOnEdit: false },
|
||||||
{ name: 'update', label: '更新', type: 'primary', permission: 'pms:blenderStep:update', showOnEdit: true },
|
{ name: "update", label: "更新", type: "primary", permission: "pms:material:save", 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: ['stepId'],
|
||||||
extraParams: 'stepId',
|
extraParams: "materialId",
|
||||||
props: [
|
props: [
|
||||||
{ prop: 'sort', label: '步骤', isEditField: true },
|
{ prop: "createTime", label: "添加时间", filter: timeFilter, isEditField: true },
|
||||||
{ prop: 'name', label: '参数名称', isEditField: true },
|
{ prop: "name", label: "属性名", isEditField: true },
|
||||||
{ prop: 'description', label: '描述', isEditField: true },
|
{ prop: "value", label: "属性值", isEditField: true },
|
||||||
{ prop: 'value', label: '设定值', isEditField: true },
|
|
||||||
{ prop: 'valueFloor', label: '值下限', isEditField: true },
|
|
||||||
{ prop: 'valueTop', 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:materialArrt:save" },
|
||||||
{ name: 'delete', permission: 'pms:blenderStepParam:delete' },
|
{ name: "delete", permission: "pms:materialArrt:save" },
|
||||||
]
|
],
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
data: [
|
data: [
|
||||||
// TOOD 暂时用不到,但获取可以考虑把拉取接口数据的函数迁移到此文件(没有太大必要)
|
// TOOD 暂时用不到,但获取可以考虑把拉取接口数据的函数迁移到此文件(没有太大必要)
|
||||||
@ -105,32 +171,28 @@ export default function () {
|
|||||||
},
|
},
|
||||||
|
|
||||||
subDialog: {
|
subDialog: {
|
||||||
extraParam: 'stepId',
|
extraParam: "materialId",
|
||||||
|
forceAttachCode: true,
|
||||||
rows: [
|
rows: [
|
||||||
[
|
[
|
||||||
{ input: true, label: '步骤', prop: 'sort', rules: { required: true, message: 'not empty', trigger: 'blur' }, elparams: { placeholder: '请输入步骤' } },
|
{ input: true, label: "属性名", prop: "name", elparams: { placeholder: "请输入属性名" } }
|
||||||
{ input: true, label: '步骤描述', prop: 'description', rules: { required: true, message: 'not empty', trigger: 'blur' }, elparams: { placeholder: '请输入描述' } },
|
|
||||||
], [
|
|
||||||
{ input: true, label: '参数名称', prop: 'name', elparams: { placeholder: '请输入参数名称' } },
|
|
||||||
{ input: true, label: '参数编码', prop: 'code', rules: { required: true, message: 'not empty', trigger: 'blur' }, 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: "value", elparams: { placeholder: "请输入属性值" } }
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{ input: true, label: "备注", prop: "remark", elparams: { placeholder: "请输入备注" } },
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
operations: [
|
operations: [
|
||||||
{ name: 'add', label: '保存', type: 'primary', permission: 'pms:blenderStepParam:save', showOnEdit: false },
|
{ name: "add", label: "保存", type: "primary", permission: "pms:materialArrt:save", showOnEdit: false },
|
||||||
{ name: 'update', label: '更新', type: 'primary', permission: 'pms:blenderStepParam:update', showOnEdit: true },
|
{ name: "update", label: "更新", type: "primary", permission: "pms:materialArrt: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: {
|
||||||
@ -139,14 +201,14 @@ 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/materialType',
|
base: "/pms/material",
|
||||||
page: '/pms/materialType/page',
|
page: "/pms/material/page",
|
||||||
// subase: '/pms/blenderStepParam',
|
subase: "/pms/materialArrt",
|
||||||
// subpage: '/pms/blenderStepParam/page',
|
subpage: "/pms/materialArrt/page",
|
||||||
// more...
|
// more...
|
||||||
}
|
},
|
||||||
}
|
};
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user