|
@@ -1,41 +1,80 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
- <Card style="width:100%" :bordered="false" :dis-hover="true">
|
|
|
+ <Card style="width: 100%" :bordered="false" :dis-hover="true">
|
|
|
<p slot="title">添加采购订单物料</p>
|
|
|
<div slot="extra">
|
|
|
- <Button @click="$emit('return')">返回</Button>
|
|
|
+ <Button @click="goBack">返回</Button>
|
|
|
</div>
|
|
|
<Row :gutter="10" style="margin-bottom: 10px">
|
|
|
<Col span="4">
|
|
|
- <Select clearable v-model="searchForm.ck" :disabled="ckLock" placeholder="仓库名">
|
|
|
- <Option v-for="item in ckList" :value="item.twId" :key="item.twId">{{ item.twName }}</Option>
|
|
|
+ <Select
|
|
|
+ clearable
|
|
|
+ v-model="searchForm.ck"
|
|
|
+ :disabled="ckLock"
|
|
|
+ placeholder="仓库名"
|
|
|
+ >
|
|
|
+ <Option
|
|
|
+ v-for="item in ckList"
|
|
|
+ :value="item.twId"
|
|
|
+ :key="item.twId"
|
|
|
+ >{{ item.twName }}</Option
|
|
|
+ >
|
|
|
</Select>
|
|
|
</Col>
|
|
|
<Col span="4">
|
|
|
- <Select clearable v-model="searchForm.yjfl" placeholder="一级分类" @on-change="yjflChange">
|
|
|
- <Option v-for="item in yjflList" :value="item.gcId" :key="item.gcId">{{ item.gcName }}</Option>
|
|
|
+ <Select
|
|
|
+ clearable
|
|
|
+ v-model="searchForm.yjfl"
|
|
|
+ placeholder="一级分类"
|
|
|
+ @on-change="yjflChange"
|
|
|
+ >
|
|
|
+ <Option
|
|
|
+ v-for="item in yjflList"
|
|
|
+ :value="item.gcId"
|
|
|
+ :key="item.gcId"
|
|
|
+ >{{ item.gcName }}</Option
|
|
|
+ >
|
|
|
</Select>
|
|
|
</Col>
|
|
|
<Col span="4">
|
|
|
<Select clearable v-model="searchForm.ejfl" placeholder="二级分类">
|
|
|
- <Option v-for="item in ejflList" :value="item.gcId" :key="item.gcId">{{ item.gcName }}</Option>
|
|
|
+ <Option
|
|
|
+ v-for="item in ejflList"
|
|
|
+ :value="item.gcId"
|
|
|
+ :key="item.gcId"
|
|
|
+ >{{ item.gcName }}</Option
|
|
|
+ >
|
|
|
</Select>
|
|
|
</Col>
|
|
|
<Col span="4">
|
|
|
<Input v-model="searchForm.wlmc" placeholder="物料编码或名称" />
|
|
|
</Col>
|
|
|
<Col span="4">
|
|
|
- <Select clearable filterable v-model="searchForm.purchaserId" placeholder="分管采购员">
|
|
|
+ <Select
|
|
|
+ clearable
|
|
|
+ filterable
|
|
|
+ v-model="searchForm.purchaserId"
|
|
|
+ placeholder="分管采购员"
|
|
|
+ >
|
|
|
<Option
|
|
|
v-for="item in fgcgyList"
|
|
|
:value="item.userId"
|
|
|
:key="item.userId"
|
|
|
- >{{ item.userName }}</Option>
|
|
|
+ >{{ item.userName }}</Option
|
|
|
+ >
|
|
|
</Select>
|
|
|
<!-- <Input v-model="searchForm.applicantName" placeholder="申请人名称" />-->
|
|
|
</Col>
|
|
|
<Col span="4">
|
|
|
- <Button type="primary" style="width: 80px" @click="pageNum = 1;getTableData()">查询</Button>
|
|
|
+ <Button
|
|
|
+ type="primary"
|
|
|
+ style="width: 80px"
|
|
|
+ @click="
|
|
|
+ pageNum = 1;
|
|
|
+ getTableData();
|
|
|
+ "
|
|
|
+ >查询</Button
|
|
|
+ >
|
|
|
<Button type="primary" @click="plAdd">批量添加</Button>
|
|
|
</Col>
|
|
|
</Row>
|
|
@@ -57,7 +96,13 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
</Table>
|
|
|
- <Page align="right" :current="pageNum" :total="pageTotal" @on-change="pageChange" show-total />
|
|
|
+ <Page
|
|
|
+ align="right"
|
|
|
+ :current="pageNum"
|
|
|
+ :total="pageTotal"
|
|
|
+ @on-change="pageChange"
|
|
|
+ show-total
|
|
|
+ />
|
|
|
</Card>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -232,8 +277,10 @@ export default {
|
|
|
getJobList().then((res) => {
|
|
|
if (res.status == 200) {
|
|
|
this.fgcgyList = res.data;
|
|
|
- if (res.data.filter(site => site.userId == localStorage.user_id).length){
|
|
|
- this.searchForm.purchaserId = localStorage.user_id
|
|
|
+ if (
|
|
|
+ res.data.filter((site) => site.userId == localStorage.user_id).length
|
|
|
+ ) {
|
|
|
+ this.searchForm.purchaserId = localStorage.user_id;
|
|
|
}
|
|
|
} else {
|
|
|
this.$Message.error("获取分管采购员列表失败!");
|
|
@@ -259,12 +306,19 @@ export default {
|
|
|
};
|
|
|
queryPurchasePoolList(postData).then((res) => {
|
|
|
if (res.status == 200) {
|
|
|
- if (this.tableSelectAll[this.pageNum] && this.tableSelectAll[this.pageNum].length){
|
|
|
- res.data.records.forEach(item=>{
|
|
|
- if (this.tableSelectAll[this.pageNum].filter(site=>site.id == item.id).length){
|
|
|
- item['_checked'] = true
|
|
|
+ if (
|
|
|
+ this.tableSelectAll[this.pageNum] &&
|
|
|
+ this.tableSelectAll[this.pageNum].length
|
|
|
+ ) {
|
|
|
+ res.data.records.forEach((item) => {
|
|
|
+ if (
|
|
|
+ this.tableSelectAll[this.pageNum].filter(
|
|
|
+ (site) => site.id == item.id
|
|
|
+ ).length
|
|
|
+ ) {
|
|
|
+ item["_checked"] = true;
|
|
|
}
|
|
|
- })
|
|
|
+ });
|
|
|
}
|
|
|
this.tableData = res.data.records;
|
|
|
this.pageTotal = res.data.total;
|
|
@@ -272,12 +326,12 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
pageChange(val) {
|
|
|
- this.getSelectNode()
|
|
|
+ this.getSelectNode();
|
|
|
this.pageNum = val;
|
|
|
this.getTableData();
|
|
|
},
|
|
|
- getSelectNode(){
|
|
|
- this.tableSelectAll[this.pageNum] = this.$refs.orderTable.getSelection()
|
|
|
+ getSelectNode() {
|
|
|
+ this.tableSelectAll[this.pageNum] = this.$refs.orderTable.getSelection();
|
|
|
},
|
|
|
//获取仓库
|
|
|
getCk() {
|
|
@@ -299,10 +353,10 @@ export default {
|
|
|
},
|
|
|
//批量添加物料
|
|
|
plAdd() {
|
|
|
- this.getSelectNode()
|
|
|
-
|
|
|
- for (let key in this.tableSelectAll){
|
|
|
- this.tableSelect = this.tableSelect.concat(this.tableSelectAll[key])
|
|
|
+ this.getSelectNode();
|
|
|
+
|
|
|
+ for (let key in this.tableSelectAll) {
|
|
|
+ this.tableSelect = this.tableSelect.concat(this.tableSelectAll[key]);
|
|
|
}
|
|
|
if (!this.tableSelect.length) {
|
|
|
this.$Message.error("请至少选择一个物料。");
|
|
@@ -362,8 +416,8 @@ export default {
|
|
|
this.$emit("plAdd", arr);
|
|
|
this.$emit("return");
|
|
|
// this.tableSelect = []
|
|
|
- this.$set(this, 'tableSelect', [])
|
|
|
- this.$set(this, 'tableSelectAll', {})
|
|
|
+ this.$set(this, "tableSelect", []);
|
|
|
+ this.$set(this, "tableSelectAll", {});
|
|
|
} else {
|
|
|
this.$Message.error(res.message);
|
|
|
}
|
|
@@ -371,6 +425,12 @@ export default {
|
|
|
// this.$emit("plAdd", arr);
|
|
|
// this.$emit("return");
|
|
|
},
|
|
|
+ goBack() {
|
|
|
+ this.$emit("return");
|
|
|
+ // this.tableSelect = []
|
|
|
+ this.$set(this, "tableSelect", []);
|
|
|
+ this.$set(this, "tableSelectAll", {});
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|