index.vue 22 KB

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