|
@@ -25,22 +25,18 @@
|
|
|
<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>
|
|
|
+ <firm :mess="{deviceId: category.Family}" 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-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" :type="'edit'" @change="changeSystemType"></system-type>
|
|
|
<details-dialog :iframeSrc="iframeSrc" v-if="myDialog.details" :dialog="myDialog"></details-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -53,10 +49,9 @@ import session from "@/framework/utils/storage"
|
|
|
import buildFloorData from '@/utils/handsontable/buildFloorData'
|
|
|
|
|
|
import handsonTable from "@/components/common/handsontable"
|
|
|
-import { getDataDictionary, createEquip, createPropertyData, getEquipBelongs, getSpaceFloor } from "@/api/scan/request"
|
|
|
+import { getDataDictionary, 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"
|
|
@@ -66,10 +61,8 @@ 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,
|
|
@@ -79,7 +72,6 @@ export default {
|
|
|
uploadFilesDialog,
|
|
|
uploadImgDialog,
|
|
|
picDialog,
|
|
|
- systemType,
|
|
|
handsonTable
|
|
|
},
|
|
|
data() {
|
|
@@ -87,15 +79,14 @@ export default {
|
|
|
addNum: 1,
|
|
|
onlyRead: false,
|
|
|
tableHeader: [],
|
|
|
- tableData: session.get("deviceAddData")
|
|
|
- ? session.get("deviceAddData").length
|
|
|
- ? session.get("deviceAddData")
|
|
|
- : [{ Checked: 1 }]
|
|
|
- : [{ Checked: 1 }],
|
|
|
+ tableData: session.get("propertyAddData")
|
|
|
+ ? session.get("propertyAddData").length
|
|
|
+ ? session.get("propertyAddData")
|
|
|
+ : [{}]
|
|
|
+ : [{}],
|
|
|
copyTableData: [],
|
|
|
category: "", //当前设备类
|
|
|
myDialog: {
|
|
|
- qrcode: false, //二维码弹窗
|
|
|
firm: false, //厂商弹窗
|
|
|
supply: false, //选择供应合同
|
|
|
supplier: false, //供应商选择
|
|
@@ -108,7 +99,6 @@ export default {
|
|
|
addDevice: false,
|
|
|
systemType: false,
|
|
|
details: false, //详情页
|
|
|
- changeRea: false,
|
|
|
lookPic: false //图片查看
|
|
|
},
|
|
|
qrcodeUrl: "", //二维码图片地址
|
|
@@ -119,93 +109,17 @@ export default {
|
|
|
graphyId: null,
|
|
|
id: 0,
|
|
|
showTypeFlag: true,
|
|
|
- EquipmentList: [],
|
|
|
- firmId: "" //品牌型号所需字段--族id三位编码(传设备类id或部件类id)
|
|
|
+ EquipmentList: []
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
...mapGetters("layout", ["projectId", "secret", "userId"])
|
|
|
},
|
|
|
created() {
|
|
|
- this.category = this.$route.query;
|
|
|
- this.getBelongs();
|
|
|
- this.getFloorData();
|
|
|
+ this.category = this.$route.query;
|
|
|
this.getTableHeader();
|
|
|
},
|
|
|
methods: {
|
|
|
- //查询设备类对应的 族
|
|
|
- getBelongs() {
|
|
|
- let params = {
|
|
|
- data: {
|
|
|
- Filters: `EquipCode='${this.category.deviceId}'`,
|
|
|
- PageNumber: 1,
|
|
|
- PageSize: 50
|
|
|
- }
|
|
|
- }
|
|
|
- getEquipBelongs(params, res => {
|
|
|
- this.firmId = res.Content[0].Family;
|
|
|
- })
|
|
|
- },
|
|
|
- //获取楼层数据
|
|
|
- getFloorData() {
|
|
|
- let param = {
|
|
|
- ProjId: this.projectId,
|
|
|
- secret: this.secret
|
|
|
- }
|
|
|
- getSpaceFloor(param).then(res => {
|
|
|
- if (res.data.Result == 'success') {
|
|
|
- let data = this.changeArr(res.data.Content), floorData = []
|
|
|
- data.map(item => {
|
|
|
- if (!!item.children) {
|
|
|
- item.children.unshift({
|
|
|
- value: '',
|
|
|
- label: "未明确楼层"
|
|
|
- })
|
|
|
- }
|
|
|
- return item
|
|
|
- })
|
|
|
- data.map(item => {
|
|
|
- if (!!item.children && item.children.length) {
|
|
|
- item.children.map(child => {
|
|
|
- floorData.push({
|
|
|
- Code: item.value + "-" + child.value,
|
|
|
- Name: item.label + "-" + child.label
|
|
|
- })
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- this.floorData = floorData
|
|
|
- } else {
|
|
|
- this.$message.error(res.data.ResultMsg)
|
|
|
- }
|
|
|
- }).catch(() => {
|
|
|
- this.$message.error("请求出错")
|
|
|
- })
|
|
|
- },
|
|
|
- //将数组转换成optiosn格式
|
|
|
- changeArr(arr) {
|
|
|
- return arr.map(item => {
|
|
|
- if (item.floors && item.floors.length) {
|
|
|
- return {
|
|
|
- value: item.id,
|
|
|
- label: item.infos.BuildLocalName,
|
|
|
- children: item.floors.map(i => {
|
|
|
- return {
|
|
|
- value: i.id,
|
|
|
- label: i.infos.FloorLocalName || "未知",
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- } else {
|
|
|
- return {
|
|
|
- value: item.id,
|
|
|
- label: item.infos.BuildLocalName,
|
|
|
- children: null,
|
|
|
- isChilren: 1,
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
// 获取表头数据(初始化表格)
|
|
|
async getTableHeader() {
|
|
|
let params = {
|
|
@@ -213,17 +127,17 @@ export default {
|
|
|
PageNumber: 1,
|
|
|
PageSize: 500
|
|
|
},
|
|
|
- type: this.category.deviceId
|
|
|
+ type: this.category.Family
|
|
|
};
|
|
|
await getDataDictionary(params, res => {
|
|
|
this.tableHeader = res.Content;
|
|
|
this.initTable();
|
|
|
});
|
|
|
},
|
|
|
- // 创建设备数据
|
|
|
+ // 创建资产数据
|
|
|
async handleCreateTableData() {
|
|
|
let newData = this.tableData.filter(item => {
|
|
|
- let keys = Object.keys(item);
|
|
|
+ let keys = Object.keys(item)
|
|
|
keys.map(key => {
|
|
|
//将值为空字符串的属性删除
|
|
|
if (item[key] == "") {
|
|
@@ -231,100 +145,75 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
let newK = Object.keys(item)
|
|
|
- if ((item.Checked && newK.length > 1) || (!item.Checked && newK.length)) {
|
|
|
+ if (keys.length && newK.length) {
|
|
|
return item;
|
|
|
}
|
|
|
- });
|
|
|
+ })
|
|
|
if (!newData.length) {
|
|
|
this.$message("创建信息为空,请录入信息后再创建!");
|
|
|
return;
|
|
|
}
|
|
|
let flag = false;
|
|
|
newData.map(item => {
|
|
|
- if (item.Checked && !item.EquipLocalName) {
|
|
|
- flag = true;
|
|
|
+ item.Family = this.category.Family
|
|
|
+ if (!item.EquipLocalName) {
|
|
|
+ flag = true
|
|
|
}
|
|
|
// 处理建筑-楼层
|
|
|
if (item.flowBuild) {
|
|
|
- item.BuildingId = item.flowBuild.split("-")[0]
|
|
|
- item.FloorId = item.flowBuild.split("-")[1]
|
|
|
- }
|
|
|
- //处理管理的系统
|
|
|
- if (item.LinkSystem && item.LinkSystem.length) {
|
|
|
- item.SystemList = []
|
|
|
- item.LinkSystem.map(t => {
|
|
|
- item.SystemList.push(t.id)
|
|
|
- })
|
|
|
- }
|
|
|
+ let BuildingId = item.flowBuild.split("-")[0]
|
|
|
+ let FloorId = item.flowBuild.split("-")[1]
|
|
|
+ if (BuildingId && FloorId) {
|
|
|
+ item.BuildingId = BuildingId
|
|
|
+ item.FloorId = FloorId
|
|
|
+ } else if (BuildingId && !FloorId) {
|
|
|
+ item.BuildingId = BuildingId
|
|
|
+ }
|
|
|
+ }
|
|
|
})
|
|
|
if (flag) {
|
|
|
this.$message.info("存在设备的本地名称为空,请检查")
|
|
|
return;
|
|
|
- }
|
|
|
-
|
|
|
- for (let i = 0; i < newData.length; i++) {
|
|
|
- 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.EntityList[0].EquipID
|
|
|
- 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 createEquip([params], res => {
|
|
|
- if (i == newData.length - 1) {
|
|
|
- this.$router.push({
|
|
|
- path: "/ledger/facility",
|
|
|
- query: { deviceId: this.category.deviceId }
|
|
|
- });
|
|
|
- session.remove("deviceAddData")
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
+ }
|
|
|
+
|
|
|
+ await createPropertyData(newData, res => {
|
|
|
+ this.$router.push({
|
|
|
+ path: "/ledger/property",
|
|
|
+ query: { Family: this.category.Family }
|
|
|
+ })
|
|
|
+ session.remove("propertyAddData")
|
|
|
+ })
|
|
|
},
|
|
|
// 删除表格行
|
|
|
handleDeleteTableRow() {
|
|
|
- this.$message.success("删除成功");
|
|
|
- this.formaTableData();
|
|
|
+ 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();
|
|
|
+ let addRowLength = this.addNum
|
|
|
+ this.initTable()
|
|
|
+ this.formaTableData()
|
|
|
},
|
|
|
//修改
|
|
|
handleUpdataTable(changeData, source) {
|
|
|
- this.formaTableData();
|
|
|
+ this.formaTableData()
|
|
|
},
|
|
|
//保存去掉空字段的新增数据
|
|
|
formaTableData() {
|
|
|
let newData = this.tableData.filter(item => {
|
|
|
- let keys = Object.keys(item);
|
|
|
+ let keys = Object.keys(item)
|
|
|
keys.map(key => {
|
|
|
//将值为空字符串的属性删除
|
|
|
if (item[key] == "") {
|
|
|
- delete item[key];
|
|
|
+ delete item[key]
|
|
|
}
|
|
|
- });
|
|
|
+ })
|
|
|
if (keys.length && Object.keys(item).length) {
|
|
|
return item;
|
|
|
}
|
|
|
- });
|
|
|
- session.set("deviceAddData", newData);
|
|
|
+ })
|
|
|
+ session.set("propertyAddData", newData);
|
|
|
},
|
|
|
//格式化表头显示的数据
|
|
|
formatHeaderData(list) {
|
|
@@ -334,8 +223,8 @@ export default {
|
|
|
data.unshift("所属建筑楼层")
|
|
|
return data
|
|
|
},
|
|
|
+ //格式化表头头映射的数据
|
|
|
formatHeaderType(list) {
|
|
|
- //格式化表头头映射的数据
|
|
|
let arr = tools.copyArr(list)
|
|
|
let showType = this.showTypeFlag?'partInfo':'all'
|
|
|
let data = showTools.headerTypeFilter(arr, 'property', this.onlyRead, showType, true)
|
|
@@ -344,7 +233,7 @@ export default {
|
|
|
renderer: tools.customDropdownRenderer,
|
|
|
editor: "chosen",
|
|
|
chosenOptions: {
|
|
|
- data: buildFloorData.data
|
|
|
+ data: buildFloorData.data
|
|
|
}
|
|
|
})
|
|
|
return data
|
|
@@ -360,7 +249,7 @@ export default {
|
|
|
contextMenu: {
|
|
|
items: {
|
|
|
remove_row: {
|
|
|
- name: "删除设备"
|
|
|
+ name: "删除资产"
|
|
|
}
|
|
|
}
|
|
|
},
|
|
@@ -435,10 +324,6 @@ export default {
|
|
|
changePics(keys) {
|
|
|
this.setDataToMain(keys, this.messKey, this.row);
|
|
|
},
|
|
|
- //关联系统变更
|
|
|
- changeSystemType(data) {
|
|
|
- tools.setDataForKey(this.tableData[this.row], "LinkSystem", data)
|
|
|
- },
|
|
|
//表格点击事件
|
|
|
handleTdClick(el, rowArr) {
|
|
|
//点击的是表头
|
|
@@ -486,33 +371,6 @@ export default {
|
|
|
getInfors(infos, row) {
|
|
|
let val = this.tableExample.colToProp(row.col);
|
|
|
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.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) {
|
|
@@ -592,14 +450,6 @@ export default {
|
|
|
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;
|
|
|
}
|