|
@@ -1,18 +1,701 @@
|
|
|
<template>
|
|
|
- <div>
|
|
|
- 11111111111111
|
|
|
+ <div id="deviceList">
|
|
|
+ <el-row class="right">
|
|
|
+ <span style="float:left;">当前选择的设备类型:{{category.Name}}</span>
|
|
|
+ <div style="width:200px;display:inline-block;text-align:left;color:gray;">
|
|
|
+ <span>隐藏自动填充的信息</span>
|
|
|
+ <el-checkbox v-model="isWatch" @change="getTableHeader"></el-checkbox>
|
|
|
+ </div>
|
|
|
+ <span>增加</span>
|
|
|
+ <el-input v-model="addNum" style="width:40px;" size="small"></el-input>
|
|
|
+ <span>个{{category.Name}}</span>
|
|
|
+ <el-button @click="handleAddTableRow">增加</el-button>
|
|
|
+ </el-row>
|
|
|
+ <div class="tableBox">
|
|
|
+ <div class="center middle_sty" style="flex:2;" v-show="tableData && !tableData.length">
|
|
|
+ <p>
|
|
|
+ <i class="iconwushuju iconfont"></i>
|
|
|
+ 暂无数据
|
|
|
+ </p>
|
|
|
+ </div>
|
|
|
+ <div class="tableLeft" v-show="tableData && tableData.length">
|
|
|
+ <handson-table ref="table"></handson-table>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
+ <el-row class="center">
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ size="medium"
|
|
|
+ @click="handleCreateTableData"
|
|
|
+ class="create_button"
|
|
|
+ >创建设备</el-button>
|
|
|
+ </el-row>
|
|
|
+ <!-- 二维码弹窗 -->
|
|
|
+ <qrcode :dialog="myDialog" :qrcodeUrl="qrcodeUrl" :addBody="true" ref="qrcode"></qrcode>
|
|
|
+ <!-- 型号弹窗 -->
|
|
|
+ <firm :mess="{deviceId: firmId}" 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>
|
|
|
+ <system-type :infos="systemId" :graphyId="graphyId" :dialog="myDialog"></system-type>
|
|
|
+ <details-dialog :iframeSrc="iframeSrc" v-if="myDialog.details" :dialog="myDialog"></details-dialog>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
-
|
|
|
<script>
|
|
|
-export default {
|
|
|
-
|
|
|
-}
|
|
|
-</script>
|
|
|
-
|
|
|
+import tools from "@/utils/scan/tools";
|
|
|
+import handsonUtils from "@/utils/hasontableUtils";
|
|
|
+import showTools from "@/utils/handsontable/notShow";
|
|
|
+import text from "@/utils/handsontable/mainText";
|
|
|
+import session from "@/framework/utils/storage";
|
|
|
|
|
|
-<style>
|
|
|
-
|
|
|
-</style>
|
|
|
+import handsonTable from "@/components/common/handsontable";
|
|
|
+import {
|
|
|
+ getDataDictionary,
|
|
|
+ createPart,
|
|
|
+ getEquipmentFamily,
|
|
|
+ createPropertyData
|
|
|
+} from "@/api/scan/request";
|
|
|
+import { mapGetters, mapActions } from "vuex";
|
|
|
|
|
|
+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";
|
|
|
+export default {
|
|
|
+ components: {
|
|
|
+ qrcode, //二维码页面
|
|
|
+ firm, //品牌型号弹窗
|
|
|
+ supplyDialog,
|
|
|
+ supplierDialog,
|
|
|
+ maintainerDialog,
|
|
|
+ insurerDialog,
|
|
|
+ guaranteeDialog,
|
|
|
+ uploadFilesDialog,
|
|
|
+ uploadImgDialog,
|
|
|
+ picDialog,
|
|
|
+ systemType,
|
|
|
+ handsonTable
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ addNum: 1,
|
|
|
+ onlyRead: false,
|
|
|
+ tableHeader: [],
|
|
|
+ tableData: session.get("partsAddData")
|
|
|
+ ? session.get("partsAddData").length
|
|
|
+ ? session.get("partsAddData")
|
|
|
+ : [{ Checked: 1 }]
|
|
|
+ : [{ Checked: 1 }],
|
|
|
+ isWatch: true,
|
|
|
+ copyTableData: [],
|
|
|
+ category: "", //当前设备类
|
|
|
+ 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 //图片查看
|
|
|
+ },
|
|
|
+ qrcodeUrl: "", //二维码图片地址
|
|
|
+ filesArr: [], //保存临时的文件key
|
|
|
+ imgsArr: [], //临时保存的图片key数组
|
|
|
+ picsArr: [], //临时设备图片keys数组
|
|
|
+ systemId: null,
|
|
|
+ graphyId: null,
|
|
|
+ mess: {},
|
|
|
+ id: 0,
|
|
|
+ readArr: ["A1","A2","B1","C5","D1","D2","E1","F1","F2","L","L1","L2","M"],
|
|
|
+ EquipmentList: [],
|
|
|
+ firmId: "" //品牌型号所需字段
|
|
|
+ };
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ ...mapGetters("layout", ["projectId", "secret", "userId"])
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.category = this.$route.params;
|
|
|
+ this.category.ParentId = this.category.Code.substr(0, 4);
|
|
|
+ this.mess = {
|
|
|
+ deviceId: this.category.ParentId
|
|
|
+ };
|
|
|
+ this.getEquipmentFamilyList();
|
|
|
+ this.getTableHeader();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ getEquipmentFamilyList() {
|
|
|
+ getEquipmentFamily(res => {
|
|
|
+ this.EquipmentList = res.Content;
|
|
|
+ this.changeCader();
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 获取表头数据(初始化表格)
|
|
|
+ async getTableHeader() {
|
|
|
+ let params = {
|
|
|
+ PageNumber: 1,
|
|
|
+ PageSize: 500,
|
|
|
+ Filters: `type='Equipment' or type='${this.category.Code}'`
|
|
|
+ };
|
|
|
+ await getDataDictionary(params, res => {
|
|
|
+ let response = res;
|
|
|
+ if (response.Result == "success") {
|
|
|
+ this.tableHeader = response.Content;
|
|
|
+ this.initTable();
|
|
|
+ } else {
|
|
|
+ this.$message.error("请求错误:" + response.Result);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 创建设备数据
|
|
|
+ async handleCreateTableData() {
|
|
|
+ let newData = this.tableData.filter(item => {
|
|
|
+ let keys = Object.keys(item);
|
|
|
+ keys.map(key => {
|
|
|
+ //将值为空字符串的属性删除
|
|
|
+ if (item[key] == "") {
|
|
|
+ delete item[key];
|
|
|
+ }
|
|
|
+ });
|
|
|
+ let newK = Object.keys(item)
|
|
|
+ if ((item.Checked&&newK.length>1) || (!item.Checked&&newK.length)) {
|
|
|
+ return item;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if (!newData.length) {
|
|
|
+ this.$message("创建信息为空,请录入信息后再创建!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ let flag = false;
|
|
|
+ newData.map(item=>{
|
|
|
+ if(item.Checked&&!item.EquipLocalName){
|
|
|
+ flag = true;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if (flag) {
|
|
|
+ this.$message.info("存在设备的本地名称为空,请检查")
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ let params = { projectId: this.projectId }
|
|
|
|
|
|
+ for (let i = 0; i < newData.length; i++) {
|
|
|
+ let data = {
|
|
|
+ ParentId: this.category.deviceId, //当前设备id
|
|
|
+ Category: this.category.Code //当前设备分类
|
|
|
+ };
|
|
|
+ params.data = Object.assign(data, newData[i]);
|
|
|
+ // await createPart(params).then(res => {
|
|
|
+ // let response = res;
|
|
|
+ // if(response.Result=='success'){
|
|
|
+ // if(newData[i].Checked){//同时创建资产
|
|
|
+ // params.data.EquipmentId = response.Id
|
|
|
+ // createPropertyData(params);
|
|
|
+ // }
|
|
|
+ // if(i==newData.length-1){
|
|
|
+ // this.$router.push({
|
|
|
+ // path: "/ledger/partsmanage",
|
|
|
+ // query: {
|
|
|
+ // deviceId: this.category.deviceId,
|
|
|
+ // typeId: this.category.ParentId
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // session.remove("partsAddData")
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ if(newData[i].Checked){//同时创建资产
|
|
|
+ await createPropertyData(params, res => {
|
|
|
+ let response = res;
|
|
|
+ params.data.PropertyId = response.Id;
|
|
|
+ })
|
|
|
+ await createPart(params, res=>{
|
|
|
+ if(i==newData.length-1){
|
|
|
+ this.$router.push({
|
|
|
+ path: "/ledger/partsmanage",
|
|
|
+ query: {
|
|
|
+ deviceId: this.category.deviceId,
|
|
|
+ typeId: this.category.ParentId
|
|
|
+ }
|
|
|
+ });
|
|
|
+ session.remove("partsAddData")
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ await createPart(params, res=>{
|
|
|
+ if(i==newData.length-1){
|
|
|
+ this.$router.push({
|
|
|
+ path: "/ledger/partsmanage",
|
|
|
+ query: {
|
|
|
+ deviceId: this.category.deviceId,
|
|
|
+ typeId: this.category.ParentId
|
|
|
+ }
|
|
|
+ });
|
|
|
+ session.remove("partsAddData")
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 删除表格行
|
|
|
+ handleDeleteTableRow() {
|
|
|
+ this.$message.success("删除成功");
|
|
|
+ this.formaTableData();
|
|
|
+ },
|
|
|
+ // 添加行
|
|
|
+ handleAddTableRow() {
|
|
|
+ let addRowLength = this.addNum;
|
|
|
+ for (let i = 0; i < addRowLength; i++) {
|
|
|
+ this.tableData.push({ Checked: 1 });
|
|
|
+ }
|
|
|
+ this.initTable();
|
|
|
+ this.formaTableData();
|
|
|
+ },
|
|
|
+ //修改
|
|
|
+ handleUpdataTable(changeData, source) {
|
|
|
+ this.formaTableData();
|
|
|
+ },
|
|
|
+ //保存去掉空字段的新增数据
|
|
|
+ formaTableData() {
|
|
|
+ let newData = this.tableData.filter(item => {
|
|
|
+ let keys = Object.keys(item);
|
|
|
+ keys.map(key => {
|
|
|
+ //将值为空字符串的属性删除
|
|
|
+ if (item[key] == "") {
|
|
|
+ delete item[key];
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if (keys.length && Object.keys(item).length) {
|
|
|
+ return item;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ session.set("partsAddData", newData);
|
|
|
+ },
|
|
|
+ //格式化表头显示的数据
|
|
|
+ formatHeaderData(list) {
|
|
|
+ let arr = tools.copyArr(list);
|
|
|
+ arr.map(item => {
|
|
|
+ item.Visible = true;
|
|
|
+ });
|
|
|
+ if (!this.onlyRead) {
|
|
|
+ this.readArr.push("Own");
|
|
|
+ }
|
|
|
+ let data = showTools.tableHeadFilter(
|
|
|
+ arr,
|
|
|
+ this.readArr,
|
|
|
+ this.onlyRead,
|
|
|
+ this.isWatch,
|
|
|
+ false
|
|
|
+ );
|
|
|
+ data.unshift("同时创建资产");
|
|
|
+ return data;
|
|
|
+ },
|
|
|
+ formatHeaderType(list) {
|
|
|
+ //格式化表头头映射的数据
|
|
|
+ let arr = tools.copyArr(list);
|
|
|
+ let data = showTools.tableHeaderTypes(
|
|
|
+ arr,
|
|
|
+ this.readArr,
|
|
|
+ this.onlyRead,
|
|
|
+ this.isWatch,
|
|
|
+ false
|
|
|
+ );
|
|
|
+ data.unshift({
|
|
|
+ type: "checkbox",
|
|
|
+ checkedTemplate: 1,
|
|
|
+ uncheckedTemplate: 0,
|
|
|
+ data: "Checked",
|
|
|
+ label: {
|
|
|
+ position: "after"
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return data;
|
|
|
+ },
|
|
|
+ initTable() {
|
|
|
+ //实例化表格
|
|
|
+ let settings = {
|
|
|
+ data: this.tableData,
|
|
|
+ colHeaders: this.formatHeaderData(this.tableHeader),
|
|
|
+ columns: this.formatHeaderType(this.tableHeader),
|
|
|
+ rowHeights: 30,
|
|
|
+ maxRows: this.tableData.length,
|
|
|
+ contextMenu: {
|
|
|
+ items: {
|
|
|
+ remove_row: {
|
|
|
+ name: "删除设备"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 事件
|
|
|
+ afterChange: this.handleUpdataTable, //修改后
|
|
|
+ afterFilter: this.trimmedRows, //排序前
|
|
|
+ afterRemoveRow: this.handleDeleteTableRow, //右键删除
|
|
|
+ afterOnCellMouseDown: this.handleTdClick //鼠标点击
|
|
|
+ };
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.tableExample = this.$refs.table.init(settings);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ //去除数组中相同的元素
|
|
|
+ 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;
|
|
|
+ },
|
|
|
+ //选择型号修改
|
|
|
+ firmChange(data) {
|
|
|
+ console.log(this.row)
|
|
|
+ tools.setDataForKey(this.tableData[this.row],"DPSpecificationID",data.specificationId)
|
|
|
+ tools.setDataForKey(this.tableData[this.row],"LedgerParam.EquipManufactor.Brand",data.brand)
|
|
|
+ tools.setDataForKey(this.tableData[this.row],"LedgerParam.EquipManufactor.Specification",data.name)
|
|
|
+ tools.setDataForKey(this.tableData[this.row],"LedgerParam.EquipManufactor.Manufacturer",data.venderName)
|
|
|
+ for (let key in data) {
|
|
|
+ if (key == "venderId") {
|
|
|
+ data[key] = data[key] + "-" + data.name + "/" + data.brand;
|
|
|
+ this.utilToKey(key, "venderId", data, "DPManufacturerID");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ supplyChange(data) {
|
|
|
+ let changeData = { id: data };
|
|
|
+ this.utilToKey("id", "id", changeData, "SupplierContractID");
|
|
|
+ },
|
|
|
+ //如果选择供应商之后
|
|
|
+ supplierChange(data) {
|
|
|
+ tools.setDataForKey(this.tableData[this.row],"LedgerParam.SupplyPurchase.Supplier",data.name)
|
|
|
+ tools.setDataForKey(this.tableData[this.row],"LedgerParam.SupplyPurchase.SupplierWeb",data.website)
|
|
|
+ tools.setDataForKey(this.tableData[this.row],"LedgerParam.SupplyPurchase.SupplierContactor",data.man)
|
|
|
+ tools.setDataForKey(this.tableData[this.row],"LedgerParam.SupplyPurchase.SupplierPhone",data.phone)
|
|
|
+ tools.setDataForKey(this.tableData[this.row],"LedgerParam.SupplyPurchase.SupplierFax",data.fox)
|
|
|
+ tools.setDataForKey(this.tableData[this.row],"LedgerParam.SupplyPurchase.SupplierEmail",data.email)
|
|
|
+ for (let key in data) {
|
|
|
+ if (key == "venderId") {
|
|
|
+ data[key] = data[key] + "-" + data.name;
|
|
|
+ this.utilToKey(key, "venderId", data, "DPSupplierID");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //保险合同
|
|
|
+ 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");
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //上传文件弹窗触发事件
|
|
|
+ fileChange(keys) {
|
|
|
+ this.setDataToMain(keys, this.messKey, this.row);
|
|
|
+ },
|
|
|
+ //上传图片弹窗触发事件
|
|
|
+ imgChange(keys) {
|
|
|
+ this.setDataToMain(keys, this.messKey, this.row);
|
|
|
+ },
|
|
|
+ //维修商变更
|
|
|
+ changeMaintainer(data) {
|
|
|
+ tools.setDataForKey(this.tableData[this.row],"LedgerParam.OperationMainte.Maintainer",data.name)
|
|
|
+ tools.setDataForKey(this.tableData[this.row],"LedgerParam.OperationMainte.MaintainerWeb",data.website)
|
|
|
+ tools.setDataForKey(this.tableData[this.row],"LedgerParam.OperationMainte.MaintainerContactor",data.man)
|
|
|
+ tools.setDataForKey(this.tableData[this.row],"LedgerParam.OperationMainte.MaintainerPhone",data.phone)
|
|
|
+ tools.setDataForKey(this.tableData[this.row],"LedgerParam.OperationMainte.MaintainerFax",data.fox)
|
|
|
+ tools.setDataForKey(this.tableData[this.row],"LedgerParam.OperationMainte.MaintainerEmail",data.email)
|
|
|
+ for (let key in data) {
|
|
|
+ if (key == "venderId") {
|
|
|
+ data[key] = data[key] + "-" + data.name;
|
|
|
+ this.utilToKey(key, "venderId", data, "DPMaintainerID");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //保险商变更
|
|
|
+ changeInsurer(data) {
|
|
|
+ tools.setDataForKey(this.tableData[this.row],"LedgerParam.InsuranceDoc.InsurerEmail",data.email)
|
|
|
+ tools.setDataForKey(this.tableData[this.row],"LedgerParam.InsuranceDoc.InsurerFax",data.fox)
|
|
|
+ tools.setDataForKey(this.tableData[this.row],"LedgerParam.InsuranceDoc.InsurerPhone",data.phone)
|
|
|
+ tools.setDataForKey(this.tableData[this.row],"LedgerParam.InsuranceDoc.InsurerContactor",data.man)
|
|
|
+ tools.setDataForKey(this.tableData[this.row],"LedgerParam.InsuranceDoc.InsurerWeb",data.website)
|
|
|
+ tools.setDataForKey(this.tableData[this.row],"LedgerParam.InsuranceDoc.Insurer",data.name)
|
|
|
+ for (let key in data) {
|
|
|
+ if (key == "venderId") {
|
|
|
+ data[key] = data[key] + "-" + data.name;
|
|
|
+ this.utilToKey(key, "venderId", data, "DPInsurerID");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //设备图片弹窗改变事件
|
|
|
+ changePics(keys) {
|
|
|
+ this.setDataToMain(keys, this.messKey, this.row);
|
|
|
+ },
|
|
|
+ setGraphyId(graphyId, assetGroupList) {
|
|
|
+ this.graphyId = graphyId;
|
|
|
+ this.assetGroupList = assetGroupList;
|
|
|
+ },
|
|
|
+ //触发父组件change
|
|
|
+ getClose(val) {
|
|
|
+ this.$emit("close", val);
|
|
|
+ },
|
|
|
+ reset() {},
|
|
|
+ //表格点击事件
|
|
|
+ handleTdClick(el, rowArr) {
|
|
|
+ //点击的是表头
|
|
|
+ if (rowArr.row < 0) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //被筛选过后的数组
|
|
|
+ let trimmedArr = this.trimmedRows();
|
|
|
+ //是否启用了排序
|
|
|
+ let isSort = this.tableExample.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 });
|
|
|
+ } else if (isSort) {
|
|
|
+ //排序后的数组
|
|
|
+ let sortArr = this.tableExample.getPlugin("columnSorting").rowsMapper
|
|
|
+ .__arrayMap;
|
|
|
+ let infos = this.tableData[sortArr[rowArr.row]];
|
|
|
+ this.getInfors(infos, { row: sortArr[rowArr.row], col: rowArr.col });
|
|
|
+ } else if (trimmedArr.length) {
|
|
|
+ let infos = this.tableData[trimmedArr[rowArr.row]];
|
|
|
+ this.getInfors(infos, { row: trimmedArr[rowArr.row], col: rowArr.col });
|
|
|
+ } else {
|
|
|
+ let infos = this.tableData[rowArr.row];
|
|
|
+ this.getInfors(infos, rowArr);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //获取被筛选掉的行号
|
|
|
+ trimmedRows() {
|
|
|
+ var plugin = this.tableExample.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 || [];
|
|
|
+ },
|
|
|
+ getInfors(infos, row) {
|
|
|
+ //其他的开始判断
|
|
|
+ let val = this.tableExample.colToProp(row.col);
|
|
|
+ //设备二维码图片
|
|
|
+ if (val == "EquipQRCode") {
|
|
|
+ this.myDialog.qrcode = true;
|
|
|
+ this.$refs.qrcode.getCanvas(1111);
|
|
|
+ }
|
|
|
+ //关联系统
|
|
|
+ if (val == "linkSystem") {
|
|
|
+ // this.systemList = this.tableData[row.row].linkSystem || [];
|
|
|
+ this.myDialog.systemType = true;
|
|
|
+ }
|
|
|
+ //品牌型号弹窗
|
|
|
+ if (val == "DPManufacturerID") {
|
|
|
+ this.myDialog.firm = true;
|
|
|
+ }
|
|
|
+ //供应商信息弹窗
|
|
|
+ if (val == "DPSupplierID") {
|
|
|
+ this.myDialog.supplier = true;
|
|
|
+ }
|
|
|
+ //维修商信息弹窗
|
|
|
+ if (val == "DPMaintainerID") {
|
|
|
+ this.myDialog.maintainer = true;
|
|
|
+ }
|
|
|
+ //保险公司信息
|
|
|
+ if (val == "DPInsurerID") {
|
|
|
+ this.myDialog.insurer = true;
|
|
|
+ }
|
|
|
+ //供应合同编号
|
|
|
+ if (val == "LedgerParam.SupplyPurchase.SupplierContractID") {
|
|
|
+ let falg = null;
|
|
|
+ let data = this.tableData[row.row].DPSupplierID;
|
|
|
+ if (data) {
|
|
|
+ falg = data.split("-")[0];
|
|
|
+ }
|
|
|
+ if (!!falg) {
|
|
|
+ this.id = falg;
|
|
|
+ this.myDialog.supply = true;
|
|
|
+ } else {
|
|
|
+ this.$message("请先选择供应商");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //保险单号
|
|
|
+ if (val == "LedgerParam.InsuranceDoc.InsuranceNum") {
|
|
|
+ //选择保单
|
|
|
+ let falg = null;
|
|
|
+ let data = this.tableData[row.row].DPInsurerID
|
|
|
+ if (data) {
|
|
|
+ falg = data.split("-")[0];
|
|
|
+ }
|
|
|
+ if (!!falg) {
|
|
|
+ this.id = falg;
|
|
|
+ this.myDialog.guarantee = true;
|
|
|
+ } else {
|
|
|
+ this.$message("请先选择保险商");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //保险文件--设备文档--安装质检报告
|
|
|
+ if (
|
|
|
+ val == "LedgerParam.InsuranceDoc.InsuranceFile" ||
|
|
|
+ val == "LedgerParam.PhotoDoc.Archive" ||
|
|
|
+ val == "LedgerParam.Siteinstall.CheckReport"
|
|
|
+ ) {
|
|
|
+ let data = tools.dataForKey(this.tableData[row.row], val)
|
|
|
+ this.filesArr = data? data: []
|
|
|
+ // this.filesArr = this.tableData[row.row].infos
|
|
|
+ // ? this.tableData[row.row].infos[val.split(".")[1]]
|
|
|
+ // ? [this.tableData[row.row].infos[val.split(".")[1]]]
|
|
|
+ // : []
|
|
|
+ // : [];
|
|
|
+ this.myDialog.uploadFiles = true;
|
|
|
+ }
|
|
|
+ //安装照片--安装图纸--设备铭牌照片--设备图纸
|
|
|
+ if (
|
|
|
+ val == "LedgerParam.Siteinstall.InstallPic" ||
|
|
|
+ val == "LedgerParam.Siteinstall.InstallDrawing" ||
|
|
|
+ val == "LedgerParam.PhotoDoc.Nameplate" ||
|
|
|
+ val == "LedgerParam.PhotoDoc.Drawing"
|
|
|
+ ) {
|
|
|
+ let data = tools.dataForKey(this.tableData[row.row], val)
|
|
|
+ this.imgsArr = data? data: []
|
|
|
+ // if (val == "LedgerParam.PhotoDoc.Nameplate") {
|
|
|
+ // this.imgsArr = this.tableData[row.row].infos
|
|
|
+ // ? this.tableData[row.row].infos[val.split(".")[1]]
|
|
|
+ // ? [this.tableData[row.row].infos[val.split(".")[1]].key]
|
|
|
+ // : []
|
|
|
+ // : [];
|
|
|
+ // } else {
|
|
|
+ // this.imgsArr = this.tableData[row.row].infos
|
|
|
+ // ? this.tableData[row.row].infos[val.split(".")[1]]
|
|
|
+ // ? [this.tableData[row.row].infos[val.split(".")[1]]]
|
|
|
+ // : []
|
|
|
+ // : [];
|
|
|
+ // }
|
|
|
+ this.myDialog.uploadImgs = true;
|
|
|
+ }
|
|
|
+ //设备照片
|
|
|
+ if (val == "LedgerParam.PhotoDoc.Pic") {
|
|
|
+ let data = tools.dataForKey(this.tableData[row.row], val)
|
|
|
+ this.picsArr = data? data: []
|
|
|
+ // this.picsArr = this.tableData[row.row].infos
|
|
|
+ // ? this.tableData[row.row].infos[val.split(".")[1]]
|
|
|
+ // ? this.tableData[row.row].infos[val.split(".")[1]]
|
|
|
+ // : []
|
|
|
+ // : [];
|
|
|
+ this.myDialog.pic = true;
|
|
|
+ }
|
|
|
+ this.row = row.row;
|
|
|
+ this.messKey = val;
|
|
|
+ },
|
|
|
+ //修改设备类型
|
|
|
+ changeCader() {
|
|
|
+ this.EquipmentList.map(item => {
|
|
|
+ if (!!item.content && item.content.length) {
|
|
|
+ item.content.map(child => {
|
|
|
+ if (child.code == this.mess.deviceId) {
|
|
|
+ this.firmId = item.code;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ 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.tableData[row][key] = data;
|
|
|
+ } else {
|
|
|
+ this.tableData[row] = {};
|
|
|
+ tools.setDataForKey(this.tableData[row], key, data)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ tools.setDataForKey(this.tableData[row], key, "")
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|
|
|
+<style lang="less" scoped>
|
|
|
+#deviceList {
|
|
|
+ overflow: hidden;
|
|
|
+ height: 100%;
|
|
|
+ background-color: #fff;
|
|
|
+ padding: 10px;
|
|
|
+ position: relative;
|
|
|
+ .right {
|
|
|
+ background: #fff;
|
|
|
+ }
|
|
|
+ .search-header {
|
|
|
+ overflow: hidden;
|
|
|
+ padding: 0 10px 10px 10px;
|
|
|
+ border-bottom: 1px solid #bcbcbc;
|
|
|
+ }
|
|
|
+ .tableBox {
|
|
|
+ display: flex;
|
|
|
+ height: calc(100% - 100px);
|
|
|
+ margin-top: 10px;
|
|
|
+ .tableLeft {
|
|
|
+ flex: 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .create_button {
|
|
|
+ margin-top: 10px;
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|