addfacility.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730
  1. <template>
  2. <div id="deviceList">
  3. <el-row class="right">
  4. <!-- <span style="width:20px;float:left;display:block;height:20px;cursor: pointer;" @click="changeAssetsFalg">
  5. <i class="el-icon-fa el-icon-fa-compass"></i>
  6. </span> -->
  7. <span style="float:left;">当前选择的设备类型:{{ category.name }}</span>
  8. <el-select v-model="showType" @change="initTable" style="width:125px;margin-right:10px;vertical-align:bottom;">
  9. <el-option v-for="item in showTypes" :key="item.value" :label="item.label" :value="item.value"></el-option>
  10. </el-select>
  11. <span>增加</span>
  12. <el-input v-model="addNum" style="width:50px;" size="small"></el-input>
  13. <span>个{{ category.name }}</span>
  14. <el-button @click="handleAddTableRow">增加</el-button>
  15. </el-row>
  16. <div class="tableBox">
  17. <div class="center middle_sty" style="flex:2;" v-show="tableData && !tableData.length">
  18. <p>
  19. <i class="icon-wushuju iconfont"></i>
  20. 暂无数据
  21. </p>
  22. </div>
  23. <div class="tableLeft" v-show="tableData && tableData.length">
  24. <handson-table ref="table"></handson-table>
  25. </div>
  26. </div>
  27. <el-row class="center">
  28. <el-button type="primary" size="medium" @click="handleCreateTableData" class="create_button">创建设备</el-button>
  29. </el-row>
  30. <!-- 二维码弹窗 -->
  31. <qrcode :dialog="myDialog" :qrcodeUrl="qrcodeUrl" :addBody="true" ref="qrcode"></qrcode>
  32. <!-- 型号弹窗 -->
  33. <firm :mess="{deviceId: firmId}" ref="firm" @changeFirm="firmChange" :dialog="myDialog"></firm>
  34. <!-- 供应商合同弹窗 -->
  35. <supply-dialog ref="supply" @change="supplyChange" :id="id" :dialog="myDialog"></supply-dialog>
  36. <!-- 供应商弹窗 -->
  37. <supplier-dialog ref="supplier" @changeSupplier="supplierChange" :dialog="myDialog"></supplier-dialog>
  38. <guarantee-dialog :id="id" ref="guarantee" @change="guaranteeChange" :dialog="myDialog"></guarantee-dialog>
  39. <upload-files-dialog :read="onlyRead ? true : false" ref="upload" @changeFile="fileChange" :keysArr="filesArr"
  40. :dialog="myDialog">
  41. </upload-files-dialog>
  42. <upload-img-dialog :read="onlyRead ? true : false" @changeFile="imgChange" :keysArr="imgsArr"
  43. :dialog="myDialog"></upload-img-dialog>
  44. <maintainer-dialog @changeMaintainer="changeMaintainer" ref="maintainer" :dialog="myDialog"></maintainer-dialog>
  45. <insurer-dialog @changeInsurer="changeInsurer" ref="insurer" :dialog="myDialog"></insurer-dialog>
  46. <pic-dialog :read="onlyRead ? true : false" :dialog="myDialog" :keysArr="picsArr" @change="changePics"></pic-dialog>
  47. <system-type :device="category" :dialog="myDialog" :type="onlyRead?'read':'edit'" @change="changeSystemType"
  48. :list="systemList"></system-type>
  49. <details-dialog :iframeSrc="iframeSrc" v-if="myDialog.details" :dialog="myDialog"></details-dialog>
  50. </div>
  51. </template>
  52. <script>
  53. import tools from "@/utils/scan/tools";
  54. import handsonUtils from "@/utils/hasontableUtils";
  55. import showTools from "@/utils/handsontable/notShow";
  56. import text from "@/utils/handsontable/mainText";
  57. import session from "@/framework/utils/storage";
  58. import buildFloor from '@/utils/handsontable/buildFloorData'
  59. import handsonTable from "@/components/common/handsontable";
  60. import {
  61. // getDataDictionary,
  62. createEquip,
  63. createPropertyData,
  64. getEquipBelongs,
  65. createEquipAndProperty
  66. } from "@/api/scan/request";
  67. import { getDataDictionary } from "@/api/dict";
  68. import { mapGetters, mapActions } from "vuex";
  69. import qrcode from "@/components/ledger/lib/qrcode";
  70. import firm from "@/components/dialogs/list/firm";
  71. import supplyDialog from "@/components/dialogs/list/supplyDialog";
  72. import supplierDialog from "@/components/dialogs/list/supplierDialog";
  73. import maintainerDialog from "@/components/dialogs/list/maintainerDialog";
  74. import insurerDialog from "@/components/dialogs/list/insurerDialog";
  75. import guaranteeDialog from "@/components/dialogs/list/guaranteeDialog";
  76. import uploadFilesDialog from "@/components/dialogs/list/filesDialog";
  77. import uploadImgDialog from "@/components/dialogs/list/uploadImgDialog";
  78. import picDialog from "@/components/dialogs/list/picDialog";
  79. import systemType from "@/components/dialogs/list/systemType";
  80. export default {
  81. components: {
  82. qrcode, //二维码页面
  83. firm, //品牌型号弹窗
  84. supplyDialog,
  85. supplierDialog,
  86. maintainerDialog,
  87. insurerDialog,
  88. guaranteeDialog,
  89. uploadFilesDialog,
  90. uploadImgDialog,
  91. picDialog,
  92. systemType,
  93. handsonTable
  94. },
  95. data() {
  96. return {
  97. addNum: 1,
  98. onlyRead: false,
  99. showTypes: [{ value: "partInfo", label: '隐藏信息点' }, { value: "all", label: '全部' }, {
  100. value: "Visible",
  101. label: '只看采集信息'
  102. }],
  103. tableHeader: [],
  104. tableData: session.get("deviceAddData")
  105. ? session.get("deviceAddData").length
  106. ? session.get("deviceAddData")
  107. : [{ checked: 1 }]
  108. : [{ checked: 1 }],
  109. copyTableData: [],
  110. category: "", //当前设备类
  111. myDialog: {
  112. qrcode: false, //二维码弹窗
  113. firm: false, //厂商弹窗
  114. supply: false, //选择供应合同
  115. supplier: false, //供应商选择
  116. guarantee: false, //选择保单
  117. maintainer: false, //选择维修商
  118. insurer: false, //选择保险公司
  119. uploadFiles: false, //上传文件
  120. uploadImgs: false, //上传单个图片
  121. pic: false, //多个图片
  122. addDevice: false,
  123. systemType: false,
  124. details: false, //详情页
  125. changeRea: false,
  126. lookPic: false //图片查看
  127. },
  128. qrcodeUrl: "", //二维码图片地址
  129. filesArr: [], //保存临时的文件key
  130. imgsArr: [], //临时保存的图片key数组
  131. picsArr: [], //临时设备图片keys数组
  132. systemList: [], //关联的系统
  133. systemId: null,
  134. graphyId: null,
  135. id: 0,
  136. showType: this.$route.query.showType,
  137. EquipmentList: [],
  138. firmId: "", //品牌型号所需字段--族id三位编码(传设备类id或部件类id)
  139. buildFloorData: [],
  140. floorFlag: true,
  141. };
  142. },
  143. computed: {
  144. ...mapGetters("layout", ["projectId", "secret", "userId"])
  145. },
  146. created() {
  147. this.category = this.$route.query;
  148. buildFloor.getData(this.buildFloorData)
  149. this.getBelongs();
  150. this.getTableHeader();
  151. },
  152. methods: {
  153. //查询设备类对应的 族
  154. getBelongs() {
  155. let params = {
  156. data: {
  157. filters: `equipCode='${this.category.deviceId}'`,
  158. pageNumber: 1,
  159. pageSize: 50
  160. }
  161. }
  162. getEquipBelongs(params, res => {
  163. if (res.content.length) {
  164. this.firmId = res.content[0].family
  165. }
  166. })
  167. },
  168. //维护建筑
  169. // changeAssetsFalg() {
  170. // if (this.floorFlag) {
  171. // this.floorFlag = false
  172. // } else {
  173. // this.$confirm('<p>维护设备所在建筑楼层后,对后续数据影响较大,如业务空间中的所在关系or其他?暂未梳理明白……</p><p>后续要修改设备所属建筑楼层,只能通过模型中的待建模清单操作</p>', '提示', {
  174. // dangerouslyUseHTMLString: true,
  175. // confirmButtonText: '就要维护设备所属建筑楼层',
  176. // cancelButtonText: '暂时不搞了',
  177. // confirmButtonClass: 'confirmButtonClass',
  178. // cancelButtonClass: 'cancelButtonClass'
  179. // }).then(_ => {
  180. // this.floorFlag = true
  181. // this.getTableHeader()
  182. // }).catch(_ => {
  183. // this.$message("取消")
  184. // })
  185. // }
  186. // },
  187. //将数组转换成optiosn格式
  188. changeArr(arr) {
  189. return arr.map(item => {
  190. if (item.floors && item.floors.length) {
  191. return {
  192. value: item.id,
  193. label: item.infos.BuildLocalName,
  194. children: item.floors.map(i => {
  195. return {
  196. value: i.id,
  197. label: i.infos.FloorLocalName || "未知",
  198. }
  199. })
  200. }
  201. } else {
  202. return {
  203. value: item.id,
  204. label: item.infos.BuildLocalName,
  205. children: null,
  206. isChilren: 1,
  207. }
  208. }
  209. })
  210. },
  211. // 获取表头数据(初始化表格)
  212. async getTableHeader() {
  213. let params = {
  214. orders: "sort asc, name desc",
  215. pageNumber: 1,
  216. pageSize: 1000,
  217. type: this.category.deviceId
  218. };
  219. await getDataDictionary(params, res => {
  220. this.tableHeader = res.content;
  221. this.initTable();
  222. });
  223. },
  224. // 创建设备数据
  225. async handleCreateTableData() {
  226. let newData = this.tableData.filter(item => {
  227. let keys = Object.keys(item);
  228. keys.map(key => {
  229. //将值为空字符串的属性删除
  230. if (item[key] == "") {
  231. delete item[key];
  232. }
  233. });
  234. let newK = Object.keys(item)
  235. if ((item.checked && newK.length > 1) || (!item.checked && newK.length)) {
  236. return item;
  237. }
  238. });
  239. if (!newData.length) {
  240. this.$message("创建信息为空,请录入信息后再创建!");
  241. return;
  242. }
  243. let flag = false;
  244. newData.map(item => {
  245. if (item.checked && !item.localName) {
  246. flag = true;
  247. }
  248. // 处理建筑-楼层
  249. if (item.flowBuild) {
  250. let bid = item.flowBuild.split("-");
  251. item.buildingId = item.flowBuild.split("-")[0]
  252. if (bid[1]) {
  253. item.floorId = item.flowBuild.split("-")[1]
  254. }
  255. }
  256. //处理管理的系统
  257. if (item.linkSystem && item.linkSystem.length) {
  258. item.SystemList = []
  259. item.linkSystem.map(t => {
  260. // todo 测试 t.SysID === ? id
  261. item.SystemList.push(t.id)
  262. })
  263. }
  264. item.propertyId = !!item.checked;
  265. item.classCode = this.category.deviceId;
  266. })
  267. if (flag) {
  268. this.$message.info("存在设备的本地名称为空,请检查")
  269. return;
  270. }
  271. // for (let i = 0; i < newData.length; i++) {
  272. // let params = newData[i]
  273. // params.Family = this.firmId;
  274. // params.Category = this.category.deviceId;
  275. // if (newData[i].PropertyId) {//同时创建资产
  276. // await createPropertyData([params], async res => {
  277. // params.PropertyId = res.EntityList[0].EquipID
  278. // await createEquip([params], res => {
  279. // if (i == newData.length - 1) {
  280. // this.$router.push({
  281. // path: "/ledger/facility",
  282. // query: { deviceId: this.category.deviceId }
  283. // });
  284. // session.remove("deviceAddData")
  285. // }
  286. // })
  287. // })
  288. // } else {
  289. // await createEquip([params], res => {
  290. // if (i == newData.length - 1) {
  291. // this.$router.push({
  292. // path: "/ledger/facility",
  293. // query: { deviceId: this.category.deviceId }
  294. // });
  295. // session.remove("deviceAddData")
  296. // }
  297. // });
  298. // }
  299. // }
  300. //待接口修改为关联创建即可修改
  301. let param = {
  302. cascade: [],
  303. content: newData
  304. }
  305. createEquipAndProperty(param, res => {
  306. this.$message.success('创建成功')
  307. session.remove("deviceAddData")
  308. this.$router.push({
  309. name: "facilityLedger",
  310. params: { deviceId: this.category.deviceId }
  311. });
  312. })
  313. },
  314. // 删除表格行
  315. handleDeleteTableRow() {
  316. this.$message.success("删除成功");
  317. this.formaTableData();
  318. },
  319. // 添加行
  320. handleAddTableRow() {
  321. let addRowLength = this.addNum;
  322. for (let i = 0; i < addRowLength; i++) {
  323. this.tableData.push({ checked: 1 });
  324. }
  325. this.initTable();
  326. this.formaTableData();
  327. },
  328. //修改
  329. handleUpdataTable(changeData, source) {
  330. if (!this.onlyRead && source != 'ObserveChanges.change') {
  331. this.formaTableData();
  332. }
  333. },
  334. //保存去掉空字段的新增数据
  335. formaTableData() {
  336. let newData = this.tableData.filter(item => {
  337. let keys = Object.keys(item);
  338. keys.map(key => {
  339. //将值为空字符串的属性删除
  340. if (item[key] == "") {
  341. delete item[key];
  342. }
  343. });
  344. if (keys.length && Object.keys(item).length) {
  345. return item;
  346. }
  347. });
  348. session.set("deviceAddData", newData);
  349. },
  350. //格式化表头显示的数据
  351. formatHeaderData(list) {
  352. let arr = tools.copyArr(list);
  353. let data = showTools.headerTextFilter(arr, 'equipment', this.onlyRead, this.showType, true);
  354. data.unshift("同时创建资产", "所属系统实例");
  355. if (this.floorFlag) {
  356. data.splice(1, 0, "所属建筑楼层")
  357. }
  358. return data;
  359. },
  360. formatHeaderType(list) {
  361. //格式化表头头映射的数据
  362. let arr = tools.copyArr(list);
  363. let data = showTools.headerTypeFilter(arr, 'equipment', this.onlyRead, this.showType, true);
  364. data.unshift({
  365. type: "checkbox",
  366. checkedTemplate: 1,
  367. uncheckedTemplate: 0,
  368. data: "Checked",
  369. label: {
  370. position: "after"
  371. }
  372. }, {
  373. data: "linkSystem",
  374. renderer: text.systemList,
  375. readOnly: true
  376. });
  377. if (this.floorFlag) {
  378. data.splice(1, 0, {
  379. data: "flowBuild",
  380. renderer: tools.customDropdownRenderer,
  381. editor: "chosen",
  382. chosenOptions: {
  383. // multiple: true,//多选
  384. data: this.buildFloorData
  385. }
  386. })
  387. }
  388. return data;
  389. },
  390. initTable() {
  391. //实例化表格
  392. let settings = {
  393. data: this.tableData,
  394. colHeaders: this.formatHeaderData(this.tableHeader),
  395. columns: this.formatHeaderType(this.tableHeader),
  396. rowHeights: 30,
  397. maxRows: this.tableData.length,
  398. contextMenu: this.onlyRead ? false : {
  399. items: {
  400. remove_row: {
  401. name: "删除设备"
  402. }
  403. }
  404. },
  405. // 事件
  406. afterChange: this.handleUpdataTable, //修改后
  407. afterFilter: this.trimmedRows, //排序前
  408. afterRemoveRow: this.handleDeleteTableRow, //右键删除
  409. afterOnCellMouseDown: this.handleTdClick //鼠标点击
  410. };
  411. this.$nextTick(() => {
  412. this.tableExample = this.$refs.table.init(settings);
  413. });
  414. },
  415. //去除数组中相同的元素
  416. array_diff(a, b) {
  417. for (var i = 0; i < b.length; i++) {
  418. for (var j = 0; j < a.length; j++) {
  419. if (a[j] == b[i]) {
  420. a.splice(j, 1);
  421. j = j - 1;
  422. }
  423. }
  424. }
  425. return a;
  426. },
  427. //选择型号修改
  428. firmChange(data) {
  429. tools.setDataForKey(this.tableData[this.row], "dpManufacturerId", data.venderId)//生产商ID
  430. tools.setDataForKey(this.tableData[this.row], "dpBrandId", data.brandId)//品牌ID
  431. tools.setDataForKey(this.tableData[this.row], "dpSpecificationId", data.specificationId)//型号ID
  432. tools.setDataForKey(this.tableData[this.row], "infos.manufacturer", data.venderName)
  433. tools.setDataForKey(this.tableData[this.row], "infos.brand", data.brandName)
  434. tools.setDataForKey(this.tableData[this.row], "infos.specification", data.name)
  435. },
  436. supplyChange(data) {
  437. tools.setDataForKey(this.tableData[this.row], "infos.supplierContractID", { id: data });
  438. },
  439. //如果选择供应商之后
  440. supplierChange(data) {
  441. tools.setDataForKey(this.tableData[this.row], "infos.supplier", data.name)
  442. tools.setDataForKey(this.tableData[this.row], "dpSupplierId", data.venderId)
  443. },
  444. //保险合同
  445. guaranteeChange(data) {
  446. for (let key in data) {
  447. this.utilToKey(key, "insuranceNo", data, "insuranceNum");
  448. if (key == "contractFile") {
  449. if (!!data[key]) {
  450. data[key] = [data[key]];
  451. }
  452. }
  453. this.utilToKey(key, "contractFile", data, "insuranceFile");
  454. }
  455. },
  456. //上传文件弹窗触发事件
  457. fileChange(keys) {
  458. this.setDataToMain(keys, this.messKey, this.row);
  459. },
  460. //上传图片弹窗触发事件
  461. imgChange(keys) {
  462. this.setDataToMain(keys, this.messKey, this.row);
  463. },
  464. //维修商变更
  465. changeMaintainer(data) {
  466. tools.setDataForKey(this.tableData[this.row], "infos.maintainer", data.name)
  467. tools.setDataForKey(this.tableData[this.row], "dpMaintainerId", data.venderId)
  468. },
  469. //保险商变更
  470. changeInsurer(data) {
  471. tools.setDataForKey(this.tableData[this.row], "infos.insurer", data.name)
  472. tools.setDataForKey(this.tableData[this.row], "dpInsurerId", data.venderId)
  473. },
  474. //设备图片弹窗改变事件
  475. changePics(keys) {
  476. this.setDataToMain(keys, this.messKey, this.row);
  477. },
  478. //关联系统变更
  479. changeSystemType(data) {
  480. tools.setDataForKey(this.tableData[this.row], "linkSystem", data)
  481. },
  482. //表格点击事件
  483. handleTdClick(el, rowArr) {
  484. //点击的是表头
  485. if (rowArr.row < 0) {
  486. return;
  487. }
  488. //被筛选过后的数组
  489. let trimmedArr = this.trimmedRows();
  490. //是否启用了排序
  491. let isSort = this.tableExample.getPlugin("columnSorting").isSorted();
  492. if (trimmedArr.length && isSort) {
  493. let sortArr = this.myHotArr.getPlugin("columnSorting").rowsMapper
  494. .__arrayMap;
  495. let infos = this.tableData[trimmedArr[sortArr[rowArr.row]]];
  496. this.getInfors(infos, { row: sortArr[rowArr.row], col: rowArr.col });
  497. } else if (isSort) {
  498. //排序后的数组
  499. let sortArr = this.tableExample.getPlugin("columnSorting").rowsMapper
  500. .__arrayMap;
  501. let infos = this.tableData[sortArr[rowArr.row]];
  502. this.getInfors(infos, { row: sortArr[rowArr.row], col: rowArr.col });
  503. } else if (trimmedArr.length) {
  504. let infos = this.tableData[trimmedArr[rowArr.row]];
  505. this.getInfors(infos, { row: trimmedArr[rowArr.row], col: rowArr.col });
  506. } else {
  507. let infos = this.tableData[rowArr.row];
  508. this.getInfors(infos, rowArr);
  509. }
  510. },
  511. //获取被筛选掉的行号
  512. trimmedRows() {
  513. var plugin = this.tableExample.getPlugin("trimRows").trimmedRows;
  514. let dataLength = this.tableData.length;
  515. let dataArr = new Array();
  516. for (let i = 0; i < dataLength; i++) {
  517. dataArr.push(i);
  518. }
  519. if (plugin.length <= 0) {
  520. dataArr = undefined;
  521. } else {
  522. dataArr = this.array_diff(dataArr, plugin);
  523. }
  524. return dataArr || [];
  525. },
  526. getInfors(infos, row) {
  527. let val = this.tableExample.colToProp(row.col);
  528. switch (val) {
  529. //操作
  530. case 'caozuo':
  531. // window.open(`http://adm.sagacloud.cn:8058/spread?id=${infos.EquipID}&pid=${this.projectId}&secret=${this.secret}`,"_blank")
  532. this.$message("开发中...")
  533. break;
  534. //设备二维码图片
  535. // case 'EquipQRCode':
  536. // this.qrcodeUrl = this.tableData[row.row].equipQRCode;
  537. //
  538. // if (!!this.qrcodeUrl) {
  539. // this.myDialog.qrcode = true;
  540. // } else {
  541. // this.$message("此设备没有设备二维码");
  542. // }
  543. // break;
  544. case "defaultQRCode":
  545. this.qrcodeUrl = this.tableData[row.row][val];
  546. if (this.qrcodeUrl) {
  547. this.myDialog.qrcode = true;
  548. } else {
  549. this.$message("此设备没有设备二维码");
  550. }
  551. break;
  552. //关联系统
  553. case 'linkSystem':
  554. if (!this.onlyRead) {
  555. this.systemList = this.tableData[row.row].linkSystem || [];
  556. this.myDialog.systemType = true;
  557. }
  558. break;
  559. //关联资产
  560. case 'linkEquipLocalName':
  561. if (this.linkNameFalg) {
  562. this.myDialog.changeRea = true;
  563. }
  564. break;
  565. //品牌型号弹窗
  566. case 'dpManufacturerId':
  567. if (!this.onlyRead) {
  568. this.myDialog.firm = true;
  569. }
  570. break;
  571. //供应商信息弹窗
  572. case 'dpSupplierId':
  573. if (!this.onlyRead) {
  574. this.myDialog.supplier = true;
  575. }
  576. break;
  577. //维修商信息弹窗
  578. case 'dpMaintainerId':
  579. if (!this.onlyRead) {
  580. this.myDialog.maintainer = true;
  581. }
  582. break;
  583. //保险公司信息
  584. case 'dpInsurerId':
  585. if (!this.onlyRead) {
  586. this.myDialog.insurer = true;
  587. }
  588. break;
  589. //供应合同编号
  590. case 'infos.SupplierContractID':
  591. if (!this.onlyRead) {
  592. let ContractIDflag = null;
  593. let DPSdata = this.tableData[row.row].dpSupplierId;
  594. if (DPSdata) {
  595. ContractIDflag = DPSdata.split("-")[0];
  596. }
  597. if (!!ContractIDflag) {
  598. this.id = ContractIDflag;
  599. this.myDialog.supply = true;
  600. } else {
  601. this.$message("请先选择供应商");
  602. }
  603. }
  604. break;
  605. //保险单号
  606. case 'infos.insuranceNum':
  607. if (!this.onlyRead) {
  608. let DPInsurerIDflag = null;
  609. let DPIdata = this.tableData[row.row].dpInsurerId;
  610. if (DPIdata) {
  611. DPInsurerIDflag = DPIdata.split("-")[0];
  612. }
  613. if (!!DPInsurerIDflag) {
  614. this.id = DPInsurerIDflag;
  615. this.myDialog.guarantee = true;
  616. } else {
  617. this.$message("请先选择保险商");
  618. }
  619. }
  620. break;
  621. //保险文件--设备文档--安装质检报告
  622. case 'infos.insuranceFile': //保险文件
  623. case 'infos.archive': //设备文档
  624. case 'infos.checkReport': //安装质检报告
  625. case 'infos.maintainManual': //维修保养手册
  626. case 'infos.approachingAcceptance': //进场验收单
  627. case 'infos.acceptanceReport': //验收报告
  628. case 'infos.operationManual': //操作说明书
  629. case 'infos.originalCertificate': //原厂证明
  630. case 'infos.testReport': //检测报告
  631. case 'infos.productCertification': //产品合格证
  632. case 'infos.installInstruction': //安装说明书
  633. case 'infos.supplierContract': //供应合同
  634. case 'infos.drawing': //设备图纸
  635. case 'infos.installDrawing': //安装图纸
  636. let IPSdata = tools.dataForKey(this.tableData[row.row], val);
  637. this.filesArr = IPSdata ? IPSdata : [];
  638. this.myDialog.uploadFiles = true;
  639. break;
  640. //安装照片--设备铭牌照片
  641. case 'infos.installPic':
  642. case 'infos.nameplate':
  643. let SSPPdata = tools.dataForKey(this.tableData[row.row], val);
  644. this.imgsArr = SSPPdata ? SSPPdata : [];
  645. this.myDialog.uploadImgs = true;
  646. break;
  647. //设备照片
  648. case 'infos.pic':
  649. let Pdata = tools.dataForKey(this.tableData[row.row], val);
  650. this.picsArr = Pdata ? Pdata : [];
  651. this.myDialog.pic = true;
  652. break;
  653. //包含的部件字段
  654. case 'count':
  655. if (this.onlyRead) {
  656. this.$router.push({ path: '/ledger/parts', query: { deviceId: infos.EquipID } });
  657. } else {
  658. this.$router.push({
  659. path: '/ledger/partsmanage',
  660. query: { deviceId: infos.EquipID, typeId: this.mess.deviceId }
  661. });
  662. }
  663. break;
  664. default:
  665. break;
  666. }
  667. this.row = row.row;
  668. this.messKey = val;
  669. },
  670. utilToKey(key, name, data, messName) {
  671. if (key == name) {
  672. this.setDataToMain(data[key], messName, this.row);
  673. }
  674. },
  675. //判断是否有值,有值赋值
  676. setDataToMain(data, key, row) {
  677. if (!!data && data != "--") {
  678. if (!!this.tableData[row]) {
  679. //铭牌照片特殊处理
  680. tools.setDataForKey(this.tableData[row], key, data)
  681. // this.tableData[row][key] = data;
  682. } else {
  683. this.tableData[row] = {};
  684. tools.setDataForKey(this.tableData[row], key, data)
  685. }
  686. } else {
  687. tools.setDataForKey(this.tableData[row], key, "")
  688. }
  689. }
  690. }
  691. };
  692. </script>
  693. <style lang="less" scoped>
  694. #deviceList {
  695. overflow: hidden;
  696. height: 100%;
  697. background-color: #fff;
  698. padding: 10px;
  699. position: relative;
  700. .right {
  701. background: #fff;
  702. }
  703. .search-header {
  704. overflow: hidden;
  705. padding: 0 10px 10px 10px;
  706. border-bottom: 1px solid #bcbcbc;
  707. }
  708. .tableBox {
  709. display: flex;
  710. height: calc(100% - 100px);
  711. margin-top: 10px;
  712. .tableLeft {
  713. flex: 1;
  714. }
  715. }
  716. .create_button {
  717. margin-top: 10px;
  718. }
  719. }
  720. </style>