@@ -459,7 +459,7 @@ function numberToChinese(num) {
if (num === 0) {
return '零元'
}
-
+
const units = ['', '拾', '佰', '仟', '万', '拾', '佰', '仟', '亿', '拾', '佰', '仟', '万']
const digits = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖']
const [integer, decimal] = num.toString().split('.')
@@ -505,7 +505,7 @@ function numberToChinese(num) {
}
}
}
-
+
if (!decimal || parseInt(decimal) === 0) {
result += '整'
}
@@ -986,12 +986,12 @@ export default {
message: '必填'
}
],
- act_date: [
- {
- required: this.contract_category.required_act_date === 1,
- message: '必填'
- }
- ]
+ // act_date: [
+ // {
+ // required: this.contract_category.required_act_date === 1,
+ // message: '必填'
+ // }
+ // ]
}
const res = await getFundLog({
contract_id: this.contract.id,
@@ -1466,7 +1466,7 @@ export default {
input.addEventListener('change', this.calculateTotal)
input.addEventListener('blur', this.calculateTotal)
})
-
+
// 获取所有以 fen 开头的输入框
const fenAmountInputs = dom.querySelectorAll('input[data-field^="fen"]')
// 移除旧的监听器
@@ -1506,7 +1506,7 @@ export default {
totalInput.removeEventListener('input', (e) => this.updateUpperCaseFromTotal(e, dom))
totalInput.removeEventListener('change', (e) => this.updateUpperCaseFromTotal(e, dom))
totalInput.removeEventListener('blur', (e) => this.updateUpperCaseFromTotal(e, dom))
-
+
totalInput.addEventListener('input', (e) => this.updateUpperCaseFromTotal(e, dom))
totalInput.addEventListener('change', (e) => this.updateUpperCaseFromTotal(e, dom))
totalInput.addEventListener('blur', (e) => this.updateUpperCaseFromTotal(e, dom))
@@ -1568,7 +1568,7 @@ export default {
const value = parseFloat(input.value) || 0
wanTotal += value
})
-
+
const wanInput = dom.querySelector('input[data-field="wTotal"]')
if (wanInput) {
wanInput.value = wanTotal===0?'0':wanTotal
@@ -1747,7 +1747,7 @@ export default {
const totalInput = dom.querySelector('input[data-field="total"]')
const upperCaseInput = dom.querySelector('input[data-field="upperCaseAmount"]')
-
+
if (totalInput && upperCaseInput) {
this.total = parseFloat(totalInput.value.replace(/¥/g, '')) || 0
upperCaseInput.value = numberToChinese(this.total)
@@ -2108,7 +2108,7 @@ export default {
display: flex;
flex-direction: column;
max-height: 80vh;
-
+
::v-deep .el-dialog__body {
flex: 1;
overflow-y: auto;
diff --git a/src/views/contract/contractList.vue b/src/views/contract/contractList.vue
index 10edcd8..74e1936 100644
--- a/src/views/contract/contractList.vue
+++ b/src/views/contract/contractList.vue
@@ -686,6 +686,8 @@
:value="item.id"
/>
+
-
-
- 合同分类
-
-
-
-
-
-
- 事务类型
-
-
-
-
-
-
- 合同类型
-
-
-
关键字
@@ -69,6 +43,51 @@
@on-change="(e)=>select.year = e"
/>
+
+
+
+ 预算金额
+
+
+ -
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 合同分类
+
+
+
+
+
+
+ 事务类型
+
+
+
+
+
+
+ 合同类型
+
+
创建日期
@@ -144,14 +163,6 @@
-
-
- 预算金额
-
-
- -
-
-
@@ -218,7 +229,8 @@
-
+
+
)
}
- }
+ },
+ {
+ prop: 'type',
+ label: '预算类型',
+ width: 120,
+ formatter: (cell, data, value) => {
+ const res = this.type.filter(item => {
+ return item.id === value
+ })
+ return res[0]?.value || '未知'
+ }
+ },
+ {
+ prop: 'year',
+ label: '所属年份',
+ width: 160
+ },
+ {
+ prop: 'plan_department.name',
+ label: '相关科室',
+ width: 180
+ },
+ {
+ prop: 'content',
+ label: '描述',
+ align: 'left',
+ width: 300
+ },
]
}
},
@@ -296,7 +302,7 @@ export default {
async getPlanProgress() {
const res = await getProgress({
- page_size: 10,
+ page_size: this.select.page_size,
page: this.select.pageIndex,
year: this.select.year,
type: this.select.type,
@@ -304,23 +310,73 @@ export default {
top_pid: 1,
...this.select
})
- for (var m of res.list.data) {
- m.pid_info_name = m.pid_info?.name
- }
- this.list =
- mergeTableRow({
- data: res.list.data,
- mergeColNames: ['pid_info_name'], // 需要合并的列,默认合并列相同的数据
- firstMergeColNames: ['pid_info_name'], // 受影响的列,只合并以firstMerge为首的同类型数据
- firstMerge: 'pid_info_name' // 以哪列为基础进行合并,一般为第一列
- })
+ // for (var m of res.list.data) {
+ // m.pid_info_name = m.pid_info?.name
+ // }
+ // this.list =
+ // mergeTableRow({
+ // data: res.list.data,
+ // mergeColNames: ['pid_info_name'], // 需要合并的列,默认合并列相同的数据
+ // firstMergeColNames: ['pid_info_name'], // 受影响的列,只合并以firstMerge为首的同类型数据
+ // firstMerge: 'pid_info_name' // 以哪列为基础进行合并,一般为第一列
+ // })
+ this.list = this.concactPid(res.list.data)
this.total = res.list.total
this.useMoneyTotal = res.use_money_total
this.moneyTotal = res.money
this.updateMoneyTotal = res.update_money
this.rateTotal = this.toper(this.updateMoneyTotal, this.moneyTotal, this.useMoneyTotal)
- console.log(res)
+ console.log("list",this.list)
+ },
+ concactPid(arr){
+ const groupByPid = {};
+ arr.forEach(item => {
+ const key = item.pid;
+ if (!groupByPid[key]) {
+ groupByPid[key] = [];
+ }
+ groupByPid[key].push(item);
+ });
+
+ // 2. 构建合并后的数组
+ const mergedResult = Object.values(groupByPid).map(children => {
+ // 从分组的第一项中获取 pid_info(因同 pid 的 pid_info 相同)
+ const pidInfo = children[0].pid_info;
+
+ // 计算父级的 use_money_total(children 中 use_money_total 之和,null 视为 0)
+ const useMoneyTotal = children.reduce((sum, child) => {
+ const value = child.use_money_total ?? 0; // 处理 null
+ return parseFloat(sum) + parseFloat(value);
+ }, 0);
+
+ // 构建父级对象
+ return {
+ pid: children[0].pid, // 父级 pid 与分组的 pid 一致
+ id:pidInfo.pid+'-'+pidInfo.id,
+ pid_info_name: pidInfo.name,
+ money: parseFloat(pidInfo.money).toFixed(2),
+ type: pidInfo.type,
+ isParent:true,
+ update_money: parseFloat(pidInfo.update_money).toFixed(2),
+ use_money_total: parseFloat(useMoneyTotal).toFixed(2), // 子项总和
+ children: children // 保留所有子项
+ };
+ });
+
+ const arrayWithPer = mergedResult.map(row => {
+ // 计算 per(公式:use_money_total / (update_money || money),处理 null 和 NaN)
+ const useMoneyTotal = Number(row.use_money_total ?? 0); // null 视为 0,转换为数字
+ const denominator = Number(row.update_money) || Number(row.money); // 取 update_money 或 money
+ const calculation_result = isNaN(useMoneyTotal / denominator) ? 0 : useMoneyTotal / denominator;
+
+ return {
+ ...row,
+ calculation_result: calculation_result // 新增 per 字段
+ };
+ });
+ const sortedArray = arrayWithPer.sort((a, b) => b.calculation_result - a.calculation_result);
+ return sortedArray
}
}
}