Commit cc6d2e40 authored by renjintao's avatar renjintao

Merge branch 'product' of git.mes123.com:zhouyx/mes-ui into product-rjt

parents ce4350c0 c523529d
<template> <template>
<div class="master-data"> <div class="master-data">
<DataGrid :columns="cols" ref="grid" :conditions="easySearch" :action="action" :initsearch="sets" :high="false" :format="formatFun" :height="tableHeight" @on-selection-change="onSelect" :exportTitle="exportTitle"> <DataGrid
:columns="cols"
ref="grid"
:conditions="easySearch"
:action="action"
:initsearch="sets"
:high="false"
:format="formatFun"
:height="tableHeight"
@on-selection-change="onSelect"
:exportTitle="exportTitle"
>
<template slot="easySearch"> <template slot="easySearch">
<Form ref="formInline" :model="easySearch" inline> <Form ref="formInline" :model="easySearch" inline>
<FormItem prop="keys"> <FormItem prop="keys">
<Input placeholder="请输入编码/名称/状态" v-width="200" v-model="easySearch.keys.value" clearable /> <Input
placeholder="请输入编码/名称/状态"
v-width="200"
v-model="easySearch.keys.value"
clearable
/>
</FormItem> </FormItem>
<FormItem> <FormItem>
<Button type="primary" @click="search">查询</Button> <Button type="primary" @click="search">查询</Button>
...@@ -20,11 +36,36 @@ ...@@ -20,11 +36,36 @@
<Button type="primary" @click="modalSchedule">批量送审</Button> <Button type="primary" @click="modalSchedule">批量送审</Button>
</template> </template>
</DataGrid> </DataGrid>
<Modal v-model="modal" :title="title" width="1000" footer-hide :mask-closable="false" :fullscreen="fullscreen"> <Modal
<component :is="detail" :eid="curId" :rootCategoryId="rootCategoryId" :rowsTable="rowsTable" :nodeInfo="nodeInfo" @on-close="cancel" @on-cancel="cancel" @on-ok="ok" ref="chlidren" /> v-model="modal"
:title="title"
width="1000"
footer-hide
:mask-closable="false"
:fullscreen="fullscreen"
>
<component
:is="detail"
:eid="curId"
:rootCategoryId="rootCategoryId"
:rowsTable="rowsTable"
:nodeInfo="nodeInfo"
@on-close="cancel"
@on-cancel="cancel"
@on-ok="ok"
ref="chlidren"
/>
</Modal> </Modal>
<ImportExcel ref="importExcel" @on-get-data="getData" :modalTitle="temTitle" :columns="cols" :open="ModalIm" @on-cancel="ModalImCancel" @on-ok="ok" /> <ImportExcel
</div> ref="importExcel"
@on-get-data="getData"
:modalTitle="temTitle"
:columns="cols"
:open="ModalIm"
@on-cancel="ModalImCancel"
@on-ok="ok"
/>
</div>
</template> </template>
<script> <script>
...@@ -51,24 +92,25 @@ export default { ...@@ -51,24 +92,25 @@ export default {
codeRuleData: [], codeRuleData: [],
detail: null, detail: null,
temTitle: "物料管理", temTitle: "物料管理",
sets: v => { sets: (v) => {
v.categoryId = this.nodeInfo.categoryId; v.categoryId = this.nodeInfo.categoryId;
v.rootCategoryId = this.nodeInfo.rootCategoryId; v.rootCategoryId = this.nodeInfo.rootCategoryId;
}, },
easySearch: { easySearch: {
keys: { keys: {
op: "code,name", op: "code,name",
value: null value: null,
}, },
categoryId: { categoryId: {
op: "In", op: "In",
value: this.nodeInfo.ids value: this.nodeInfo.ids,
} },
}, },
columns: [{ columns: [
{
type: "selection", type: "selection",
width: 70, width: 70,
align: "center" align: "center",
}, },
{ {
key: "codeRuleType", key: "codeRuleType",
...@@ -81,43 +123,34 @@ export default { ...@@ -81,43 +123,34 @@ export default {
{ {
key: "codeRuleId", key: "codeRuleId",
title: "编码名称", title: "编码名称",
materialKey: '3', materialKey: "3",
import: true, import: true,
hide: true, hide: true,
render: (h, params) => { render: (h, params) => {
return h( return h("span", {}, this.getType3(params.row.codeRuleId));
"span", {}, },
this.getType3(params.row.codeRuleId)
);
}
}, },
{ {
key: "rootCategoryId", key: "rootCategoryId",
title: "大类", title: "大类",
align: "right", align: "right",
materialKey: '1', materialKey: "1",
import: true, import: true,
hide: true, hide: true,
render: (h, params) => { render: (h, params) => {
return h( return h("span", {}, this.getType1(params.row.rootCategoryId));
"span", {}, },
this.getType1(params.row.rootCategoryId)
);
}
}, },
{ {
key: "categoryId", key: "categoryId",
title: "子类", title: "子类",
align: "right", align: "right",
materialKey: '2', materialKey: "2",
import: true, import: true,
hide: true, hide: true,
render: (h, params) => { render: (h, params) => {
return h( return h("span", {}, this.getType2(params.row.categoryId));
"span", {}, },
this.getType2(params.row.categoryId)
);
}
}, },
{ {
key: "code", key: "code",
...@@ -125,20 +158,23 @@ export default { ...@@ -125,20 +158,23 @@ export default {
align: "left", align: "left",
render: (h, params) => { render: (h, params) => {
return h( return h(
"a", { "a",
{
props: {}, props: {},
on: { on: {
click: () => this.details(params.row) click: () => this.details(params.row),
}
}, },
!params.row.code || params.row.code == 0 ? "未分配" : params.row.code },
!params.row.code || params.row.code == 0
? "未分配"
: params.row.code
); );
} },
}, },
{ {
key: "name", key: "name",
title: "名称", title: "名称",
align: "left" align: "left",
}, },
{ {
key: "status", key: "status",
...@@ -150,26 +186,26 @@ export default { ...@@ -150,26 +186,26 @@ export default {
key: "version", key: "version",
title: "版本", title: "版本",
align: "left", align: "left",
code: "material.main.version" code: "material.main.version",
}, },
{ {
key: "drawing", key: "drawing",
title: "图号", title: "图号",
align: "left" align: "left",
}, },
{ {
key: "creationTime", key: "creationTime",
title: "创建时间", title: "创建时间",
hide: true, hide: true,
align: "left", align: "left",
type: "date" type: "date",
}, },
{ {
key: "creatorUserId", key: "creatorUserId",
title: "创建人", title: "创建人",
hide: true, hide: true,
align: "left", align: "left",
type: "user" type: "user",
}, },
{ {
title: "操作", title: "操作",
...@@ -177,60 +213,64 @@ export default { ...@@ -177,60 +213,64 @@ export default {
width: 150, width: 150,
align: "left", align: "left",
render: (h, params) => { render: (h, params) => {
return h("div", { return h(
class: "action" "div",
}, [ {
class: "action",
},
[
h( h(
"op", { "op",
{
attrs: { attrs: {
oprate: "edit" oprate: "edit",
}, },
on: { on: {
click: () => this.edit(params.row) click: () => this.edit(params.row),
} },
}, },
"编辑" params.row.status == 3 ? "" : "编辑"
), ),
h( h(
"op", { "op",
{
attrs: { attrs: {
oprate: "delete" oprate: "delete",
}, },
on: { on: {
click: () => this.remove(params.row.id) click: () => this.remove(params.row.id),
} },
}, },
params.row.status == 3 ? "" : "删除" params.row.status == 3 ? "" : "删除"
), ),
h( h(
"op", { "op",
{
attrs: { attrs: {
oprate: "edit" oprate: "edit",
}, },
on: { on: {
click: () => this.send(params.row) click: () => this.send(params.row),
} },
}, },
(params.row.status == 0 || params.row.status == 1) && (params.row.status == 0 || params.row.status == 1) &&
this.status == 0 ? this.status == 0
"送审" : ? "送审"
"" : ""
) ),
]); ]
} );
} },
},
], //基础咧 ], //基础咧
cols: [], // cols: [], //
status: null, status: null,
ModalIm: false, ModalIm: false,
addCol: [], addCol: [],
exportTitle: '物料管理', exportTitle: "物料管理",
}; };
}, },
async fetch({ async fetch({ store, params }) {
store,
params
}) {
await store.dispatch("loadDictionary"); // 加载数据字典 await store.dispatch("loadDictionary"); // 加载数据字典
}, },
created() { created() {
...@@ -242,15 +282,15 @@ export default { ...@@ -242,15 +282,15 @@ export default {
this.initCols(); this.initCols();
} }
Api.getbyid({ Api.getbyid({
id: "b6303ddc-8b5e-40a3-a51b-294657d1d913" id: "b6303ddc-8b5e-40a3-a51b-294657d1d913",
}).then(r => { }).then((r) => {
this.status = r.result.status; //status为0的话为启用,有送审,为1的话,流程是禁用的,没有送审按钮 this.status = r.result.status; //status为0的话为启用,有送审,为1的话,流程是禁用的,没有送审按钮
this.nodeInfo.status = this.status; this.nodeInfo.status = this.status;
}); });
}, },
mounted() { mounted() {
this.getTreeData() this.getTreeData();
this.getcodeRuleData() this.getcodeRuleData();
window.onresize = () => { window.onresize = () => {
///浏览器窗口大小变化 ///浏览器窗口大小变化
return (() => { return (() => {
...@@ -262,7 +302,7 @@ export default { ...@@ -262,7 +302,7 @@ export default {
methods: { methods: {
//格式化原始数据 //格式化原始数据
formatFun(data) { formatFun(data) {
data.map(e => { data.map((e) => {
if (e.status == 0) { if (e.status == 0) {
e._disabled = false; e._disabled = false;
} else { } else {
...@@ -290,32 +330,34 @@ export default { ...@@ -290,32 +330,34 @@ export default {
this.$refs.grid.reload(this.easySearch); this.$refs.grid.reload(this.easySearch);
}, },
initCols(delay) { initCols(delay) {
let conditions = [{ let conditions = [
{
conditionalType: "Equal", conditionalType: "Equal",
fieldName: "categoryId", fieldName: "categoryId",
fieldValue: this.nodeInfo.rootCategoryId fieldValue: this.nodeInfo.rootCategoryId,
}]; },
];
Api.listTable({ Api.listTable({
conditions: conditions, conditions: conditions,
sortBy: "id", sortBy: "id",
isDesc: false isDesc: false,
}).then(r => { }).then((r) => {
if (r.result) { if (r.result) {
var items = r.result.filter(u => { var items = r.result.filter((u) => {
return ( return (
!this.columns.some(p => { !this.columns.some((p) => {
return p.key == u.field; return p.key == u.field;
}) && u.dataType != 5 }) && u.dataType != 5
); );
}); });
this.addCol = items; this.addCol = items;
this.cols = this.$u.clone(this.columns); this.cols = this.$u.clone(this.columns);
let extra = items.map(u => { let extra = items.map((u) => {
// console.log(u); // console.log(u);
var col = { var col = {
key: u.field, key: u.field,
title: u.title title: u.title,
}; };
if (u.dataType == 3) { if (u.dataType == 3) {
col.code = u.note; col.code = u.note;
...@@ -328,7 +370,7 @@ export default { ...@@ -328,7 +370,7 @@ export default {
"material.main.unitName" "material.main.unitName"
); );
let item = units.filter(p => { let item = units.filter((p) => {
return p.code == u.unitName; return p.code == u.unitName;
}); });
// console.log(units, item); // console.log(units, item);
...@@ -370,7 +412,7 @@ export default { ...@@ -370,7 +412,7 @@ export default {
this.modal = true; this.modal = true;
}, },
remove(id) { remove(id) {
Api.delete(id).then(r => { Api.delete(id).then((r) => {
if (r.success) { if (r.success) {
this.$refs.grid.reload(this.easySearch); this.$refs.grid.reload(this.easySearch);
this.$Message.success("删除成功"); this.$Message.success("删除成功");
...@@ -409,18 +451,17 @@ export default { ...@@ -409,18 +451,17 @@ export default {
//导入功能 //导入功能
openModalIm() { openModalIm() {
if (this.nodeInfo.categoryId) { if (this.nodeInfo.categoryId) {
this.ModalIm = true this.ModalIm = true;
} else { } else {
this.$Message.error("请先选择分类"); this.$Message.error("请先选择分类");
} }
}, },
ModalImCancel() { ModalImCancel() {
this.ModalIm = false this.ModalIm = false;
}, },
getData(val) { getData(val) {
let url = `${material}/materialimportservice/import`; let url = `${material}/materialimportservice/import`;
this.$refs.importExcel.deelData(url, this.cols, this.formatMethod(val)) this.$refs.importExcel.deelData(url, this.cols, this.formatMethod(val));
}, },
//根据页面二次处理数据 //根据页面二次处理数据
formatMethod(val) { formatMethod(val) {
...@@ -428,9 +469,9 @@ export default { ...@@ -428,9 +469,9 @@ export default {
let tempList = []; let tempList = [];
tempData.forEach((ele) => { tempData.forEach((ele) => {
let obj = { let obj = {
name: ele.name ? ele.name : '', name: ele.name ? ele.name : "",
version: ele.version ? Number(ele.version) : '', version: ele.version ? Number(ele.version) : "",
drawing: ele.drawing ? ele.drawing : '', drawing: ele.drawing ? ele.drawing : "",
description: ele.description ? ele.description : "", description: ele.description ? ele.description : "",
code: 0, code: 0,
status: this.nodeInfo.status == 1 ? 3 : 0, status: this.nodeInfo.status == 1 ? 3 : 0,
...@@ -438,72 +479,70 @@ export default { ...@@ -438,72 +479,70 @@ export default {
categoryId: this.nodeInfo.categoryId, //左侧树点击的id categoryId: this.nodeInfo.categoryId, //左侧树点击的id
customProperties: {}, customProperties: {},
rootCategoryId: this.nodeInfo.rootCategoryId, //左侧树点击的数据的最顶层id rootCategoryId: this.nodeInfo.rootCategoryId, //左侧树点击的数据的最顶层id
codeRuleType: this.nodeInfo.codeRuleType codeRuleType: this.nodeInfo.codeRuleType,
}; };
this.addCol.forEach(el => { this.addCol.forEach((el) => {
obj[el.field] = ele[el.field] obj[el.field] = ele[el.field];
}) });
if (ele.name && ele.name != '') { if (ele.name && ele.name != "") {
obj.ico = false obj.ico = false;
} else { } else {
obj.ico = true obj.ico = true;
} }
tempList.push(obj); tempList.push(obj);
}); });
return tempList return tempList;
}, },
//批量导入end //批量导入end
//物料大类和子类的解析start //物料大类和子类的解析start
getTreeData() { getTreeData() {
let data = { let data = {
conditions: [] conditions: [],
}; };
Api.list(data).then((r) => { Api.list(data).then((r) => {
this.treeData = r.result this.treeData = r.result;
}); });
}, },
getType1(val) { getType1(val) {
let tempTreeList = this.$u.clone(this.treeData) let tempTreeList = this.$u.clone(this.treeData);
let rootName = "" let rootName = "";
tempTreeList.forEach(ele => { tempTreeList.forEach((ele) => {
if (ele.upId == 0 && ele.id == val) { if (ele.upId == 0 && ele.id == val) {
rootName = ele.name rootName = ele.name;
} }
}) });
return rootName return rootName;
}, },
getType2(val) { getType2(val) {
let tempTreeList = this.$u.clone(this.treeData) let tempTreeList = this.$u.clone(this.treeData);
let childrenName = "" let childrenName = "";
tempTreeList.forEach(ele => { tempTreeList.forEach((ele) => {
if (ele.upId > 0 && ele.id == val) { if (ele.upId > 0 && ele.id == val) {
childrenName = ele.name childrenName = ele.name;
} }
}) });
return childrenName return childrenName;
}, },
//获取编码名称 //获取编码名称
getcodeRuleData() { getcodeRuleData() {
let data = { let data = {
conditions: [] conditions: [],
}; };
Api.pagedSlecet(data).then((r) => { Api.pagedSlecet(data).then((r) => {
if (r.success) { if (r.success) {
this.codeRuleData = r.result.items || [] this.codeRuleData = r.result.items || [];
} }
}); });
}, },
getType3(val) { getType3(val) {
let codeRuleDataList = this.$u.clone(this.codeRuleData) let codeRuleDataList = this.$u.clone(this.codeRuleData);
let codeRuleName = "" let codeRuleName = "";
codeRuleDataList.forEach(ele => { codeRuleDataList.forEach((ele) => {
if (ele.id == val) { if (ele.id == val) {
codeRuleName = ele.name codeRuleName = ele.name;
} }
}) });
return codeRuleName return codeRuleName;
}, },
//物料大类和子类的解析end //物料大类和子类的解析end
}, },
...@@ -511,7 +550,7 @@ export default { ...@@ -511,7 +550,7 @@ export default {
nodeInfo: { nodeInfo: {
handler(newName, oldName) { handler(newName, oldName) {
// console.log("ovo", newName, oldName); // console.log("ovo", newName, oldName);
this.temTitle = "物料管理(" + newName.rootCategoryName + ")" this.temTitle = "物料管理(" + newName.rootCategoryName + ")";
if (newName.rootCategoryId) { if (newName.rootCategoryId) {
this.initCols(() => { this.initCols(() => {
if (newName.categoryId) { if (newName.categoryId) {
...@@ -525,9 +564,9 @@ export default { ...@@ -525,9 +564,9 @@ export default {
} }
}, },
immediate: true, immediate: true,
deep: true deep: true,
},
}, },
}
}; };
</script> </script>
......
<template> <template>
<div> <div>
<div class="mb10 pt5"> <div class="mb10 pt5">
<Input v-model="searchValue" placeholder="请输入库位名称" clearable style="width: 240px" /> <Input
v-model="searchValue"
placeholder="请输入库位名称"
clearable
style="width: 240px"
/>
<Button type="primary" class @click="handleSearch">查询</Button> <Button type="primary" class @click="handleSearch">查询</Button>
<div class="fr"> <div class="fr">
<Button type="primary" @click="add()">新增库位</Button> <Button type="primary" @click="add()">新增库位</Button>
...@@ -78,6 +83,12 @@ export default { ...@@ -78,6 +83,12 @@ export default {
title: "物料编号", title: "物料编号",
align: "left", align: "left",
}, },
{
key: "materialType",
title: "物料类型",
align: "left",
code: "material.main.type",
},
{ {
key: "userName", key: "userName",
title: this.l("userName"), title: this.l("userName"),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment