2 Commitit 5295eb201b ... 23530c425f

Tekijä SHA1 Viesti Päivämäärä
  suhp 23530c425f Merge branch 'master' of http://1.71.9.215:3000/feiyi/cbjsxt-front-master 1 kuukausi sitten
  suhp 9faa2d3646 1 1 kuukausi sitten
2 muutettua tiedostoa jossa 121 lisäystä ja 6 poistoa
  1. 3 3
      public/config.js
  2. 118 3
      src/views/costAudit/auditInfo/auditManage/costAudit.vue

+ 3 - 3
public/config.js

@@ -5,7 +5,7 @@
 //var host = 'http://116.204.117.33' // 测试
 // var host = 'http://b463f4b7.natappfree.cc' // 后端服务海鹏
 // var host = 'http://5jrgep.ipx.wanziwk.cn' // 后端服务译文
-var host = 'http://192.168.1.144' // 后端服务译文
+var host = 'http://127.0.0.1' // 后端服务译文
 // var host = 'http://1.71.9.215'
 // var host = 'http://5jrgep.ipx.wanziwk.cn'
 // combine为true时五合一部署, 为false时分五个服务部署
@@ -31,8 +31,8 @@ window.getModuleRootUrl = function (module) {
   if (!combine) {
     modulePort = defaultModulePortMap[module]
   }
-  // return "http://5jrgep.ipx.wanziwk.cn";
-  return host + ':' + modulePort
+  return "http://5jrgep.ipx.wanziwk.cn";
+  //return host + ':' + modulePort
   // return host + modulePort
 }
 window.context = {

+ 118 - 3
src/views/costAudit/auditInfo/auditManage/costAudit.vue

@@ -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>