shaun-sheep 5 jaren geleden
bovenliggende
commit
63c90a8f24

+ 63 - 0
src/api/relation/api.js

@@ -1,4 +1,6 @@
 import httpUtil from "../scan/httpUtil";
+import fetch from "../scan/fetch";
+import storage from '@/framework/utils/storage'
 
 
 //查询总览
@@ -14,6 +16,12 @@ export function graphicNumber(param, success) {
 
 }
 
+//导入excel
+export function graphicUpload(param, success) {
+    let url = '/api/datacenter/graphic/import'
+    httpUtil.postJson(url, param, success)
+}
+
 // 下载报告
 export function reportDownload(param, success) {
     let url = '/api/datacenter/graphic/report-downloads'
@@ -61,3 +69,58 @@ export function sysDirection(param, success) {
     httpUtil.postJson(url, param, success)
 }
 
+//************************数据转换********************************//
+
+// 项目化字典-统计数量
+export function dictCount(param, success) {
+    let url = '/api/equip-component/dict-custom/project-dict-count'
+    httpUtil.postJson(url, param, success)
+}
+
+// 项目化字典-需补充转换规则数量
+export function dictSwitchCount(param, success) {
+    let url = '/api/equip-component/dict-custom/project-dict-switch-count'
+    httpUtil.postJson(url, param, success)
+}
+
+//项目化字典 - 内容
+// export function dectInfo(param, success) {
+//     let url = '/api/equip-component/dict-custom/project-dict-info'
+//     httpUtil.postJson(url, param, success)
+// }
+
+export function dectInfo(param) {
+    let data = param
+    let userName = storage.get("user_name")
+    let ProjectId = localStorage.getItem("projectId")
+    return fetch({
+        method: 'POST',
+        url: `/api/equip-component/dict-custom/project-dict-info`,
+        data,
+        headers: {'ProjectId': ProjectId, 'Comming': 'adm', 'Account': userName}
+    })
+}
+
+//数据中心-物理世界数据转换
+export function dictDataCenter(param, success) {
+    let url = '/api/equip-component/dict-custom/project-dict-datacenter'
+    httpUtil.postJson(url, param, success)
+}
+
+//物理世界-数据中心数据转换
+export function dictDataPlatFrom(param, success) {
+    let url = '/api/equip-component/dict-custom/project-dict-dataplatfrom'
+    httpUtil.postJson(url, param, success)
+}
+
+// 同步设备
+export function createEquip(param, success) {
+    let url = `/api/dataplatform-sync/project-sync/create-equip?projectId=${param.projectId}`
+    httpUtil.postJson(url, {}, success)
+}
+
+//更新自定义自定脚本
+export function dictUpdate(param, success) {
+    let url = '/api/equip-component/dict-custom/update'
+    httpUtil.postJson(url, param, success)
+}

+ 6 - 0
src/components/relation/overview/Modal/RelationMaintain.vue

@@ -134,6 +134,7 @@
                 action="/api/datacenter/graphic/import"
                 multiple
                 name="fileName"
+                :before-upload="beforeUpload"
                 :on-progress="progress"
                 :on-success="success"
                 :on-error="error"
@@ -348,6 +349,11 @@
                     this.dialogTableVisibleMore = false
 
                 }
+            },
+            beforeUpload(file) {
+                let fd = new FormData()
+                fd.append('files',file)
+
             }
         }
     }

+ 2 - 1
src/framework/layout/layout-store.js

@@ -87,7 +87,8 @@ export default {
         },
         setUploaderList: (state, val) => {
             state.uploaderList = val?val:[]
-        }
+        },
+
     },
     actions: {
         loadUserInfo({ state }) {

+ 106 - 25
src/views/relation/data/index.vue

@@ -2,52 +2,59 @@
   <div class="container">
     <div class="banner">
       <section class="table-text">
-        <span>共有项目化字典类型:60</span>
-        <span>需从物理世界补全“继承”规则的:x</span>
-        <el-button type="primary">重新转换</el-button>
+        <span>共有项目化字典类型:{{allCount}}</span>
+        <span>需从物理世界补全“继承”规则的:{{filterCount}}</span>
+        <el-button
+            type="primary"
+            @click="resetTransformation"
+            :disabled="isDisabled"
+        >重新转换
+        </el-button>
         <span
             class="iconfont icon-guizeyingyong"
             @click="dataTable"
         ></span>
-        <span>需补充转换规则的:31</span>
+        <span>需补充转换规则的:{{replenishCount}}</span>
       </section>
     </div>
     <el-row :gutter="24">
       <el-col :span="12">
         <p class="border-left-8">标准数字化交付数据(数据中心)→(物理世界)项目实际数据</p>
         <el-table
-            :data="tableData"
+            :data="margeData(dataCenter)"
             stripe
             style="width: 100%"
             :header-cell-style="{background:'#d9d9d9',color:'#606266'}"
         >
           <el-table-column
-              prop="date"
+              prop="title"
               label="标准字典类型"
+              align="center"
           />
           <el-table-column
-              prop="name"
+              prop="Count"
               label="不能项目化的实例数量"
-              width="200"
+              align="center"
           />
         </el-table>
       </el-col>
       <el-col :span="12" style="padding-left: 0">
         <p class="border-left-8">项目实际数据(物理世界)→(数据中心)标准数字化交付数据</p>
         <el-table
-            :data="tableData"
+            :data="margeData(dataPlatForm)"
             stripe
             style="width: 100%"
             :header-cell-style="{background:'#d9d9d9',color:'#606266'}"
         >
           <el-table-column
-              prop="date"
+              prop="title"
+              align="center"
               label="项目化字典类型"
           />
           <el-table-column
-              prop="name"
+              prop="Count"
+              align="center"
               label="不能标准化的实例数量"
-              width="200"
           />
         </el-table>
       </el-col>
@@ -56,25 +63,74 @@
 </template>
 
 <script>
+  import {createEquip, dictCount, dictDataCenter, dictDataPlatFrom, dictSwitchCount} from '../../../api/relation/api'
+  import {mapGetters} from 'vuex'
+
   export default {
     name: "index",
     data() {
       return {
-        tableData: [{
-          date: '2016-05-02',
-          name: '王小虎',
-        }, {
-          date: '2016-05-04',
-          name: '王小虎',
-        }, {
-          date: '2016-05-01',
-          name: '王小虎',
-        }, {
-          date: '2016-05-03',
-          name: '王小虎',
-        }]
+        allCount: '',
+        filterCount: '',
+        replenishCount: '',
+        dataCenter: [],
+        dataPlatForm: [],
+        isDisabled: true,
       }
     },
+    computed: {
+      ...mapGetters('layout', ['projectId']),
+    },
+    watch: {},
+    created() {
+      //  统计数量
+      let count = {
+        projectId: this.projectId
+      }
+      dictCount(count, res => {
+        this.allCount = res.Count
+      })
+      //需要转换数量
+      dictSwitchCount(count, res => {
+        this.replenishCount = res.Count
+        if (res.Count === 0) {
+          this.isDisabled = true
+          return
+        }
+        let _this = this
+        if (localStorage.getItem('CountNumber')) {
+          // if (localStorage.getItem('CountNumber') == res.Count) {
+          //   _this.isDisabled = true
+          // } else {
+          //   _this.isDisabled = false
+          // }
+          _this.isDisabled = localStorage.getItem('CountNumber') == res.Count ? true : false
+        } else { //不存在
+          localStorage.setItem('CountNumber', res.Count)
+
+        }
+
+
+      })
+      //数据中心-物理世界数据转换
+      dictDataCenter(count, res => {
+        this.dataCenter = res.Content
+      })
+      // 物理世界-数据中心数据转换
+      dictDataPlatFrom(count, res => {
+        this.dataPlatForm = res.Content
+      })
+      //条件查询数量
+      let filterCount = {
+        projectId: this.projectId,
+        "Filters": "type!=1;dcCategory isnull"
+      }
+      dictCount(filterCount, res => {
+        this.filterCount = res.Count
+      })
+
+
+    },
     methods: {
       dataTable() {
         this.$router.push({
@@ -84,6 +140,31 @@
           //   qq: 2
           // }
         })
+      },
+      margeData(arr) {
+        if (arr.length) {
+          let arrList = arr.map(item => {
+            let title = item.CategoryName ? item.CategoryName : '未知'
+            item = {
+              ...item,
+              title: `${title}(编码${item.Category})`
+            }
+            return item
+          })
+          return arrList
+        } else {
+          return []
+        }
+
+      },
+      resetTransformation() {
+        localStorage.setItem('CountNumber', this.replenishCount)
+        this.isDisabled = true
+        let param = {
+          projectId: this.projectId
+        }
+        createEquip(param, res => {
+        })
       }
     }
   }

+ 132 - 92
src/views/relation/datatable/index.vue

@@ -25,22 +25,23 @@
       </el-select>
     </div>
     <el-table
-        :data="tableData"
+        :data="tableList"
         style="width: 100%;margin-top: 30px"
+        v-loading="loading"
     >
       <el-table-column
           label="L1(专业)"
           align="center"
       >
         <el-table-column
-            prop="province"
+            prop="major"
             label="编码"
             width="120"
             align="center"
         >
         </el-table-column>
         <el-table-column
-            prop="city"
+            prop="majorName"
             label="名称"
             width="120"
             align="center"
@@ -52,14 +53,14 @@
           align="center"
       >
         <el-table-column
-            prop="date"
+            prop="sys"
             label="编码"
             width="120"
             align="center"
         >
         </el-table-column>
         <el-table-column
-            prop="name"
+            prop="sysName"
             label="名称"
             width="120"
             align="center"
@@ -71,14 +72,14 @@
           align="center"
       >
         <el-table-column
-            prop="address"
+            prop="device"
             label="编码"
             width="120"
             align="center"
         >
         </el-table-column>
         <el-table-column
-            prop="zip"
+            prop="deviceName"
             label="名称"
             width="120"
             align="center"
@@ -90,14 +91,14 @@
           align="center"
       >
         <el-table-column
-            prop="province"
+            prop="unit"
             label="编码"
             width="120"
             align="center"
         >
         </el-table-column>
         <el-table-column
-            prop="city"
+            prop="unitName"
             label="名称"
             width="120"
             align="center"
@@ -109,14 +110,14 @@
           align="center"
       >
         <el-table-column
-            prop="date"
+            prop="dc"
             label="编码"
             width="120"
             align="center"
         >
         </el-table-column>
         <el-table-column
-            prop="name"
+            prop="dcName"
             label="名称"
             width="120"
             align="center"
@@ -134,9 +135,12 @@
         >
           <template slot-scope="scope">
             <el-input
-                v-model="scope.row.txt"
-                @change="dataAndGlobal(scope.$index,scope.row)"
+                v-model="scope.row.SwitchRule"
+                :disabled="scope.row.type != 1"
+                @change="dataAndGlobal(scope.$index,scope.row,1)"
+                :class="!scope.row.SwitchRule && scope.row.DatacenterSign === 1 ?'danger-color':''"
             ></el-input>
+
           </template>
         </el-table-column>
         <el-table-column
@@ -144,7 +148,13 @@
             align="center"
         >
           <template slot-scope="scope">
-            <el-input></el-input>
+            <el-input
+                v-model="scope.row.SwitchRuleDataplatform"
+                :disabled="scope.row.type != 1"
+                @change="dataAndGlobal(scope.$index,scope.row,2)"
+                :class="!scope.row.SwitchRuleDataplatform && scope.row.DatacenterSign === 1 ?'danger-color':''"
+
+            ></el-input>
           </template>
         </el-table-column>
 
@@ -154,88 +164,18 @@
 </template>
 
 <script>
+  import {dectInfo, dictUpdate} from '../../../api/relation/api'
+  import {mapGetters} from 'vuex'
 
   export default {
     name: "index",
     data() {
       return {
         deviceCls:'项目设备类',
-        options: [{
-          value: '选项1',
-          label: '黄金糕'
-        }, {
-          value: '选项2',
-          label: '双皮奶'
-        }, {
-          value: '选项3',
-          label: '蚵仔煎'
-        }, {
-          value: '选项4',
-          label: '龙须面'
-        }, {
-          value: '选项5',
-          label: '北京烤鸭'
-        }],
         value: '',
-        tableData: [{
-          date: '2016-05-03',
-          name: '王小虎',
-          province: '上海',
-          city: '普陀区',
-          address: '上海市普陀区金沙江路 1518 弄',
-          zip: 200333,
-          txt:''
-        }, {
-          date: '2016-05-02',
-          name: '王小虎',
-          province: '上海',
-          city: '普陀区',
-          address: '上海市普陀区金沙江路 1518 弄',
-          zip: 200333,
-          txt:'123'
-        }, {
-          date: '2016-05-04',
-          name: '王小虎',
-          province: '上海',
-          city: '普陀区',
-          address: '上海市普陀区金沙江路 1518 弄',
-          zip: 200333,
-          txt:'eee'
-        }, {
-          date: '2016-05-01',
-          name: '王小虎',
-          province: '上海',
-          city: '普陀区',
-          address: '上海市普陀区金沙江路 1518 弄',
-          zip: 200333,
-          txt:'123'
-        }, {
-          date: '2016-05-08',
-          name: '王小虎',
-          province: '上海',
-          city: '普陀区',
-          address: '上海市普陀区金沙江路 1518 弄',
-          zip: 200333,
-           txt:'12w3'
-        }, {
-          date: '2016-05-06',
-          name: '王小虎',
-          province: '上海',
-          city: '普陀区',
-          address: '上海市普陀区金沙江路 1518 弄',
-          zip: 200333,
-          txt:'1232e3'
-        }, {
-          date: '2016-05-07',
-          name: '王小虎',
-          province: '上海',
-          city: '普陀区',
-          address: '上海市普陀区金沙江路 1518 弄',
-          zip: 200333,
-          txt:'12344'
-        }],
-
-        dataValue:''
+        loading: false,
+        dataValue: '',
+        tableList: []
       }
     },
     created() {
@@ -248,6 +188,82 @@
       }, {
         label: '手动维护转换规则'
       }])
+      //    获取表单数据
+      let param = {
+          projectId: this.projectId,
+          "Filters": "DatacenterSign = 1",
+          "Orders": "dcCategory",
+          "PageNumber": 1,
+          "PageSize": 1000,
+      }
+      this.loading = true
+      dectInfo(param).then(res=> {
+        this.loading = false
+        if(res.data.Result === 'success') {
+          console.log(res.data.Count,'count')
+          res.data.Content.length && res.data.Content.forEach(i => {
+            this.tableList.push({
+              majorName: i.CustomCategoryName,
+              major: i.CustomCategory,
+              dcName: i.DcCategoryName,
+              dc: i.DcCategory,
+              SwitchRule: '',
+              SwitchRuleDataplatform: '',
+              DatacenterSign: '',
+              DataplatformSign: '',
+            })
+            i.Content.length && i.Content.forEach(j => {
+              this.tableList.push({
+                sysName: j.CustomCategoryName,
+                sys: j.CustomCategory,
+                dcName: j.DcCategoryName,
+                dc: j.DcCategory,
+                SwitchRule: '',
+                SwitchRuleDataplatform: '',
+                DatacenterSign: '',
+                DataplatformSign: '',
+              })
+              j.Content.length && j.Content.forEach(k => {
+                this.tableList.push({
+                  type: 1,
+                  deviceName: k.CustomCategoryName,
+                  device: k.CustomCategory,
+                  dcName: k.DcCategoryName,
+                  dc: k.DcCategory,
+                  DatacenterSign: k.DatacenterSign,
+                  DataplatformSign: k.DataplatformSign,
+                  SwitchRule: k.SwitchRule,
+                  SwitchRuleDataplatform: k.SwitchRuleDataplatform,
+                  SchemeId: k.SchemeId
+                })
+                k.Content.length && k.Content.forEach(l => {
+                  this.tableList.push({
+                    type: 1,
+                    unitName: l.CustomCategoryName,
+                    Unit: l.CustomCategory,
+                    dcName: l.DcCategoryName,
+                    dc: l.DcCategory,
+                    DatacenterSign: l.DatacenterSign,
+                    DataplatformSign: l.DataplatformSign,
+                    SwitchRule: l.SwitchRule,
+                    SwitchRuleDataplatform: l.SwitchRuleDataplatform,
+                    SchemeId: l.SchemeId
+                  })
+                })
+              })
+            })
+          })
+        } else {
+          this.$message({
+            message: res.data.Message,
+            type: 'error'
+          })
+          this.back()
+        }
+      })
+    },
+    computed: {
+      ...mapGetters('layout', ['projectId','secret']),
     },
     methods: {
       back() {
@@ -256,9 +272,29 @@
       changOptions(val) {
         console.log(val)
       },
-      dataAndGlobal(index, val) {
+      dataAndGlobal(index, val, type) {
         console.log(index, val)
+        let param = []
+        if (type === 1) {
+          param.push({
+            projectId: this.projectId,
+            SchemeId: val.SchemeId,
+            CustomCategory: val.device,
+            SwitchRule: val.SwitchRule
+          })
+        }
+        if (type === 2) {
+          param.push({
+            projectId: this.projectId,
+            SchemeId: val.SchemeId,
+            CustomCategory: val.device,
+            SwitchRuleDataplatform: val.SwitchRuleDataplatform
+          })
+        }
+        dictUpdate(param, res => {
+        })
       }
+
     },
 
   }
@@ -266,8 +302,12 @@
 
 <style scoped lang="less">
   .data-table {
-    /deep/ .el-input__inner {
-      /*border-color: #f56c6c;*/
+
+
+    .danger-color {
+      /deep/ .el-input__inner {
+        border-color: #f56c6c !important;
+      }
     }
     label {
       margin-left: 20px;