shaun-sheep 5 years ago
parent
commit
cb97331b3e

+ 21 - 24
src/components/ledger/details/detail/exhibitionBaseInformation.vue

@@ -1,33 +1,30 @@
 <template>
 <div class="exhibition-baseInformation">
-  <section v-for="(val,key,i) in information">
+  <section v-for="(val,key,i) in exhibitionBaseInformation.information">
     <h4 class="base">{{key}}</h4>
     <div v-for="(value,keys,index) in val.paths"
          style="width: 47%;display: inline-block;margin-left: 20px">
       <span> {{value.InfoPointName}}:</span>
       <span>{{value.Value}}</span>
-
-      <!--          <el-popover-->
-
-
-      <!--            placement="top-start"-->
-      <!--            width="160"-->
-      <!--            trigger="hover"-->
-      <!--            v-model="visible">-->
-      <!--            <p>xxxxxxxxx</p>-->
-      <!--            <div style="text-align: right; margin: 0">-->
-      <!--              <el-button-->
-      <!--                type="primary"-->
-      <!--                size="mini"-->
-      <!--                @click="handleCopy"-->
-      <!--              >复制N-->
-      <!--              </el-button>-->
-      <!--            </div>-->
-      <!--            <el-button-->
-      <!--              slot="reference"-->
-      <!--              type="text"-->
-      <!--            >xxxx</el-button>-->
-      <!--          </el-popover>-->
+<!--                <el-popover-->
+<!--                  placement="top-start"-->
+<!--                  width="160"-->
+<!--                  trigger="hover"-->
+<!--                  v-model="visible">-->
+<!--                  <p>{{value.Value}}</p>-->
+<!--                  <div style="text-align: right; margin: 0">-->
+<!--                    <el-button-->
+<!--                      type="primary"-->
+<!--                      size="mini"-->
+<!--                      @click="handleCopy"-->
+<!--                    >复制-->
+<!--                    </el-button>-->
+<!--                  </div>-->
+<!--                  <el-button-->
+<!--                    slot="reference"-->
+<!--                    type="text"-->
+<!--                  >xxxx</el-button>-->
+<!--                </el-popover>-->
 
 
     </div>
@@ -40,7 +37,7 @@
 <script>
     export default {
       name: "exhibition-baseInformation",
-      props: ['information', 'exampleData'],
+      props: ['exhibitionBaseInformation'],
       data() {
         return {
           visible: false,

+ 1 - 0
src/components/ledger/details/detail/exhibitionCrux.vue

@@ -2,6 +2,7 @@
   <section class="exhibition-crux">
     <p class="title">{{exhibitionCrux.title}}
       <span class="el-icon-s-tools setting" @click="setting"></span></p>
+    <div style="text-align: center" v-if="!exhibitionCrux.cruxArray.length">暂无数据</div>
   <cruxDialog ref="setting"/>
   </section>
 </template>

+ 13 - 2
src/components/ledger/details/detail/selectRadio.vue

@@ -1,8 +1,14 @@
 <template>
   <div class="select-radio">
     <p class="title">{{selectRadio.information}}</p>
-    <template v-for="item in selectRadio.radioList">
-      <el-radio v-model="radio" :label="item.label">{{item.value}}</el-radio>
+    <template>
+      <el-radio-group
+        style=" margin: 0 10px;"
+        v-model="radio"
+        @change="changeRadio"
+        v-for="(item,index) in selectRadio.radioList">
+        <el-radio :label="item.label">{{item.value}}</el-radio>
+      </el-radio-group>
     </template>
   </div>
 </template>
@@ -15,6 +21,11 @@
       return {
         radio: '1'
       };
+    },
+    methods: {
+      changeRadio(val) {
+        this.$emit('changeRadio', val)
+      }
     }
   }
 </script>

+ 102 - 57
src/views/ledger/facility/details/index.vue

@@ -10,17 +10,16 @@
           <exhibitionCrux :exhibitionCrux="exhibitionCrux"/>
         </div>
         <div class="content-showType">
-          <selectRadio :selectRadio="selectRadio"/>
+          <selectRadio
+            :selectRadio="selectRadio"
+            @changeRadio="changeRadio"
+          />
         </div>
         <div class="content-point">
           <div class="content-point-left">
             <el-scrollbar style="height:100%;">
               <div style="height:1000px">
-                <exhibitionBaseInformation
-                  :exhibitionBaseInformation="exhibitionBaseInformation"
-                  :information="information"
-                  :exampleData="exampleData"
-                />
+                <exhibitionBaseInformation :exhibitionBaseInformation="exhibitionBaseInformation"/>
               </div>
             </el-scrollbar>
           </div>
@@ -56,7 +55,7 @@
   import exhibitionCrux from "@/components/ledger/details/detail/exhibitionCrux";
   import exhibitionMaintain from "@/components/ledger/details/detail/exhibitionMaintain";
   import selectRadio from "@/components/ledger/details/detail/selectRadio";
-
+  import tools from "../../../../utils/buildfloor/tools";
   import {getDataDictionary, queryEquip} from "@/api/scan/request";
   import {mapGetters} from "vuex";
 
@@ -91,7 +90,7 @@
         list: [], //设备列表
         pointData: [], //信息点数据
         exampleData: {}, //实例数据
-        information:{},//传给组件
+        currentRadio: '',//当前选中的select
         selectRadio: {
           information: '设备信息点',
           radioList: [
@@ -100,43 +99,25 @@
               label: '1'
             },
             {
-              value: '显示需采集信息点',
+              value: '显示有值信息点',
               label: '2'
             },
             {
-              value: '显示需采集信息点',
+              value: '显示全部信息点',
               label: '3'
             }
           ]
         },
         exhibitionBaseInformation: {
-          //产品说所有信息的key和value是动态生成的
-          base: {
-            baseInformation: '基本信息',
-            list: [
-              {
-                text: '设备本地编码:',
-                val: '123--22:'
-              },
-              {
-                text: '设备二维码图片:',
-                val: '2:'
-              },
-            ]
-          },
-          manufacture: {
-            manufacturerParameter: '台账参数 / 设备厂家',
-          },
-          supplier: {
-            supplierParameters: '台账参数 / 供应购买'
-          }
+          information: {}
         },
-        exhibitionMaintain:{
-          title:'维修/维保记录'
+        exhibitionMaintain: {
+          title: '维修/维保记录'
         },
         exhibitionFile: {},
         exhibitionCrux: {
-          title: '关键信息点:'
+          title: '关键信息点:',
+          cruxArray: [],
         },
         exhibitionImage: {
           title: '图片'
@@ -169,39 +150,103 @@
         Promise.all([promise1, promise2]).then(values => {
           this.pointData = values[0].Content;
           this.exampleData = values[1].Content[0];
-          let objectList = {}
-          //
-          const result = {}
 
-          values[0].Content.forEach(i => {
-            if(  this.exampleData.hasOwnProperty(i.Path)) {
-              i.value = this.exampleData[i.Path]
-              console.log(i.InfoPointName,i.value,'======')
+          this.handleRadios(1)
+        })
+      },
+      handleRadios(val) { //判断radio的值显示关键信息,基本信息,图片,文件
+        let arr = []
+        if (val == 1) { //需采集信息
+          arr = this.pointData.filter(i => i.Visible)
+          //关键信息点
+          this.exhibitionCrux.cruxArray = arr.filter(i => i.KeyWord) //todo 融合
+          //  图片和文件的处理
+          this.handlePicList(arr)
+
+        } else if (val == 2) { //有值
+          let list = this.pointData
+          list.map(j => {
+            if (this.exampleData.hasOwnProperty(j.Path)) {
+              return {
+                ...j,
+                value: this.exampleData[j.Path]
+              }
             }
-            if (result[`${i.FirstName}${i.SecondName? '/'+i.SecondName:''}`]) {
-              result[`${i.FirstName}${i.SecondName? '/'+i.SecondName:''}`].paths.push({
-                Path:i.Path,
+            arr = list.filter(k => k.value)
+          })
+        } else { //全部
+          arr = this.pointData
+        }
+        this.displayData(arr)
+      },
+      handlePicList(arr) {
+        let picObject = {}
+        //处理数据格式
+        let obj = tools.formatData(this.exampleData)
+        console.log(obj, '==obj==')
+        arr.map(i => {
+            if (obj.hasOwnProperty('LedgerParam.PhotoDoc.Drawing')) {
+
+              console.log(obj['LedgerParam.PhotoDoc.Drawing'], '===i.Path==')
+              // i.picList = obj[i.Path]
+            }
+          //   console.log(i.picList,'picList')
+          switch (i.Path) {
+            case 'LedgerParam.PhotoDoc.Drawing':
+            case 'LedgerParam.Siteinstall.InstallPic':
+            case 'LedgerParam.Siteinstall.InstallDrawing':
+            case 'LedgerParam.PhotoDoc.Nameplate':
+              break
+          }
+          // if (picObject[i.InfoPointName]) {
+          //   picObject[i.InfoPointName].push({
+          //     Path: i.Path,
+          //     InfoPointName: i.InfoPointName,
+          //     InfoPointCode: i.InfoPointCode,
+          //   })
+          // } else {
+          //   picObject[i.InfoPointName] = []
+          // }
+
+
+        })
+        console.log(picObject, 'picObject')
+      },
+      displayData(arr) {//对数据进行处理传给组件展示
+        const result = {}
+        arr.forEach(i => {
+          if (this.exampleData.hasOwnProperty(i.Path) && this.currentRadio != 2) {
+            i.value = this.exampleData[i.Path]
+            console.log(i.value, '======')
+          }
+          if (result[`${i.FirstName}${i.SecondName ? '/' + i.SecondName : ''}`]) {
+            result[`${i.FirstName}${i.SecondName ? '/' + i.SecondName : ''}`].paths.push({
+              Path: i.Path,
+              InfoPointName: i.InfoPointName,
+              InfoPointCode: i.InfoPointCode,
+              Value: i.value
+            })
+          } else {
+            result[`${i.FirstName}${i.SecondName ? '/' + i.SecondName : ''}`] = {
+              paths: [{
+                Path: i.Path,
                 InfoPointName: i.InfoPointName,
                 InfoPointCode: i.InfoPointCode,
-                Value:i.value
-              })
-            } else {
-              result[`${i.FirstName}${i.SecondName? '/'+i.SecondName:''}`] = {
-                paths: [{
-                  Path:i.Path,
-                  InfoPointName: i.InfoPointName,
-                  InfoPointCode: i.InfoPointCode,
-                  Value:i.value
-                }]
-              }
+                Value: i.value
+              }]
             }
-          })
-          this.information = result
+          }
         })
+        this.exhibitionBaseInformation.information = result
       },
-      goBack () {
+      goBack() {
         this.$router.push({path: "/ledger/facility"})
       },
+      changeRadio(val) { //1,需采集,2,有值,3,全部
+        this.handleRadios(val)
+        this.currentRadio = val
+        console.log(val, '=======val======')
+      }
     },
     watch: {
       projectId() {