|
@@ -1,14 +1,14 @@
|
|
|
<template>
|
|
|
<div id="deviceList">
|
|
|
<el-row class="right">
|
|
|
- <span style="float:left;">当前选择的设备类型:{{category.Name}}</span>
|
|
|
+ <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>
|
|
|
+ <span>个{{category.name}}</span>
|
|
|
<el-button @click="handleAddTableRow">增加</el-button>
|
|
|
</el-row>
|
|
|
<div class="tableBox">
|
|
@@ -23,12 +23,7 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<el-row class="center">
|
|
|
- <el-button
|
|
|
- type="primary"
|
|
|
- size="medium"
|
|
|
- @click="handleCreateTableData"
|
|
|
- class="create_button"
|
|
|
- >创建设备</el-button>
|
|
|
+ <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>
|
|
@@ -39,27 +34,11 @@
|
|
|
<!-- 供应商弹窗 -->
|
|
|
<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>
|
|
|
+ <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>
|
|
|
+ <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>
|
|
@@ -74,9 +53,9 @@ import session from "@/framework/utils/storage";
|
|
|
import handsonTable from "@/components/common/handsontable";
|
|
|
import {
|
|
|
getDataDictionary,
|
|
|
- createPart,
|
|
|
- getEquipmentFamily,
|
|
|
- createPropertyData
|
|
|
+ createEquip,
|
|
|
+ createPropertyData,
|
|
|
+ getEquipBelongs
|
|
|
} from "@/api/scan/request";
|
|
|
import { mapGetters, mapActions } from "vuex";
|
|
|
|
|
@@ -111,9 +90,9 @@ export default {
|
|
|
addNum: 1,
|
|
|
onlyRead: false,
|
|
|
tableHeader: [],
|
|
|
- tableData: session.get("partsAddData")
|
|
|
- ? session.get("partsAddData").length
|
|
|
- ? session.get("partsAddData")
|
|
|
+ tableData: session.get("deviceAddData")
|
|
|
+ ? session.get("deviceAddData").length
|
|
|
+ ? session.get("deviceAddData")
|
|
|
: [{ Checked: 1 }]
|
|
|
: [{ Checked: 1 }],
|
|
|
isWatch: true,
|
|
@@ -142,47 +121,59 @@ export default {
|
|
|
picsArr: [], //临时设备图片keys数组
|
|
|
systemId: null,
|
|
|
graphyId: null,
|
|
|
- mess: {},
|
|
|
id: 0,
|
|
|
- readArr: ["A1","A2","B1","C5","D1","D2","E1","F1","F2","L","L1","L2","M"],
|
|
|
+ readArr: [
|
|
|
+ "A1",
|
|
|
+ "A2",
|
|
|
+ "B1",
|
|
|
+ "C5",
|
|
|
+ "D1",
|
|
|
+ "D2",
|
|
|
+ "E1",
|
|
|
+ "F1",
|
|
|
+ "F2",
|
|
|
+ "L",
|
|
|
+ "L1",
|
|
|
+ "L2",
|
|
|
+ "M"
|
|
|
+ ],
|
|
|
EquipmentList: [],
|
|
|
- firmId: "" //品牌型号所需字段
|
|
|
+ firmId: "" //品牌型号所需字段--族id三位编码(传设备类id或部件类id)
|
|
|
};
|
|
|
},
|
|
|
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.category = this.$route.query;
|
|
|
+ console.log(this.category)
|
|
|
+ this.getBelongs();
|
|
|
this.getTableHeader();
|
|
|
},
|
|
|
methods: {
|
|
|
- getEquipmentFamilyList() {
|
|
|
- getEquipmentFamily(res => {
|
|
|
- this.EquipmentList = res.Content;
|
|
|
- this.changeCader();
|
|
|
- });
|
|
|
+ //查询设备类对应的 族
|
|
|
+ getBelongs() {
|
|
|
+ let params = {
|
|
|
+ data: {
|
|
|
+ Filters: `EquipCode='${this.category.deviceId}'`,
|
|
|
+ PageNumber: 1,
|
|
|
+ PageSize: 50
|
|
|
+ }
|
|
|
+ }
|
|
|
+ getEquipBelongs(params, res => {
|
|
|
+ this.firmId = res.Content[0].Family;
|
|
|
+ })
|
|
|
},
|
|
|
// 获取表头数据(初始化表格)
|
|
|
async getTableHeader() {
|
|
|
let params = {
|
|
|
PageNumber: 1,
|
|
|
PageSize: 500,
|
|
|
- Filters: `type='Equipment' or type='${this.category.Code}'`
|
|
|
+ Filters: `type='Equipment' or type='${this.category.deviceId}'`
|
|
|
};
|
|
|
await getDataDictionary(params, res => {
|
|
|
- let response = res;
|
|
|
- if (response.Result == "success") {
|
|
|
- this.tableHeader = response.Content;
|
|
|
- this.initTable();
|
|
|
- } else {
|
|
|
- this.$message.error("请求错误:" + response.Result);
|
|
|
- }
|
|
|
+ this.tableHeader = res.Content;
|
|
|
+ this.initTable();
|
|
|
});
|
|
|
},
|
|
|
// 创建设备数据
|
|
@@ -196,7 +187,7 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
let newK = Object.keys(item)
|
|
|
- if ((item.Checked&&newK.length>1) || (!item.Checked&&newK.length)) {
|
|
|
+ if ((item.Checked && newK.length > 1) || (!item.Checked && newK.length)) {
|
|
|
return item;
|
|
|
}
|
|
|
});
|
|
@@ -205,8 +196,8 @@ export default {
|
|
|
return;
|
|
|
}
|
|
|
let flag = false;
|
|
|
- newData.map(item=>{
|
|
|
- if(item.Checked&&!item.EquipLocalName){
|
|
|
+ newData.map(item => {
|
|
|
+ if (item.Checked && !item.EquipLocalName) {
|
|
|
flag = true;
|
|
|
}
|
|
|
})
|
|
@@ -214,61 +205,34 @@ export default {
|
|
|
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")
|
|
|
- }
|
|
|
+ let params = newData[i]
|
|
|
+ params.Family = this.firmId;
|
|
|
+ params.Category = this.category.deviceId;
|
|
|
+ if (newData[i].Checked) {//同时创建资产
|
|
|
+ await createPropertyData(params, async res => {
|
|
|
+ params.PropertyId = res.Id
|
|
|
+ await createEquip(params, res => {
|
|
|
+ if (i == newData.length - 1) {
|
|
|
+ this.$router.push({
|
|
|
+ path: "/ledger/facility",
|
|
|
+ query: {
|
|
|
+ deviceId: this.category.deviceId }
|
|
|
+ });
|
|
|
+ session.remove("deviceAddData")
|
|
|
+ }
|
|
|
+ })
|
|
|
})
|
|
|
- }else{
|
|
|
- await createPart(params, res=>{
|
|
|
- if(i==newData.length-1){
|
|
|
+ } else {
|
|
|
+ await createEquip(params, res => {
|
|
|
+ if (i == newData.length - 1) {
|
|
|
this.$router.push({
|
|
|
path: "/ledger/partsmanage",
|
|
|
query: {
|
|
|
- deviceId: this.category.deviceId,
|
|
|
- typeId: this.category.ParentId
|
|
|
- }
|
|
|
+ deviceId: this.category.deviceId }
|
|
|
});
|
|
|
- session.remove("partsAddData")
|
|
|
+ session.remove("deviceAddData")
|
|
|
}
|
|
|
});
|
|
|
}
|
|
@@ -306,7 +270,7 @@ export default {
|
|
|
return item;
|
|
|
}
|
|
|
});
|
|
|
- session.set("partsAddData", newData);
|
|
|
+ session.set("deviceAddData", newData);
|
|
|
},
|
|
|
//格式化表头显示的数据
|
|
|
formatHeaderData(list) {
|
|
@@ -324,7 +288,7 @@ export default {
|
|
|
this.isWatch,
|
|
|
false
|
|
|
);
|
|
|
- data.unshift("同时创建资产");
|
|
|
+ data.unshift("同时创建资产", "所属系统实例");
|
|
|
return data;
|
|
|
},
|
|
|
formatHeaderType(list) {
|
|
@@ -345,7 +309,11 @@ export default {
|
|
|
label: {
|
|
|
position: "after"
|
|
|
}
|
|
|
- });
|
|
|
+ }, {
|
|
|
+ data: "linkSystem",
|
|
|
+ renderer: text.systemList,
|
|
|
+ readOnly: true
|
|
|
+ });
|
|
|
return data;
|
|
|
},
|
|
|
initTable() {
|
|
@@ -387,11 +355,10 @@ export default {
|
|
|
},
|
|
|
//选择型号修改
|
|
|
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)
|
|
|
+ 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;
|
|
@@ -405,12 +372,12 @@ export default {
|
|
|
},
|
|
|
//如果选择供应商之后
|
|
|
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)
|
|
|
+ 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;
|
|
@@ -440,12 +407,12 @@ export default {
|
|
|
},
|
|
|
//维修商变更
|
|
|
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)
|
|
|
+ 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;
|
|
@@ -455,12 +422,12 @@ export default {
|
|
|
},
|
|
|
//保险商变更
|
|
|
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)
|
|
|
+ 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;
|
|
@@ -472,15 +439,6 @@ export default {
|
|
|
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) {
|
|
|
//点击的是表头
|
|
@@ -586,11 +544,11 @@ export default {
|
|
|
//保险文件--设备文档--安装质检报告
|
|
|
if (
|
|
|
val == "LedgerParam.InsuranceDoc.InsuranceFile" ||
|
|
|
- val == "LedgerParam.PhotoDoc.Archive" ||
|
|
|
+ val == "LedgerParam.PhotoDoc.Archive" ||
|
|
|
val == "LedgerParam.Siteinstall.CheckReport"
|
|
|
) {
|
|
|
let data = tools.dataForKey(this.tableData[row.row], val)
|
|
|
- this.filesArr = data? data: []
|
|
|
+ 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]]]
|
|
@@ -606,7 +564,7 @@ export default {
|
|
|
val == "LedgerParam.PhotoDoc.Drawing"
|
|
|
) {
|
|
|
let data = tools.dataForKey(this.tableData[row.row], val)
|
|
|
- this.imgsArr = data? data: []
|
|
|
+ this.imgsArr = data ? data : []
|
|
|
// if (val == "LedgerParam.PhotoDoc.Nameplate") {
|
|
|
// this.imgsArr = this.tableData[row.row].infos
|
|
|
// ? this.tableData[row.row].infos[val.split(".")[1]]
|
|
@@ -625,7 +583,7 @@ export default {
|
|
|
//设备照片
|
|
|
if (val == "LedgerParam.PhotoDoc.Pic") {
|
|
|
let data = tools.dataForKey(this.tableData[row.row], val)
|
|
|
- this.picsArr = data? data: []
|
|
|
+ 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]]
|
|
@@ -636,18 +594,6 @@ export default {
|
|
|
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);
|