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

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
+2 -2
View File
@@ -82,8 +82,8 @@ const getIsAssociatedProject = (param) => getAction('/contract/payIncomeContract
const aduitExpenditureContract = (param) => postAction('/contract/paySpendingContract/audit', param)
// 支出合同存档
const archiveExpenditureContract = (param) => postAction('/contract/paySpendingContract/archive', param)
// 获取全部收入合同
const getAllRevenueContract = (param) => getAction('', param)
// 获取全部收入合同(通过企业id查询列表)
const getAllRevenueContract = (param) => getAction('/contract/payIncomeContract/queryByCompanyId', param)
export {
getWorkingGroupById,
+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)
}
})
},
@@ -127,6 +127,7 @@
<!-- @change="e => {e.target.value = (e.target.value + '').trim()}"></a-input>-->
<select-revenue-contract
placeholder="请选择合同号"
:company="selectedCompany"
v-decorator="['contractNum',validatorRules.contractNum]"
:disabled="isContractNumDisabled || isAssociatedContract">
</select-revenue-contract>
@@ -472,8 +473,9 @@ export default {
this.selectedCompany = value
this.model.contactsId = undefined
this.model.mailContactsId = undefined
this.model.contractNum = undefined
this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model, 'contactsId', 'mailContactsId'))
this.form.setFieldsValue(pick(this.model, 'contactsId', 'mailContactsId', 'contractNum'))
})
},
/**
@@ -88,8 +88,10 @@
<a-col :xl="12" :sm="24">
<a-form-item label="来款方式" :labelCol="labelCol" :wrapperCol="wrapperCol">
<span v-if="defaultChargeWay === 2">合同</span>
<a-radio-group v-decorator="['chargeWay',validatorRules.chargeWay]" @change="handlechargeWayChange"
v-else :disabled="isAssociatedContract">
<a-radio-group v-decorator="['chargeWay',validatorRules.chargeWay]"
@change="handlechargeWayChange"
v-else
:disabled="isAssociatedContract">
<a-radio :value="1"></a-radio>
<a-radio :value="2">合同</a-radio>
<a-radio :value="3">收费通知</a-radio>
@@ -145,8 +147,9 @@
<!-- @change="e => {e.target.value = (e.target.value + '').trim()}"></a-input>-->
<select-revenue-contract
placeholder="请选择合同号"
v-decorator="['contractNum',validatorRules.contractNum]">
:company="selectedCompany"
:disabled="isContractNumDisabled || isAssociatedContract"
v-decorator="['contractNum',validatorRules.contractNum]">
</select-revenue-contract>
</a-form-item>
</a-col>
@@ -417,6 +420,7 @@ export default {
checkAssociatedProject(record.id).then(res => {
this.disabledCompany = this.disabledChargeCompany || res || (!!record.inAccount && record.inAccount !== 0) || (!!record.makeInvoice && record.makeInvoice !== 0) || (!!record.mail && record.mail !== 0)
this.isAssociatedContract = res
console.log(this.isContractNumDisabled,this.isAssociatedContract, this.isContractNumDisabled || this.isAssociatedContract, '----------------')
})
} else {
this.disabledCompany = this.disabledChargeCompany
@@ -584,8 +588,9 @@ export default {
this.model.contactsIdTwo = undefined
this.model.contactsIdThree = undefined
this.model.mailContactsId = undefined
this.model.contractNum = undefined
this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model, 'contactsIdOne', 'contactsIdTwo', 'contactsIdThree', 'mailContactsId'))
this.form.setFieldsValue(pick(this.model, 'contactsIdOne', 'contactsIdTwo', 'contactsIdThree', 'mailContactsId', 'contractNum'))
})
},
/**