|
|
@@ -128,14 +128,86 @@
|
|
|
>
|
|
|
<template slot-scope="scope">
|
|
|
<span v-if="item.isDisplayOnly">{{ scope.row[item.prop] }}</span>
|
|
|
+ <!-- 字符串类型输入框 -->
|
|
|
+ <el-input
|
|
|
+ v-else-if="item.fieldType === 'string'"
|
|
|
+ v-model="scope.row[item.prop]"
|
|
|
+ :placeholder="item.label"
|
|
|
+ :disabled="item.disabled"
|
|
|
+ :maxlength="item.fieldTypelen ? parseInt(item.fieldTypelen) : null"
|
|
|
+ show-word-limit
|
|
|
+ style="width: 100%"
|
|
|
+ @input="handleCellInput(scope.row, item)"
|
|
|
+ @change="handleCellInput(scope.row, item)"
|
|
|
+ ></el-input>
|
|
|
+ <!-- 整数类型输入框 -->
|
|
|
+ <el-input
|
|
|
+ v-else-if="item.fieldType === 'integer'"
|
|
|
+ v-model.number="scope.row[item.prop]"
|
|
|
+ :placeholder="item.label"
|
|
|
+ :disabled="item.disabled"
|
|
|
+ :maxlength="item.fieldTypelen ? parseInt(item.fieldTypelen) : null"
|
|
|
+ show-word-limit
|
|
|
+ style="width: 100%"
|
|
|
+ type="number"
|
|
|
+ step="1"
|
|
|
+ @input="handleCellInput(scope.row, item)"
|
|
|
+ @change="handleCellInput(scope.row, item)"
|
|
|
+ ></el-input>
|
|
|
+ <!-- 小数类型输入框 -->
|
|
|
+ <el-input
|
|
|
+ v-else-if="item.fieldType === 'double'"
|
|
|
+ v-model.number="scope.row[item.prop]"
|
|
|
+ :placeholder="item.label"
|
|
|
+ :disabled="item.disabled"
|
|
|
+ :maxlength="item.fieldTypelen ? parseInt(item.fieldTypelen) : null"
|
|
|
+ show-word-limit
|
|
|
+ style="width: 100%"
|
|
|
+ type="number"
|
|
|
+ step="0.01"
|
|
|
+ @input="handleCellInput(scope.row, item)"
|
|
|
+ @change="handleCellInput(scope.row, item)"
|
|
|
+ ></el-input>
|
|
|
+ <!-- 日期类型输入框 -->
|
|
|
+ <el-date-picker
|
|
|
+ v-else-if="item.fieldType === 'datetime'"
|
|
|
+ v-model="scope.row[item.prop]"
|
|
|
+ :placeholder="item.label"
|
|
|
+ :disabled="item.disabled"
|
|
|
+ style="width: 100%"
|
|
|
+ type="date"
|
|
|
+ value-format="yyyy-MM-dd"
|
|
|
+ @input="handleCellInput(scope.row, item)"
|
|
|
+ @change="handleCellInput(scope.row, item)"
|
|
|
+ ></el-date-picker>
|
|
|
+ <!-- 字典类型下拉框 -->
|
|
|
+ <el-select
|
|
|
+ v-else-if="item.isDict === 'true'"
|
|
|
+ v-model="scope.row[item.prop]"
|
|
|
+ :placeholder="item.label"
|
|
|
+ :disabled="item.disabled"
|
|
|
+ style="width: 100%"
|
|
|
+ @input="handleCellInput(scope.row, item)"
|
|
|
+ @change="handleCellInput(scope.row, item)"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="dict in getDictOptions(item.dictCode)"
|
|
|
+ :key="dict.value"
|
|
|
+ :label="dict.label"
|
|
|
+ :value="dict.value"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ <!-- 默认输入框 -->
|
|
|
<el-input
|
|
|
v-else
|
|
|
v-model="scope.row[item.prop]"
|
|
|
:placeholder="item.label"
|
|
|
:disabled="item.disabled"
|
|
|
+ :maxlength="item.fieldTypelen ? parseInt(item.fieldTypelen) : null"
|
|
|
+ show-word-limit
|
|
|
style="width: 100%"
|
|
|
- @input="handleCellInput(scope.row)"
|
|
|
- @change="handleCellInput(scope.row)"
|
|
|
+ @input="handleCellInput(scope.row, item)"
|
|
|
+ @change="handleCellInput(scope.row, item)"
|
|
|
></el-input>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
@@ -183,13 +255,13 @@
|
|
|
} from '@/api/costVerifyManage'
|
|
|
import { getDetail } from '@/api/auditInitiation'
|
|
|
import { catalogMixin } from '@/mixins/useDict'
|
|
|
+ import { getByTypeKey } from '@/api/dictionaryManage'
|
|
|
import {
|
|
|
saveSingleRecordSurvey,
|
|
|
getSurveyDetail,
|
|
|
downloadTemplate,
|
|
|
importData,
|
|
|
} from '@/api/audit/survey'
|
|
|
-
|
|
|
export default {
|
|
|
name: 'CostAudit',
|
|
|
mixins: [catalogMixin],
|
|
|
@@ -259,6 +331,8 @@
|
|
|
project: {},
|
|
|
// 年份到各列prop的映射:{ '2025': { book: '...', audit: '...', approved: '...' } }
|
|
|
yearPropMap: {},
|
|
|
+ // 字典缓存
|
|
|
+ dictCache: {},
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
|
@@ -601,6 +675,10 @@
|
|
|
width: item.fieldName == '序号' ? '80px' : undefined,
|
|
|
minWidth: item.fieldName == '序号' ? undefined : '150px',
|
|
|
align: 'center',
|
|
|
+ fieldType: item.fieldType,
|
|
|
+ fieldTypelen: item.fieldTypelen,
|
|
|
+ isDict: item.isDict,
|
|
|
+ dictCode: item.dictCode,
|
|
|
showOverflowTooltip: item.fieldName == '序号' ? false : true,
|
|
|
}
|
|
|
this.costAuditcolumn.push(column)
|
|
|
@@ -1507,6 +1585,43 @@
|
|
|
}
|
|
|
)
|
|
|
},
|
|
|
+ // 获取字典选项
|
|
|
+ async getDictOptions(dictCode) {
|
|
|
+ // 如果没有字典代码,返回空数组
|
|
|
+ if (!dictCode) {
|
|
|
+ return []
|
|
|
+ }
|
|
|
+
|
|
|
+ // 检查是否已经缓存了该字典数据
|
|
|
+ if (this.dictCache && this.dictCache[dictCode]) {
|
|
|
+ return this.dictCache[dictCode]
|
|
|
+ }
|
|
|
+
|
|
|
+ try {
|
|
|
+ // 从后端获取字典数据
|
|
|
+ const response = await getByTypeKey({ typeKey: dictCode })
|
|
|
+ let dictOptions = []
|
|
|
+
|
|
|
+ // 处理响应数据
|
|
|
+ if (response && Array.isArray(response)) {
|
|
|
+ dictOptions = response.map((item) => ({
|
|
|
+ value: item.dictValue || item.key || item.value,
|
|
|
+ label: item.dictLabel || item.name || item.label,
|
|
|
+ }))
|
|
|
+ }
|
|
|
+
|
|
|
+ // 缓存字典数据
|
|
|
+ if (!this.dictCache) {
|
|
|
+ this.dictCache = {}
|
|
|
+ }
|
|
|
+ this.dictCache[dictCode] = dictOptions
|
|
|
+
|
|
|
+ return dictOptions
|
|
|
+ } catch (error) {
|
|
|
+ console.error('获取字典数据失败:', error)
|
|
|
+ return []
|
|
|
+ }
|
|
|
+ },
|
|
|
},
|
|
|
}
|
|
|
</script>
|