chuwu 5 years ago
parent
commit
7d0a18f46f

+ 35 - 17
src/utils/handsontable/delType.js

@@ -1,23 +1,35 @@
 import tools from "@/utils/scan/tools"
 let tagsFun = (instance, td, row, col, prop, value, cellProperties) => {
-        if (!!value) {
-            let arr = value || [],
-                dom = ``;
-            arr.map(item => {
-                dom += `<span style="display: inline-block;line-height:25px;padding: 0px 10px;background: #FFF5E4;border: 1px solid #F5A623;border-radius: 100px;font-size: 12px;color: #F5A623;text-align: center;">${item}</span>`
-            })
-            td.innerHTML = dom
-            return td;
-        }
-        return td
+    if (!!value) {
+        let arr = value || [],
+            dom = ``;
+        arr.map(item => {
+            dom += `<span style="display: inline-block;line-height:25px;padding: 0px 10px;background: #FFF5E4;border: 1px solid #F5A623;border-radius: 100px;font-size: 12px;color: #F5A623;text-align: center;">${item}</span>`
+        })
+        td.innerHTML = dom
+        return td;
     }
-    /**
-     * 
-     * @param {表头数组} arr 
-     * @param {添加的参数} '
-     * 
-     * @returns {对应数组} arr
-     */
+    return td
+}
+
+let switchRenderer = (instance, td, row, col, prop, value, cellProperties) => {
+    // td.innerHTML = value
+    if (value) {
+        td.innerHTML = `<div role="switch" class="el-switch is-checked" aria-checked="true"><input type="checkbox" name="" true-value="true" class="el-switch__input"><!----><span class="el-switch__core" style="width: 40px; border-color: rgb(19, 206, 102); background-color: rgb(19, 206, 102);"></span><!----></div>`
+    } else {
+        td.innerHTML = `<span class="el-switch__core" style="width: 40px; border-color: #dcdfe6; background-color: #dcdfe6;"></span>`
+    }
+    return td
+}
+
+
+/**
+ * 
+ * @param {表头数组} arr 
+ * @param {添加的参数} '
+ * 
+ * @returns {对应数组} arr
+ */
 
 export function showTypes(arr, infosKey = '') {
     let data = arr.map(item => {
@@ -147,6 +159,12 @@ export function showTypes(arr, infosKey = '') {
                         data: item.DataSource || ""
                     }
                 }
+            } else if (item.InputMode == 'switchBtn') {
+                return {
+                    data: infosKey + item.InfoPointCode,
+                    renderer: switchRenderer,
+                    readOnly: true
+                }
             } else {
                 return undefined;
             }

+ 1 - 1
src/utils/point_edit/handson_header.js

@@ -179,7 +179,7 @@ let common = [{
     {
         InfoPointName: "使用",
         InfoPointCode: "Used",
-        InputMode: "B1",
+        InputMode: "switchBtn",
         Visible: true,
         FirstTag: ""
     },

+ 2 - 2
src/views/point/config_point/index.vue

@@ -3,8 +3,8 @@
         <div style="line-height:32px;">
             <span>此项目包括<i style="color:#409EFF;">{{list.length}}</i>个数据源</span>
             <div style="float:right;">
-                <el-button type="primary">同步配置文件到云端</el-button>
-                <el-button type="primary" @click="addItem">添加数据源</el-button>
+                <el-button>同步配置文件到云端</el-button>
+                <el-button @click="addItem">添加数据源</el-button>
             </div>
         </div>
         <div class="saga-origin-list" v-loading="isLoading">

+ 11 - 7
src/views/point/config_point/steps/step1.vue

@@ -1,13 +1,13 @@
 <template>
     <div id="handsonStep1">
         <div class="btns-view">
-            <el-button style="float:right;margin-top:4px;margin-left:10px;" type="primary" @click="saveData">保存</el-button>
-            <el-button style="float:right;margin-top:4px;" type="primary" @click="addRow">新增行</el-button>
-            <el-button style="float:right;margin-top:4px;" type="primary" @click="downData">下载数据</el-button>
-            <el-button style="float:right;margin-top:4px;" type="primary" @click="updateExcel = true">导入Excel</el-button>
-            <el-button style="float:right;margin-top:4px;" type="primary" @click="downloadExcel = true">导出Excel模板</el-button>
+            <el-button style="float:right;margin-top:4px;margin-left:10px;" @click="saveData">保存</el-button>
+            <el-button style="float:right;margin-top:4px;" @click="addRow">新增行</el-button>
+            <el-button style="float:right;margin-top:4px;" @click="downData">下载数据</el-button>
+            <el-button style="float:right;margin-top:4px;" @click="updateExcel = true">导入Excel</el-button>
+            <el-button style="float:right;margin-top:4px;" @click="downloadExcel = true">导出Excel模板</el-button>
             <el-checkbox style="float:right;line-height:40px;" @change="getData" v-model="checked">只显示使用的原始点位</el-checkbox>
-            <el-button type="primary">获取原始点位当前值</el-button>
+            <el-button>获取原始点位当前值</el-button>
         </div>
         <div id="handsontableSteps1" v-loading="isLoading">
             <handsontable-component v-if="!!allData.length" @delete="delePoint" ref="handsontable" @mouseDown="clickTable" @change="changeHand"></handsontable-component>
@@ -250,6 +250,9 @@
             clickTable(info, row) {
                 let activeCell = this.hot.getActiveEditor()
                 console.log(activeCell, 'activeCell')
+                if(activeCell.prop == "Used"){
+                    info.Used = !info.Used
+                }
                 if (activeCell.prop == "LocationFlag") {
                     this.renderData = info
                     this.localtionDialog = true
@@ -382,7 +385,6 @@
                     if (createList.length) {
                         this.createList(createList)
                     }
-                    this.getData()
                 } else {
                     this.$message.error("请确保存在数据")
                 }
@@ -395,6 +397,7 @@
                         await this.create(createList[i])
                     }
                 }
+                this.getData()
                 this.changeFlag = true
             },
             async create(obj) {
@@ -430,6 +433,7 @@
                     type: this.protocolType
                 }, res => {
                     console.log(res)
+                    this.getData()
                 })
             },
             //没有保存的时候弹窗

+ 6 - 6
src/views/point/config_point/steps/step2.vue

@@ -1,13 +1,13 @@
 <template>
     <div id="handsonStep2">
         <div class="btns-view">
-            <el-button type="primary">AI自动识别</el-button>
-            <el-button type="primary" @click="discern(1)">批量识别设备类型关键字</el-button>
-            <el-button type="primary" @click="discern(2)">批量识别设备参数关键字</el-button>
-            <el-button type="primary" @click="examine">检查&微调</el-button>
+            <el-button>AI自动识别</el-button>
+            <el-button @click="discern(1)">批量识别设备类型关键字</el-button>
+            <el-button @click="discern(2)">批量识别设备参数关键字</el-button>
+            <el-button @click="examine">检查&微调</el-button>
             <div style="float:right;">
-                <el-button type="primary" @click="reset">刷新</el-button>
-                <el-button type="primary" @click="saveData">保存</el-button>
+                <el-button @click="reset">刷新</el-button>
+                <el-button @click="saveData">保存</el-button>
             </div>
         </div>
         <div id="handsontableSteps1" v-loading="isLoading">

+ 2 - 2
src/views/point/config_point/steps/step3.vue

@@ -1,8 +1,8 @@
 <template>
     <div id="handsonStep2">
         <div class="btns-view">
-            <el-button type="primary" @click="dialogShow(1)">根据关键内容批量标准化设备标识</el-button>
-            <el-button type="primary" @click="dialogShow(2)">根据关键内容批量对应数据字典</el-button>
+            <el-button @click="dialogShow(1)">根据关键内容批量标准化设备标识</el-button>
+            <el-button @click="dialogShow(2)">根据关键内容批量对应数据字典</el-button>
             <el-checkbox style="float:right;" @change="changeChecked" v-model="checked">只显示未标准化得的原始点位</el-checkbox>
         </div>
         <div id="handsontableSteps1" v-if="pages.total">

+ 2 - 2
src/views/point/config_point/steps/step4.vue

@@ -1,8 +1,8 @@
 <template>
     <div class="h100 steps4">
         <div class="btns-view">
-            <el-button type="primary" @click="checkedAll">获取展开点位数据</el-button>
-            <el-button type="primary">获取全部点位数据</el-button>
+            <el-button @click="checkedAll">获取展开点位数据</el-button>
+            <el-button>获取全部点位数据</el-button>
         </div>
         <div class="center point-border">
             <el-radio-group v-model="activeIndex" @change="clickTabs">