Przeglądaj źródła

wanda-adm:feat > 修改回显操作,tab定位,最后时间展示

shaun-sheep 4 lat temu
rodzic
commit
d63ec802a3

+ 3 - 2
package.json

@@ -13,15 +13,16 @@
     "test:unit": "jest --clearCache && vue-cli-service test:unit"
   },
   "dependencies": {
+    "@babel/runtime": "^7.12.5",
     "@persagy-web/base": "2.2.1",
+    "@persagy-web/big": "2.2.48",
     "@persagy-web/draw": "2.2.12",
     "@persagy-web/graph": "2.2.44",
-    "@persagy-web/big": "2.2.48",
-    "@babel/runtime": "^7.12.5",
     "axios": "^0.21.1",
     "core-js": "^3.6.5",
     "element-ui": "^2.15.0",
     "js-cookie": "^2.2.1",
+    "moment": "^2.29.1",
     "normalize.css": "^8.0.1",
     "nprogress": "^0.2.0",
     "path-to-regexp": "^6.2.0",

+ 2 - 0
src/components/business/baseDataForm.vue

@@ -47,6 +47,8 @@
                                     v-else-if="item.dataType == 'DATETIME'"
                                     v-model="form[item.path]"
                                     placeholder="选择日期"
+                                    format="yyyy 年 MM 月 dd 日"
+                                    value-format="yyyy-MM-dd"
                                     type="date">
                                 </el-date-picker>
                                 <uploadImgs

+ 4 - 2
src/components/business/dataForm.vue

@@ -18,7 +18,7 @@
                         <el-tab-pane v-for="(item,index) in paneMsg" :key="index" :label="item"
                                      :name="index.toString()"/>
                     </el-tabs>
-                    <div class="table" style="height: 200px;overflow: auto">
+                    <div class="table" style="height: 194px;overflow: auto">
                         <el-row :gutter="18">
                             <el-col :span="item.dataType == 'ATTACHMENT'? 24:8"
                                     :key="item.path"
@@ -59,6 +59,8 @@
                                         v-else-if="item.dataType == 'DATETIME'"
                                         v-model="form[item.path]"
                                         placeholder="选择日期"
+                                        format="yyyy 年 MM 月 dd 日"
+                                        value-format="yyyy-MM-dd"
                                         type="date">
                                     </el-date-picker>
                                     <uploadImgs
@@ -132,7 +134,7 @@ export default class extends Vue {
         localId: [{ required: true, message: "请填写本地编码", trigger: 'blur' }],
     }
     // tabs数据
-    activeName = ""
+    activeName = 0
     header = {}
     form = {}
     paneMsg = []

+ 10 - 15
src/components/public/adm-multi-table.vue

@@ -12,7 +12,8 @@
         >
             <el-table-column prop="date" label="编辑" width="80" align="center" fixed>
                 <template slot-scope="scope">
-                    <span class="el-icon-edit el-input__icon" style="cursor: pointer" @click="handleEdit(scope.$index, scope.row)"> </span>
+                    <span class="el-icon-edit el-input__icon" style="cursor: pointer"
+                          @click="handleEdit(scope.$index, scope.row)"> </span>
                 </template>
             </el-table-column>
             <el-table-column v-for="item in headersStage" :key="item.name" :label="item.name" align="center">
@@ -51,14 +52,13 @@ export default class extends Vue {
         return row;
     }
 
-    get haderInfoMap() {
+    get headerInfoMap() {
         if (this.headersStage?.dictStages?.data?.length) {
-            const haderInfoMap: any = {};
+            const headerInfoMap: any = {};
             this.headersStage.dictStages.data.forEach((item: any) => {
-                haderInfoMap[item.path] = item;
+                headerInfoMap[item.path] = item;
             });
-            console.log(haderInfoMap);
-            return haderInfoMap;
+            return headerInfoMap;
         } else {
             return {};
         }
@@ -68,10 +68,10 @@ export default class extends Vue {
      * 表格特殊内容格式化处理
      */
     private formatContent(row: any, column: any, cellValue: any) {
-        const info = this.haderInfoMap[column.property];
+        const info = this.headerInfoMap[column.property];
         if (info && cellValue) { //有值且获取到表头信息
             const dataSource = info?.dataSource ? info.dataSource : [];
-            if (info.dataType === "ENUM" || info.dataType === "BOOLEAN") { //内容为单选枚举和布尔类型 
+            if (info.dataType === "ENUM" || info.dataType === "BOOLEAN") { //内容为单选枚举和布尔类型
                 const text = dataSource.find((item: any) => {
                     return item.code === cellValue;
                 })?.name;
@@ -87,6 +87,8 @@ export default class extends Vue {
                     }
                 }).filter((item: any) => item).join(",");
                 return textList;
+            } else if (info.dataType === "ATTACHMENT") { // 内容为附件类型
+                return cellValue.length + '个' || ''
             } else {
                 return cellValue;
             }
@@ -101,13 +103,6 @@ export default class extends Vue {
         });
     }
 
-    @Watch("tableData", { immediate: true, deep: true })
-    handleTableData(o: any, n: any) {
-        this.$nextTick(() => {
-            console.log(o, n);
-            // this.tableData = this.tableData
-        });
-    }
 }
 </script>
 

+ 3 - 1
src/main.ts

@@ -16,7 +16,9 @@ import '@/utils/directive' //自定义指令
 import "@/icons/components";
 import '@/assets/iconfont/iconfont.css'
 import "@/permission";
-
+import moment from "moment";
+Vue.prototype.moment = moment;
+moment.locale('zh-cn')
 Vue.use(uploader);
 Vue.use(ElementUI, { size: "small", zIndex: 1000 });
 Vue.use(SvgIcon, {

+ 17 - 11
src/views/maintain/device/index.vue

@@ -15,7 +15,9 @@
             </el-tabs>
             <div class="table" v-loading="loading">
                 <template v-if="deviceType.length > 0">
-                    <admMultiTable :currentHeader="currentHeader" @handleCurrentEdit="handleCurrentEdit"
+                    <admMultiTable :currentHeader="currentHeader"
+                                   @handleCurrentEdit="handleCurrentEdit"
+
                                    :tableData="tableData" :headersStage="headersStage"/>
                     <Pagination v-if="tableData.length > 0" :paginationList="paginationList"
                                 @handleCurrentChange="handleCurrentChange"
@@ -78,7 +80,7 @@
                         </span>
                     </template>
                     <template v-else>
-                            <dataForm :deviceHeaders="deviceHeaders" ref="dataForm" :currRowContent="currRowContent"/>
+                        <dataForm :deviceHeaders="deviceHeaders"  ref="dataForm" :currRowContent="currRowContent"/>
                         <span slot="footer" class="dialog-footer">
                          <el-button type="primary" @click="handleDataForm">确 定</el-button>
                          <el-button @click="handlePosition">维护位置</el-button>
@@ -97,7 +99,7 @@ import { AdmMultiTable, AdmSearch, dataForm, Pagination, Statistics } from '../c
 import { allDevice, BeatchQueryParam, dictInfo } from "@/api/equipComponent";
 import { createEquip, queryCount, queryEquip, updateEquip } from "@/api/datacenter";
 import { UserModule } from "@/store/modules/user";
-import deviceGraph from "./components/deviceGraph"
+import deviceGraph from "./components/deviceGraph.vue"
 import tools from "@/utils/maintain"
 
 
@@ -142,7 +144,7 @@ export default class extends Vue {
     // tabs数据
     paneMsg = []
     // 当前tabs值
-    activeName = ""
+    activeName = 0
     // 分页
     paginationList = {
         page: 1,
@@ -211,12 +213,12 @@ export default class extends Vue {
                 param2.filters += `;codeName contain '${ this.inputSearch }' or systemCategory contain '${ this.inputSearch }' or bimTypeId contain '${ this.inputSearch }' or localId contain '${ this.inputSearch }'`
             }
             let promise = new Promise(resolve => {
-                dictInfo(param).then(res => {
+                dictInfo(param).then((res: []) => {
                     resolve(res)
                 })
             })
             let promise2 = new Promise(resolve => {
-                queryEquip(param2).then(res => {
+                queryEquip(param2).then((res: []) => {
                     resolve(res)
                 })
             })
@@ -226,7 +228,7 @@ export default class extends Vue {
                 this.headerInformation = res[0] // 获取表头
                 this.tableData = res[1].content // 主体数据
                 this.paneMsg = res[0].dictStages.map(i => i.name)
-                this.currentHeader = this.paneMsg[0]
+                this.currentHeader = this.paneMsg[this.activeName]
                 this.headerStage()
                 this.paginationList.total = res[1].total
             })
@@ -412,7 +414,7 @@ export default class extends Vue {
     }
 
     // 编辑当前行
-    handleCurrentEdit(val) {
+    handleCurrentEdit(val: object) {
         this.status = '编辑'
         this.currRowContent = val
         this.handleNext()
@@ -435,10 +437,9 @@ export default class extends Vue {
         // @ts-ignore
         this.$refs.deviceGraph.cancelLocation()
     }
+
     // 保存
     saveLocation() {
-        alert(1)
-        return
         // @ts-ignore
         const data = this.$refs.deviceGraph.getLocation()
         if (data) {
@@ -455,6 +456,7 @@ export default class extends Vue {
             this.handleCreateEquip(this.curEquip);
         }
     }
+
     // 更新设备
     handleUpdateEquip(obj) {
         let pa;
@@ -471,6 +473,7 @@ export default class extends Vue {
             }
         })
     }
+
     // 创建设备
     handleCreateEquip(obj: any) {
         let pa;
@@ -487,11 +490,13 @@ export default class extends Vue {
             }
         })
     }
+
     // 重置
     resetLocation() {
         // @ts-ignore
         this.$refs.deviceGraph.resetLocation()
     }
+
     // 返回
     goBack() {
         this.displayLocation = false
@@ -639,7 +644,8 @@ $border: 1px solid #E1E7EA;
 
 .el-dialog {
     .el-dialog__body {
-        max-height: 500px !important;
+        padding: 20px;
+        max-height: 643px !important;
         min-height: 100px;
         overflow-y: auto;
         overflow-x: hidden;

+ 8 - 9
src/views/maintain/relationship/index.vue

@@ -45,12 +45,10 @@
                                 </el-col>
                             </el-row>
                             <article class="ship-card-time">
-                                <span v-show="relation.computationalState === 3">关系计算中...</span>
-                                <span v-show="relation.computationalState === 5">计算失败</span>
-                                <span
-                                    v-show="relation.computationalState !== 3  && relation.computingTime">最后一次计算时间 {{
-                                        relation.computingTime
-                                    }}</span>
+                                <span v-if="relation.computationalState === 3">关系计算中...</span>
+                                <span v-else-if="relation.computationalState === 5">计算失败</span>
+                                <span v-else-if="relation.computationalState !== 3  && relation.computingTime">最后一次计算时间 {{ relation.computingTime }}</span>
+                                <span v-else-if="relation.times">最后一次计算时间 {{ relation.times }}</span>
                                 <span style="float: right">
                                 <el-tooltip
                                     content="启动计算"
@@ -60,7 +58,6 @@
                                         :is-dot="relation.computationalState === 2 || relation.computationalState === 5">
                                         <el-button
                                             @click="computed(relation)"
-                                            :disabled="!relation.source && !relation.automatic"
                                             circle
                                             type=""
                                             plain
@@ -100,6 +97,7 @@
 <script lang="ts">
 import { Component, Vue } from "vue-property-decorator";
 import { relationshipCount, relationshipOverview } from "@/api/datacenter"
+import moment from "moment";
 @Component({
     name: "relationShip"
 })
@@ -159,8 +157,8 @@ export default class extends Vue {
         });
     }
 
-    computed() {
-
+    computed(relation) {
+        this.$set(relation, 'times', moment(Date.now()).format("YYYY-MM-DD HH:mm:ss"))
     }
 
     manual() {
@@ -251,6 +249,7 @@ export default class extends Vue {
         span {
             font-size: 12px;
             color: #C3C7CB;
+            line-height: 3;
         }
 
         .sm-button {

+ 11 - 60
src/views/maintain/space/index.vue

@@ -274,6 +274,7 @@ export default class spaceIndex extends Vue {
             }
         });
     }
+
     //改变楼层
     changeCascader() {
         if (this.building.length > 0) {
@@ -309,14 +310,14 @@ export default class spaceIndex extends Vue {
             } else if (this.building.length === 2) {
                 switch (this.building[1]) {
                     case "noKnow":
-                        param2.filters = `buildingId='${this.building[0]}';floorId='isnull'`;
+                        param2.filters = `buildingId='${ this.building[0] }';floorId='isnull'`;
 
                         break;
                     case "all":
-                        param2.filters = `buildingId='${this.building[0]}'`;
+                        param2.filters = `buildingId='${ this.building[0] }'`;
                         break;
                     default:
-                        param2.filters = `buildingId='${this.building[0]}';floorId='${this.building[1]}'`;
+                        param2.filters = `buildingId='${ this.building[0] }';floorId='${ this.building[1] }'`;
                 }
             }
 
@@ -386,29 +387,6 @@ export default class spaceIndex extends Vue {
                     if (item.outline) {
                         delete item.outline;
                     }
-                    // this.all.forEach(i => {
-                    //     const category = ['ENUM', 'MENUM', 'BOOLEAN']
-                    //     if (i.category == 'STATIC' && category.includes(i.dataType) && i.dataSource) {
-                    //         let inx = i.path.substr(i.path.indexOf('.') + 1)
-                    //         for (let l in item) {
-                    //             if (l == inx) {
-                    //                 if (i.dataSource) {
-                    //                     item[l] = i.dataSource.filter(i => item[l].includes(i.code)).map(item => item.name).join(',')
-                    //                 }
-                    //             }
-                    //         }
-                    //     }
-                    //     if (i.category == 'STATIC' && i.dataType == 'ATTACHMENT') {
-                    //         let inx = i.path.substr(i.path.indexOf('.') + 1)
-                    //         for (let l in item) {
-                    //             if (l == inx) {
-                    //                 item['sign/' + inx] = item[l]
-                    //                 item[l] = item[l].length
-                    //             }
-                    //         }
-                    //     }
-                    // })
-
                     // item = {
                     //     ...item,
                     //     outline: JSON.stringify(item.outline),
@@ -430,7 +408,6 @@ export default class spaceIndex extends Vue {
                             console.log(e);
                         }
                     }
-                    // console.log(this.codeToDataSource,' this.codeToDataSource')
                 });
                 this.getBatch(this.tableData);
             });
@@ -438,10 +415,12 @@ export default class spaceIndex extends Vue {
             console.log("void");
         }
     }
+
     // 图建筑楼层修改
     changeGraphCascader() {
         this.toGraph();
     }
+
     // 动态信息点
     getBatch(data) {
 
@@ -555,39 +534,8 @@ export default class spaceIndex extends Vue {
     }
 
     // 编辑当前行
-    handleCurrentEdit(val) {
-        // this.tableData.map(item => {
-        //     this.all.forEach(i => {
-        //         const category = ['ENUM', 'MENUM', 'BOOLEAN']
-        //         if (i.category == 'STATIC' && category.includes(i.dataType) && i.dataSource) {
-        //             let inx = i.path.substr(i.path.indexOf('.') + 1)
-        //             for (let l in item) {
-        //                 if (l == inx) {
-        //                     if (i.dataSource) {
-        //                         item[l] = i.dataSource.filter(i => item[l].includes(i.name)).map(item => item.code).join(',')
-        //                     }
-        //                 }
-        //             }
-        //             for (let l in val) {
-        //                 if (l == inx) {
-        //                     if (i.dataSource) {
-        //                         val[l] = i.dataSource.filter(i => val[l].includes(i.name)).map(item => item.code).join(',')
-        //                     }
-        //                 }
-        //             }
-        //         }
-        //         if (i.category == 'STATIC' && i.dataType == 'ATTACHMENT') {
-        //             let inx = i.path.substr(i.path.indexOf('.') + 1)
-        //             for (let l in item) {
-        //                 if (l == inx) {
-        //                     item[l] = item['sign/' + inx]
-        //                 }
-        //             }
-        //         }
-        //     })
-        // })
+    handleCurrentEdit(val: object) {
         this.currRowContent = val
-        console.log(val)
         let pic = this.headersStage.dictStages.data.filter(i => i.dataType == 'ATTACHMENT')
         let base = this.headersStage.dictStages.data.filter(i => i.dataType != 'ATTACHMENT')
         this.headersStage.dictStages.data = pic.length > 0 ? [...base, ...pic] : [...base]
@@ -668,9 +616,11 @@ export default class spaceIndex extends Vue {
                     margin-left: 16px;
                 }
             }
+
             .borderBottom {
                 border-bottom: 1px solid #e1e7ea;
             }
+
             .graph {
                 height: calc(100% - 64px);
             }
@@ -688,7 +638,8 @@ export default class spaceIndex extends Vue {
 .adm-space {
     .el-dialog {
         .el-dialog__body {
-            max-height: 500px !important;
+            padding: 20px;
+            max-height: 643px !important;
             min-height: 100px;
             overflow-y: auto;
             overflow-x: hidden;

+ 2 - 1
src/views/maintain/system/index.vue

@@ -503,7 +503,8 @@ $border: 1px solid #e1e7ea;
 
     .el-dialog {
         .el-dialog__body {
-            max-height: 500px !important;
+            padding: 20px;
+            max-height: 643px !important;
             min-height: 100px;
             overflow-y: auto;
             overflow-x: hidden;