index.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858
  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].split(".")[0]);
  266. }
  267. });
  268. //生成对应修改数据
  269. data.map((item, index) => {
  270. param.data.Projection.map(value => {
  271. let itemData = tools.dataForKey(item, value);
  272. tools.setDataForKey(item, value, itemData == "" ? null : itemData);
  273. });
  274. // let keyarr = change[index][1].split(".");
  275. // if (keyarr && keyarr.length > 1) {
  276. // item[keyarr[0]][keyarr[1]] =
  277. // item[keyarr[0]][keyarr[1]] != ""
  278. // ? item[keyarr[0]][keyarr[1]]
  279. // : null;
  280. // } else {
  281. // item[keyarr[0]] = item[keyarr[0]] != "" ? item[keyarr[0]] : null;
  282. // }
  283. param.data.Content.push(item);
  284. });
  285. await updateParts(param).then(res => {});
  286. },
  287. // 删除表格数据
  288. async deleteTableData(params) {
  289. await deleteParts(params).then(res => {
  290. this.$message.success("删除成功!");
  291. this.getTypes();
  292. });
  293. },
  294. //保存元空间关联
  295. async saveSpaceList() {
  296. let data = {
  297. ShaftId: this.shaftId,
  298. SpaceId: this.spaceList
  299. };
  300. const params = {
  301. ProjId: this.projectId,
  302. secret: this.secret,
  303. data: data
  304. };
  305. await saveCenoteRelateSpace(params, res => {
  306. this.$message.success("关联成功!");
  307. this.getTableHeader();
  308. });
  309. },
  310. // 添加部件
  311. handleCreateTableData() {
  312. this.activeTab.deviceId = this.deviceId;
  313. this.$router.push({
  314. name: "addparts",
  315. params: this.activeTab
  316. });
  317. },
  318. // 删除表格行
  319. handleDeleteTableRow() {
  320. let params = tools.differenceArr(this.tableData, this.copyTableData);
  321. if (params.length < 1 || this.tableData > this.copyTableData) {
  322. return;
  323. }
  324. let param = {
  325. projectId: this.projectId,
  326. data: []
  327. };
  328. params.map(item => {
  329. param.data.push(item.EquipID);
  330. });
  331. this.$confirm("此操作将删除部件,是否继续?", "提示", {
  332. confirmButtonText: "确定",
  333. cancelButtonText: "取消",
  334. type: "warning"
  335. })
  336. .then(() => {
  337. this.deleteTableData(param);
  338. })
  339. .catch(() => {
  340. this.getTableHeader();
  341. this.$message("取消删除");
  342. });
  343. },
  344. //修改
  345. handleUpdataTable(changeData, source) {
  346. if (!this.onlyRead) {
  347. if (changeData) {
  348. let trimmedArr = this.trimmedRows();
  349. let param = handsonUtils.getParam(
  350. changeData,
  351. source,
  352. this.tableExample,
  353. trimmedArr
  354. );
  355. let data = [];
  356. for (let i = 0; i < param.length; i++) {
  357. data.push(param[i]);
  358. }
  359. //如果data中包含/且data长度为1,将其转换成.
  360. if (
  361. changeData.length == 1 &&
  362. changeData[0][1] &&
  363. changeData[0][1].indexOf("/") > 0
  364. ) {
  365. changeData[0][1] = changeData[0][1].split("/").join(".");
  366. }
  367. // 存在data进行修改请求
  368. if (data && data.length) {
  369. this.updateTableData(data, changeData);
  370. }
  371. }
  372. }
  373. },
  374. //撤回
  375. undo() {
  376. this.tableExample.undo();
  377. },
  378. //切换每页显示多少条数据
  379. handleSizeChange(val) {
  380. this.page.pageSize = val;
  381. this.getTableHeader();
  382. },
  383. //切换页数
  384. handleCurrentChange(val) {
  385. this.page.pageNumber = val;
  386. this.getTableHeader();
  387. },
  388. formatHeaderData(list) {
  389. //格式化表头显示的数据
  390. let arr = tools.copyArr(list);
  391. arr.map(item => {
  392. item.Visible = true;
  393. });
  394. if (!this.onlyRead) {
  395. this.readArr.push("Own");
  396. }
  397. let data = showTools.tableHeadFilter(
  398. arr,
  399. this.readArr,
  400. this.onlyRead,
  401. this.isWatch,
  402. false
  403. );
  404. data.unshift("查看详情", "当前关联的资产");
  405. return data;
  406. },
  407. formatHeaderType(list) {
  408. //格式化表头头映射的数据
  409. let arr = tools.copyArr(list);
  410. arr.map(item => {
  411. item.Visible = true;
  412. });
  413. let data = showTools.tableHeaderTypes(
  414. arr,
  415. this.readArr,
  416. this.onlyRead,
  417. this.isWatch,
  418. false
  419. );
  420. data.unshift(
  421. {
  422. data: "caozuo",
  423. renderer: tools.lookDetails,
  424. readOnly: true
  425. },
  426. {
  427. data: "PropertyLocalName",
  428. readOnly: true
  429. }
  430. );
  431. return data;
  432. },
  433. initTable() {
  434. //实例化表格
  435. let settings = {
  436. data: this.tableData,
  437. colHeaders: this.formatHeaderData(this.tableHeader),
  438. columns: this.formatHeaderType(this.tableHeader),
  439. rowHeights: 30,
  440. maxRows: this.tableData.length,
  441. contextMenu: {
  442. items: {
  443. remove_row: {
  444. name: "删除部件"
  445. }
  446. }
  447. },
  448. // 事件
  449. afterChange: this.handleUpdataTable, //修改后
  450. afterRemoveRow: this.handleDeleteTableRow, //右键删除
  451. afterOnCellMouseDown: this.handleTdClick //鼠标点击
  452. };
  453. this.$nextTick(() => {
  454. this.tableExample = this.$refs.table.init(settings);
  455. });
  456. },
  457. //去除数组中相同的元素
  458. array_diff(a, b) {
  459. for (var i = 0; i < b.length; i++) {
  460. for (var j = 0; j < a.length; j++) {
  461. if (a[j] == b[i]) {
  462. a.splice(j, 1);
  463. j = j - 1;
  464. }
  465. }
  466. }
  467. return a;
  468. },
  469. //选择型号修改
  470. firmChange(data) {
  471. tools.setDataForKey(
  472. this.tableData[this.row],
  473. "DPSpecificationID",
  474. data.specificationId
  475. );
  476. tools.setDataForKey(
  477. this.tableData[this.row],
  478. "LedgerParam.EquipManufactor.Brand",
  479. data.brand
  480. );
  481. tools.setDataForKey(
  482. this.tableData[this.row],
  483. "LedgerParam.EquipManufactor.Specification",
  484. data.name
  485. );
  486. tools.setDataForKey(
  487. this.tableData[this.row],
  488. "LedgerParam.EquipManufactor.Manufacturer",
  489. data.venderName
  490. );
  491. for (let key in data) {
  492. if (key == "venderId") {
  493. data[key] = data[key] + "-" + data.name + "/" + data.brand;
  494. this.utilToKey(key, "venderId", data, "DPManufacturerID");
  495. }
  496. }
  497. },
  498. supplyChange(data) {
  499. let changeData = { id: data };
  500. this.utilToKey("id", "id", changeData, "SupplierContractID");
  501. },
  502. //如果选择供应商之后
  503. supplierChange(data) {
  504. tools.setDataForKey(
  505. this.tableData[this.row],
  506. "LedgerParam.SupplyPurchase.Supplier",
  507. data.name
  508. );
  509. tools.setDataForKey(
  510. this.tableData[this.row],
  511. "LedgerParam.SupplyPurchase.SupplierWeb",
  512. data.website
  513. );
  514. tools.setDataForKey(
  515. this.tableData[this.row],
  516. "LedgerParam.SupplyPurchase.SupplierContactor",
  517. data.man
  518. );
  519. tools.setDataForKey(
  520. this.tableData[this.row],
  521. "LedgerParam.SupplyPurchase.SupplierPhone",
  522. data.phone
  523. );
  524. tools.setDataForKey(
  525. this.tableData[this.row],
  526. "LedgerParam.SupplyPurchase.SupplierFax",
  527. data.fox
  528. );
  529. tools.setDataForKey(
  530. this.tableData[this.row],
  531. "LedgerParam.SupplyPurchase.SupplierEmail",
  532. data.email
  533. );
  534. for (let key in data) {
  535. if (key == "venderId") {
  536. data[key] = data[key] + "-" + data.name;
  537. this.utilToKey(key, "venderId", data, "DPSupplierID");
  538. }
  539. }
  540. },
  541. //保险合同
  542. guaranteeChange(data) {
  543. for (let key in data) {
  544. this.utilToKey(key, "insuranceNo", data, "InsuranceNum");
  545. if (key == "contractFile") {
  546. if (!!data[key]) {
  547. data[key] = [data[key]];
  548. }
  549. }
  550. this.utilToKey(key, "contractFile", data, "InsuranceFile");
  551. }
  552. },
  553. //上传文件弹窗触发事件
  554. fileChange(keys) {
  555. this.setDataToMain(keys, this.messKey, this.row);
  556. },
  557. //上传图片弹窗触发事件
  558. imgChange(keys) {
  559. this.setDataToMain(keys, this.messKey, this.row);
  560. },
  561. //维修商变更
  562. changeMaintainer(data) {
  563. tools.setDataForKey(
  564. this.tableData[this.row],
  565. "LedgerParam.OperationMainte.Maintainer",
  566. data.name
  567. );
  568. tools.setDataForKey(
  569. this.tableData[this.row],
  570. "LedgerParam.OperationMainte.MaintainerWeb",
  571. data.website
  572. );
  573. tools.setDataForKey(
  574. this.tableData[this.row],
  575. "LedgerParam.OperationMainte.MaintainerContactor",
  576. data.man
  577. );
  578. tools.setDataForKey(
  579. this.tableData[this.row],
  580. "LedgerParam.OperationMainte.MaintainerPhone",
  581. data.phone
  582. );
  583. tools.setDataForKey(
  584. this.tableData[this.row],
  585. "LedgerParam.OperationMainte.MaintainerFax",
  586. data.fox
  587. );
  588. tools.setDataForKey(
  589. this.tableData[this.row],
  590. "LedgerParam.OperationMainte.MaintainerEmail",
  591. data.email
  592. );
  593. for (let key in data) {
  594. if (key == "venderId") {
  595. data[key] = data[key] + "-" + data.name;
  596. this.utilToKey(key, "venderId", data, "DPMaintainerID");
  597. }
  598. }
  599. },
  600. //保险商变更
  601. changeInsurer(data) {
  602. tools.setDataForKey(
  603. this.tableData[this.row],
  604. "LedgerParam.InsuranceDoc.InsurerEmail",
  605. data.email
  606. );
  607. tools.setDataForKey(
  608. this.tableData[this.row],
  609. "LedgerParam.InsuranceDoc.InsurerFax",
  610. data.fox
  611. );
  612. tools.setDataForKey(
  613. this.tableData[this.row],
  614. "LedgerParam.InsuranceDoc.InsurerPhone",
  615. data.phone
  616. );
  617. tools.setDataForKey(
  618. this.tableData[this.row],
  619. "LedgerParam.InsuranceDoc.InsurerContactor",
  620. data.man
  621. );
  622. tools.setDataForKey(
  623. this.tableData[this.row],
  624. "LedgerParam.InsuranceDoc.InsurerWeb",
  625. data.website
  626. );
  627. tools.setDataForKey(
  628. this.tableData[this.row],
  629. "LedgerParam.InsuranceDoc.Insurer",
  630. data.name
  631. );
  632. for (let key in data) {
  633. if (key == "venderId") {
  634. data[key] = data[key] + "-" + data.name;
  635. this.utilToKey(key, "venderId", data, "DPInsurerID");
  636. }
  637. }
  638. },
  639. //设备图片弹窗改变事件
  640. changePics(keys) {
  641. this.setDataToMain(keys, this.messKey, this.row);
  642. },
  643. setGraphyId(graphyId, assetGroupList) {
  644. this.graphyId = graphyId;
  645. this.assetGroupList = assetGroupList;
  646. },
  647. //触发父组件change
  648. getClose(val) {
  649. this.$emit("close", val);
  650. },
  651. reset() {},
  652. //表格点击事件
  653. handleTdClick(el, rowArr) {
  654. //点击的是表头
  655. if (rowArr.row < 0) {
  656. return;
  657. }
  658. //被筛选过后的数组
  659. let trimmedArr = this.trimmedRows();
  660. //是否启用了排序
  661. let isSort = this.tableExample.getPlugin("columnSorting").isSorted();
  662. if (trimmedArr.length && isSort) {
  663. let sortArr = this.myHotArr.getPlugin("columnSorting").rowsMapper
  664. .__arrayMap;
  665. let infos = this.tableData[trimmedArr[sortArr[rowArr.row]]];
  666. this.getInfors(infos, { row: sortArr[rowArr.row], col: rowArr.col });
  667. } else if (isSort) {
  668. //排序后的数组
  669. let sortArr = this.tableExample.getPlugin("columnSorting").rowsMapper
  670. .__arrayMap;
  671. let infos = this.tableData[sortArr[rowArr.row]];
  672. this.getInfors(infos, { row: sortArr[rowArr.row], col: rowArr.col });
  673. } else if (trimmedArr.length) {
  674. let infos = this.tableData[trimmedArr[rowArr.row]];
  675. this.getInfors(infos, { row: trimmedArr[rowArr.row], col: rowArr.col });
  676. } else {
  677. let infos = this.tableData[rowArr.row];
  678. this.getInfors(infos, rowArr);
  679. }
  680. },
  681. //获取被筛选掉的行号
  682. trimmedRows() {
  683. var plugin = this.tableExample.getPlugin("trimRows").trimmedRows;
  684. let dataLength = this.tableData.length;
  685. let dataArr = new Array();
  686. for (let i = 0; i < dataLength; i++) {
  687. dataArr.push(i);
  688. }
  689. if (plugin.length <= 0) {
  690. dataArr = undefined;
  691. } else {
  692. dataArr = this.array_diff(dataArr, plugin);
  693. }
  694. return dataArr || [];
  695. },
  696. getInfors(infos, row) {
  697. //其他的开始判断
  698. let val = this.tableExample.colToProp(row.col);
  699. if (val == "caozuo") {
  700. // window.open(`http://adm.sagacloud.cn:8058/spread?id=${infos.EquipID}&pid=${this.projectId}&secret=${this.secret}`,"_blank")
  701. this.$message("开发中...")
  702. }
  703. //设备二维码图片
  704. if (val == "EquipQRCode") {
  705. this.qrcodeUrl = this.tableData[row.row].EquipQRCode;
  706. if (!!this.qrcodeUrl) {
  707. this.myDialog.qrcode = true;
  708. } else {
  709. this.$message("此设备没有设备二维码");
  710. }
  711. }
  712. //关联系统
  713. if (val == "linkSystem") {
  714. // this.systemList = this.tableData[row.row].linkSystem || [];
  715. this.myDialog.systemType = true;
  716. }
  717. //品牌型号弹窗
  718. if (val == "DPManufacturerID") {
  719. this.myDialog.firm = true;
  720. }
  721. //供应商信息弹窗
  722. if (val == "DPSupplierID") {
  723. this.myDialog.supplier = true;
  724. }
  725. //维修商信息弹窗
  726. if (val == "DPMaintainerID") {
  727. this.myDialog.maintainer = true;
  728. }
  729. //保险公司信息
  730. if (val == "DPInsurerID") {
  731. this.myDialog.insurer = true;
  732. }
  733. //供应合同编号
  734. if (val == "LedgerParam.SupplyPurchase.SupplierContractID") {
  735. let falg = null;
  736. let data = this.tableData[row.row].DPSupplierID;
  737. if (data) {
  738. falg = data.split("-")[0];
  739. }
  740. if (!!falg) {
  741. this.id = falg;
  742. this.myDialog.supply = true;
  743. } else {
  744. this.$message("请先选择供应商");
  745. }
  746. }
  747. //保险单号
  748. if (val == "LedgerParam.InsuranceDoc.InsuranceNum") {
  749. //选择保单
  750. let falg = null;
  751. let data = this.tableData[row.row].DPInsurerID;
  752. if (data) {
  753. falg = data.split("-")[0];
  754. }
  755. if (!!falg) {
  756. this.id = falg;
  757. this.myDialog.guarantee = true;
  758. } else {
  759. this.$message("请先选择保险商");
  760. }
  761. }
  762. //保险文件--设备文档--安装质检报告
  763. if (
  764. val == "LedgerParam.InsuranceDoc.InsuranceFile" ||
  765. val == "LedgerParam.PhotoDoc.Archive" ||
  766. val == "LedgerParam.Siteinstall.CheckReport"
  767. ) {
  768. let data = tools.dataForKey(this.tableData[row.row], val);
  769. this.filesArr = data ? data : [];
  770. this.myDialog.uploadFiles = true;
  771. }
  772. //安装照片--安装图纸--设备铭牌照片--设备图纸
  773. if (
  774. val == "LedgerParam.Siteinstall.InstallPic" ||
  775. val == "LedgerParam.Siteinstall.InstallDrawing" ||
  776. val == "LedgerParam.PhotoDoc.Nameplate" ||
  777. val == "LedgerParam.PhotoDoc.Drawing"
  778. ) {
  779. let data = tools.dataForKey(this.tableData[row.row], val);
  780. this.imgsArr = data ? data : [];
  781. this.myDialog.uploadImgs = true;
  782. }
  783. //设备照片
  784. if (val == "LedgerParam.PhotoDoc.Pic") {
  785. let data = tools.dataForKey(this.tableData[row.row], val);
  786. this.picsArr = data ? data : [];
  787. this.myDialog.pic = true;
  788. }
  789. this.row = row.row;
  790. this.messKey = val;
  791. },
  792. //修改设备类型
  793. changeCader() {
  794. this.EquipmentList.map(item => {
  795. if (!!item.content && item.content.length) {
  796. item.content.map(child => {
  797. if (child.code == this.mess.deviceId) {
  798. this.firmId = item.code;
  799. }
  800. });
  801. }
  802. });
  803. },
  804. utilToKey(key, name, data, messName) {
  805. if (key == name) {
  806. this.setDataToMain(data[key], messName, this.row);
  807. }
  808. },
  809. //判断是否有值,有值赋值
  810. setDataToMain(data, key, row) {
  811. if (!!data && data != "--") {
  812. if (!!this.tableData[row]) {
  813. tools.setDataForKey(this.tableData[row], key, data);
  814. this.handleUpdataTable([[row, key, null, data]], "edit");
  815. } else {
  816. this.tableData[row] = {};
  817. tools.setDataForKey(this.tableData[row], key, data);
  818. }
  819. } else {
  820. tools.setDataForKey(this.tableData[row], key, "");
  821. }
  822. }
  823. }
  824. };
  825. </script>
  826. <style lang="less" scoped>
  827. #deviceList {
  828. overflow: hidden;
  829. height: 100%;
  830. background-color: #fff;
  831. padding: 10px;
  832. position: relative;
  833. .right {
  834. background: #fff;
  835. }
  836. .search-header {
  837. overflow: hidden;
  838. padding: 0 10px 10px 10px;
  839. border-bottom: 1px solid #bcbcbc;
  840. }
  841. .tableBox {
  842. display: flex;
  843. height: calc(100% - 150px);
  844. margin-top: 10px;
  845. .tableLeft,
  846. .middle_sty {
  847. flex: 1;
  848. }
  849. }
  850. }
  851. .el-pagination button,
  852. .el-pagination span:not([class*="suffix"]) {
  853. vertical-align: middle;
  854. }
  855. </style>