|
@@ -126,7 +126,21 @@
|
|
|
</vxe-table-column>
|
|
|
<vxe-table-column align="center" field="tradeName" title="商品名称" :edit-render="{}" :rules="[]">
|
|
|
<template v-slot:edit="scope">
|
|
|
- <el-input @change="ifSameValue" v-model="scope.row.tradeName"></el-input>
|
|
|
+<!-- <el-input @change="ifSameValue" v-model="scope.row.tradeName"></el-input>-->
|
|
|
+ <vxe-pulldown ref="xDown1" transfer>
|
|
|
+ <template #default>
|
|
|
+ <vxe-input v-model="scope.row.tradeName" placeholder="请输入商品名称" maxlength="64"
|
|
|
+ @focus="focusEvent1(scope.row)"
|
|
|
+ @input="keyupEvent1(scope.row)"></vxe-input>
|
|
|
+ </template>
|
|
|
+ <template #dropdown>
|
|
|
+ <div class="my-dropdown1">
|
|
|
+ <div class="list-item1" v-for="item in scope.row.tradeNameData" :key="item.id" @click="selectEvent1(scope.row, item)">
|
|
|
+ <span>{{ item.tradeName }}</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </vxe-pulldown>
|
|
|
</template>
|
|
|
</vxe-table-column>
|
|
|
<vxe-table-column align="center" field="supplierName" title="供应商" :edit-render="{}" :rules="[{required: true, message:'请选择供应商', trigger:'blur'}]">
|
|
@@ -276,6 +290,7 @@
|
|
|
import MaterialTypePullForm from '../info/MaterialTypePullForm'
|
|
|
import UserPullForm from '@/views/modules/finance/invoice/UserPullForm'
|
|
|
import SupplierService from '@/api/materialManagement/SupplierService'
|
|
|
+ import WareHouseService from '@/api/materialManagement/WareHouseService'
|
|
|
export default {
|
|
|
data () {
|
|
|
return {
|
|
@@ -288,6 +303,9 @@
|
|
|
],
|
|
|
procurementType: [
|
|
|
{required: true, message: '采购类型不能为空'}
|
|
|
+ ],
|
|
|
+ tradeName: [
|
|
|
+ {required: true, message: '商品名称不能为空'}
|
|
|
]
|
|
|
},
|
|
|
title: '',
|
|
@@ -333,11 +351,13 @@
|
|
|
userService: null,
|
|
|
commonApi: null,
|
|
|
supplierService: null,
|
|
|
+ wareHouseService: null,
|
|
|
created () {
|
|
|
this.materialManagementService = new MaterialManagementService()
|
|
|
this.userService = new UserService()
|
|
|
this.commonApi = new CommonApi()
|
|
|
this.supplierService = new SupplierService()
|
|
|
+ this.wareHouseService = new WareHouseService()
|
|
|
},
|
|
|
props: {
|
|
|
businessId: {
|
|
@@ -651,6 +671,24 @@
|
|
|
this.loading = false
|
|
|
return
|
|
|
}
|
|
|
+ if (this.commonJS.isEmpty(this.inputForm.detailInfos[j].tradeName)) {
|
|
|
+ this.$message.error('采购详情第' + k + '行请填写商品名称')
|
|
|
+ this.loading = false
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (let j = 0; j < i; j++) {
|
|
|
+ for (let k = j + 1; k < i; k++) {
|
|
|
+ if (this.inputForm.detailInfos[j].procurementType === this.inputForm.detailInfos[k].procurementType) { // 如果采购类型相同
|
|
|
+ if (this.inputForm.detailInfos[j].tradeName === this.inputForm.detailInfos[k].tradeName) { // 如果商品名称相同
|
|
|
+ if (this.inputForm.detailInfos[j].supplierName === this.inputForm.detailInfos[k].supplierName) {
|
|
|
+ this.$message.warning(`采购详情中,同种采购类型、同一供应商的商品名称只能输入一条`)
|
|
|
+ this.loading = false
|
|
|
+ throw new Error('采购详情中,同种采购类型、同一供应商的商品名称只能输入一条')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
this.inputForm.files = this.$refs.uploadComponent.getDataList()
|
|
@@ -861,19 +899,6 @@
|
|
|
getProgramForType (rows) {
|
|
|
this.inputForm.detailInfos[this.indexRow].procurementTypeId = rows.id
|
|
|
this.inputForm.detailInfos[this.indexRow].procurementType = rows.name
|
|
|
- let i = this.inputForm.detailInfos.length
|
|
|
- for (let j = 0; j < i; j++) {
|
|
|
- for (let k = j + 1; k < i; k++) {
|
|
|
- if (this.inputForm.detailInfos[j].procurementTypeId === this.inputForm.detailInfos[k].procurementTypeId) {
|
|
|
- if (this.commonJS.isNotEmpty(this.inputForm.detailInfos[j].tradeName) &&
|
|
|
- this.commonJS.isNotEmpty(this.inputForm.detailInfos[k].tradeName) && this.inputForm.detailInfos[j].tradeName === this.inputForm.detailInfos[k].tradeName) {
|
|
|
- // parseFloat(item.account).toFixed(2)
|
|
|
- this.inputForm.detailInfos.splice(k, 1)
|
|
|
- this.$message.warning(`同种采购类型的商品名称只能输入一条信息!`)
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
this.indexRow = ''
|
|
|
this.$forceUpdate()
|
|
|
},
|
|
@@ -958,13 +983,52 @@
|
|
|
this.tablePage4.total = data.total
|
|
|
this.loading4 = false
|
|
|
})
|
|
|
+ },
|
|
|
+ focusEvent1 (row) {
|
|
|
+ row.tradeNameList = []
|
|
|
+ row.tradeNameData = []
|
|
|
+ if (this.commonJS.isNotEmpty(row.procurementTypeId)) {
|
|
|
+ this.materialManagementService.findTradeByTypeId(row.procurementTypeId).then(({data}) => {
|
|
|
+ row.tradeNameList = JSON.parse(JSON.stringify(data))
|
|
|
+ row.tradeNameData = JSON.parse(JSON.stringify(data))
|
|
|
+ this.$refs.xDown1.showPanel()
|
|
|
+ }).catch(() => {
|
|
|
+ this.$refs.xDown1.showPanel()
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.$refs.xDown1.showPanel()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ keyupEvent1 (row) {
|
|
|
+ row.tradeNameData = this.commonJS.isNotEmpty(row.tradeName) ? row.tradeNameList.filter(item => item.tradeName.indexOf(row.tradeName) > -1) : row.tradeNameList
|
|
|
+ },
|
|
|
+ selectEvent1 (row, item) {
|
|
|
+ row.tradeName = item.tradeName
|
|
|
+ this.$refs.xDown1.hidePanel()
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
-<style>
|
|
|
+<style scoped>
|
|
|
.el-divider__text {
|
|
|
font-size: 16px;
|
|
|
font-weight: bold;
|
|
|
}
|
|
|
+
|
|
|
+ /*.my-dropdown1、.list-item1、.list-item1:hover 为商品名称下拉选择框样式*/
|
|
|
+ .my-dropdown1 {
|
|
|
+ height: 155px;
|
|
|
+ overflow: auto;
|
|
|
+ border-radius: 4px;
|
|
|
+ border: 1px solid #dcdfe6;
|
|
|
+ background-color: #fff;
|
|
|
+ }
|
|
|
+ .list-item1 {
|
|
|
+ line-height: 30px;
|
|
|
+ text-align: center;
|
|
|
+ border-bottom: #c4c7cc73 1px solid;
|
|
|
+ }
|
|
|
+ .list-item1:hover {
|
|
|
+ background-color: #f5f7fa;
|
|
|
+ }
|
|
|
</style>
|