Commit 05a177e5 authored by 仇晓婷's avatar 仇晓婷

资源物料ok

parent c4b7b181
...@@ -51,7 +51,6 @@ ...@@ -51,7 +51,6 @@
:multiple="multiple" :multiple="multiple"
:departmentId="departmentId" :departmentId="departmentId"
:disabled="disabled" :disabled="disabled"
clearable
filterable filterable
> >
<Option <Option
...@@ -143,6 +142,11 @@ export default { ...@@ -143,6 +142,11 @@ export default {
type: String, type: String,
default: "", default: "",
}, },
codeRuleType: {
// 库房类型
type: Number,
default: "",
},
}, },
methods: { methods: {
change(val) { change(val) {
...@@ -167,9 +171,14 @@ export default { ...@@ -167,9 +171,14 @@ export default {
conditions = [ conditions = [
{ {
conditionalType: "In", conditionalType: "In",
fieldName: "categoryId", fieldName: "rootCategoryId",
fieldValue: this.materialType, fieldValue: this.materialType,
}, },
{
fieldName: "codeRuleType",
fieldValue: this.codeRuleType + "",
conditionalType: "In",
},
]; ];
} else { } else {
conditions = []; conditions = [];
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</Col> </Col>
<Col :span="12"> <Col :span="12">
<FormItem :label="l('name')" prop="materialId"> <FormItem :label="l('name')" prop="materialId">
<Materiel v-model="entity.materialId" @on-change="change" :materialType="materialType"></Materiel> <Materiel v-model="entity.materialId" @on-change="change" :materialType="materialType" :codeRuleType='codeRuleType'></Materiel>
</FormItem> </FormItem>
</Col> </Col>
...@@ -123,13 +123,15 @@ export default { ...@@ -123,13 +123,15 @@ export default {
}, },
}; };
}, },
props: { props: ["eid", "rootName", "storeTitle", "materialType", "codeRuleType"],
// v: Object, // props: {
eid: Number,
rootName: String, // eid: Number,
storeTitle: String, // rootName: String,
materialType: String, // storeTitle: String,
}, // materialType: String,
// codeRuleType:String,
// },
mounted() {}, mounted() {},
methods: { methods: {
handleSubmit() { handleSubmit() {
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
:rootName="rootName" :rootName="rootName"
:storeTitle="storeTitle" :storeTitle="storeTitle"
:materialType="materialType" :materialType="materialType"
:codeRuleType="codeRuleType"
:storeId="storeId" :storeId="storeId"
:mcode="mCode" :mcode="mCode"
@on-close="cancel" @on-close="cancel"
...@@ -60,6 +61,7 @@ export default { ...@@ -60,6 +61,7 @@ export default {
easySearch: { easySearch: {
keys: { op: "name,storeTitle,materialCode", value: null }, keys: { op: "name,storeTitle,materialCode", value: null },
}, },
codeRuleType: null,
fscreeen: false, fscreeen: false,
modal: false, modal: false,
title: "新增", title: "新增",
...@@ -211,10 +213,14 @@ export default { ...@@ -211,10 +213,14 @@ export default {
}, },
add() { add() {
if (this.curId) { if (this.curId) {
if (this.codeRuleType == 1) {
this.title = "新增"; this.title = "新增";
this.detail = () => import("./add"); this.detail = () => import("./add");
this.fscreeen = false; this.fscreeen = false;
this.modal = true; this.modal = true;
} else {
this.$Message.error("请先选择正确的库房类型");
}
} else { } else {
this.$Message.error("请先选择库房库位"); this.$Message.error("请先选择库房库位");
} }
...@@ -262,7 +268,16 @@ export default { ...@@ -262,7 +268,16 @@ export default {
}, },
productSearch(item, ids, rootName) { productSearch(item, ids, rootName) {
console.log(item); console.log(item);
let type = [];
this.curId = item.id; this.curId = item.id;
type = item.codeRuleType.split(",");
if (type) {
type.forEach((e) => {
if (e == 1) {
this.codeRuleType = 1;
}
});
}
this.storeTitle = item.title; this.storeTitle = item.title;
this.rootName = rootName.join(" / "); this.rootName = rootName.join(" / ");
this.materialType = item.materialType; this.materialType = item.materialType;
......
...@@ -102,6 +102,7 @@ export default { ...@@ -102,6 +102,7 @@ export default {
}, },
methods: { methods: {
clickItem(val) { clickItem(val) {
console.log(val);
this.nodeInfo.codeRuleId = val; this.nodeInfo.codeRuleId = val;
this.model8 = val; this.model8 = val;
this.cityList.forEach((e) => { this.cityList.forEach((e) => {
......
...@@ -258,7 +258,7 @@ export default { ...@@ -258,7 +258,7 @@ export default {
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
......
...@@ -90,6 +90,7 @@ export default { ...@@ -90,6 +90,7 @@ export default {
return { return {
action: Api.index, action: Api.index,
rowId: "", rowId: "",
fileds:[],
entity: {}, entity: {},
metCodesStrTxt: "", metCodesStrTxt: "",
results: {}, results: {},
...@@ -313,7 +314,7 @@ export default { ...@@ -313,7 +314,7 @@ export default {
let codeList = []; let codeList = [];
let idList = []; let idList = [];
if (this.eid !== 0) { if (this.eid !== 0) {
if (this.entity.code) { if (this.entity.code!=0) {
codeList.push(this.entity.code); codeList.push(this.entity.code);
} else { } else {
codeList.push(this.eid); codeList.push(this.eid);
......
...@@ -12,7 +12,12 @@ ...@@ -12,7 +12,12 @@
</Col> </Col>
<Col :span="12"> <Col :span="12">
<FormItem :label="l('name')" prop="resourceId"> <FormItem :label="l('name')" prop="resourceId">
<Materiel v-model="entity.resourceId" @on-change="change" :materialType="materialType"></Materiel> <Materiel
v-model="entity.resourceId"
@on-change="change"
:materialType="materialType"
:codeRuleType="codeRuleType"
></Materiel>
</FormItem> </FormItem>
</Col> </Col>
...@@ -125,13 +130,14 @@ export default { ...@@ -125,13 +130,14 @@ export default {
}, },
}; };
}, },
props: { props: ["eid", "rootName", "storeTitle", "materialType", "codeRuleType"],
// v: Object, // props: {
eid: Number, // // v: Object,
rootName: String, // eid: Number,
storeTitle: String, // rootName: String,
materialType: String, // storeTitle: String,
}, // materialType: String,
// },
mounted() {}, mounted() {},
methods: { methods: {
handleSubmit() { handleSubmit() {
......
<template> <template>
<Layout class="full"> <Layout class="full">
<Sider hide-trigger v-if="showMenu" class="menu_side" width="300"> <Sider hide-trigger v-if="showMenu" class="menu_side" width="300">
<StoreTree @on-hide="onHide" @on-select="productSearch" /> <StoreTree @on-hide="onHide" @on-select="productSearch" />
</Sider> </Sider>
...@@ -9,11 +9,26 @@ ...@@ -9,11 +9,26 @@
</a> </a>
</div> </div>
<Content class="content" :class="!showMenu?'con_bord':''"> <Content class="content" :class="!showMenu?'con_bord':''">
<DataGrid :columns="columns" ref="grid" :action="action" :conditions="easySearch" :batch="true" :format="checkData" @all-change="allchange" @on-selection-change="onSelect" exportTitle="制造资源"> <DataGrid
:columns="columns"
ref="grid"
:action="action"
:conditions="easySearch"
:batch="true"
:format="checkData"
@all-change="allchange"
@on-selection-change="onSelect"
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 clearable placeholder="请输入资源名称/资源编码/编码" v-model.trim="easySearch.keys.value" v-width="260" /> <Input
clearable
placeholder="请输入资源名称/资源编码/编码"
v-model.trim="easySearch.keys.value"
v-width="260"
/>
</FormItem> </FormItem>
<FormItem> <FormItem>
<Button type="primary" @click="search">查询</Button> <Button type="primary" @click="search">查询</Button>
...@@ -36,11 +51,31 @@ ...@@ -36,11 +51,31 @@
</template> </template>
</DataGrid> </DataGrid>
<Modal v-model="modal" :title="title" width="1200" footer-hide :fullscreen="fscreeen"> <Modal v-model="modal" :title="title" width="1200" footer-hide :fullscreen="fscreeen">
<component :is="detail" :eid="curId" :rootName="rootName" :storeTitle="storeTitle" :materialType="materialType" :storeId="storeId" :mcode="mCode" :cartList="this.$u.clone(this.$store.state.cart)" @on-close="cancel" @on-ok="ok" @substr="substr" /> <component
:is="detail"
:eid="curId"
:rootName="rootName"
:storeTitle="storeTitle"
:materialType="materialType"
:codeRuleType="codeRuleType"
:storeId="storeId"
:mcode="mCode"
:cartList="this.$u.clone(this.$store.state.cart)"
@on-close="cancel"
@on-ok="ok"
@substr="substr"
/>
</Modal> </Modal>
<ImportExcel ref="importExcel" @on-get-data="getData" :columns="columns" :open="ModalIm" @on-cancel="ModalImCancel" @on-ok="ok" /> <ImportExcel
ref="importExcel"
@on-get-data="getData"
:columns="columns"
:open="ModalIm"
@on-cancel="ModalImCancel"
@on-ok="ok"
/>
</Content> </Content>
</Layout> </Layout>
</template> </template>
<script> <script>
...@@ -63,7 +98,7 @@ export default { ...@@ -63,7 +98,7 @@ export default {
easySearch: { easySearch: {
keys: { keys: {
op: "nameOfResource,code,resourceCode", op: "nameOfResource,code,resourceCode",
value: null value: null,
}, },
}, },
fscreeen: false, fscreeen: false,
...@@ -76,7 +111,8 @@ export default { ...@@ -76,7 +111,8 @@ export default {
storeTitle: "", storeTitle: "",
materialType: "", materialType: "",
mCode: "", mCode: "",
columns: [{ columns: [
{
key: "selection", key: "selection",
type: "selection", type: "selection",
width: 50, width: 50,
...@@ -97,19 +133,23 @@ export default { ...@@ -97,19 +133,23 @@ export default {
high: true, high: true,
width: 60, width: 60,
render: (h, params) => { render: (h, params) => {
return h("div", { return h(
class: "action" "div",
}, [ {
class: "action",
},
[
h(params.row.numberAvailable > 0 ? "op" : "", { h(params.row.numberAvailable > 0 ? "op" : "", {
attrs: { attrs: {
icon: "ios-cart-outline", icon: "ios-cart-outline",
type: "icon", type: "icon",
}, },
on: { on: {
click: () => this.addCart(params.row) click: () => this.addCart(params.row),
}, },
}), }),
]); ]
);
}, },
}, },
{ {
...@@ -250,36 +290,44 @@ export default { ...@@ -250,36 +290,44 @@ export default {
key: "action", key: "action",
hide: false, hide: false,
render: (h, params) => { render: (h, params) => {
return h("div", { return h(
class: "action" "div",
}, [ {
class: "action",
},
[
h( h(
"op", { "op",
{
attrs: { attrs: {
oprate: "delete", oprate: "delete",
title: "删除", title: "删除",
}, },
class: params.row.totalNum === params.row.numberAvailable ? class:
"remove" : "disable", params.row.totalNum === params.row.numberAvailable
? "remove"
: "disable",
on: { on: {
click: () => this.remove(params.row) click: () => this.remove(params.row),
}, },
}, },
"删除" "删除"
), ),
h( h(
"op", { "op",
{
attrs: { attrs: {
oprate: "detail", oprate: "detail",
title: "查看日志", title: "查看日志",
}, },
on: { on: {
click: () => this.logDetail(params.row.id) click: () => this.logDetail(params.row.id),
}, },
}, },
"查看日志" "查看日志"
), ),
]); ]
);
}, },
}, },
], ],
...@@ -293,6 +341,7 @@ export default { ...@@ -293,6 +341,7 @@ export default {
selectRows: [], selectRows: [],
//导入 //导入
ModalIm: false, ModalIm: false,
codeRuleType: null,
}; };
}, },
created() { created() {
...@@ -307,10 +356,7 @@ export default { ...@@ -307,10 +356,7 @@ export default {
})(); })();
}; };
}, },
async fetch({ async fetch({ store, params }) {
store,
params
}) {
await store.dispatch("loadDictionary"); // 加载数据字典 await store.dispatch("loadDictionary"); // 加载数据字典
}, },
computed: {}, computed: {},
...@@ -371,7 +417,7 @@ export default { ...@@ -371,7 +417,7 @@ export default {
hasPush = true; hasPush = true;
thisArr[index] = { thisArr[index] = {
...item, ...item,
...item2 ...item2,
}; };
return; return;
} }
...@@ -433,10 +479,14 @@ export default { ...@@ -433,10 +479,14 @@ export default {
}, },
add() { add() {
if (this.curId) { if (this.curId) {
if (this.codeRuleType == 3) {
this.title = "新增"; this.title = "新增";
this.detail = () => import("./add"); this.detail = () => import("./add");
this.fscreeen = false; this.fscreeen = false;
this.modal = true; this.modal = true;
} else {
this.$Message.error("请先选择正确的库房类型");
}
} else { } else {
this.$Message.error("请先选择库房库位"); this.$Message.error("请先选择库房库位");
} }
...@@ -478,14 +528,23 @@ export default { ...@@ -478,14 +528,23 @@ export default {
productSearch(item, ids, rootName) { productSearch(item, ids, rootName) {
// console.log(item); // console.log(item);
this.curId = item.id; this.curId = item.id;
let type = [];
type = item.codeRuleType.split(",");
if (type) {
type.forEach((e) => {
if (e == 3) {
this.codeRuleType = 3;
}
});
}
this.storeTitle = item.title; this.storeTitle = item.title;
this.rootName = rootName.join(" / "); this.rootName = rootName.join(" / ");
this.materialType = item.materialType; this.materialType = item.materialType;
let where = { let where = {
storeId: { storeId: {
op: "In", op: "In",
value: ids value: ids,
} },
}; };
this.$refs.grid.reload(where); this.$refs.grid.reload(where);
}, },
...@@ -499,14 +558,18 @@ export default { ...@@ -499,14 +558,18 @@ export default {
//批量导入start //批量导入start
//导入功能 //导入功能
openModalIm() { openModalIm() {
this.ModalIm = true this.ModalIm = true;
}, },
ModalImCancel() { ModalImCancel() {
this.ModalIm = false this.ModalIm = false;
}, },
getData(val) { getData(val) {
let url = `${resourceUrl}/resourceimportservice/import`; let url = `${resourceUrl}/resourceimportservice/import`;
this.$refs.importExcel.deelData(url, this.columns, this.formatMethod(val)) this.$refs.importExcel.deelData(
url,
this.columns,
this.formatMethod(val)
);
}, },
//根据页面二次处理数据 //根据页面二次处理数据
formatMethod(val) { formatMethod(val) {
...@@ -514,26 +577,31 @@ export default { ...@@ -514,26 +577,31 @@ export default {
let tempList = []; let tempList = [];
tempData.forEach((ele) => { tempData.forEach((ele) => {
let obj = { let obj = {
nameOfResource: ele.nameOfResource ? ele.nameOfResource : '', nameOfResource: ele.nameOfResource ? ele.nameOfResource : "",
resourceCode: ele.resourceCode ? ele.resourceCode : '', resourceCode: ele.resourceCode ? ele.resourceCode : "",
code: ele.code ? ele.code : '', code: ele.code ? ele.code : "",
totalNum: ele.totalNum ? ele.nameOfResource : 0, totalNum: ele.totalNum ? ele.nameOfResource : 0,
storeTitle: ele.storeTitle ? ele.storeTitle : '', storeTitle: ele.storeTitle ? ele.storeTitle : "",
storeId: ele.storeId ? ele.nameOfResource : null, storeId: ele.storeId ? ele.nameOfResource : null,
state: 1, state: 1,
numberAvailable: ele.numberAvailable ? ele.nameOfResource : 0, numberAvailable: ele.numberAvailable ? ele.nameOfResource : 0,
json: {} json: {},
}; };
if (ele.nameOfResource && ele.nameOfResource != '' && ele.code && ele.code != '' && ele.resourceCode && ele.resourceCode != '') { if (
obj.ico = false ele.nameOfResource &&
ele.nameOfResource != "" &&
ele.code &&
ele.code != "" &&
ele.resourceCode &&
ele.resourceCode != ""
) {
obj.ico = false;
} else { } else {
obj.ico = true obj.ico = true;
} }
tempList.push(obj); tempList.push(obj);
}); });
return tempList return tempList;
}, },
//批量导入end //批量导入end
l(key) { l(key) {
......
...@@ -68,6 +68,7 @@ export default { ...@@ -68,6 +68,7 @@ export default {
level: this.level, level: this.level,
userName: "", userName: "",
userIds: "", userIds: "",
codeRuleType: "",
}, },
rules: { rules: {
title: [{ required: true, message: "必填", trigger: "blur" }], title: [{ required: true, message: "必填", trigger: "blur" }],
...@@ -105,15 +106,19 @@ export default { ...@@ -105,15 +106,19 @@ export default {
}, },
changeVal(val) { changeVal(val) {
let code = []; let code = [];
let type = [];
for (let i = 0; i < this.list.length; i++) { for (let i = 0; i < this.list.length; i++) {
let obj = this.list[i]; let obj = this.list[i];
for (let j = 0; j < val.length; j++) { for (let j = 0; j < val.length; j++) {
if (obj.id == val[j]) { if (obj.id == val[j]) {
code.push(obj.code); code.push(obj.code);
type.push(obj.codeRuleType);
} }
} }
} }
this.entity.materialTypeName = code.join(","); this.entity.materialTypeName = code.join(",");
this.entity.codeRuleType = type.join(",");
}, },
handleSubmit() { handleSubmit() {
this.$refs.form.validate((v) => { this.$refs.form.validate((v) => {
...@@ -137,6 +142,7 @@ export default { ...@@ -137,6 +142,7 @@ export default {
userIds: userId, //库管员id userIds: userId, //库管员id
materialType: materialType, //物料类型 materialType: materialType, //物料类型
materialTypeName: this.entity.materialTypeName, //物料编码 materialTypeName: this.entity.materialTypeName, //物料编码
codeRuleType:this.entity.codeRuleType
}; };
Api.create(paramsdata) Api.create(paramsdata)
......
...@@ -51,6 +51,7 @@ export default { ...@@ -51,6 +51,7 @@ export default {
roleTitle: "库管", roleTitle: "库管",
entity: { entity: {
materialType: [], materialType: [],
codeRuleType: "",
}, },
materialType: [], materialType: [],
rules: { rules: {
...@@ -91,15 +92,19 @@ export default { ...@@ -91,15 +92,19 @@ export default {
}, },
changeVal(val) { changeVal(val) {
let code = []; let code = [];
let type = [];
for (let i = 0; i < this.list.length; i++) { for (let i = 0; i < this.list.length; i++) {
let obj = this.list[i]; let obj = this.list[i];
for (let j = 0; j < val.length; j++) { for (let j = 0; j < val.length; j++) {
if (obj.id == val[j]) { if (obj.id == val[j]) {
code.push(obj.code); code.push(obj.code);
type.push(obj.codeRuleType);
} }
} }
} }
alert(type)
this.entity.materialTypeName = code.join(","); this.entity.materialTypeName = code.join(",");
this.entity.codeRuleType = type.join(",");
}, },
load(v) { load(v) {
Api.get({ id: v }).then((r) => { Api.get({ id: v }).then((r) => {
...@@ -138,6 +143,7 @@ export default { ...@@ -138,6 +143,7 @@ export default {
creatorUserId: this.entity.creatorUserId, creatorUserId: this.entity.creatorUserId,
materialType: materialType, //物料类型 materialType: materialType, //物料类型
materialTypeName: this.entity.materialTypeName, //物料编码 materialTypeName: this.entity.materialTypeName, //物料编码
codeRuleType: this.entity.codeRuleType,
}; };
Api.update(paramsdata) Api.update(paramsdata)
......
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