addfacility.vue 25 KB

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