lion 7 months ago
commit 8744f2bf62

@ -1721,11 +1721,31 @@ export default {
},
//
async getMoneyWay() {
this.moneyWay = (await getparameter({
try {
const response = await getparameter({
number: 'money_way'
})).detail
});
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() {
@ -2516,12 +2536,28 @@ export default {
}
},
handleAddContract() {
async handleAddContract() {
// loading
this.loading = true;
try {
//
this.isShowAdd = true;
// Call API to get category options
this.getCategoryOptions();
// Reset form
//
await this.getCategoryOptions();
//
this.resetForm();
} catch (error) {
console.error('加载数据失败:', error);
this.$message.error('加载数据失败');
} finally {
// loading
this.loading = false;
}
},
handleAddContractOk() {
@ -2646,7 +2682,7 @@ export default {
//
getCategoryName(id) {
const category = this.categoryOptions.find(item => item.id === id)
return category ? category.name : ''
return category ? category.value : ''
},
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) {
try {

Loading…
Cancel
Save