|
@@ -51,29 +51,46 @@
|
|
|
|
|
|
<div style="margin-top: 20px">
|
|
|
<el-button type="primary" size="small" icon="el-icon-plus" @click="openDialog">添加引用</el-button>
|
|
|
+ <el-button type="danger" size="small" icon="el-icon-minus" @click="deleteGoods" :disabled="tableSelection.length < 1">批量删除</el-button>
|
|
|
</div>
|
|
|
<div class="table" style="margin-top: 20px">
|
|
|
- <el-table :data="goodsList" element-loading-text="Loading" border fit highlight-current-row stripe max-height="400">
|
|
|
- <el-table-column align="center" label="序号" type="index" width="50"></el-table-column>
|
|
|
- <el-table-column align="center" label="销售订单号" prop="orderId" min-width="160" show-overflow-tooltip></el-table-column>
|
|
|
- <el-table-column align="center" label="订单日期" prop="aaa" min-width="160" show-overflow-tooltip></el-table-column>
|
|
|
- <el-table-column align="center" label="经销商编码" prop="customerId" min-width="160" show-overflow-tooltip></el-table-column>
|
|
|
+ <el-table :data="goodsList" element-loading-text="Loading" border fit highlight-current-row stripe max-height="400" @selection-change="tableSelectionChange">
|
|
|
+ <el-table-column align="center" type="selection" width="55"></el-table-column>
|
|
|
+ <el-table-column align="center" label="销售订单号" prop="orderId" min-width="180" show-overflow-tooltip></el-table-column>
|
|
|
+ <el-table-column align="center" label="订单日期" prop="orderDate" min-width="120" show-overflow-tooltip>
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{scope.row.orderDate | dateToDayFilter}}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column align="center" label="经销商编码" prop="customerId" min-width="120" show-overflow-tooltip></el-table-column>
|
|
|
<el-table-column align="center" label="经销商名称" prop="customerName" min-width="160" show-overflow-tooltip></el-table-column>
|
|
|
<el-table-column align="center" label="物料代码" prop="materialOldNumber" min-width="160" show-overflow-tooltip></el-table-column>
|
|
|
<el-table-column align="center" label="产品编码" prop="materialNumber" min-width="160" show-overflow-tooltip></el-table-column>
|
|
|
<el-table-column align="center" label="产品名称" prop="materialName" min-width="160" show-overflow-tooltip></el-table-column>
|
|
|
- <el-table-column align="center" label="规格型号" prop="specification" min-width="160" show-overflow-tooltip></el-table-column>
|
|
|
- <el-table-column align="center" label="单位" prop="unit" min-width="160" show-overflow-tooltip></el-table-column>
|
|
|
- <el-table-column align="center" label="预留数量" prop="reservedNum" min-width="160" show-overflow-tooltip></el-table-column>
|
|
|
- <el-table-column align="center" label="订单数量" prop="qty" min-width="160" show-overflow-tooltip></el-table-column>
|
|
|
+ <el-table-column align="center" label="规格型号" prop="specification" min-width="100" show-overflow-tooltip></el-table-column>
|
|
|
+ <el-table-column align="center" label="单位" prop="unit" min-width="100" show-overflow-tooltip></el-table-column>
|
|
|
+ <el-table-column align="center" label="预留数量" prop="reservedNum" min-width="100" show-overflow-tooltip></el-table-column>
|
|
|
+ <el-table-column align="center" label="订单数量" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
|
|
|
<el-table-column align="center" label="备注" prop="reservedRemark" min-width="160" show-overflow-tooltip></el-table-column>
|
|
|
+ <el-table-column align="center" label="状态" prop="status" min-width="100" show-overflow-tooltip>
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{scope.row.status ? '执行中':'已关闭'}}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column align="center" label="操作" width="100" fixed="right">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button type="text" @click="deleteItem(scope.$index)" v-if="!listItem">删除</el-button>
|
|
|
+
|
|
|
+ <el-button type="text" @click="changeItem(scope.$index, 0)" v-if="listItem && scope.row.status === 1">关闭</el-button>
|
|
|
+ <el-button type="text" @click="changeItem(scope.$index, 1)" v-if="listItem && scope.row.status === 0">开启</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
</el-table>
|
|
|
</div>
|
|
|
|
|
|
<div class="page-footer">
|
|
|
<div class="footer" :class="classObj">
|
|
|
<el-button type="primary" @click="clickSubmitForm">保 存</el-button>
|
|
|
- <el-button type="primary" @click="clickSubmitForm">提交审核</el-button>
|
|
|
<el-popconfirm title="确定关闭吗?" @onConfirm="goBack" style="margin-left: 10px;">
|
|
|
<el-button slot="reference">关 闭</el-button>
|
|
|
</el-popconfirm>
|
|
@@ -96,43 +113,43 @@
|
|
|
<el-col :xs="12" :sm="6" :lg="4">
|
|
|
<el-form-item prop="type">
|
|
|
<el-select v-model="screenForm.type" placeholder="产品大类" style="width: 100%">
|
|
|
- <el-option v-for="item in typeList" :key="item.dictCode" :label="item.dictValue" :value="item.dictCode"></el-option>
|
|
|
+ <el-option v-for="item in typeList" :key="item.dictValue" :label="item.dictValue" :value="item.dictValue"></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :xs="12" :sm="6" :lg="4">
|
|
|
- <el-form-item prop="jxsName">
|
|
|
- <el-input v-model="screenForm.jxsName" placeholder="产品编码"></el-input>
|
|
|
+ <el-form-item prop="goodsNum">
|
|
|
+ <el-input v-model="screenForm.goodsNum" placeholder="产品编码"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :xs="12" :sm="6" :lg="4">
|
|
|
- <el-form-item prop="jxsName">
|
|
|
- <el-input v-model="screenForm.jxsName" placeholder="物料代码"></el-input>
|
|
|
+ <el-form-item prop="goodsCode">
|
|
|
+ <el-input v-model="screenForm.goodsCode" placeholder="物料代码"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :xs="12" :sm="6" :lg="4">
|
|
|
- <el-form-item prop="jxsName">
|
|
|
- <el-input v-model="screenForm.jxsName" placeholder="产品名称"></el-input>
|
|
|
+ <el-form-item prop="goodsName">
|
|
|
+ <el-input v-model="screenForm.goodsName" placeholder="产品名称"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :xs="12" :sm="6" :lg="4">
|
|
|
- <el-form-item prop="jxsName">
|
|
|
- <el-input v-model="screenForm.jxsName" placeholder="规格型号"></el-input>
|
|
|
+ <el-form-item prop="model">
|
|
|
+ <el-input v-model="screenForm.model" placeholder="规格型号"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :xs="12" :sm="6" :lg="4">
|
|
|
- <el-form-item prop="type">
|
|
|
- <el-select v-model="screenForm.type" placeholder="订单类型" style="width: 100%">
|
|
|
- <el-option v-for="item in typeList" :key="item.dictCode" :label="item.dictValue" :value="item.dictCode"></el-option>
|
|
|
+ <el-form-item prop="orderType">
|
|
|
+ <el-select v-model="screenForm.orderType" placeholder="订单类型" style="width: 100%">
|
|
|
+ <el-option v-for="item in orderTypeList" :key="item.value" :label="item.label" :value="item.value"></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :xs="12" :sm="6" :lg="4">
|
|
|
- <el-form-item prop="orderNum">
|
|
|
- <el-input v-model="screenForm.orderNum" placeholder="销售订单号"></el-input>
|
|
|
+ <el-form-item prop="saleNum">
|
|
|
+ <el-input v-model="screenForm.saleNum" placeholder="销售订单号"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :xs="12" :sm="6" :lg="4" class="tr">
|
|
|
+ <el-col :xs="12" :sm="18" :lg="12" class="tr">
|
|
|
<el-form-item label="">
|
|
|
<el-button size="small" @click="resetScreenForm">清空</el-button>
|
|
|
<el-button size="small" type="primary" @click="submitScreenForm">搜索</el-button>
|
|
@@ -142,16 +159,24 @@
|
|
|
</el-form>
|
|
|
|
|
|
<div class="table">
|
|
|
- <el-table :data="tableGoodsList" element-loading-text="Loading" border fit highlight-current-row stripe height="400" @selection-change="tableSelectionChange">
|
|
|
+ <el-table :data="dialogGoodsList" element-loading-text="Loading" border fit highlight-current-row stripe height="400" @selection-change="dialogSelectionChange">
|
|
|
<el-table-column align="center" type="selection" width="55" :selectable='checkboxSelect'></el-table-column>
|
|
|
- <el-table-column align="center" label="经销商编码" prop="orderId" min-width="160" show-overflow-tooltip></el-table-column>
|
|
|
- <el-table-column align="center" label="经销商名称" prop="orderId" min-width="160" show-overflow-tooltip></el-table-column>
|
|
|
- <el-table-column align="center" label="订单日期" prop="orderId" min-width="160" show-overflow-tooltip></el-table-column>
|
|
|
- <el-table-column align="center" label="订单类型" prop="orderId" min-width="100" show-overflow-tooltip></el-table-column>
|
|
|
- <el-table-column align="center" label="订单号" prop="orderId" min-width="160" show-overflow-tooltip></el-table-column>
|
|
|
+ <el-table-column align="center" label="经销商编码" prop="customerId" min-width="120" show-overflow-tooltip></el-table-column>
|
|
|
+ <el-table-column align="center" label="经销商名称" prop="customerName" min-width="160" show-overflow-tooltip></el-table-column>
|
|
|
+ <el-table-column align="center" label="订单日期" prop="orderDate" min-width="120" show-overflow-tooltip>
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{scope.row.orderDate | dateToDayFilter}}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column align="center" label="订单类型" prop="orderType" min-width="100" show-overflow-tooltip>
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{scope.row.orderType | orderTypeFilter}}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column align="center" label="订单号" prop="orderId" min-width="180" show-overflow-tooltip></el-table-column>
|
|
|
<el-table-column align="center" label="销售类型" prop="saleTypeName" min-width="100" show-overflow-tooltip></el-table-column>
|
|
|
- <el-table-column align="center" label="产品编码" prop="materialName" min-width="160" show-overflow-tooltip></el-table-column>
|
|
|
- <el-table-column align="center" label="物料代码" prop="materialName" min-width="160" show-overflow-tooltip></el-table-column>
|
|
|
+ <el-table-column align="center" label="产品编码" prop="materialCode" min-width="160" show-overflow-tooltip></el-table-column>
|
|
|
+ <el-table-column align="center" label="物料代码" prop="materialOldNumber" min-width="160" show-overflow-tooltip></el-table-column>
|
|
|
<el-table-column align="center" label="产品名称" prop="materialName" min-width="160" show-overflow-tooltip></el-table-column>
|
|
|
<el-table-column align="center" label="规格型号" prop="specification" min-width="160" show-overflow-tooltip></el-table-column>
|
|
|
<el-table-column align="center" label="单位" prop="unit" min-width="100" show-overflow-tooltip></el-table-column>
|
|
@@ -181,12 +206,20 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { getDetail, getGoodsList } from "@/api/supply/reserve";
|
|
|
+import { getDetail, getGoodsList, addData, editData } from "@/api/supply/reserve";
|
|
|
+import { getDictList } from '@/api/common'
|
|
|
|
|
|
+let that
|
|
|
export default {
|
|
|
name: 'ReserveForm',
|
|
|
componentName: 'ReserveForm',
|
|
|
props: ['listItem'],
|
|
|
+ filters: {
|
|
|
+ orderTypeFilter(val) {
|
|
|
+ let obj = that.orderTypeList.find(o => o.value == val);
|
|
|
+ return obj ? obj.label : ''
|
|
|
+ }
|
|
|
+ },
|
|
|
data() {
|
|
|
return {
|
|
|
mainForm: {
|
|
@@ -197,19 +230,36 @@ export default {
|
|
|
remark: '',
|
|
|
},
|
|
|
goodsList: [],
|
|
|
+ tableSelection: [],
|
|
|
|
|
|
+ typeList: [],
|
|
|
+ orderTypeList: [
|
|
|
+ { label: '商用单', value: 'TRADE' },
|
|
|
+ { label: '家用单', value: 'HOME' },
|
|
|
+ { label: '零售单', value: 'RETAIL' },
|
|
|
+ { label: '销售政策单', value: 'RETAIL_POLICY' },
|
|
|
+ { label: '置换家用单', value: 'PERMU_HOME' },
|
|
|
+ { label: '置换商用单', value: 'PERMU_TRADE' },
|
|
|
+ { label: '置换零售单', value: 'PERMU_RETAIL' },
|
|
|
+ { label: '置换销售政策单', value: 'PERMU_RETAIL_POLICY' },
|
|
|
+ ],
|
|
|
isShowDialog: false,
|
|
|
screenForm: {
|
|
|
- warehouse: '',
|
|
|
+ jxsNum: '',
|
|
|
+ jxsName: '',
|
|
|
type: '',
|
|
|
- orderNum: '',
|
|
|
+ goodsNum: '',
|
|
|
+ goodsCode: '',
|
|
|
+ goodsName: '',
|
|
|
+ model: '',
|
|
|
+ orderType: '',
|
|
|
+ saleNum: '',
|
|
|
},
|
|
|
currentPage: 1,
|
|
|
listTotal: 0,
|
|
|
- typeList: [],
|
|
|
|
|
|
- tableGoodsList: [],
|
|
|
- tableSelection: [],
|
|
|
+ dialogGoodsList: [],
|
|
|
+ dialogSelection: [],
|
|
|
}
|
|
|
},
|
|
|
|
|
@@ -225,6 +275,10 @@ export default {
|
|
|
},
|
|
|
},
|
|
|
|
|
|
+ beforeCreate() {
|
|
|
+ that = this;
|
|
|
+ },
|
|
|
+
|
|
|
created() {
|
|
|
if(this.listItem) {
|
|
|
this.getDetail();
|
|
@@ -251,6 +305,12 @@ export default {
|
|
|
return currentdate;
|
|
|
},
|
|
|
|
|
|
+ getDictList() {
|
|
|
+ getDictList({sysDictEnum: 'PRODUCT_TYPE'}).then(res => {
|
|
|
+ this.typeList = res.data;
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
// 返回列表
|
|
|
goBack() {
|
|
|
this.$emit('backListFormDetail');
|
|
@@ -274,25 +334,32 @@ export default {
|
|
|
getGoodsList({
|
|
|
pageNum: this.currentPage,
|
|
|
pageSize: 10,
|
|
|
- stockId: this.screenForm.warehouse,
|
|
|
- mainId: this.screenForm.type,
|
|
|
- id: this.screenForm.orderNum,
|
|
|
- examineStatus: 'OK',
|
|
|
- type: 1,
|
|
|
+ customerNumber: this.screenForm.jxsNum,
|
|
|
+ customerName: this.screenForm.jxsName,
|
|
|
+ mainName: this.screenForm.type,
|
|
|
+ materialCode: this.screenForm.goodsNum,
|
|
|
+ materialOldNumber: this.screenForm.goodsCode,
|
|
|
+ materialName: this.screenForm.goodsName,
|
|
|
+ specification: this.screenForm.model,
|
|
|
+ orderType: this.screenForm.orderType,
|
|
|
+ orderId: this.screenForm.saleNum,
|
|
|
}).then(res => {
|
|
|
+ res.data.records.forEach(item => {
|
|
|
+ item.status = 1;
|
|
|
+ });
|
|
|
let oldGoodsList = this.goodsList;
|
|
|
let newGoodsList = res.data.records;
|
|
|
for(let i = 0; i < oldGoodsList.length; i++) {
|
|
|
let oldItem = oldGoodsList[i]
|
|
|
for(let j = 0; j < newGoodsList.length; j++) {
|
|
|
let newItem = newGoodsList[j]
|
|
|
- if(newItem.materialId === oldItem.materialId){
|
|
|
+ if(newItem.orderId === oldItem.orderId){
|
|
|
newGoodsList[j].selected = true;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- this.tableGoodsList = newGoodsList;
|
|
|
+ this.dialogGoodsList = newGoodsList;
|
|
|
this.listTotal = res.data.total;
|
|
|
})
|
|
|
},
|
|
@@ -309,14 +376,12 @@ export default {
|
|
|
// 点击 选择商品
|
|
|
openDialog() {
|
|
|
this.isShowDialog = true;
|
|
|
+ this.getDictList();
|
|
|
this.getGoodsList();
|
|
|
},
|
|
|
|
|
|
// 提交筛选表单
|
|
|
submitScreenForm() {
|
|
|
- if(!this.screenForm.warehouse || !this.screenForm.type) {
|
|
|
- return this.$errorMsg('请选择仓库和产品大类');
|
|
|
- }
|
|
|
this.currentPage = 1;
|
|
|
this.getGoodsList();
|
|
|
},
|
|
@@ -325,13 +390,13 @@ export default {
|
|
|
resetScreenForm() {
|
|
|
this.$refs.screenForm.resetFields();
|
|
|
this.currentPage = 1;
|
|
|
- this.tableGoodsList = [];
|
|
|
- // this.getGoodsList();
|
|
|
+ this.dialogGoodsList = [];
|
|
|
+ this.getGoodsList();
|
|
|
},
|
|
|
|
|
|
// 更改列表当前页
|
|
|
handleTableCurrentChange(val) {
|
|
|
- if(this.tableSelection.length > 0) {
|
|
|
+ if(this.dialogSelection.length > 0) {
|
|
|
return this.$errorMsg('已选择产品不可切换');
|
|
|
}
|
|
|
this.currentPage = val;
|
|
@@ -344,59 +409,69 @@ export default {
|
|
|
},
|
|
|
|
|
|
// 列表选择
|
|
|
- tableSelectionChange(val) {
|
|
|
- this.tableSelection = val;
|
|
|
- },
|
|
|
-
|
|
|
- // 数组去重
|
|
|
- delRepeat(arr1, arr2) {
|
|
|
- let allArr = arr1.concat(arr2); // 两个数组对象合并
|
|
|
- let newArr = []; // 存放去重后数据的新数组
|
|
|
- for(let i=0; i<allArr.length; i++){ // 循环allArr数组对象的内容
|
|
|
- let flag = true; // 建立标记,判断数据是否重复,true为不重复
|
|
|
- for(let j=0; j<newArr.length; j++){ // 循环新数组的内容
|
|
|
- if(allArr[i].materialId == newArr[j].materialId){ // 让allArr数组对象的内容与新数组的内容作比较,相同的话,改变标记为false
|
|
|
- flag = false;
|
|
|
- }
|
|
|
- }
|
|
|
- if(flag){ // 判断是否重复
|
|
|
- newArr.push(allArr[i]); // 不重复的放入新数组。 新数组的内容会继续进行上边的循环。
|
|
|
- }
|
|
|
- }
|
|
|
- return newArr;
|
|
|
+ dialogSelectionChange(val) {
|
|
|
+ this.dialogSelection = val;
|
|
|
},
|
|
|
|
|
|
// 确定 添加产品
|
|
|
submitAddGoods() {
|
|
|
- let allList = this.tableGoodsList;
|
|
|
- let selectList = this.tableSelection;
|
|
|
- let submitList = [];
|
|
|
-
|
|
|
- for(let i = 0; i < allList.length; i++) {
|
|
|
- for(let j = 0; j < selectList.length; j++) {
|
|
|
- if(selectList[j].orderId == allList[i].orderId){
|
|
|
- submitList.push(allList[i]);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- // this.goodsList = this.goodsList.concat(submitList);
|
|
|
-
|
|
|
- this.goodsList = this.delRepeat(submitList, this.goodsList);
|
|
|
+ this.goodsList = this.goodsList.concat(this.dialogSelection);
|
|
|
this.isShowDialog = false;
|
|
|
- this.tableGoodsList = [];
|
|
|
+ this.dialogGoodsList = [];
|
|
|
},
|
|
|
|
|
|
// 删除产品
|
|
|
deleteItem(index) {
|
|
|
this.goodsList.splice(index, 1);
|
|
|
- // this.goodsList = this.goodsList.filter((item) => {
|
|
|
- // return item.orderId != id
|
|
|
- // })
|
|
|
},
|
|
|
|
|
|
+ // 修改状态
|
|
|
+ changeItem(index, status) {
|
|
|
+ this.goodsList[index].status = status;
|
|
|
+ },
|
|
|
|
|
|
- clickSubmitForm() {
|
|
|
+ tableSelectionChange(val) {
|
|
|
+ this.tableSelection = val;
|
|
|
+ },
|
|
|
+
|
|
|
+ // 批量删除
|
|
|
+ deleteGoods() {
|
|
|
+ let goodsList = this.goodsList;
|
|
|
+ let tableSelection = this.tableSelection;
|
|
|
+ for(let i = 0; i < goodsList.length; i++) {
|
|
|
+ for(let j = 0; j < tableSelection.length; j++) {
|
|
|
+ if(tableSelection[j].orderId == goodsList[i].orderId){
|
|
|
+ this.goodsList.splice(i, 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
|
|
|
+ // 提交
|
|
|
+ clickSubmitForm() {
|
|
|
+ this.$refs.mainForm.validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ let params = {
|
|
|
+ orderTime: this.mainForm.orderDate + ' 00:00:00',
|
|
|
+ remark: this.mainForm.remark,
|
|
|
+ reservedOrderItems: this.goodsList,
|
|
|
+ }
|
|
|
+ if(this.listItem) {
|
|
|
+ params.id = this.listItem.id;
|
|
|
+ editData(params).then(res => {
|
|
|
+ this.$successMsg('编辑成功');
|
|
|
+ this.goBack();
|
|
|
+ this.$parent.getList();
|
|
|
+ })
|
|
|
+ }else {
|
|
|
+ addData(params).then(res => {
|
|
|
+ this.$successMsg('添加成功');
|
|
|
+ this.goBack();
|
|
|
+ this.$parent.getList();
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
}
|
|
|
}
|