123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862 |
- <template>
- <div style="height: calc(100% - 44.5px);padding: 0px 10px 10px;box-sizing: border-box;">
- <div class="hanson-bar">
- <div style="float:right;overflow:hidden;">
- <span style="width:20px;float:left;display:block;height:20px;cursor: pointer;" @click="changeAssetsFalg">
- <i v-show="!onlyRead" class="el-icon-fa el-icon-fa-compass"></i>
- </span>
- <span>当前筛选条件下共{{page.total || '--'}}设备</span>
- </div>
- <el-select v-model="onlyRead" @change="getHeaderData(mess)" style="width:100px;margin-right:20px;vertical-align:bottom;">
- <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"></el-option>
- </el-select>
- <el-select v-model="showType" @change="initTable" style="width:130px;margin-right:10px;vertical-align:bottom;">
- <el-option v-for="item in showTypes" :key="item.value" :label="item.label" :value="item.value"></el-option>
- </el-select>
- <el-button size="small" style='width: 80px;' @click="download" icon="iconfont icon-xiazai">下载</el-button>
- <el-button size="small" style='width: 80px;' @click="addDevice" icon="iconfont icon-tianjia">添加设备</el-button>
- <el-button size="small" style='width: 80px;' @click="reset" icon="iconfont icon-shuaxin">刷新</el-button>
- <el-button size="small" style='width: 80px;' v-show="!onlyRead" @click="undo" icon="iconfont icon-undo">撤销</el-button>
- </div>
- <!-- 二维码弹窗 -->
- <qrcode :dialog="myDialog" :qrcodeUrl="qrcodeUrl" :addBody="true" ref="qrcode"></qrcode>
- <!-- 型号弹窗 -->
- <firm :mess="{deviceId: deviceType.assetType}" ref="firm" @changeFirm="firmChange" :dialog="myDialog"></firm>
- <!-- 供应商合同弹窗 -->
- <supply-dialog ref="supply" @change="supplyChange" :id="id" :dialog="myDialog"></supply-dialog>
- <!-- 供应商弹窗 -->
- <supplier-dialog ref="supplier" @changeSupplier="supplierChange" :dialog="myDialog"></supplier-dialog>
- <guarantee-dialog :id="id" ref="guarantee" @change="guaranteeChange" :dialog="myDialog"></guarantee-dialog>
- <upload-files-dialog :read="onlyRead ? true : false" ref="upload" @changeFile="fileChange" :keysArr="filesArr" :dialog="myDialog">
- </upload-files-dialog>
- <upload-img-dialog :read="onlyRead ? true : false" @changeFile="imgChange" :keysArr="imgsArr" :dialog="myDialog"></upload-img-dialog>
- <maintainer-dialog @changeMaintainer="changeMaintainer" ref="maintainer" :dialog="myDialog"></maintainer-dialog>
- <insurer-dialog @changeInsurer="changeInsurer" ref="insurer" :dialog="myDialog"></insurer-dialog>
- <pic-dialog :read="onlyRead ? true : false" :dialog="myDialog" :keysArr="picsArr" @change="changePics"></pic-dialog>
- <div class=" middle_sty" style="height: 91%; text-align:center" v-show="!mess.deviceId && (!tableData || !tableData.length)">
- <p>
- <i class="iconwushuju iconfont"></i>
- 请选择设备族
- </p>
- </div>
- <div class="center middle_sty" style="height: 91%" v-show="mess.deviceId && (!tableData || !tableData.length)">
- <p>
- <i class="iconwushuju iconfont"></i>
- 暂无数据
- </p>
- </div>
- <div v-show="mess.deviceId && tableData && tableData.length" v-loading="loading" id="handsontable" ref="handsontable"></div>
- <div v-show="mess.deviceId && tableData && tableData.length" class="right">
- <my-pagination @change="getTableData" :page="page"></my-pagination>
- </div>
- <details-dialog :iframeSrc="iframeSrc" v-if="myDialog.details" :dialog="myDialog"></details-dialog>
- <!-- 关联的系统 -->
- <system-type :device="mess" :curDevice="curDevice" :dialog="myDialog" :type="onlyRead?'read':'edit'" @change="changeSystemType"></system-type>
- <!-- 关联资产 -->
- <change-rea @changeProperty="changeProperty" :dialog="myDialog" :category="deviceType"></change-rea>
- <look-pic :dialog="myDialog" :keysArr="picsArr"></look-pic>
- <!-- 新增设备 -->
- <el-dialog title="确定新增设备的类型" :visible.sync="myDialog.addDevice" width="30%">
- <el-row>
- <my-cascader ref="cascader" @change="changeAddType"></my-cascader>
- </el-row>
- <span slot="footer" class="dialog-footer">
- <el-button type="primary" @click="toAddDevice">下 一 步</el-button>
- </span>
- </el-dialog>
- </div>
- </template>
- <script>
- import {
- getTableHeader,//表头
- getSpaceFloor,//获取楼层数据-添加设备维护楼层信息
- getEquipmentFamily,//获取族
- getBillEquipList,//获取表数据
- BeatchQueryParam,//通过标号功能号获取值
- delBatchList,//删除选中设备
- updateBusiness,//更新设备
- updateEquip,//更新设备
- getDataDictionary,//新表头
- getEquipTableCon,//获取表数据
- deleteEquip,//删除选中设备
- getEquipBelongs,//获取族
- } from "@/api/scan/request";
- import tools from "@/utils/scan/tools";
- import handsonUtils from "@/utils/hasontableUtils"
- import showTools from "@/utils/handsontable/notShow"
- import text from "@/utils/handsontable/mainText"
- import myCascader from "@/components/ledger/lib/cascader";
- import qrcode from "@/components/ledger/lib/qrcode";
- import firm from "@/components/dialogs/list/firm";
- import supplyDialog from "@/components/dialogs/list/supplyDialog";
- import supplierDialog from "@/components/dialogs/list/supplierDialog";
- import maintainerDialog from "@/components/dialogs/list/maintainerDialog";
- import insurerDialog from "@/components/dialogs/list/insurerDialog";
- import guaranteeDialog from "@/components/dialogs/list/guaranteeDialog";
- import uploadFilesDialog from "@/components/dialogs/list/filesDialog";
- import uploadImgDialog from "@/components/dialogs/list/uploadImgDialog";
- import picDialog from "@/components/dialogs/list/picDialog"
- import systemType from "@/components/dialogs/list/systemType"
- import myPagination from "@/components/ledger/lib/myPagination";
- import dialogAssets from "@/components/dialogs/addDialog/dialogDevice";
- import detailsDialog from "@/components/ledger/lib/detailsDia"
- import changeRea from "@/components/dialogs/changeRea"
- //图片查看
- import lookPic from "@/components/ledger/lib/lookImages"
- //下拉插件
- import "@/assets/js/chosen.jquery.min";
- import "@/assets/js/handsontable-chosen-editor";
- import { mapGetters, mapActions } from "vuex";
- import Handsontable from "handsontable-pro"
- import 'handsontable-pro/dist/handsontable.full.css'
- import zhCN from 'handsontable-pro/languages/zh-CN';
- export default {
- props: ["myParam"],
- components: {
- qrcode, //二维码页面
- firm, //
- supplyDialog,
- supplierDialog,
- guaranteeDialog,
- uploadFilesDialog,
- maintainerDialog,
- insurerDialog,
- uploadImgDialog,
- picDialog,
- myPagination,
- dialogAssets,
- systemType,
- detailsDialog,
- changeRea,
- lookPic,
- myCascader
- },
- data() {
- return {
- options: [{
- value: true,
- label: '只读模式'
- }, {
- value: false,
- label: '编辑模式'
- }],
- tableData: [],
- mess: {},
- tableHeader: null,
- page: {
- size: 50,
- sizes: [10, 30, 50, 100, 150, 200],
- total: 0,
- currentPage: 1
- },
- myDialog: {
- qrcode: false, //二维码弹窗
- firm: false, //厂商弹窗
- supply: false, //选择供应合同
- supplier: false, //供应商选择
- guarantee: false, //选择保单
- maintainer: false, //选择维修商
- insurer: false, //选择保险公司
- uploadFiles: false,//上传文件
- uploadImgs: false,//上传单个图片
- pic: false, //多个图片
- addDevice: false,//添加设备
- systemType: false,//关联系统
- details: false,//详情页
- changeRea: false,//关联资产
- lookPic: false,//图片查看
- },
- row: null, //被修改的row
- filesArr: [], //保存临时的文件key
- messKey: null,
- imgsArr: [], //临时保存的图片key数组
- picsArr: [], //临时设备图片keys数组
- copyMain: null,
- graphyId: null,
- assetGroupList: [],
- iframeSrc: "",
- id: 0,
- onlyRead: true,
- showType: 'all',
- linkNameFalg: false,
- qrcodeUrl: "", //二维码图片地址
- loading: false,
- deviceType: {}, //族3位编码及名称
- floorData: [],
- curDevice: '',//当前点击的设备id
- addData: {}, //添加设备选择的设备类型
- };
- },
- created() { },
- computed: {
- ...mapGetters("layout", ["projectId", "secret", "userId"]),
- showTypes() {
- return this.onlyRead ?
- [{ value: "Visible", label: '只看采集信息' }, { value: "all", label: '全部' }] :
- [{ value: "Visible", label: '只看采集信息' }, { value: "partInfo", label: '隐藏信息点' }, { value: "all", label: '全部' }]
- }
- },
- methods: {
- //获取表头
- getHeaderData(code) {
- this.page.currentPage = 1
- this.mess = code
- this.changeCader()
- if (this.mess.deviceId) {
- let params = {
- data: {
- PageNumber: 1,
- PageSize: 500
- },
- type: this.mess.deviceId
- };
- getDataDictionary(params, res => {
- this.tableHeader = res.Content;
- this.getTableData()
- });
- }
- },
- //获取主体数据
- getTableData() {
- let _this = this
- this.loading = true
- //type存在发送请求
- if (!!this.mess.deviceId) {
- let param = {
- PageSize: this.page.size,
- Orders: "createTime desc, EquipID desc",
- 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") {
- param.Filters += `;buildingId='${this.mess.buildId}'`
- }
- if (this.mess.floorId == "noKnow") {
- param.Filters += `;floorId isNull`
- } else if (this.mess.floorId && this.mess.floorId != "all") {
- param.Filters += `;floorId='${this.mess.floorId}'`
- }
- getEquipTableCon(param, res => {
- this.loading = false;
- _this.tableData = res.Content;
- _this.copyMain = tools.deepCopy(res.Content);
- _this.page.total = res.Total;
- if (_this.hot) {
- _this.hot.destroy();
- _this.hot = null;
- }
- if (res.Content && res.Content.length) {
- if (this.onlyRead) {
- this.getBatch(res.Content)
- }
- _this.initTable();
- }
- })
- }
- },
- //获取动态参数
- getBatch(data) {
- let param = {
- secret: this.secret,
- ProjId: this.projectId,
- data: {
- criterias: []
- }
- }
- if (!!data && data.length) {
- //一级遍历list
- data.map(item => {
- if (!!item.infos) {
- // 二级遍历对象infos
- for (let key in item.infos) {
- //判断是否是设定参数和动态参数
- if (!!item.infos[key]) {
- this.tableHeader.map(child => {
- //如果一级标签为动态参数或者设定参数放入数据等待请求
- if (key == child.InfoPointCode && (child.InputMode == "L" || child.InputMode == "L1" || child.InputMode == "L2" || child.InputMode == "M")) {
- param.data.criterias.push({
- id: item.id,
- code: key
- })
- }
- })
- }
- }
- }
- })
- if (param.data.criterias.length) {
- BeatchQueryParam(param, res => {
- if (!this.onlyRead) {
- return false
- }
- this.tableData = data.map(item => {
- res.Content.map(child => {
- if (item.id == child.id) {
- if (!!child.data || child.data == 0) {
- item.infos[child.code] = child.data
- } else {
- item.infos[child.code] = child.error ? "表号功能号格式错误" : "表号功能号不存在"
- }
- }
- })
- return item
- })
- this.hot.loadData(this.tableData)
- })
- }
- }
- },
- //修改资产
- changeAssetsFalg() {
- if (this.linkNameFalg) {
- this.linkNameFalg = false
- } else {
- this.$confirm('<p>真的要在这里修改设备关联的资产么?</p><p>真的能通过列表信息找到想关联的资产么?</p><p>在这里修改关联的资产一定是因为之前关联错了要修改么?</p>', '提示', {
- dangerouslyUseHTMLString: true,
- confirmButtonText: '没错!我要改关联的资产',
- cancelButtonText: '我就点开看看',
- confirmButtonClass: 'cancelButtonClass',
- cancelButtonClass: 'cancelButtonClass'
- }).then(_ => {
- this.linkNameFalg = true
- }).catch(_ => {
- this.$message("取消")
- })
- }
- },
- //撤回
- undo() {
- this.hot.undo();
- },
- //刷新-switch改变
- reset() {
- this.getTableData();
- },
- //添加设备
- addDevice() {
- this.myDialog.addDevice = true
- if (this.mess.deviceId) {
- this.$nextTick(() => {
- this.$refs.cascader.setValue([this.mess.deviceId])
- })
- }
- },
- //下一步
- toAddDevice() {
- if (this.addData.deviceId) {
- this.$router.push({
- path: "/ledger/addevice",
- query: this.addData
- });
- }
- },
- //选择设备类型-添加设备
- changeAddType(val) {
- this.addData.deviceId = val.code;
- this.addData.name = val.facility;
- },
- //下载
- download() {
- if (!this.onlyRead) {
- if (!!this.hot) {
- let fileName = this.mess.name + "-页数:" + this.page.currentPage + "-个数:" + this.tableData.length + "-总个数:" + this.page.total
- this.hot.getPlugin('exportFile').downloadFile("csv", { filename: fileName, columnHeaders: true, exportHiddenRows: true, exportHiddenColumns: true, rowHeaders: true })
- } else {
- this.$message("请确定存在表格")
- }
- } else {
- this.$message("下载需在编辑状态下")
- }
- },
- //格式化表头
- formatHeaderData(list) {
- let arr = tools.copyArr(list)
- let data = showTools.headerTextFilter(arr, 'equipment', this.onlyRead, this.showType, true)
- data.unshift("操作", "当前关联的资产", "所属系统实例", "包含的部件");
- return data;
- },
- //格式化表内容
- formatHeaderType(list) {
- let arr = tools.copyArr(list)
- let data = showTools.headerTypeFilter(arr, 'equipment', this.onlyRead, this.showType, true)
- data.unshift(
- {
- data: "caozuo",
- renderer: tools.lookDetails,
- readOnly: true
- },
- {
- data: "LinkEquipLocalName",
- readOnly: true,
- renderer: tools.LinkEquipLocalName
- }, {
- data: "LinkSystem",
- renderer: text.systemList,
- readOnly: true
- }, {
- data: "Count",
- readOnly: true,
- renderer: tools.lookDetails
- }
- );
- if (this.onlyRead) {
- data.map(item => {
- item.readOnly = true
- })
- }
- return data;
- },
- //初始化插件
- initTable() {
- var container = document.getElementById("handsontable");
- let winHeight = document.documentElement.clientHeight;
- this.hot = new Handsontable(container, {
- data: this.tableData,
- fixedColumnsLeft: 6,
- colHeaders: this.formatHeaderData(this.tableHeader), //表头文案
- columns: this.formatHeaderType(this.tableHeader), //数据显示格式
- filters: true,
- maxRows: this.tableData.length,
- height: winHeight - 335,
- columnSorting: true, //添加排序
- sortIndicator: true, //添加排序
- renderAllRows: true,
- // colWidths: 200,
- autoColumnSize: true,
- language: "zh-CN",
- manualColumnResize: true,
- manualColumnMove: true,
- dropdownMenu: [
- "filter_by_condition",
- "filter_by_value",
- "filter_action_bar"
- ],
- contextMenu: {
- items: {
- remove_row: {
- name: "删除选中设备"
- }
- }
- },
- // 事件
- afterChange: this.handleUpdataTable, //修改后
- afterFilter: this.trimmedRows, //排序前
- afterRemoveRow: this.handleDeleteTableRow, //右键删除
- afterOnCellMouseDown: this.eventClick //鼠标点击
- });
- let pro = document.getElementById("hot-display-license-info");
- if (!!pro) {
- pro.parentNode.removeChild(pro);
- }
- this.isLoading = false;
- },
- //表格中的点击
- eventClick(el, rowArr) {
- //点击的是表头
- if (rowArr.row < 0) {
- return;
- }
- //被筛选过后的数组
- let trimmedArr = this.trimmedRows();
- //是否启用了排序
- let isSort = this.hot.getPlugin("columnSorting").isSorted();
- if (trimmedArr.length && isSort) {
- let sortArr = this.myHotArr.getPlugin("columnSorting").rowsMapper
- .__arrayMap;
- let infos = this.tableData[trimmedArr[sortArr[rowArr.row]]];
- this.getInfors(infos, { row: sortArr[rowArr.row], col: rowArr.col }, el);
- } else if (isSort) {
- //排序后的数组
- let sortArr = this.hot.getPlugin("columnSorting").rowsMapper.__arrayMap;
- let infos = this.tableData[sortArr[rowArr.row]];
- this.getInfors(infos, { row: sortArr[rowArr.row], col: rowArr.col }, el);
- } else if (trimmedArr.length) {
- let infos = this.tableData[trimmedArr[rowArr.row]];
- this.getInfors(infos, { row: trimmedArr[rowArr.row], col: rowArr.col }, el);
- } else {
- let infos = this.tableData[rowArr.row];
- this.getInfors(infos, rowArr, el);
- }
- },
- // 更新
- handleUpdataTable(changeData, source) {
- if (!this.onlyRead) {
- if (changeData) {
- let trimmedArr = this.trimmedRows();
- let param = handsonUtils.getParam(changeData, source, this.hot, trimmedArr);
- let data = [];
- for (let i = 0; i < param.length; i++) {
- data.push(param[i]);
- }
- //如果data中包含/且data长度为1,将其转换成.
- if (changeData.length == 1 && changeData[0][1].indexOf("/") > 0) {
- changeData[0][1] = changeData[0][1].split("/").join(".")
- }
- //存在data进行修改请求
- if (data && data.length) {
- this.updateBusiness(data, changeData);
- }
- }
- }
- },
- //删除设备
- handleDeleteTableRow() {
- let params = tools.differenceArr(this.tableData, this.copyMain)
- let _this = this
- if (params.length < 1) {
- return
- }
- let param = []
- params.map(item => {
- param.push({ EquipID: item.EquipID })
- })
- this.$confirm("此操作将删除设备,是否继续?", "提示", {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- this.removeDevice(param)
- }).catch(() => {
- this.reset()
- this.$message("取消删除")
- })
- },
- // 删除设备
- async removeDevice(param) {
- await deleteEquip(param, res => {
- this.$message.success("删除成功")
- this.$emit('close','')
- this.getTableData()
- })
- },
- // 更新
- updateBusiness(data, change) {
- let param = {
- Content: [],
- Projection: []
- };
- //生成要修改字段列表
- change.map(item => {
- if (item[1] && param.Projection.indexOf(item[1]) == -1) {
- param.Projection.push(item[1].split(".")[0]);
- }
- });
- //生成对应修改数据
- data.map((item, index) => {
- param.Projection.map(value => {
- let itemData = tools.dataForKey(item, value);
- tools.setDataForKey(item, value, itemData == "" ? null : itemData);
- });
- param.Content.push(item);
- });
- updateEquip(param, res => { });
- },
- //修改设备类型
- changeCader() {
- if (this.mess.deviceId) {
- let param = {
- data: {
- Filters: `EquipCode='${this.mess.deviceId}'`,
- PageNumber: 1,
- PageSize: 50
- }
- }
- getEquipBelongs(param, res => {
- if (res.Content.length) {
- this.deviceType.assetType = res.Content[0].Family
- this.deviceType.assetName = res.Content[0].FamilyName
- }
- })
- }
- },
- //获取到了正确的信息
- getInfors(infos, row, el) {
- let val = this.hot.colToProp(row.col);
- this.row = row.row;
- this.messKey = val;
- switch (val) {
- //操作
- case 'caozuo':
- // window.open(`http://adm.sagacloud.cn:8058/spread?id=${infos.EquipID}&pid=${this.projectId}&secret=${this.secret}`,"_blank")
- this.$message("开发中...")
- break;
- //设备二维码图片
- case 'EquipQRCode':
- this.qrcodeUrl = this.tableData[row.row].EquipQRCode;
- if (!!this.qrcodeUrl) {
- this.myDialog.qrcode = true;
- } else {
- this.$message("此设备没有设备二维码");
- }
- break;
- //关联系统
- case 'LinkSystem':
- if (!this.onlyRead) {
- this.curDevice = infos.EquipID;
- this.systemList = this.tableData[row.row].LinkSystem || [];
- this.myDialog.systemType = true;
- }
- break;
- //关联资产
- case 'LinkEquipLocalName':
- if (this.linkNameFalg) {
- this.myDialog.changeRea = true;
- }
- break;
- //品牌型号弹窗
- case 'DPManufacturerID':
- if (!this.onlyRead) {
- this.myDialog.firm = true;
- }
- break;
- //供应商信息弹窗
- case 'DPSupplierID':
- if (!this.onlyRead) {
- this.myDialog.supplier = true;
- }
- break;
- //维修商信息弹窗
- case 'DPMaintainerID':
- if (!this.onlyRead) {
- this.myDialog.maintainer = true;
- }
- break;
- //保险公司信息
- case 'DPInsurerID':
- if (!this.onlyRead) {
- this.myDialog.insurer = true;
- }
- break;
- //供应合同编号
- case 'LedgerParam.SupplyPurchase.SupplierContractID':
- if (!this.onlyRead) {
- let ContractIDflag = null;
- let DPSdata = this.tableData[row.row].DPSupplierID;
- if (DPSdata) {
- ContractIDflag = DPSdata.split("-")[0];
- }
- if (!!ContractIDflag) {
- this.id = ContractIDflag;
- this.myDialog.supply = true;
- } else {
- this.$message("请先选择供应商");
- }
- }
- break;
- //保险单号
- case 'LedgerParam.InsuranceDoc.InsuranceNum':
- if (!this.onlyRead) {
- let DPInsurerIDflag = null;
- let DPIdata = this.tableData[row.row].DPInsurerID;
- if (DPIdata) {
- DPInsurerIDflag = DPIdata.split("-")[0];
- }
- if (!!DPInsurerIDflag) {
- this.id = DPInsurerIDflag;
- this.myDialog.guarantee = true;
- } else {
- this.$message("请先选择保险商");
- }
- }
- break;
- //保险文件--设备文档--安装质检报告
- case 'LedgerParam.InsuranceDoc.InsuranceFile':
- case 'LedgerParam.PhotoDoc.Archive':
- case 'LedgerParam.Siteinstall.CheckReport':
- let IPSdata = tools.dataForKey(this.tableData[row.row], val);
- this.filesArr = IPSdata ? IPSdata : [];
- this.myDialog.uploadFiles = true;
- break;
- //安装照片--安装图纸--设备铭牌照片--设备图纸
- case 'LedgerParam.Siteinstall.InstallPic':
- case 'LedgerParam.Siteinstall.InstallDrawing':
- case 'LedgerParam.PhotoDoc.Nameplate':
- case 'LedgerParam.PhotoDoc.Drawing':
- let SSPPdata = tools.dataForKey(this.tableData[row.row], val);
- this.imgsArr = SSPPdata ? SSPPdata : [];
- this.myDialog.uploadImgs = true;
- break;
- //设备照片
- case 'LedgerParam.PhotoDoc.Pic':
- let Pdata = tools.dataForKey(this.tableData[row.row], val);
- this.picsArr = Pdata ? Pdata : [];
- this.myDialog.pic = true;
- break;
- //包含的部件字段
- case 'Count':
- if (this.onlyRead) {
- this.$router.push({ path: '/ledger/parts', query: { deviceId: infos.EquipID } });
- } else {
- this.$router.push({ path: '/ledger/partsmanage', query: { deviceId: infos.EquipID, typeId: this.mess.deviceId } });
- }
- break;
- default:
- break;
- }
- },
- //获取被筛选掉的行号
- trimmedRows() {
- var plugin = this.hot.getPlugin("trimRows").trimmedRows;
- let dataLength = this.tableData.length;
- let dataArr = new Array();
- for (let i = 0; i < dataLength; i++) {
- dataArr.push(i);
- }
- if (plugin.length <= 0) {
- dataArr = undefined;
- } else {
- dataArr = this.array_diff(dataArr, plugin);
- }
- return dataArr || [];
- },
- //去除数组中相同的元素
- array_diff(a, b) {
- for (var i = 0; i < b.length; i++) {
- for (var j = 0; j < a.length; j++) {
- if (a[j] == b[i]) {
- a.splice(j, 1);
- j = j - 1;
- }
- }
- }
- return a;
- },
- //如果选择供应商之后
- supplierChange(data) {
- tools.setDataForKey(this.tableData[this.row], "DPSupplierID", data.venderId)
- tools.setDataForKey(this.tableData[this.row], "LedgerParam.SupplyPurchase.Supplier", data.name)
- this.handleUpdataTable([[this.row, "DPSupplierID", null, data.venderId]], "edit")
- this.handleUpdataTable([[this.row, "LedgerParam.SupplyPurchase.Supplier", null, data.name]], "edit")
- },
- //供应合同编号
- supplyChange(data) {
- tools.setDataForKey(this.tableData[this.row], "LedgerParam.SupplyPurchase.SupplierContractID", { id: data })
- },
- //保险单号-保险文件
- guaranteeChange(data) {
- for (let key in data) {
- this.utilToKey(key, "insuranceNo", data, "InsuranceNum")
- if (key == "contractFile") {
- if (!!data[key]) {
- data[key] = [data[key]]
- }
- }
- this.utilToKey(key, "contractFile", data, "InsuranceFile")
- }
- },
- //选择型号修改
- firmChange(data) {
- tools.setDataForKey(this.tableData[this.row], "DPManufacturerID", data.venderId)
- tools.setDataForKey(this.tableData[this.row], "LedgerParam.EquipManufactor.Brand", data.brand)
- tools.setDataForKey(this.tableData[this.row], "LedgerParam.EquipManufactor.Specification", data.name)
- this.handleUpdataTable([[this.row, "DPManufacturerID", null, data.venderId]], "edit")
- this.handleUpdataTable([[this.row, "LedgerParam.EquipManufactor.Brand", null, data.brand]], "edit")
- this.handleUpdataTable([[this.row, "LedgerParam.EquipManufactor.Specification", null, data.name]], "edit")
- },
- //保险商变更
- changeInsurer(data) {
- tools.setDataForKey(this.tableData[this.row], "DPInsurerID", data.venderId)
- tools.setDataForKey(this.tableData[this.row], "LedgerParam.InsuranceDoc.Insurer", data.name)
- this.handleUpdataTable([[this.row, "DPInsurerID", null, data.venderId]], "edit")
- this.handleUpdataTable([[this.row, "LedgerParam.InsuranceDoc.Insurer", null, data.name]], "edit")
- },
- //维修商变更
- changeMaintainer(data) {
- tools.setDataForKey(this.tableData[this.row], "DPMaintainerID", data.venderId)
- tools.setDataForKey(this.tableData[this.row], "LedgerParam.OperationMainte.Maintainer", data.name)
- this.handleUpdataTable([[this.row, "DPMaintainerID", null, data.venderId]], "edit")
- this.handleUpdataTable([[this.row, "LedgerParam.OperationMainte.Maintainer", null, data.name]], "edit")
- },
- //修改关联的资产
- changeProperty(val) {
- this.setDataToMain(val.PropertyId, 'PropertyId', this.row);
- this.setDataToMain(val.LinkEquipLocalName, 'LinkEquipLocalName', this.row);
- },
- //上传文件弹窗触发事件
- fileChange(keys) {
- this.setDataToMain(keys, this.messKey, this.row);
- },
- //上传图片弹窗触发事件
- imgChange(keys) {
- this.setDataToMain(keys, this.messKey, this.row);
- },
- //关联系统更改
- changeSystemType(data) {
- tools.setDataForKey(this.tableData[this.row], "LinkSystem", data)
- },
- //设备图片弹窗改变事件
- changePics(keys) {
- this.setDataToMain(keys, this.messKey, this.row);
- },
- utilToKey(key, name, data, messName) {
- if (key == name) {
- this.setDataToMain(data[key], messName, this.row)
- }
- },
- //判断是否有值,有值赋值
- setDataToMain(data, key, row) {
- if (!!data && data != '--') {
- if (!!this.tableData[row]) {
- tools.setDataForKey(this.tableData[row], key, data);
- this.handleUpdataTable([[row, key, null, data]], "edit");
- } else {
- this.tableData[row] = {};
- tools.setDataForKey(this.tableData[row], key, data);
- }
- } else {
- tools.setDataForKey(this.tableData[row], key, "");
- }
- },
- //未知
- setGraphyId(graphyId, assetGroupList) {
- this.graphyId = graphyId
- this.assetGroupList = assetGroupList
- },
- },
- watch: {
- projectId() {
- this.tableData = []
- this.mess.deviceId = null
- this.page.total = 0
- },
- showTypes: {
- handler(newName, oldName) {
- if (newName && newName[0] && newName[0].value) {
- this.showType = newName[0].value
- } else {
- this.showType = ""
- }
- },
- immediate: true,
- deep: true
- }
- }
- };
- </script>
- <style lang="less">
- .hanson-bar {
- height: 40px;
- padding: 5px 0;
- font-size: 14px;
- overflow: hidden;
- margin-top: 0;
- line-height: 40px;
- .iconfont {
- font-size: 12px;
- }
- }
- .cancelButtonClass {
- width: 180px;
- }
- </style>
|