index.vue 25 KB

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