Quellcode durchsuchen

'重构多选文件'

shaun-sheep vor 5 Jahren
Ursprung
Commit
9c3f195244

+ 5 - 5
src/components/business_space/dialogs/list/firm.vue

@@ -26,7 +26,7 @@
             <el-table-column header-align='center' prop="name" label="型号"></el-table-column>
             <el-table-column header-align='center' label="技术参数">
               <template slot-scope="scope">
-                <el-button type="text"v-show="scope.row.name"  @click="lookParam(scope.row)">技术参数</el-button>
+                <el-button type="text"  @click="lookParam(scope.row)">技术参数</el-button>
               </template>
             </el-table-column>
           </el-table>
@@ -51,11 +51,11 @@
   </el-dialog>
 </template>
 <script>
-import myPagination from "@/components/common/myPagination";
-import paramDetails from "@/components/business_space/dialogs/list/paramDetails"
-import { getSpecList } from "@/api/scan/request"
+    import myPagination from "@/components/common/myPagination";
+    import paramDetails from "@/components/business_space/dialogs/list/paramDetails"
+    import {getSpecList} from "@/api/scan/request"
 
-export default {
+    export default {
   components: {
     myPagination,
     paramDetails

+ 126 - 106
src/components/dialogs/list/batchDialog.vue

@@ -39,9 +39,8 @@
                         v-for="(city,index) in newFirm"
                         :label="city"
                         :key="index"
-
                     >
-                        <span @click="fourVendors(city)"> {{city.name}}:</span>
+                        <span @click="fourVendors(city.code)"> {{city.name}}:</span>
                         <span>{{city.rname}}</span>
                     </el-checkbox>
                 </el-checkbox-group>
@@ -58,20 +57,58 @@
                     <el-radio :label="2">以覆盖方式维护</el-radio>
                 </el-radio-group>
                 <div style="margin: 15px "></div>
-                <el-checkbox-group
-                    v-model="checkedFile"
-                    @change="handleCheckedFileChange"
-                >
-                    <el-checkbox
-                        v-for="(file,index) in newFolder"
-                        :label="file"
-                        :key="index"
+                <!--                <el-checkbox-group-->
+                <!--                    v-model="checkedFile"-->
+                <!--                    @change="handleCheckedFileChange"-->
+                <!--                >-->
+                <!--                    <el-checkbox-->
+                <!--                        v-for="(file,index) in newFolder"-->
+                <!--                        :label="file"-->
+                <!--                        :key="index"-->
 
-                    >
-                        <span @click="fourVendors(file)"> {{file.name}}:</span>
-                        <span v-for="name in file.img">{{name}}   </span>
-                    </el-checkbox>
-                </el-checkbox-group>
+                <!--                    >-->
+                <!--                        <span @click="fourVendors(file)"> {{file.name}}:</span>-->
+                <!--                        <span v-for="name in file.img">{{name}}   </span>-->
+                <!--                    </el-checkbox>-->
+                <!--                </el-checkbox-group>-->
+                <div class="checkbox">
+                    <p>
+                        <el-checkbox @change="multiple('archive')">
+                            {{information.archive.name}}
+                        </el-checkbox>
+                        <span v-for="item in information.archive.Archive">{{item | filterImgName}}</span>
+                    </p>
+                    <p>
+                        <el-checkbox @change="multiple('checkPoint')">
+                            {{information.checkPoint.name}}
+                        </el-checkbox>
+                        <span v-for="item in information.checkPoint.CheckReport">{{item | filterImgName}}</span>
+
+                    </p>
+                    <p>
+                        <el-checkbox>{{information.drawing.name}}</el-checkbox>
+                    </p>
+                    <p>
+                        <el-checkbox>{{information.installDrawing.name}}</el-checkbox>
+                    </p>
+
+                    <p>
+                        <el-checkbox>{{information.installPic.name}}</el-checkbox>
+                    </p>
+                    <p>
+                        <el-checkbox @change="multiple('insuranceFile')">
+                            {{information.insuranceFile.name}}
+                        </el-checkbox>
+                        <span v-for="item in information.insuranceFile.InsuranceFile">{{item | filterImgName}}</span>
+
+                    </p>
+                    <p>
+                        <el-checkbox>{{information.pic.name}}</el-checkbox>
+                    </p>
+                    <p>
+                        <el-checkbox>{{information.nameplate.name}}</el-checkbox>
+                    </p>
+                </div>
             </section>
             <el-button
                 style="margin-top: 12px"
@@ -96,22 +133,25 @@
                 />
                 <el-table-column
                     label="设备本地名称"
-                    width="120"
+                    width=""
                 >
-                    <template slot-scope="scope">{{scope.row.date}}</template>
+                    <template slot-scope="scope">{{scope.row.EquipLocalName}}</template>
                 </el-table-column>
                 <el-table-column
-                    prop="name"
+                    prop="EquipLocalID"
                     label="设备本地编码"
                     width="120"
                 />
                 <el-table-column
-                    prop="address"
+                    prop="build"
                     label="所属建筑楼层"
                     show-overflow-tooltip
                 />
             </el-table>
-
+            <my-pagination
+                @change="getAllData"
+                :page="page"
+            ></my-pagination>
             <el-button @click="maintenanceAll">维护所有</el-button>
             <el-button
                 type="primary"
@@ -123,10 +163,12 @@
 </template>
 
 <script>
+    import myPagination from "@/components/ledger/lib/myPagination"
 
     export default {
         name: "batchDialog",
-        props: ['firmName', 'fileDataType'],
+        props: ['firmName', 'allObject', 'page','information'],
+        components: {myPagination},
         data() {
             return {
                 batchDialog: false,//dialog
@@ -134,7 +176,8 @@
                 checkAll: false,//全选
                 isIndeterminate: true,
                 checkedCities: [],//选择的项,单项
-                firm: [{
+                firm: [
+                    {
                     name: "品牌型号",
                     code: "DPManufacturerID",
                     num: 2,
@@ -150,84 +193,21 @@
                     name: "保险公司信息",
                     code: "DPInsurerID",
                     num: 42
-                }],
-                folder: [{
-                    name: '保险文件',
-                    code: 'LedgerParam.InsuranceDoc.InsuranceFile',
-                    num: 11
-                },
-                    {
-                        name: '设备铭牌照片',
-                        code: 'LedgerParam.PhotoDoc.Nameplate',
-                        num: 12
-                    },
-                    {
-                        name: '设备图纸',
-                        code: 'LedgerParam.PhotoDoc.Drawing',
-                        num: 13
-                    },
-                    {
-                        name: '设备文档',
-                        code: 'LedgerParam.PhotoDoc.Archive',
-                        num: 14
-                    },
-                    {
-                        name: '设备照片',
-                        code: 'LedgerParam.PhotoDoc.Pic',
-                        num: 15
-                    },
-                    {
-                        name: '安装图纸',
-                        code: 'LedgerParam.Siteinstall.InstallDrawing',
-                        num: 16
-                    },
-                    {
-                        name: '安装照片',
-                        code: 'LedgerParam.Siteinstall.InstallPic',
-                        num: 17
-                    },
-                    {
-                        name: '安装质检报告',
-                        code: 'LedgerParam.Siteinstall.CheckReport',
-                        num: 18
                     }
                 ],
+
                 radio: 1,
                 checkedFile: [],//多项
-                tableData: [{
-                    date: '2016-05-03',
-                    name: '王小虎',
-                    address: '上海市普陀区金沙江路 1518 弄'
-                }, {
-                    date: '2016-05-02',
-                    name: '王小虎',
-                    address: '上海市普陀区金沙江路 1518 弄'
-                }, {
-                    date: '2016-05-04',
-                    name: '王小虎',
-                    address: '上海市普陀区金沙江路 1518 弄'
-                }, {
-                    date: '2016-05-01',
-                    name: '王小虎',
-                    address: '上海市普陀区金沙江路 1518 弄'
-                }, {
-                    date: '2016-05-08',
-                    name: '王小虎',
-                    address: '上海市普陀区金沙江路 1518 弄'
-                }, {
-                    date: '2016-05-06',
-                    name: '王小虎',
-                    address: '上海市普陀区金沙江路 1518 弄'
-                }, {
-                    date: '2016-05-07',
-                    name: '王小虎',
-                    address: '上海市普陀区金沙江路 1518 弄'
-                }],
-                multipleSelection: [],
+                multipleSelection: [],//checkbox选择的对象数组
                 filterList: [],//过滤单项选择的值
 
             }
         },
+        watch:{
+          information() {
+              return this.information
+          }
+        },
         computed: {
             newFirm() {
                 this.firm.map((item, index) => {
@@ -239,15 +219,37 @@
                 })
                 return this.firm
             },
-            newFolder() {
-                this.folder.map(item => {
-                    if (item.num === this.fileDataType.num) {
-                        item.img = this.fileDataType.img
+            // informationList() {
+            //     let {name, code} = this.fileDataType
+            //     if (this.information.archive.code === code) {
+            //         this.information.archive[name] = this.fileDataType.img
+            //     }
+            //     this.$forceUpdate()
+            //     return this.information
+            // },
+            tableData() {
+                this.allObject.map(item => {
+                    let build = ''
+                    if (item.Building && item.Floor) {
+                        build = item.Building.BuildLocalName + ' - ' + item.Floor.FloorLocalName
+                    } else if (item.Building) {
+                        build = item.Building.BuildLocalName
+                    } else if (item.Floor) {
+                        build = item.Floor.FloorLocalName
+                    } else {
+                        build = '-'
                     }
+                    item.build = build
                     return item
                 })
-                this.$forceUpdate()
-                return this.folder
+                return this.allObject
+            },
+        },
+        filters: {
+            filterImgName(value) {
+                if (value.length > 20) {
+                    return value.substr(0, 15) + '...'
+                }
             }
         },
         methods: {
@@ -297,17 +299,26 @@
                 }
             },
             maintenanceAll() { //维护所有
-                this.closeDialog()
+                console.log(this.tableData)
+                // this.closeDialog()
             },
             maintenanceSelect() { //维护已选
-                this.closeDialog()
+                console.log(this.multipleSelection)
+                // this.closeDialog()
             },
             closeDialog() {  //关闭弹窗,返回初始状态
                 this.batchDialog = false
                 this.active = 0
             },
             handleSelectionChange(val) { //表格复选
+                console.log(val, this.multipleSelection, '表格按钮checkbox')
                 this.multipleSelection = val
+            },
+            getAllData() {
+                this.$emit('getAllData')
+            },
+            multiple(val) {
+                this.$emit('multiple',val)
             }
         }
     }
@@ -315,15 +326,9 @@
 
 <style scoped lang="less">
     .batchContainer {
-        /*.el-steps--horizontal {*/
-        /*    margin: 0 auto;*/
-        /*    width: 70%;*/
-        /*}*/
-
         /deep/ .el-step__description {
             margin: 2% 0;
         }
-
         .el-checkbox-group {
             display: flex;
             justify-content: space-between;
@@ -339,6 +344,21 @@
             }
         }
 
+        .checkbox {
+            display: flex;
+            justify-content: space-between;
+            flex-direction: row;
+            flex-wrap: wrap;
+
+            p {
+                width: 50%;
+            }
+
+            .el-checkbox:last-of-type {
+                margin-right: 10px;
+            }
+        }
+
         .text-message {
             overflow: hidden;
             margin-top: 10px;

+ 19 - 4
src/components/dialogs/list/filesDialog.vue

@@ -12,7 +12,6 @@
                 :readOnly="read"
                 :keysArr="keysArr"
                 :firmDataType="firmDataType"
-                :fileDataType="fileDataType"
                 @change="changeItem"
                 max="2"/>
         </div>
@@ -47,7 +46,10 @@
             firmDataType: {
                 type: String
             },
-            fileDataType: {
+            infoType: {
+                type: String
+            },
+            information: {
                 type: Object
             }
         },
@@ -61,8 +63,21 @@
         methods: {
             changeItem(file) {
                 if (this.firmDataType === 'dialog') {
-                    this.fileDataType.img = file
-                    this.$emit("changeFile", this.fileDataType, this.firmDataType)
+                    let info = this.infoType;
+                    switch (info) {
+                        case 'archive':
+                            this.information.archive.Archive = file
+                            this.$emit("changeFile", this.information, this.firmDataType)
+                            break
+                        case 'checkPoint':
+                            this.information.checkPoint.CheckReport = file
+                            this.$emit("changeFile", this.information, this.firmDataType)
+                            break
+                        case 'insuranceFile':
+                            this.information.insuranceFile.InsuranceFile = file
+                            this.$emit("changeFile", this.information, this.firmDataType)
+                            break
+                    }
                 } else {
                     this.$emit("changeFile", file, this.firmDataType)
 

+ 1 - 1
src/components/dialogs/list/firm.vue

@@ -26,7 +26,7 @@
             <el-table-column prop="name" label="型号" header-align='center'></el-table-column>
             <el-table-column  label="技术参数" header-align='center'>
               <template slot-scope="scope">
-                <el-button type="text" v-show="scope.row.name" @click="lookParam(scope.row)">技术参数</el-button>
+                <el-button type="text" @click="lookParam(scope.row)">技术参数</el-button>
               </template>
             </el-table-column>
           </el-table>

+ 156 - 23
src/components/ledger/handsontables/device.vue

@@ -31,9 +31,13 @@
 
       <guarantee-dialog :id="id" ref="guarantee" @change="guaranteeChange" :dialog="myDialog"/>
       <!--      上传文件-->
-      <upload-files-dialog :read="onlyRead ? true : false" ref="upload" @changeFile="fileChange" :keysArr="filesArr"
+      <upload-files-dialog :read="onlyRead ? true : false"
+                           ref="upload"
+                           @changeFile="fileChange"
+                           :keysArr="filesArr"
                            :firmDataType="firmDataType"
-                           :fileDataType="fileDataType"
+                           :information="information"
+                           :infoType="infoType"
                            :dialog="myDialog"/>
       <!--      上传图片-->
       <upload-img-dialog :read="onlyRead ? true : false" @changeFile="imgChange" :keysArr="imgsArr" :dialog="myDialog"/>
@@ -94,8 +98,12 @@
           ref="batchDialogs"
           @code="fourVendors"
           :firmName="firmName"
-          :fileDataType="fileDataType"
+          :allObject="allObject"
+          :page="batchPage"
+          :information="information"
           @deviceList="deviceList"
+          @getAllData="getAllData"
+          @multiple="multiple"
       />
   </div>
 </template>
@@ -106,7 +114,8 @@
         getDataDictionary,
         getEquipBelongs,
         getEquipTableCon,
-        updateEquip,
+        queryEquip,
+        updateEquip
     } from "@/api/scan/request";
 
 
@@ -173,7 +182,8 @@ export default {
                 [{value: "partInfo", label: '隐藏信息点'}, {value: "all", label: '全部'}, {value: "Visible", label: '只看采集信息'}]
         },
         batchDate() {
-            return !(!this.onlyRead && this.copyMain)
+            // return !(!this.onlyRead && this.copyMain)
+            return !(!this.onlyRead && this.page.total > 1)
         },
     },
     data() {
@@ -195,6 +205,12 @@ export default {
                 total: 0,
                 currentPage: 1
             },
+            batchPage: {
+                size: 50,
+                sizes: [10, 30, 50, 100, 150, 200],
+                total: 0,
+                currentPage: 1
+            },
             myDialog: {
                 qrcode: false, //二维码弹窗
                 firm: false, //厂商弹窗
@@ -239,11 +255,60 @@ export default {
             updateInput: '', //临时维护信息点值
             firmName: '',//维护信息显示厂家名称
             firmDataType: 'row',
-            fileDataType: {},//文件类型
-            insuranceDocList: [],//保险文件列表
-            deviceDocList: [],//设备文档列表
-            qualityDocList: [],//质检报告
+            allObject: [],
+            information: {
+                archive: {
+                    Archive: [], //设备文档
+                    name: '设备文档',
+                    code: 'LedgerParam.PhotoDoc.Archive',
+                    num: 14
+                },
+                checkPoint: {
+                    CheckReport: [],//安装质检报告
+                    name: '安装质检报告',
+                    code: 'LedgerParam.Siteinstall.CheckReport',
+                    num: 18
+
+                },
+                drawing: {
+                    Drawing: [],//设备图纸
+                    name: '设备图纸',
+                    code: 'LedgerParam.PhotoDoc.Drawing',
+                    num: 13
+                },
+                installDrawing: {
+                    InstallDrawing: [],//安装图纸
+                    name: '安装图纸',
+                    code: 'LedgerParam.Siteinstall.InstallDrawing',
+                    num: 16
+                },
+                installPic: {
+                    InstallPic: [],//安装照片
+                    name: '安装照片',
+                    code: 'LedgerParam.Siteinstall.InstallPic',
+                    num: 17
+                },
+                insuranceFile: {
+                    InsuranceFile: [],//保险文件
+                    name: '保险文件',
+                    code: 'LedgerParam.InsuranceDoc.InsuranceFile',
+                    num: 11
+                },
+                nameplate: {
+                    Nameplate: [],//设备铭牌照片
+                    name: '设备铭牌照片',
+                    code: 'LedgerParam.PhotoDoc.Nameplate',
+                    num: 12
+                },
+                pic: {
+                    Pic: [],//设备照片
+                    name: '设备照片',
+                    code: 'LedgerParam.PhotoDoc.Pic',
+                    num: 15
+                }
 
+            },
+            infoType: ''
         };
     },
     methods: {
@@ -269,6 +334,7 @@ export default {
                         }
                     })
                     this.getTableData()
+                    this.getAllData()
                 });
             }
         },
@@ -283,6 +349,7 @@ export default {
                     PageNumber: this.page.currentPage,
                     Filters: `category='${this.mess.deviceId}'`
                 }
+
                 if (this.mess.buildId == "noKnow") {
                     param.Filters += `;buildingId isNull`
                 } else if (this.mess.buildId && this.mess.buildId != "all") {
@@ -315,6 +382,51 @@ export default {
                 })
             }
         },
+        //获取所以主体数据---用于维护信息
+        getAllData() {
+            this.loading = true
+            if (!!this.mess.deviceId) {
+                //   查询step2
+                let params = {
+                    "Cascade": [
+                        {
+                            "Name": "building",
+                            "Projection": [
+                                "BuildLocalName", "BuildName", "BuildID"
+                            ]
+                        },
+                        {
+                            "Name": "floor",
+                            "Projection": [
+                                "FloorLocalName", "FloorName", "FloorID"
+                            ]
+                        }
+                    ],
+                    Filters: `category='${this.mess.deviceId}'`,
+                    PageSize: this.batchPage.size,
+                    Orders: "createTime desc, EquipID desc",
+                    PageNumber: this.batchPage.currentPage,
+                    "Projection": [
+                        "BuildingId", "FloorId", "Category", "EquipLocalName", "EquipLocalID", "EquipID", "BIMID"
+                    ]
+                };
+                if (this.mess.buildId == "noKnow") {
+                    params.Filters += `;buildingId isNull`
+                } else if (this.mess.buildId && this.mess.buildId != "all") {
+                    params.Filters += `;buildingId='${this.mess.buildId}'`
+                }
+
+                if (this.mess.floorId == "noKnow") {
+                    params.Filters += `;floorId isNull`
+                } else if (this.mess.floorId && this.mess.floorId != "all") {
+                    params.Filters += `;floorId='${this.mess.floorId}'`
+                }
+                queryEquip(params, res => {
+                    this.allObject = res.Content
+                    this.batchPage.total = res.Total
+                })
+            }
+        },
         //获取动态参数
         getBatch(data) {
             let param = {
@@ -688,9 +800,8 @@ export default {
             }
         },
         //  接受维护信息传来的code,显示弹窗
-        fourVendors(code) {
-            let numCode = code.code
-            switch (numCode) {
+        fourVendors(code,) {
+            switch (code) {
                 //品牌型号弹窗
                 case 'DPManufacturerID':
                     this.dataFirmType = 'dia'
@@ -708,16 +819,41 @@ export default {
                 case 'DPInsurerID':
                     this.myDialog.insurer = true;
                     break;
+                //安装照片--安装图纸--设备铭牌照片--设备图纸
+                case 'LedgerParam.Siteinstall.InstallPic':
+                case 'LedgerParam.Siteinstall.InstallDrawing':
+                case 'LedgerParam.PhotoDoc.Nameplate':
+                case 'LedgerParam.PhotoDoc.Drawing':
+                    this.myDialog.uploadImgs = true;
+                    break;
+                //设备照片
+                case 'LedgerParam.PhotoDoc.Pic':
+                    this.myDialog.pic = true;
+                    break;
+
+            }
+        },
+        multiple(val) {
+            switch (val) {
                 //保险文件--设备文档--安装质检报告
-                case 'LedgerParam.InsuranceDoc.InsuranceFile':
-                    this.fileDataType = code
+                case 'archive':
+                    let adata = this.information.archive.Archive;
+                    this.filesArr = adata ? adata : [];
+                    this.infoType = 'archive'
+                    debugger
                     this.myDialog.uploadFiles = true;
                     break;
-                case 'LedgerParam.PhotoDoc.Archive':
-                    this.fileDataType = code
+                case 'checkPoint':
+                    let cdata = this.information.checkPoint.CheckReport;
+                    this.filesArr = cdata ? cdata : [];
+                    this.infoType = 'checkPoint'
+                    debugger
                     this.myDialog.uploadFiles = true;
                     break;
-                case 'LedgerParam.Siteinstall.CheckReport':
+                case 'insuranceFile':
+                    let idata = this.information.insuranceFile.InsuranceFile;
+                    this.filesArr = idata ? idata : [];
+                    this.infoType = 'insuranceFile'
                     this.myDialog.uploadFiles = true;
                     break;
                 //安装照片--安装图纸--设备铭牌照片--设备图纸
@@ -731,7 +867,6 @@ export default {
                 case 'LedgerParam.PhotoDoc.Pic':
                     this.myDialog.pic = true;
                     break;
-
             }
         },
         deviceList(data) {
@@ -952,7 +1087,7 @@ export default {
         //选择型号修改
         firmChange(data, type) {
             if (type === 'dialog') { // 如果是批量信息维护
-                let firm = {...data, num: 2, name: `${data.brand}/${data.name}`}
+                let firm = {...data, num: 2, name: `${data.venderName}/${data.brand}/${data.name}`}
                 this.firmName = firm //批量维护dialog显示对象的字段
             } else {  //如果是表格操作
                 tools.setDataForKey(this.tableData[this.row], "DPManufacturerID", data.venderId)
@@ -1016,9 +1151,7 @@ export default {
         //上传文件弹窗触发事件
         fileChange(keys, type) {
             if (type === 'dialog') {
-                let list = keys
-                this.fileDataType = list
-                this.filesArr = list.img
+                this.information = keys
             } else {
                 this.setDataToMain(keys, this.messKey, this.row);
             }
@@ -1059,7 +1192,7 @@ export default {
         Batch() {
             this.firmDataType = 'dialog'
             this.$refs.batchDialogs.batchDialog = true
-        },
+        }
     },
     watch: {
     projectId() {

+ 4 - 1
src/components/ledger/lib/uploadFiles.vue

@@ -73,8 +73,11 @@
             firmDataType: {
                 type: String
             },
-            fileDataType: {
+            information: {
                 type: Object
+            },
+            infoType: {
+                type: String
             }
         },
         data() {

+ 2 - 2
src/main.js

@@ -22,7 +22,7 @@ import componentsPlugin from '@/framework/plugins/components'
 Vue.use(componentsPlugin)
 
 Vue.config.productionTip = false
-
+Vue.config.devtools = true;
 /* eslint-disable no-new */
 new Vue({
     el: '#app',
@@ -30,4 +30,4 @@ new Vue({
     store,
     components: { App },
     template: '<App/>'
-})
+})