[需求变更] 普通项目、工作组成员维护新增/编辑页面合同编号输入框变成下拉选择

This commit is contained in:
zhaoxiao
2021-10-27 14:42:40 +08:00
parent 8f5d9914d2
commit 4fc06160f2
5 changed files with 80 additions and 45 deletions
+34 -33
View File
@@ -28,7 +28,7 @@
<script>
import ContactManagementModule from '@views/businessManagement/modules/ContactManagementModule'
import { getContactsByCompany,getContactsByCompanyNoLimit } from '@api/api'
import { getContactsByCompany, getContactsByCompanyNoLimit } from '@api/api'
export default {
name: 'SelectContacts',
@@ -68,10 +68,10 @@ export default {
default: 'string'
},
// 是否调用无权限接口
isLimit:{
type:Boolean,
required:false,
default:false
isLimit: {
type: Boolean,
required: false,
default: false
}
},
data() {
@@ -119,35 +119,36 @@ export default {
* 获取联系人数据
*/
getContactsList() {
let params = {}
if (this.selectedCompany && this.selectedCompany.id) {
const params = {
companyId: this.selectedCompany.id
}
// 是否调用无权限接口
if(this.isLimit){
// 调用无权限接口
return new Promise(resolve => {
getContactsByCompanyNoLimit(params).then(res => {
this.contactsList = res.result
if (this.initContacts && this.initContacts.id) {
this.contactsList.push(this.initContacts)
}
resolve()
})
})
}else{
return new Promise(resolve => {
getContactsByCompany(params).then(res => {
this.contactsList = res.result
console.log(this.initContacts)
if (this.initContacts && this.initContacts.id) {
this.contactsList.push(this.initContacts)
}
resolve()
})
})
}
params.companyId = this.selectedCompany.id
} else {
params.companyId = null
}
// 是否调用无权限接口
if (this.isLimit) {
// 调用无权限接口
return new Promise(resolve => {
getContactsByCompanyNoLimit(params).then(res => {
this.contactsList = res.result
if (this.initContacts && this.initContacts.id) {
this.contactsList.push(this.initContacts)
}
resolve()
})
})
} else {
return new Promise(resolve => {
getContactsByCompany(params).then(res => {
this.contactsList = res.result || []
if (this.initContacts && this.initContacts.id) {
this.contactsList.push(this.initContacts)
}
resolve()
})
})
}
},
/**
* 新建联系人
@@ -179,7 +180,7 @@ export default {
// 下拉框的搜索
filterOption(input, option) {
return (
option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
)
},
/**
+32 -5
View File
@@ -7,8 +7,8 @@
allowClear
option-filter-prop="children"
:filter-option="filterOption">
<a-select-option v-for="item in contractList" :key="item.id" :value="item.contractNum">
{{ item.contractNum }}
<a-select-option v-for="item in contractList" :key="item" :value="item">
{{ item }}
</a-select-option>
</a-select>
</template>
@@ -24,6 +24,14 @@ export default {
type: String,
required: false,
default: undefined
},
// 选中的企业,用于获取合同列表
company: {
type: Object,
required: false,
default: () => {
return {}
}
}
},
data() {
@@ -32,16 +40,35 @@ export default {
contractList: []
}
},
watch: {
// 监听企业变化获取合同信息
company: {
handler() {
if (!this.company.id) {
this.$message.warn(`请先选择企业`)
return
}
this.initRevenueContractList()
},
deep: true
}
},
created() {
this.initRevenueContractList()
},
methods: {
/**
* 通过企业id获取合同号
*/
initRevenueContractList() {
getAllRevenueContract().then(res => {
const param = {
companyId: this.company.id
}
getAllRevenueContract(param).then(res => {
if (res.success) {
this.contractList = res.result.records
this.contractList = res.result
} else {
this.$message.warn(res.message)
console.log(res.message)
}
})
},