Browse Source

adm:feat> 优化名字显示规则

onlyh 3 years ago
parent
commit
749f6d7d10
2 changed files with 13 additions and 12 deletions
  1. 12 11
      src/components/business/baseDataForm.vue
  2. 1 1
      src/components/business/dataForm.vue

+ 12 - 11
src/components/business/baseDataForm.vue

@@ -9,7 +9,8 @@
                                 :key="item.path"
                                 v-for="item in obj.data"
                                 :style="{ 'height': item.dataType == 'ATTACHMENT'? 'auto':'93px' }">
-                            <el-form-item :label="item.aliasName" :prop="item.code">
+                            <el-form-item :label="item.unit ? item.aliasName + ' (' + item.unit + ')' : item.aliasName"
+                                          :prop="item.code">
                                 <!-- 动态数据按输入框输入 -->
                                 <el-input
                                     v-if="item.category !== 'STATIC'"
@@ -85,7 +86,7 @@
 
 <script lang="ts">
 
-import { Component, Prop, Vue, Watch } from 'vue-property-decorator'
+import {Component, Prop, Vue, Watch} from 'vue-property-decorator'
 import uploadFiles from "@/components/public/uploadFiles.vue";
 import uploadImgs from "@/components/public/uploadImgs.vue";
 
@@ -98,7 +99,7 @@ function flattenKeys(obj: any) {
 
     function digKeys(prev: any, obj: any) {
         Object.entries(obj).forEach(([key, value]) => {
-            const currentKey = prev ? `${ prev }.${ key }` : key
+            const currentKey = prev ? `${prev}.${key}` : key
             if (isObject(value)) {
                 digKeys(currentKey, value)
             } else {
@@ -114,19 +115,19 @@ function flattenKeys(obj: any) {
 
 @Component({
     name: "baseDataForm",
-    components: { uploadFiles, uploadImgs }
+    components: {uploadFiles, uploadImgs}
 })
 export default class extends Vue {
     rules = {
-        'localName': [{ required: true, message: '请填写本地名称', trigger: 'blur' }],
-        'localId': [{ required: true, message: '请填写本地编码', trigger: 'blur' }],
-        'buildingSign': [{ required: true, message: '请填写建筑', trigger: 'blur' }],
-        'floorSign': [{ required: true, message: '请填写本地楼层', trigger: 'blur' }]
+        'localName': [{required: true, message: '请填写本地名称', trigger: 'blur'}],
+        'localId': [{required: true, message: '请填写本地编码', trigger: 'blur'}],
+        'buildingSign': [{required: true, message: '请填写建筑', trigger: 'blur'}],
+        'floorSign': [{required: true, message: '请填写本地楼层', trigger: 'blur'}]
     }
     header = {}
     form = {}
-    @Prop({ default: Object }) objectHeaders ?: any
-    @Prop({ default: Object }) currRowContent ?: any
+    @Prop({default: Object}) objectHeaders ?: any
+    @Prop({default: Object}) currRowContent ?: any
 
     private get infoHeaders(): any {
         if (this.objectHeaders?.dictStages?.data?.length && this.objectHeaders?.basicInfos) {
@@ -150,7 +151,7 @@ export default class extends Vue {
         }
     }
 
-    @Watch('currRowContent', { immediate: true, deep: true })
+    @Watch('currRowContent', {immediate: true, deep: true})
     handleRow() {
         this.$nextTick(() => {
             // string =>array key

+ 1 - 1
src/components/business/dataForm.vue

@@ -25,7 +25,7 @@
                                     v-for="item in header.dictStages.data"
                                     :style="{ 'height':item.dataType == 'ATTACHMENT'? 'auto':'93px' }"
                             >
-                                <el-form-item :label="item.name">
+                                <el-form-item :label="item.unit ? item.aliasName + ' (' + item.unit + ')' : item.aliasName">
                                     <el-input
                                         :disabled="!item.editable"
                                         v-if="item.dataType == 'STRING'"