update material

Cette révision appartient à :
lb 2023-02-03 16:28:52 +08:00
Parent 70243b527f
révision 151f787f0a
5 fichiers modifiés avec 162 ajouts et 92 suppressions

Voir le fichier

@ -38,8 +38,8 @@
<% if (process.env.VUE_APP_NODE_ENV === 'dev') { %>
<script>
// 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.62:8080/pms-am'; // tao
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
</script>
<% } %>
<!-- 集成测试环境 -->

Voir le fichier

@ -167,13 +167,15 @@ export default {
method,
data: {
...this.dataForm,
...fields
...fields,
},
}).then(({ data: res }) => {
console.log("[add&update] res is: ", res);
this.$message.success(payload.name === "add" ? "添加成功" : "更新成功");
this.$emit("refreshDataList");
this.handleClose();
if (res.code === 0) {
this.$message.success(payload.name === "add" ? "添加成功" : "更新成功");
this.$emit("refreshDataList");
this.handleClose();
} else this.$message.error(res.msg);
});
}
}

Voir le fichier

@ -101,12 +101,6 @@ export default {
this.initDataWhenLoad && this.getList();
},
methods: {
/* 从dom移除对话框 */
destroyDialog() {
// console.log('[ListViewWithHead] destroyDialog')
this.dialogVisible = false;
},
/**
* 转换服务器数据的中间层
* 为了抹平真实服务器数据和我本地的测试服务器数据的差异

Voir le fichier

@ -30,8 +30,20 @@
<!-- :current-page.sync="currentPage"
:page-size.sync="pageSize" -->
<DialogWithMenu ref="edit-dialog" v-if="dialogType === DIALOG_WITH_MENU && dialogVisible" :configs="dialogConfigs" @refreshDataList="getList" />
<DialogJustForm ref="edit-dialog" v-if="dialogType === DIALOG_JUST_FORM && dialogVisible" :configs="dialogConfigs" @refreshDataList="getList" />
<DialogWithMenu
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>
</template>

Voir le fichier

@ -1,103 +1,169 @@
import TableOperaionComponent from '@/components/noTemplateComponents/operationComponent'
import TableTextComponent from '@/components/noTemplateComponents/detailComponent'
import StatusComponent from '@/components/noTemplateComponents/statusComponent'
import InputArea from 'code-brick-zj'
import { timeFilter } 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 = [
{ prop: 'createTime', label: '添加时间', filter: timeFilter },
{ prop: 'name', label: '物料名称' },
{ prop: 'code', label: '物料编码' },
{ prop: 'typeDictValue', label: '类别' }, // subcomponent: {/** TODO: create a new component for this option */} },
{ prop: 'type', label: '物料类型', },
{ prop: 'enName', label: '英文名称', },
{ prop: 'enAb', label: '英文缩写', },
{ prop: 'description', label: '详情', subcomponent: TableTextComponent },
{ prop: 'remark', label: '备注' },
{ prop: "createTime", label: "添加时间", filter: timeFilter },
{ prop: "name", label: "物料名称" },
{ prop: "code", label: "物料编码" },
{ prop: "typeDictValue", label: "类别", filter: dictFilter("material_category") }, // subcomponent: {/** TODO: create a new component for this option */} },
{ prop: "type", label: "物料类型" },
{ prop: "enName", label: "英文名称" },
{ prop: "enAb", label: "英文缩写" },
{ prop: "description", label: "详情", subcomponent: TableTextComponent },
{ prop: "remark", label: "备注" },
/** TODO: parentId 是用来前端重构成树形结构的... */
{
prop: 'operations',
name: '操作',
fixed: 'right',
prop: "operations",
name: "操作",
fixed: "right",
width: 120,
subcomponent: TableOperaionComponent,
options: ['edit', { name: 'delete', permission: '' }]
}
]
options: ["edit", { name: "delete", permission: "pms:material:save" }],
},
];
const headFormFields = [
{
label: '物料名称/编码',
label: "物料名称/编码",
prop: "key",
input: true,
default: { value: '' }
default: { value: "" },
bind: { placeholder: "请输入物料名称或编码" },
},
{
button: {
type: 'primary',
name: '查询'
}
type: "primary",
name: "查询",
},
},
{
button: {
type: 'primary',
name: '新增',
permission: ''
type: "primary",
name: "新增",
permission: "",
},
bind: {
plain: true,
}
}
]
},
},
];
/**
* dialog config 有两个版本一个适用于 DialogWithMenu 组件另一个适用于 DialogJustForm 组件
* 适用于 DialogWithMenu 组件的配置示例详见 blenderStep/config.js
* 此为后者的配置:
*/
const dictList = JSON.parse(localStorage.getItem("dictList"));
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: {
url: '/pms/blenderStep',
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: 'version', 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: "请输入物料编码" },
},
{
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: [
{ name: 'add', label: '保存', type: 'primary', permission: 'pms:blenderStep:save', showOnEdit: false },
{ name: 'update', label: '更新', type: 'primary', permission: 'pms:blenderStep:update', showOnEdit: true },
{ name: 'reset', label: '重置', type: 'warning', showAlways: true },
{ name: "add", label: "保存", type: "primary", permission: "pms:material:save", showOnEdit: false },
{ name: "update", label: "更新", type: "primary", permission: "pms:material:save", showOnEdit: true },
{ name: "reset", label: "重置", type: "warning", showAlways: true },
// { name: 'cancel', label: '取消', showAlways: true },
],
},
table: {
// extraParams: ['stepId'],
extraParams: 'stepId',
extraParams: "materialId",
props: [
{ prop: 'sort', label: '步骤', isEditField: true },
{ prop: 'name', label: '参数名称', isEditField: true },
{ prop: 'description', label: '描述', isEditField: true },
{ prop: 'value', label: '设定值', isEditField: true },
{ prop: 'valueFloor', label: '值下限', isEditField: true },
{ prop: 'valueTop', label: '值上限', isEditField: true },
{ prop: "createTime", label: "添加时间", filter: timeFilter, isEditField: true },
{ prop: "name", label: "属性名", isEditField: true },
{ prop: "value", label: "属性值", isEditField: true },
{
prop: 'operations',
name: '操作',
fixed: 'right',
prop: "operations",
name: "操作",
fixed: "right",
width: 120,
subcomponent: TableOperaionComponent,
options: [
{ name: 'edit', permission: 'pms:blenderStepParam:update' },
{ name: 'delete', permission: 'pms:blenderStepParam:delete' },
]
}
{ name: "edit", permission: "pms:materialArrt:save" },
{ name: "delete", permission: "pms:materialArrt:save" },
],
},
],
data: [
// TOOD 暂时用不到,但获取可以考虑把拉取接口数据的函数迁移到此文件(没有太大必要)
@ -105,32 +171,28 @@ export default function () {
},
subDialog: {
extraParam: 'stepId',
extraParam: "materialId",
forceAttachCode: true,
rows: [
[
{ input: true, label: '步骤', prop: 'sort', rules: { required: true, message: 'not empty', trigger: 'blur' }, 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: "name", elparams: { placeholder: "请输入属性名" } }
],
[
{ input: true, label: '参数值', prop: 'value', elparams: { placeholder: '请输入参数值' } },
{ input: true, label: "属性值", prop: "value", elparams: { placeholder: "请输入属性值" } }
],
[
{ input: true, label: "备注", prop: "remark", elparams: { placeholder: "请输入备注" } },
]
],
operations: [
{ name: 'add', label: '保存', type: 'primary', permission: 'pms:blenderStepParam:save', showOnEdit: false },
{ name: 'update', label: '更新', type: 'primary', permission: 'pms:blenderStepParam:update', showOnEdit: true },
{ name: "add", label: "保存", type: "primary", permission: "pms:materialArrt:save", showOnEdit: false },
{ name: "update", label: "更新", type: "primary", permission: "pms:materialArrt:update", showOnEdit: true },
// { name: 'reset', label: '重置', type: 'warning', showAlways: true },
// { name: 'cancel', label: '取消', showAlways: true },
],
},
};
return {
dialogConfigs,
tableConfig: {
@ -139,14 +201,14 @@ export default function () {
},
headFormConfigs: {
rules: null, // 名称是由 BaseSearchForm.vue 组件固定的
fields: headFormFields // 名称是由 BaseSearchForm.vue 组件固定的
fields: headFormFields, // 名称是由 BaseSearchForm.vue 组件固定的
},
urls: {
base: '/pms/materialType',
page: '/pms/materialType/page',
// subase: '/pms/blenderStepParam',
// subpage: '/pms/blenderStepParam/page',
base: "/pms/material",
page: "/pms/material/page",
subase: "/pms/materialArrt",
subpage: "/pms/materialArrt/page",
// more...
}
}
}
},
};
}