|
@@ -0,0 +1,539 @@
|
|
|
+<template>
|
|
|
+ <el-dialog
|
|
|
+ title="批量维护信息点"
|
|
|
+ :visible.sync="batchDialog"
|
|
|
+ class="batchContainer"
|
|
|
+ >
|
|
|
+ <el-steps
|
|
|
+ :active="active"
|
|
|
+ align-center
|
|
|
+ >
|
|
|
+ <el-step
|
|
|
+ @click.native="active = 0"
|
|
|
+ description="填写需维护的信息点"
|
|
|
+ />
|
|
|
+ <el-step
|
|
|
+ @click.native="active = 1"
|
|
|
+ description="选择批量维护的对象实例"
|
|
|
+ />
|
|
|
+ </el-steps>
|
|
|
+ <hr>
|
|
|
+ <div v-show="active === 0">
|
|
|
+ <section>
|
|
|
+ <p class="text-message">维护只有单值的信息点</p>
|
|
|
+ <span class="small">请选择需维护的信息点</span>
|
|
|
+ <el-checkbox
|
|
|
+ :indeterminate="isIndeterminate"
|
|
|
+ v-model="checkAll"
|
|
|
+ @change="handleCheckChange"
|
|
|
+ >
|
|
|
+ 全部选择
|
|
|
+ </el-checkbox>
|
|
|
+
|
|
|
+ <div style="margin: 15px "></div>
|
|
|
+ <el-checkbox-group
|
|
|
+ v-model="checkedCities"
|
|
|
+ @change="handleCheckedCitiesChange"
|
|
|
+ >
|
|
|
+ <el-checkbox
|
|
|
+ v-for="(city,index) in newFirm"
|
|
|
+ :label="city"
|
|
|
+ :key="index"
|
|
|
+ >
|
|
|
+ <span @click="fourVendors(city.code)"> {{city.name}}:</span>
|
|
|
+ <span>{{city.rname}}</span>
|
|
|
+ </el-checkbox>
|
|
|
+ </el-checkbox-group>
|
|
|
+ </section>
|
|
|
+ <!--维护有多个值的信息-->
|
|
|
+ <section>
|
|
|
+ <p class="text-message">维护有多个值的信息点</p>
|
|
|
+ <span class="small">选择值的更新方式</span>
|
|
|
+ <el-radio-group
|
|
|
+ v-model="radio"
|
|
|
+ @change="maintenance"
|
|
|
+ >
|
|
|
+ <el-radio :label="1">以增量方式维护</el-radio>
|
|
|
+ <el-radio :label="2">以覆盖方式维护</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ <div style="margin: 15px "></div>
|
|
|
+ <div class="checkbox">
|
|
|
+ <p>
|
|
|
+ <el-checkbox
|
|
|
+ v-model="videoModel.archive"
|
|
|
+ @change="multiple('archive')"
|
|
|
+ > <!--设备文档-->
|
|
|
+ {{information.archive.name}}
|
|
|
+ </el-checkbox>
|
|
|
+ <span v-for="item in information.archive.Archive">{{item | filterImgName}}</span>
|
|
|
+ </p>
|
|
|
+ <p>
|
|
|
+ <el-checkbox
|
|
|
+ v-model="videoModel.checkReport"
|
|
|
+ @change="multiple('checkReport')"
|
|
|
+ ><!--安装质检报告-->
|
|
|
+ {{information.checkReport.name}}
|
|
|
+ </el-checkbox>
|
|
|
+ <span v-for="item in information.checkReport.CheckReport">{{item | filterImgName}}</span>
|
|
|
+
|
|
|
+ </p>
|
|
|
+ <p>
|
|
|
+ <el-checkbox
|
|
|
+ v-model="videoModel.drawing"
|
|
|
+ @change="multiple('drawing')"
|
|
|
+ ><!--设备图纸-->
|
|
|
+ {{information.drawing.name}}
|
|
|
+ </el-checkbox>
|
|
|
+ <span v-for="item in information.drawing.Drawing">{{item.key | filterImgName}}</span>
|
|
|
+
|
|
|
+ </p>
|
|
|
+ <p>
|
|
|
+ <el-checkbox
|
|
|
+ v-model="videoModel.installDrawing"
|
|
|
+ @change="multiple('installDrawing')"
|
|
|
+ ><!--安装图纸-->
|
|
|
+ {{information.installDrawing.name}}
|
|
|
+ </el-checkbox>
|
|
|
+ <span
|
|
|
+ v-for="item in information.installDrawing.InstallDrawing">{{item.key | filterImgName}}</span>
|
|
|
+ </p>
|
|
|
+
|
|
|
+ <p>
|
|
|
+ <el-checkbox
|
|
|
+ v-model="videoModel.installPic"
|
|
|
+ @change="multiple('installPic')"
|
|
|
+ ><!--安装照片-->
|
|
|
+ {{information.installPic.name}}
|
|
|
+ </el-checkbox>
|
|
|
+ <span v-for="item in information.installPic.InstallPic">{{item.key | filterImgName}}</span>
|
|
|
+ </p>
|
|
|
+ <p>
|
|
|
+ <el-checkbox
|
|
|
+ v-model="videoModel.insuranceFile"
|
|
|
+ @change="multiple('insuranceFile')"
|
|
|
+ ><!--保险文件-->
|
|
|
+ {{information.insuranceFile.name}}
|
|
|
+ </el-checkbox>
|
|
|
+ <span v-for="item in information.insuranceFile.InsuranceFile">{{item | filterImgName}}</span>
|
|
|
+
|
|
|
+ </p>
|
|
|
+ <p>
|
|
|
+ <el-checkbox
|
|
|
+ v-model="videoModel.pic"
|
|
|
+ @change="multiple('pic')"
|
|
|
+ ><!--设备照片-->
|
|
|
+ {{information.pic.name}}
|
|
|
+ </el-checkbox>
|
|
|
+ <span v-for="item in information.pic.Pic">{{item.key | filterImgName}}</span>
|
|
|
+ </p>
|
|
|
+ <p>
|
|
|
+ <el-checkbox
|
|
|
+ v-model="videoModel.nameplate"
|
|
|
+ @change="multiple('nameplate')"><!--设备铭牌照片-->
|
|
|
+ {{information.nameplate.name}}
|
|
|
+ </el-checkbox>
|
|
|
+ <span v-for="item in information.nameplate.Nameplate">{{item.key | filterImgName}}</span>
|
|
|
+ </p>
|
|
|
+ </div>
|
|
|
+ </section>
|
|
|
+ <el-button
|
|
|
+ style="margin-top: 12px"
|
|
|
+ @click="next"
|
|
|
+ >下一步
|
|
|
+ </el-button>
|
|
|
+ </div>
|
|
|
+ <div
|
|
|
+ v-show="active === 1"
|
|
|
+ class="all-message"
|
|
|
+ >
|
|
|
+ <el-table
|
|
|
+ ref="multipleTable"
|
|
|
+ :data="tableData"
|
|
|
+ tooltip-effect="dark"
|
|
|
+ style="width:100%;margin-bottom: 10px"
|
|
|
+ @selection-change="handleSelectionChange"
|
|
|
+ >
|
|
|
+ <el-table-column
|
|
|
+ type="selection"
|
|
|
+ width="55"
|
|
|
+ />
|
|
|
+ <el-table-column
|
|
|
+ label="设备本地名称"
|
|
|
+ width=""
|
|
|
+ >
|
|
|
+ <template slot-scope="scope">{{scope.row.EquipLocalName}}</template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="EquipLocalID"
|
|
|
+ label="设备本地编码"
|
|
|
+ width="120"
|
|
|
+ />
|
|
|
+ <el-table-column
|
|
|
+ prop="build"
|
|
|
+ label="所属建筑楼层"
|
|
|
+ show-overflow-tooltip
|
|
|
+ />
|
|
|
+ </el-table>
|
|
|
+ <my-pagination
|
|
|
+ @change="getAllData"
|
|
|
+ :page="page"
|
|
|
+ ></my-pagination>
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ @click="maintenanceSelect"
|
|
|
+ >维护已选
|
|
|
+ </el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+ import myPagination from "@/components/ledger/lib/myPagination"
|
|
|
+
|
|
|
+ export default {
|
|
|
+ name: "batchDialog",
|
|
|
+ props: ['firmName', 'allObject', 'page','information'],
|
|
|
+ components: {myPagination},
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ batchDialog: false,//dialog
|
|
|
+ active: 0,//进度条
|
|
|
+ checkAll: false,//全选
|
|
|
+ isIndeterminate: true,
|
|
|
+ checkedCities: [],//选择的项,单项
|
|
|
+ firm: [
|
|
|
+ {
|
|
|
+ name: "品牌型号",
|
|
|
+ code: "DPManufacturerID",
|
|
|
+ num: 2,
|
|
|
+ }, {
|
|
|
+ name: "供应商信息",
|
|
|
+ code: "DPSupplierID",
|
|
|
+ num: 8
|
|
|
+ }, {
|
|
|
+ name: "维修商信息",
|
|
|
+ code: "DPMaintainerID",
|
|
|
+ num: 35
|
|
|
+ }, {
|
|
|
+ name: "保险公司信息",
|
|
|
+ code: "DPInsurerID",
|
|
|
+ num: 42
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ radio: 1, //1增加,2覆盖
|
|
|
+ checkedFile: [],//多项
|
|
|
+ multipleSelection: [],//checkbox选择的对象数组
|
|
|
+ filterList: [],//过滤单项选择的值
|
|
|
+ deviceList: [],//过滤全选数据
|
|
|
+ onlySelect: [],//检测是否有勾选单值信息
|
|
|
+ videoModel: {
|
|
|
+ archive: false,
|
|
|
+ checkReport: false,
|
|
|
+ drawing: false,
|
|
|
+ installDrawing: false,
|
|
|
+ insuranceFile: false,
|
|
|
+ installPic: false,
|
|
|
+ nameplate: false,
|
|
|
+ pic: false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ watch:{
|
|
|
+ information() {
|
|
|
+ return this.information
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ newFirm() {
|
|
|
+ this.firm.map(item => {
|
|
|
+ if (item.num === this.firmName.num) {
|
|
|
+ item.rname = this.firmName.name
|
|
|
+ item.info = this.firmName
|
|
|
+ }
|
|
|
+ return item
|
|
|
+ })
|
|
|
+ return this.firm
|
|
|
+ },
|
|
|
+ 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
|
|
|
+ })
|
|
|
+ return this.allObject
|
|
|
+ },
|
|
|
+ },
|
|
|
+ filters: {
|
|
|
+ filterImgName(value) {
|
|
|
+ if (value.length > 16) {
|
|
|
+ return value.substring(0, 12) + '...'
|
|
|
+ } else {
|
|
|
+ return value
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ next() { //下一步按钮
|
|
|
+ // if (this.active++ > 1) this.active = 0
|
|
|
+ this.deviceList = this.firm.filter(item => item.info)
|
|
|
+ if (!this.onlySelect.length) { //对单项全选进行过滤
|
|
|
+ this.$message({
|
|
|
+ message: '还没有选择单值信息哦',
|
|
|
+ type: 'warning'
|
|
|
+ });
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (!this.deviceList.length) { //对单项全选进行过滤
|
|
|
+ this.$message({
|
|
|
+ message: '单值信息没有填写哦',
|
|
|
+ type: 'warning'
|
|
|
+ });
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (this.checkAll) { // 如果单项全选
|
|
|
+ if (this.deviceList.length < 4) { //对单项全选进行过滤
|
|
|
+ this.$message({
|
|
|
+ message: '单值的信息点存在未填写',
|
|
|
+ type: 'warning'
|
|
|
+ });
|
|
|
+ return false
|
|
|
+ } else {
|
|
|
+ this.active++
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.active++
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleCheckChange(val) { //全选
|
|
|
+ this.checkedCities = val ? this.firm : []
|
|
|
+ this.isIndeterminate = false
|
|
|
+
|
|
|
+ },
|
|
|
+ handleCheckedCitiesChange(value) { //维护单项触发
|
|
|
+ this.onlySelect = value
|
|
|
+ this.filterList = value.filter(item => item.info)
|
|
|
+ let checkCount = value.length
|
|
|
+ this.checkAll = checkCount === this.firm.length
|
|
|
+ this.isIndeterminate = checkCount > 0 && checkCount < this.firm.length
|
|
|
+ },
|
|
|
+ handleCheckedFileChange(value) { //维护多项触发
|
|
|
+ },
|
|
|
+ fourVendors(code) {
|
|
|
+ this.$emit('code', code)
|
|
|
+ },
|
|
|
+ // 选择维护方式
|
|
|
+ maintenance(val) {
|
|
|
+ },
|
|
|
+
|
|
|
+ maintenanceSelect() { //维护已选
|
|
|
+ if (!this.multipleSelection.length) {
|
|
|
+ this.$message({
|
|
|
+ message: '还没有选择实例哦',
|
|
|
+ type: 'warning'
|
|
|
+ });
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ let arr = []
|
|
|
+ // DPSupplierID 供应商 DPManufacturerID 生产商 DPBrandID 品牌
|
|
|
+ // DPSpecificationID 型号 DPInsurerID 保险商 DPMaintainerID 维修商
|
|
|
+ this.multipleSelection.forEach(item => {
|
|
|
+ let EquipID = item.EquipID
|
|
|
+ arr.push({EquipID})
|
|
|
+ })
|
|
|
+ let Id = {}
|
|
|
+ let single = {
|
|
|
+ EquipManufactor: {
|
|
|
+ // Manufacturer: '', //生产商
|
|
|
+ // Brand: '',//品牌
|
|
|
+ // Specification: '',//型号
|
|
|
+ },
|
|
|
+ SupplyPurchase: { //供应商
|
|
|
+ // SupplierWeb: '',
|
|
|
+ // Supplier: '',
|
|
|
+ // PurchasePrice: ''
|
|
|
+ },
|
|
|
+ OperationMainte: { //维修商
|
|
|
+ // Maintainer: '',
|
|
|
+ },
|
|
|
+ InsuranceDoc: {
|
|
|
+ // Insurer: '',
|
|
|
+ // InsurerWeb: '',
|
|
|
+ InsuranceFile: this.information.insuranceFile.InsuranceFile ? this.information.insuranceFile.InsuranceFile : null
|
|
|
+ }
|
|
|
+ };
|
|
|
+ // this.deviceList 单选数组,取到需要数据
|
|
|
+ // 过滤数组,取对象
|
|
|
+ this.deviceList.filter(item => item.num === 2).forEach(i => { //型号
|
|
|
+ let {venderName, brandName, Specification, venderId, brandId, specificationId} = i.info
|
|
|
+ single.EquipManufactor.Manufacturer = venderName
|
|
|
+ Id.DPManufacturerID = venderId
|
|
|
+ single.EquipManufactor.Brand = brandName
|
|
|
+ Id.DPBrandID = brandId
|
|
|
+ single.EquipManufactor.Specification = Specification
|
|
|
+ Id.DPSpecificationID = specificationId
|
|
|
+ })
|
|
|
+ this.deviceList.filter(item => item.num === 8).forEach(i => { //供应商8
|
|
|
+ let {website, name, venderId} = i.info
|
|
|
+ single.SupplyPurchase.SupplierWeb = website
|
|
|
+ single.SupplyPurchase.Supplier = name
|
|
|
+ Id.DPSupplierID = venderId
|
|
|
+ })
|
|
|
+ this.deviceList.filter(item => item.num === 35).forEach(i => { //维修商
|
|
|
+ let {name, venderId} = i.info
|
|
|
+ single.OperationMainte.Maintainer = name
|
|
|
+ Id.DPMaintainerID = venderId
|
|
|
+ })
|
|
|
+ this.deviceList.filter(item => item.num === 42).forEach(i => { //保险
|
|
|
+ let {website, name, venderId} = i.info
|
|
|
+ single.InsuranceDoc.Insurer = name
|
|
|
+ single.InsuranceDoc.InsurerWeb = website
|
|
|
+ Id.DPInsurerID = venderId
|
|
|
+ })
|
|
|
+ // this.information 多选信息
|
|
|
+ let {archive, checkReport, drawing, installDrawing, installPic, insuranceFile, nameplate, pic} = this.information
|
|
|
+ let multiple = {
|
|
|
+ InsuranceDoc: {
|
|
|
+ InsuranceFile: insuranceFile.InsuranceFile ? insuranceFile.InsuranceFile : null
|
|
|
+ },
|
|
|
+ PhotoDoc: {
|
|
|
+ Archive: archive.Archive ? archive.Archive : null,
|
|
|
+ Drawing: drawing.Drawing ? drawing.Drawing : null,
|
|
|
+ Nameplate: nameplate.Nameplate ? nameplate.Nameplate : null,
|
|
|
+ Pic: pic.Pic ? pic.Pic : null
|
|
|
+ },
|
|
|
+ Siteinstall: {
|
|
|
+ InstallPic: installPic.InstallPic ? installPic.InstallPic : null,
|
|
|
+ InstallDrawing: installDrawing.InstallDrawing ? installDrawing.InstallDrawing : null,
|
|
|
+ CheckReport: checkReport.CheckReport ? checkReport.CheckReport : null
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let LedgerParam = {}
|
|
|
+ if (this.radio === 1) { //组装数据,根据是覆盖该是增量,1是增量
|
|
|
+ // 1:单选数据
|
|
|
+ let arr1 = this.deepCopy(arr).map(item => ({
|
|
|
+ ...Id,
|
|
|
+ ...item,
|
|
|
+ LedgerParam: {...single}
|
|
|
+ }))
|
|
|
+ // 2:多选数据
|
|
|
+ let arr2 = this.deepCopy(arr).map(item => ({
|
|
|
+ ...Id,
|
|
|
+ ...item,
|
|
|
+ LedgerParam: {...multiple}
|
|
|
+ }))
|
|
|
+ this.$emit('upDataDevice', 1, arr1, arr2)
|
|
|
+
|
|
|
+ }
|
|
|
+ if (this.radio === 2) {
|
|
|
+
|
|
|
+ let {InsuranceDoc, ...multiples} = multiple
|
|
|
+ LedgerParam = {
|
|
|
+ ...single,
|
|
|
+ ...multiples
|
|
|
+
|
|
|
+ };
|
|
|
+ let arr3 = this.deepCopy(arr).map(item => ({
|
|
|
+ ...Id,
|
|
|
+ ...item,
|
|
|
+ LedgerParam: {...LedgerParam}
|
|
|
+ }))
|
|
|
+ this.$emit('upDataDevice', 2, arr3)
|
|
|
+ }
|
|
|
+ this.closeDialog()
|
|
|
+ },
|
|
|
+ closeDialog() { //关闭弹窗,返回初始状态
|
|
|
+ this.batchDialog = false
|
|
|
+ this.active = 0
|
|
|
+ // this.checkedCities = []//清空单项的checkbox
|
|
|
+ // this.deviceList = [] //清空单选数组内容
|
|
|
+ // this.radio = 1 //返回到默认增量
|
|
|
+ // this.multipleSelection = [] //清空实例内容
|
|
|
+
|
|
|
+ },
|
|
|
+ handleSelectionChange(val) {
|
|
|
+ this.multipleSelection = val
|
|
|
+ },
|
|
|
+ getAllData() {
|
|
|
+ this.$emit('getAllData')
|
|
|
+ },
|
|
|
+ multiple(val) {
|
|
|
+ this.$emit('multiple',val)
|
|
|
+ },
|
|
|
+
|
|
|
+ deepCopy(obj) {
|
|
|
+ return JSON.parse(JSON.stringify(obj))
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped lang="less">
|
|
|
+ .batchContainer {
|
|
|
+ /deep/ .el-step__description {
|
|
|
+ margin: 2% 0;
|
|
|
+ }
|
|
|
+ .el-checkbox-group {
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ flex-direction: row;
|
|
|
+ flex-wrap: wrap;
|
|
|
+
|
|
|
+ .el-checkbox {
|
|
|
+ width: 43%;
|
|
|
+ }
|
|
|
+
|
|
|
+ .el-checkbox:last-of-type {
|
|
|
+ margin-right: 30px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .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;
|
|
|
+ color: #333;
|
|
|
+ border-left: 8px solid #333;
|
|
|
+ text-indent: 10px;
|
|
|
+ font-weight: 600;
|
|
|
+ }
|
|
|
+
|
|
|
+ .small {
|
|
|
+ font-size: 12px;
|
|
|
+ color: #555;
|
|
|
+ }
|
|
|
+
|
|
|
+ .all-message {
|
|
|
+ overflow: hidden;
|
|
|
+
|
|
|
+ button {
|
|
|
+ float: right;
|
|
|
+ padding: 10px;
|
|
|
+ margin-left: 5px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+</style>
|