Procházet zdrojové kódy

Merge branch 'test' of http://39.106.8.246:3003/web/wanda-bm-guide into develop

yunxing před 4 roky
rodič
revize
be4d950d85

+ 1 - 1
public/systemConf.js

@@ -29,4 +29,4 @@ var __systemConf = {
         // wandaBmGuideUrl: 'http://192.168.200.13:8090/wandaBmGuide/', //管理书地址
     },
 }
-window.__systemConf = __systemConf
+window.__systemConf = __systemConf

+ 23 - 1
src/lib/GraphView.js

@@ -2,7 +2,7 @@ import { SCanvasView, SColor } from "@saga-web/draw/lib";
 export class GraphView extends SCanvasView {
     constructor(id) {
         super(id);
-        // 0 :line 1:area
+        // 0 :line 1:area 2:img
         this._type = 0;
         // 线条颜色
         this._strokecolor = "";
@@ -12,6 +12,8 @@ export class GraphView extends SCanvasView {
         this._lineType = "";
         //线条粗细
         this._lineWidth = 1;
+        /** 图片地址 */
+        this._url = "";
     }
     get type() {
         return this._type;
@@ -48,6 +50,20 @@ export class GraphView extends SCanvasView {
         this._lineWidth = v;
         this.update();
     }
+    get url() {
+        return this._url;
+    }
+    set url(v) {
+        this._url = v;
+        this.img = new Image();
+        this.img.src = v;
+        this.img.onload = () => {
+            this.update();
+        };
+        this.img.onerror = (e) => {
+            this.update();
+        };
+    }
     onDraw(canvas) {
         canvas.clearRect(0, 0, this.width, this.height);
         canvas.pen.lineWidth = this.lineWidth;
@@ -65,5 +81,11 @@ export class GraphView extends SCanvasView {
         else if (this.type == 1) {
             canvas.drawRect(50, 28, 100, 57);
         }
+        else if (this.type == 2) {
+            if (this.img) {
+                console.log(this.img);
+                canvas.drawImage(this.img, 86, 43, 28, 28);
+            }
+        }
     }
 }

+ 26 - 3
src/lib/GraphView.ts

@@ -1,7 +1,7 @@
 import { SCanvasView, SColor, SPainter } from "@saga-web/draw/lib"
 
 export class GraphView extends SCanvasView {
-    // 0 :line 1:area
+    // 0 :line 1:area 2:img
     _type: number = 0;
     get type(): number {
         return this._type
@@ -41,7 +41,6 @@ export class GraphView extends SCanvasView {
     }
 
     //线条粗细
-
     private _lineWidth: number = 1;
     get lineWidth(): number {
         return this._lineWidth
@@ -51,6 +50,26 @@ export class GraphView extends SCanvasView {
         this.update()
     }
 
+    /** 图片dom */
+    img: CanvasImageSource | undefined;
+
+    /** 图片地址 */
+    private _url: string = "";
+    get url(): string {
+        return this._url;
+    }
+    set url(v: string) {
+        this._url = v;
+        this.img = new Image();
+        this.img.src = v;
+        this.img.onload = (): void => {
+            this.update();
+        };
+        this.img.onerror = (e): void => {
+            this.update();
+        };
+    }
+
     constructor(id: string) {
         super(id)
     }
@@ -69,8 +88,12 @@ export class GraphView extends SCanvasView {
         if (this.type == 0) {
             canvas.drawLine(80, 57, 120, 57);
         } else if (this.type == 1) {
-
             canvas.drawRect(50, 28, 100, 57);
+        } else if (this.type == 2) {
+            if (this.img) {
+                console.log(this.img)
+                canvas.drawImage(this.img, 86, 43, 28, 28)
+            }
         }
     }
 }

+ 16 - 17
src/views/equipment/table/eqDetaileDialog.vue

@@ -13,20 +13,20 @@
                 clearable
                 @blur='queryTableList'
             ></el-input>
-            <Select v-model='sbglgs' width='180' tipPlace='top' caption='管理归属' size='small' :selectdata='sbglgsOption' @change='queryTableList'></Select>
+            <Select v-model='sbglgs' width='180' tipPlace='top' caption='管理归属' size='small' :selectdata='sbglgsOption' @change='queryTableList'></Select>
             <Select
                 width='146'
                 style='margin: 0 12px;'
                 v-model='status'
                 tipPlace='top'
-                caption='设备状态'
+                caption='设备状态'
                 size='small'
                 :selectdata='statusOption'
                 @change='queryTableList'
             ></Select>
             <el-input
                 placeholder='搜索品牌、型号'
-                style='width:192px;margin-right:12px'
+                style='width:180px;margin-right:12px'
                 size='small'
                 clearable
                 prefix-icon='el-icon-search'
@@ -34,7 +34,7 @@
                 @blur='queryTableList'
             ></el-input>
             <Select
-                width='120'
+                width='150'
                 style='margin-right:12px;'
                 v-model='floor'
                 tipPlace='top'
@@ -43,16 +43,16 @@
                 :selectdata='floorSelect'
                 @change='queryTableList'
             ></Select>
-            <el-input placeholder='搜索安装位置' clearable style='width:192px;margin-right:12px' size='small' prefix-icon='el-icon-search' v-model='wzjc'></el-input>
+            <el-input placeholder='搜索安装位置' clearable style='width:180px;margin-right:12px' size='small' prefix-icon='el-icon-search' v-model='wzjc'></el-input>
             <!-- 多余的筛选 -->
             <input-dialog :type='1' @confirm='confirm'></input-dialog>
         </div>
         <el-table :data='tableData' :border='true' style='width: 100%;amrgin-bottom:30px'>
-            <el-table-column type='index' label='序号' width='60' :index="indexMethod"></el-table-column>
-            <el-table-column prop='sbjc' label='设备名称' show-overflow-tooltip resizable min-width="150">
+            <el-table-column type='index' label='序号' width='60' :index='indexMethod'></el-table-column>
+            <el-table-column prop='sbjc' label='设备名称' show-overflow-tooltip resizable min-width='150'>
                 <template slot-scope='{row}'>{{row.sbjc || '--'}}</template>
             </el-table-column>
-            <el-table-column prop='assetnum' label='设备编号' show-overflow-tooltip resizable width="80">
+            <el-table-column prop='assetnum' label='设备编号' show-overflow-tooltip resizable width='80'>
                 <template slot-scope='{row}'>{{row.assetnum || '--'}}</template>
             </el-table-column>
             <el-table-column prop='sl' label='数量' width='80'>
@@ -61,22 +61,22 @@
             <el-table-column prop='sbglgs' label='管理归属' show-overflow-tooltip resizable>
                 <template slot-scope='{row}'>{{row.sbglgs || '--'}}</template>
             </el-table-column>
-            <el-table-column prop='sb_status' label='设备状态' width="80">
+            <el-table-column prop='sb_status' label='设备状态' width='80'>
                 <template slot-scope='{row}'>{{row.sb_status || '--'}}</template>
             </el-table-column>
-            <el-table-column prop='brand' label='品牌' show-overflow-tooltip resizable width="80">
+            <el-table-column prop='brand' label='品牌' show-overflow-tooltip resizable width='80'>
                 <template slot-scope='{row}'>{{row.brand || '--'}}</template>
             </el-table-column>
-            <el-table-column prop='sbxh' label='型号' show-overflow-tooltip resizable width="80">
+            <el-table-column prop='sbxh' label='型号' show-overflow-tooltip resizable width='80'>
                 <template slot-scope='{row}'>{{row.sbxh || '--'}}</template>
             </el-table-column>
             <el-table-column prop='floor' sortable label='楼层' width='80'>
                 <template slot-scope='{row}'>{{row.floorcode || '--'}}</template>
             </el-table-column>
-            <el-table-column prop='wzjc' label='安装位置' show-overflow-tooltip resizable min-width="150">
+            <el-table-column prop='wzjc' label='安装位置' show-overflow-tooltip resizable min-width='150'>
                 <template slot-scope='{row}'>{{row.wzjc || '--'}}</template>
             </el-table-column>
-            <el-table-column prop='manufacturer' label='生产厂商' show-overflow-tooltip resizable min-width="150">
+            <el-table-column prop='manufacturer' label='生产厂商' show-overflow-tooltip resizable min-width='150'>
                 <template slot-scope='{row}'>{{row.manufacturer || '--'}}</template>
             </el-table-column>
             <el-table-column prop='fws' label='服务商' show-overflow-tooltip resizable>
@@ -136,7 +136,6 @@ export default {
     },
     props: ['row', 'major'],
     mounted() {
-        this.floor = this.$cookie.get('floorMapId')
         this.queryTableList()
         this.tabFind()
     },
@@ -278,13 +277,13 @@ export default {
             },
             deep: true
         },
-        sbglgs(){
+        sbglgs() {
             this.queryTableList()
         },
-        status(){
+        status() {
             this.queryTableList()
         },
-        floor(){
+        floor() {
             this.queryTableList()
         }
     }

+ 1 - 1
src/views/equipment/table/eqListTable.vue

@@ -25,7 +25,7 @@
                 @cancel='getList'
                 v-model='floor'
                 style='margin-right:12px;'
-                width='120'
+                width='160'
                 tipPlace='top'
                 caption='楼层 :'
                 :selectdata='floorSelect'

+ 1 - 1
src/views/equipment/table/standTable.vue

@@ -25,7 +25,7 @@
                 @cancel='getList'
                 v-model='floor'
                 style='margin-right:12px;'
-                width='120'
+                width='160'
                 tipPlace='top'
                 caption='楼层 :'
                 :selectdata='floorSelect'

+ 4 - 4
src/views/equipment/table/wbTable.vue

@@ -24,9 +24,9 @@
                 @change='getList'
                 v-model='ischange'
                 style='margin-right:12px'
-                width='200'
+                width='220'
                 tipPlace='top'
-                caption='是否更换配件信息 :'
+                caption='是否更换:'
                 :selectdata='changeOption'
             ></Select>
             <!-- placeholder='选择填报时间' -->
@@ -99,10 +99,10 @@
                     <div v-else>{{'---'}}</div>
                 </template>
             </el-table-column>
-            <el-table-column prop='reportdate' label='填报时间' width='130'>
+            <el-table-column prop='reportdate' label='填报时间' width='140'>
                 <template slot-scope='{row}'>{{row.reportdate?formatter(row.reportdate):'--'}}</template>
             </el-table-column>
-            <el-table-column prop='sjjssj' label='验收时间' width='130'>
+            <el-table-column prop='sjjssj' label='验收时间' width='140'>
                 <template slot-scope='{row}'>{{row.sjjssj?formatter(row.sjjssj): '--'}}</template>
             </el-table-column>
             <el-table-column prop='wonum' label='任务编号' show-overflow-tooltip resizable width='90'>

+ 5 - 5
src/views/equipment/table/wxTable.vue

@@ -24,9 +24,9 @@
                 @change='getList'
                 style='margin-right:12px;'
                 v-model='ischange'
-                width='200'
+                width='220'
                 tipPlace='top'
-                caption='是否更换配件信息 :'
+                caption='是否更换:'
                 :selectdata='changeOption'
             ></Select>
             <!-- placeholder='选择填报时间' -->
@@ -89,7 +89,7 @@
                 <el-table-column prop='cost' label='费用(万元)' width='80'>
                     <template slot-scope='{row}'>{{number_format(row.cost,2) || '--'}}</template>
                 </el-table-column>
-                <el-table-column prop='source' label='费用出处' show-overflow-tooltip resizable width="100">
+                <el-table-column prop='source' label='费用出处' show-overflow-tooltip resizable width='100'>
                     <template slot-scope='{row}'>{{row.source || '--'}}</template>
                 </el-table-column>
             </el-table-column>
@@ -99,10 +99,10 @@
                     <div v-else>{{'---'}}</div>
                 </template>
             </el-table-column>
-            <el-table-column prop='reportdate' label='填报时间' width='130'>
+            <el-table-column prop='reportdate' label='填报时间' width='140'>
                 <template slot-scope='{row}'>{{row.reportdate?formatter(row.reportdate): '--'}}</template>
             </el-table-column>
-            <el-table-column prop='sjjssj' label='验收时间' width='130'>
+            <el-table-column prop='sjjssj' label='验收时间' width='140'>
                 <template slot-scope='{row}'>{{row.sjjssj?formatter(row.sjjssj): '--'}}</template>
             </el-table-column>
             <el-table-column prop='wonum' label='工单编号' show-overflow-tooltip resizable width='80'>

+ 39 - 39
src/views/legendLibrary/addForm.vue

@@ -42,11 +42,7 @@
             <div v-show='ruleForm.Type=="Zone" || ruleForm.Type=="Image" || ruleForm.Type =="Line"'>
                 <div style='color:#646C73'>展示预览</div>
                 <div class='input-right' ref='graph'>
-                    <div v-show=' ruleForm.Type=="Image" && ruleForm.Url' class='input-right'>
-                        <img :key='key' :src='`/serve/topology-wanda/Picture/query/${ruleForm.Url}`' alt />
-                        <!-- {{ruleForm.Url}} -->
-                    </div>
-                    <canvas id='canvas' :width='canvasWidth' :height='canvasHeight' v-show='!(ruleForm.Type=="Image" && ruleForm.Url)'></canvas>
+                    <canvas id='canvas' :width='canvasWidth' :height='canvasHeight' v-show='!ruleForm.Url'></canvas>
                 </div>
             </div>
         </div>
@@ -105,7 +101,7 @@
         <div v-if='ruleForm.Type!="None"' class='form4'>
             <div class='form4-top'>
                 <span class='form4-span1'>专业/设备、位置类型</span>
-                <span class='form4-span3'>铺位可视化typeid</span>
+                <span class='form4-span3' v-if='ruleForm.Type!="Line"'>铺位可视化typeid</span>
             </div>
             <div class='form3-bottom'>
                 <span class='device-list'>
@@ -125,6 +121,7 @@
                     />
                 </span>
                 <TreeSelect
+                    v-if='ruleForm.Type!="Line"'
                     tipPlace='top'
                     width='200'
                     :notNull='true'
@@ -217,9 +214,9 @@ export default {
             view: null,
             scene: null,
             typeVisualization: [],
-
             // majorList: [], //专业
             deviceList: [],
+            formData: [], //上传乳品的formdata
             key: 1,
             InfoLocals: undefined, //工程信息化
             // InfoSystems: undefined, //工程信息化专业/系统
@@ -240,23 +237,15 @@ export default {
             // console.log(file, fileList, 'file')
             this.ruleForm.Url = ''
         },
+        //获取上传图片的信息 canvas得到图的url
         getFile(file) {
-            // let imgSrc = document.querySelector('.input-right>img')
-            // console.log(imgSrc)
             this.file = file.file
-            var formData = new FormData()
-            formData.append('file', file.file)
-            if (this.ruleForm.Url) {
-                formData.append('uid', this.ruleForm.Url)
+            var reader = new FileReader()
+            reader.readAsDataURL(this.file)
+            reader.onload = e => {
+                console.log(this.view)
+                this.view.url = e.target.result
             }
-            let postParams = formData
-            uploadImg({ postParams }).then(res => {
-                if (res.Result == 'success') {
-                    this.key++
-                    this.$set(this.ruleForm, 'Url', res.EntityList[0])
-                    this.$message.success('图标上传成功!')
-                }
-            })
         },
         create() {
             //新增
@@ -315,6 +304,10 @@ export default {
             this.view.strokecolor = this.ruleForm.Color
             this.view.lineType = this.ruleForm.LineDash
             this.view.lineWidth = this.ruleForm.LineWidth
+            if (this.ruleForm.Url) {
+                let url = `/serve/topology-wanda/Picture/query/${this.ruleForm.Url}`
+                this.view.url = url
+            }
         },
         initGraph() {
             if (this.ruleForm.Type == 'Zone' || this.ruleForm.Type == 'Line' || this.ruleForm.Type == 'Image') {
@@ -449,27 +442,32 @@ export default {
             }
             return new File([u8arr], filename, { type: mime })
         },
+        // 把canvas图保存到图片服务器
         saveImg() {
             let vm = this
             if (this.view) {
                 let data = this.view.canvasView.toDataURL('image/png')
                 var formData = new FormData()
-                formData.append('file', this.base64ToFile(data))
+                if (this.ruleForm.Type == 'Zone' || this.ruleForm.Type == 'Line') {
+                    formData.append('file', this.base64ToFile(data))
+                } else {
+                    formData.append('file', this.file)
+                }
                 let postParams = formData
                 uploadImg({ postParams }).then(res => {
                     if (res.Result == 'success') {
                         this.$set(vm.ruleForm, 'Url', res.EntityList[0])
                         this.$message.success('图标上传成功!')
-                        if (this.title == '添加图例库') {
-                            this.create()
-                            this.$emit('addSuccess')
-                            this.view.canvas.clearRect(0, 0, this.width, this.height)
-                        } else if (this.title == '修改图例库') {
-                            this.update()
-                            this.$emit('updateSuccess')
-                            this.view.canvas.clearRect(0, 0, this.width, this.height)
-                        } else {
-                        }
+                        // if (this.title == '添加图例库') {
+                        //     this.create()
+                        //     this.$emit('addSuccess')
+                        //     this.view.canvas.clearRect(0, 0, this.width, this.height)
+                        // } else if (this.title == '修改图例库') {
+                        //     this.update()
+                        //     this.$emit('updateSuccess')
+                        //     this.view.canvas.clearRect(0, 0, this.width, this.height)
+                        // } else {
+                        // }
                     }
                 })
             }
@@ -546,14 +544,16 @@ export default {
             this.changeLineType(this.ruleForm.LineDash)
             this.initGraph()
         }
-    },
-    updated() {
-        if (this.title == '修改图例库') {
-            this.changeLineWidth(this.ruleForm.LineWidth)
-            this.changeLineType(this.ruleForm.LineDash)
-            this.initGraph()
-        }
     }
+    // updated() {
+    //     this.initQueryDeviceAndPOsition()
+    //     this.visualization()
+    //     if (this.title == '修改图例库') {
+    //         this.changeLineWidth(this.ruleForm.LineWidth)
+    //         this.changeLineType(this.ruleForm.LineDash)
+    //         this.initGraph()
+    //     }
+    // }
 }
 </script>
 

+ 9 - 11
src/views/legendLibrary/addLegend.vue

@@ -59,7 +59,6 @@ export default {
             dialogVisible: false,
             InfoTypeIdList: [],
             InfosList: [],
-
             info: {
                 Name: '',
                 Type: 'None',
@@ -155,8 +154,8 @@ export default {
             }
             this.InfoTypeIdList = []
             this.InfosList = []
-
             this.$refs.add.fileList = []
+            this.$emit('cancal', this.info)
         },
         mesg() {
             this.$emit('mesg')
@@ -174,16 +173,15 @@ export default {
                 this.$message.info('请填写图例名称')
                 return false
             } else {
-                if (this.info.Type != 'Image' && this.info.Type != 'None') {
+                if (this.info.Type != 'None') {
                     this.$refs.add.saveImg()
-                } else {
-                    if (this.title == '添加图例库') {
-                        this.$refs.add.create()
-                        this.$emit('addSuccess')
-                    } else if (this.title == '修改图例库') {
-                        this.$refs.add.update()
-                        this.$emit('updateSuccess')
-                    }
+                } 
+                if (this.title == '添加图例库') {
+                    this.$refs.add.create()
+                    this.$emit('addSuccess')
+                } else if (this.title == '修改图例库') {
+                    this.$refs.add.update()
+                    this.$emit('updateSuccess')
                 }
                 this.dialogVisible = false
                 // if (!this.title || this.info.Type == 'None') {

+ 11 - 4
src/views/legendLibrary/index.vue

@@ -104,7 +104,7 @@
                     @clear='keyword = ""'
                 ></el-input>
             </div>
-            <el-table :data='tableData' :key='key' :border='true' style='width: 100%'>
+            <el-table :data='tableData' v-loading='loading' :key='key' :border='true' style='width: 100%'>
                 <el-table-column prop='Name' label='图例名称' width='120'>
                     <template slot-scope='{row}'>{{row.Name }}</template>
                 </el-table-column>
@@ -160,7 +160,7 @@
                 ></el-pagination>
             </div>
         </div>
-        <add-legend ref='addLegend' @updateSuccess='updateSuccess' @addSuccess='addSuccess'></add-legend>
+        <add-legend ref='addLegend' @updateSuccess='updateSuccess' @addSuccess='addSuccess' @cancal='cancal'></add-legend>
         <Modal :show='modalStatusTip' title='确定要作废图例吗?' mode='tip' type='error' @close='modalStatusTip=false'>
             <template #content>作废后则不可更改</template>
             <template #handle>
@@ -267,6 +267,7 @@ export default {
     components: { addLegend, Select },
     data() {
         return {
+            loading: true,
             deleteObject: {},
             modalStatusTip: false,
             tableData: [],
@@ -288,7 +289,6 @@ export default {
                 { id: '0', name: '图例库管理' },
                 { id: '1', name: '图例绘制规则' }
             ],
-
             typeOptions: [
                 {
                     id: 'all',
@@ -318,7 +318,6 @@ export default {
             currentPage: 1,
             state: '1',
             position: [],
-
             positionSelect: [],
             keyword: undefined,
             typeVisualization: [],
@@ -359,6 +358,12 @@ export default {
                 this.positionSelect = res.Content && res.Content.map(i => this.getTree(i))
             })
         },
+        //监听取消 修改的时候取消会导致表格不刷新
+        cancal(info) {
+            console.log(info)
+            this.key++
+            this.getTableList()
+        },
         dumpRules() {
             this.$router.push('/home/legendRules')
         },
@@ -467,6 +472,7 @@ export default {
             let data = {}
             queryRelation({ data, postParams }).then(res => {
                 this.tableData = res.data.Content
+                this.loading = false
                 this.total = res.Total
             })
         },
@@ -494,6 +500,7 @@ export default {
                         }
                         return i
                     })
+                this.loading = false
                 console.log(this.tableData)
             })
         },

+ 3 - 0
src/views/legendRules/index.vue

@@ -313,6 +313,9 @@ export default {
     .el-tree {
         background: rgba(247, 249, 250, 1);
     }
+    /deep/.ant-tree li .ant-tree-node-content-wrapper {
+        width: 90%;
+    }
     .is-current {
         background: #e1f2ff !important;
         border-radius: 4px;