|
@@ -10,30 +10,31 @@
|
|
|
<el-row :gutter="20">
|
|
|
<el-col :xs="24" :sm="12" :lg="6">
|
|
|
<el-form-item label="单据编号" prop="orderNum">
|
|
|
- <el-input v-model="mainForm.orderNum" placeholder="系统自动生成" readonly></el-input>
|
|
|
+ <el-input v-model="mainForm.orderNum" placeholder="系统自动生成" disabled></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :xs="24" :sm="12" :lg="6" style="height: 51px;">
|
|
|
<el-form-item label="单据日期" prop="orderDate">
|
|
|
<el-date-picker
|
|
|
v-model="mainForm.orderDate"
|
|
|
+ disabled
|
|
|
type="date"
|
|
|
value-format="yyyy-MM-dd"
|
|
|
style="width: 100%;"
|
|
|
- placeholder="选择日期">
|
|
|
+ placeholder="系统自动生成">
|
|
|
</el-date-picker>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :xs="24" :sm="12" :lg="6">
|
|
|
<el-form-item label="制单人" prop="createMan">
|
|
|
- <el-input v-model="mainForm.createMan" placeholder="请输入制单人" readonly></el-input>
|
|
|
+ <el-input v-model="mainForm.createMan" placeholder="请输入制单人" disabled></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :xs="24" :sm="12" :lg="6" style="height: 51px;">
|
|
|
<el-form-item label="制单日期" prop="createDate">
|
|
|
<el-date-picker
|
|
|
v-model="mainForm.createDate"
|
|
|
- readonly
|
|
|
+ disabled
|
|
|
type="datetime"
|
|
|
value-format="yyyy-MM-dd HH:mm:ss"
|
|
|
style="width: 100%;"
|
|
@@ -50,8 +51,8 @@
|
|
|
</el-form>
|
|
|
|
|
|
<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>
|
|
|
+ <el-button type="primary" size="small" icon="el-icon-plus" @click="openDialog" v-if="!listItem">添加引用</el-button>
|
|
|
+ <el-button type="danger" size="small" icon="el-icon-minus" @click="deleteGoods" :disabled="tableSelection.length < 1" v-if="!listItem">批量删除</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" @selection-change="tableSelectionChange">
|
|
@@ -62,10 +63,56 @@
|
|
|
{{scope.row.orderTime | 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="customerId" min-width="120" show-overflow-tooltip>
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <div v-if="scope.row.orderId || listItem">{{scope.row.customerId}}</div>
|
|
|
+ <el-select
|
|
|
+ v-else
|
|
|
+ v-model="scope.row.customerId"
|
|
|
+ placeholder="选择经销商"
|
|
|
+ size="small"
|
|
|
+ filterable
|
|
|
+ remote
|
|
|
+ clearable
|
|
|
+ :remote-method="checkDealerList"
|
|
|
+ @change="changeDealer(scope.$index)">
|
|
|
+ <el-option
|
|
|
+ v-for="item in dealerList"
|
|
|
+ :key="item.id"
|
|
|
+ :label="item.id"
|
|
|
+ :value="item.id">
|
|
|
+ <span>{{ item.id }}</span>
|
|
|
+ <span style="color: #8492a6; font-size: 13px; margin-left: 6px">{{ item.name }}</span>
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </template>
|
|
|
+ </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="materialCode" min-width="160" show-overflow-tooltip>
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <div v-if="scope.row.orderId || listItem">{{scope.row.materialCode}}</div>
|
|
|
+ <el-select
|
|
|
+ v-else
|
|
|
+ v-model="scope.row.materialCode"
|
|
|
+ placeholder="选择产品"
|
|
|
+ size="small"
|
|
|
+ filterable
|
|
|
+ remote
|
|
|
+ clearable
|
|
|
+ :remote-method="checkMaterialList"
|
|
|
+ @change="changeMaterial(scope.$index)">
|
|
|
+ <el-option
|
|
|
+ v-for="item in materialList"
|
|
|
+ :key="item.number"
|
|
|
+ :label="item.number"
|
|
|
+ :value="item.number">
|
|
|
+ <span>{{ item.number }}</span>
|
|
|
+ <span style="color: #8492a6; font-size: 13px; margin-left: 6px">{{ item.name }}</span>
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </template>
|
|
|
+ </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="materialCode" 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>
|
|
@@ -90,10 +137,11 @@
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
+ <div class="add" v-if="!listItem"><el-button type="text" icon="el-icon-plus" @click="addGoods">添加行</el-button></div>
|
|
|
</div>
|
|
|
|
|
|
<div class="page-footer">
|
|
|
- <div class="footer" :class="classObj">
|
|
|
+ <div class="footer">
|
|
|
<el-button type="primary" @click="clickSubmitForm">保 存</el-button>
|
|
|
<el-popconfirm title="确定关闭吗?" @onConfirm="goBack" style="margin-left: 10px;">
|
|
|
<el-button slot="reference">关 闭</el-button>
|
|
@@ -210,7 +258,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { getDetail, getGoodsList, addData, editData } from "@/api/supply/reserve";
|
|
|
+import { getDetail, getGoodsList, addData, editData, checkDealerList, checkMaterialList } from "@/api/supply/reserve";
|
|
|
import { getDictList } from '@/api/common'
|
|
|
|
|
|
let that
|
|
@@ -264,19 +312,10 @@ export default {
|
|
|
|
|
|
dialogGoodsList: [],
|
|
|
dialogSelection: [],
|
|
|
- }
|
|
|
- },
|
|
|
|
|
|
- computed: {
|
|
|
- sidebar() {
|
|
|
- return this.$store.state.app.sidebar
|
|
|
- },
|
|
|
- classObj() {
|
|
|
- return {
|
|
|
- hideSidebar: !this.sidebar.opened,
|
|
|
- openSidebar: this.sidebar.opened
|
|
|
- }
|
|
|
- },
|
|
|
+ dealerList: [],
|
|
|
+ materialList: [],
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
beforeCreate() {
|
|
@@ -350,6 +389,7 @@ export default {
|
|
|
}).then(res => {
|
|
|
res.data.records.forEach(item => {
|
|
|
item.status = 1;
|
|
|
+ item.reservedStatus = 1;
|
|
|
});
|
|
|
let oldGoodsList = this.goodsList;
|
|
|
let newGoodsList = res.data.records;
|
|
@@ -452,12 +492,68 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
|
|
|
+ // 添加产品
|
|
|
+ addGoods() {
|
|
|
+ this.goodsList.push({
|
|
|
+ reservedStatus: 2,
|
|
|
+ status: 1
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ // 查询经销商列表
|
|
|
+ checkDealerList(query) {
|
|
|
+ checkDealerList({
|
|
|
+ number: query,
|
|
|
+ }).then(res => {
|
|
|
+ this.dealerList = res.data || [];
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ // 更改经销商
|
|
|
+ changeDealer(index) {
|
|
|
+ if(this.goodsList[index].customerId) {
|
|
|
+ let obj = this.dealerList.find(o => o.id == this.goodsList[index].customerId);
|
|
|
+ this.goodsList[index].customerName = obj.name;
|
|
|
+ this.goodsList[index].customerNumber = obj.number;
|
|
|
+ }else {
|
|
|
+ this.goodsList[index].customerName = '';
|
|
|
+ this.goodsList[index].customerNumber = '';
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ // 查询产品
|
|
|
+ checkMaterialList(query) {
|
|
|
+ checkMaterialList({
|
|
|
+ number: query,
|
|
|
+ }).then(res => {
|
|
|
+ this.materialList = res.data || [];
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ // 更改产品
|
|
|
+ changeMaterial(index) {
|
|
|
+ if(this.goodsList[index].materialCode) {
|
|
|
+ let obj = this.materialList.find(o => o.number == this.goodsList[index].materialCode);
|
|
|
+ this.goodsList[index].materialName = obj.name;
|
|
|
+ this.goodsList[index].materialId = obj.id;
|
|
|
+ this.goodsList[index].materialOldNumber = obj.oldNumber;
|
|
|
+ this.goodsList[index].specification = obj.specification;
|
|
|
+ this.goodsList[index].unit = obj.baseUnitId;
|
|
|
+ }else {
|
|
|
+ this.goodsList[index].materialName = '';
|
|
|
+ this.goodsList[index].materialId = '';
|
|
|
+ this.goodsList[index].materialOldNumber = '';
|
|
|
+ this.goodsList[index].specification = '';
|
|
|
+ this.goodsList[index].unit = '';
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
// 提交
|
|
|
clickSubmitForm() {
|
|
|
this.$refs.mainForm.validate((valid) => {
|
|
|
if (valid) {
|
|
|
let params = {
|
|
|
- orderTime: this.mainForm.orderDate + ' 00:00:00',
|
|
|
+ // orderTime: this.mainForm.orderDate + ' 00:00:00',
|
|
|
remark: this.mainForm.remark,
|
|
|
reservedOrderItems: this.goodsList,
|
|
|
}
|
|
@@ -501,4 +597,12 @@ export default {
|
|
|
padding-left: 10px;
|
|
|
}
|
|
|
}
|
|
|
+ .add {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ border: 1px solid #EBEEF5;
|
|
|
+ border-top: none;
|
|
|
+ height: 50px;
|
|
|
+ }
|
|
|
</style>
|