lion 7 months ago
commit 8744f2bf62

@ -1721,11 +1721,31 @@ export default {
}, },
// //
async getMoneyWay() { async getMoneyWay() {
this.moneyWay = (await getparameter({ try {
number: 'money_way' const response = await getparameter({
})).detail number: 'money_way'
});
this.form.moneyWay = this.moneyWay
if (response && response.detail) {
// id
this.moneyWay = response.detail.map((item, index) => ({
id: item.id || `money_way_${index}`,
name: item.name || item.value || `资金来源${index + 1}`,
value: item.value || item.id || `money_way_${index}`
}));
// moneyWay
this.form.moneyWay = [];
} else {
this.moneyWay = [];
this.form.moneyWay = [];
}
} catch (error) {
console.error('获取资金来源失败:', error);
this.$message.error('获取资金来源失败');
this.moneyWay = [];
this.form.moneyWay = [];
}
}, },
// //
async getPurchaseWay() { async getPurchaseWay() {
@ -2516,12 +2536,28 @@ export default {
} }
}, },
handleAddContract() { async handleAddContract() {
this.isShowAdd = true; // loading
// Call API to get category options this.loading = true;
this.getCategoryOptions();
// Reset form try {
this.resetForm(); //
this.isShowAdd = true;
//
await this.getCategoryOptions();
//
this.resetForm();
} catch (error) {
console.error('加载数据失败:', error);
this.$message.error('加载数据失败');
} finally {
// loading
this.loading = false;
}
}, },
handleAddContractOk() { handleAddContractOk() {
@ -2646,7 +2682,7 @@ export default {
// //
getCategoryName(id) { getCategoryName(id) {
const category = this.categoryOptions.find(item => item.id === id) const category = this.categoryOptions.find(item => item.id === id)
return category ? category.name : '' return category ? category.value : ''
}, },
getAffairTypeName(id) { getAffairTypeName(id) {
@ -2948,36 +2984,6 @@ export default {
} }
}, },
//
handleAdd() {
this.isEditMode = false;
this.currentContractId = null;
this.isShowAdd = true;
this.currentStep = 1;
this.form = {
...this.form,
category: '',
affairType: '',
contractType: '',
purchaseForm: '',
purchaseMethod: '',
type: '',
isBudget: false,
is_simple: 0,
has_charge: 0,
is_substitute: 0,
supply: '',
price: '',
name: '',
moneyWay: [],
plan: [],
contract_carry_department: [],
before_contract_template: null,
contract_template: null
};
this.getCategoryOptions();
},
// //
async getContractDetail(id) { async getContractDetail(id) {
try { try {

Loading…
Cancel
Save