index.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735
  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.code" :name="t.code"
  6. :label="`${t.name}(${t.count?t.count:0})`"></el-tab-pane>
  7. </el-tabs>
  8. </el-row>
  9. <el-row class="left">
  10. <!-- <div style="width:200px;display:inline-block;text-align:left;color:gray;">
  11. <span>隐藏自动填充的信息</span>
  12. <el-checkbox v-model="allMess" @change="getTableHeader"></el-checkbox>
  13. </div> -->
  14. <el-button size="small" type="default" icon="el-icon-back" @click="goback" style="margin-right:10px;"></el-button>
  15. <el-select v-model="showType" @change="initTable" style="width:100px;margin-right:10px;vertical-align:bottom;">
  16. <el-option v-for="item in showTypes" :key="item.value" :label="item.label" :value="item.value">
  17. </el-option>
  18. </el-select>
  19. <el-button @click="handleCreateTableData">添加部件</el-button>
  20. <el-button @click="getTableHeader">刷新</el-button>
  21. <el-button v-show="!onlyRead" @click="undo">撤销</el-button>
  22. <div style="float:right;overflow:hidden;">
  23. <span style="width:20px;float:left;display:block;height:20px;cursor: pointer;" @click="changeAssetsFalg">
  24. <i v-show="!onlyRead" class="el-icon-fa el-icon-fa-compass"></i>
  25. </span>
  26. <span>当前筛选条件下共{{ page.total || '--' }}部件</span>
  27. </div>
  28. </el-row>
  29. <div class="tableBox">
  30. <div class="center middle_sty" v-show="tableData && !tableData.length">
  31. <p>
  32. <i class="icon-wushuju iconfont"></i>
  33. 暂无数据
  34. </p>
  35. </div>
  36. <div class="tableLeft" v-show="tableData && tableData.length">
  37. <handson-table ref="table"></handson-table>
  38. </div>
  39. </div>
  40. <el-pagination class="right" v-show="tableData && tableData.length" @size-change="handleSizeChange"
  41. @current-change="handleCurrentChange"
  42. :current-page="page.pageNumber" :page-sizes="page.pageSizes" :page-size="page.pageSize"
  43. layout="total, sizes, prev, pager, next, jumper"
  44. :total="page.total"></el-pagination>
  45. <!-- 二维码弹窗 -->
  46. <qrcode :dialog="myDialog" :qrcodeUrl="qrcodeUrl" :addBody="true" ref="qrcode"></qrcode>
  47. <upload-files-dialog :read="onlyRead ? true : false" ref="upload" @changeFile="fileChange" :keysArr="filesArr"
  48. :dialog="myDialog">
  49. </upload-files-dialog>
  50. <upload-img-dialog :read="onlyRead ? true : false" @changeFile="imgChange" :keysArr="imgsArr"
  51. :dialog="myDialog"></upload-img-dialog>
  52. <pic-dialog :read="onlyRead ? true : false" :dialog="myDialog" :keysArr="picsArr" @change="changePics"></pic-dialog>
  53. <details-dialog :iframeSrc="iframeSrc" v-if="myDialog.details" :dialog="myDialog"></details-dialog>
  54. <!-- 关联资产 -->
  55. <change-rea @changeProperty="changeProperty" :dialog="myDialog" :category="deviceType"></change-rea>
  56. <!-- 不支持的输入方式 -->
  57. <el-dialog title="临时维护信息点" :visible.sync="myDialog.update" @close="handleCloseUpdate" width="670px">
  58. <el-row>
  59. 该信息点未定义对应组件,现在维护数据不确定后续是否可用。如确实需要维护,请点击
  60. <el-link @click="updateInputShow = true" type="primary" :underline="false">继续维护</el-link>
  61. </el-row>
  62. <el-row style="margin-top:20px;" v-show="updateInputShow">
  63. <el-input type="textarea" :autosize="{ minRows: 4, maxRows: 8}" placeholder="请输入内容"
  64. v-model="updateInput"></el-input>
  65. </el-row>
  66. <span slot="footer" class="dialog-footer">
  67. <el-button @click="myDialog.update = false">取 消</el-button>
  68. <el-button type="primary" @click="handleClickUpdate">确 认</el-button>
  69. </span>
  70. </el-dialog>
  71. </div>
  72. </template>
  73. <script>
  74. import tools from "@/utils/scan/tools";
  75. import handsonUtils from "@/utils/hasontableUtils";
  76. import showTools from "@/utils/handsontable/notShow";
  77. import text from "@/utils/handsontable/mainText";
  78. import handsonTable from "@/components/common/handsontable";
  79. import {
  80. getPartsAllType,
  81. // getDataDictionary,
  82. getEquipPartsCon,
  83. updateParts,
  84. deleteParts,
  85. getEquipBelongs
  86. } from "@/api/scan/request";
  87. import { getDataDictionary } from "@/api/dict";
  88. import { mapGetters, mapActions } from "vuex";
  89. import qrcode from "@/components/ledger/lib/qrcode";
  90. import uploadFilesDialog from "@/components/dialogs/list/filesDialog";
  91. import uploadImgDialog from "@/components/dialogs/list/uploadImgDialog";
  92. import picDialog from "@/components/dialogs/list/picDialog";
  93. import changeRea from "@/components/dialogs/changeRea"
  94. export default {
  95. components: {
  96. qrcode, //二维码页面
  97. uploadFilesDialog,
  98. uploadImgDialog,
  99. picDialog,
  100. handsonTable,
  101. changeRea
  102. },
  103. data() {
  104. return {
  105. shaftId: "", //要操作的部件id
  106. isTableRightShow: false,
  107. spaceList: "",
  108. onlyRead: false,
  109. showTypes: [
  110. // { value: "partInfo", label: '隐藏信息点' },
  111. { value: "Visible", label: '只看采集信息' },
  112. { value: "all", label: '全部' },
  113. ],
  114. showType: "Visible",
  115. tableHeader: [],
  116. page: {
  117. pageSize: 50,
  118. pageSizes: [10, 20, 50, 100],
  119. pageNumber: 1,
  120. total: 0
  121. },
  122. tableData: [],
  123. copyTableData: [],
  124. inputMap: {
  125. flowBuild: {
  126. editable: true,
  127. code: "flowBuild",
  128. name: "建筑楼层",
  129. path: "flowBuild",
  130. category: 'STATIC',
  131. dataType: "ENUM"
  132. }
  133. }, //信息点和输入方式映射表
  134. updateInputShow: false, //是否显示临时维护输入框
  135. updateInfoPoint: '',//临时维护信息点
  136. updateInput: '', //临时维护信息点值
  137. tableExample: null,
  138. tabVal: "",
  139. activeTab: {}, //当前tab页index
  140. partsTypeList: [], //tabs
  141. myDialog: {
  142. qrcode: false, //二维码弹窗
  143. uploadFiles: false, //上传文件
  144. uploadImgs: false, //上传单个图片
  145. pic: false, //多个图片
  146. addDevice: false,
  147. systemType: false,
  148. details: false, //详情页
  149. lookPic: false, //图片查看
  150. changeRea: false, //关联的资产
  151. update: false,//临时维护信息点
  152. },
  153. qrcodeUrl: "", //二维码图片地址
  154. filesArr: [], //保存临时的文件key
  155. imgsArr: [], //临时保存的图片key数组
  156. picsArr: [], //临时设备图片keys数组
  157. systemId: null,
  158. graphyId: null,
  159. mess: {},
  160. id: 0,
  161. EquipmentList: [],
  162. firmId: "", //品牌型号所需字段--族id三位编码(传设备类id或部件类id)
  163. deviceType: {},
  164. queryParam: {}, //返回到指定位置
  165. };
  166. },
  167. computed: {
  168. ...mapGetters("layout", ["projectId", "secret", "userId"])
  169. },
  170. created() {
  171. this.queryParam = this.$route.query;
  172. this.deviceId = this.$route.query.deviceId; //设备id
  173. this.typeId = this.$route.query.typeId; //设备类id
  174. this.mess.deviceId = this.typeId;
  175. this.getTypes();
  176. },
  177. methods: {
  178. getBelongs() {
  179. let params = {
  180. data: {
  181. filters: `equipCode='${this.tabVal}'`,
  182. pageNumber: 1,
  183. pageSize: 50
  184. }
  185. }
  186. getEquipBelongs(params, res => {
  187. if (res.content.length) {
  188. this.firmId = res.content[0].family;
  189. this.deviceType.assetType = res.content[0].family
  190. this.deviceType.assetName = res.content[0].familyName
  191. }
  192. })
  193. },
  194. //tab页点击事件
  195. tabsClick(tab) {
  196. this.activeTab = this.partsTypeList[tab.index];
  197. this.getTableHeader();
  198. },
  199. //获取当前设备类下的所有部件类
  200. async getTypes() {
  201. let params = {
  202. category: this.typeId, //设备类型
  203. id: this.deviceId //设备id
  204. };
  205. await getPartsAllType(params, res => {
  206. this.partsTypeList = res.content;
  207. this.tabVal = this.partsTypeList[0].code;
  208. this.activeTab = this.partsTypeList[0];
  209. this.getTableHeader();
  210. this.getBelongs();
  211. });
  212. },
  213. // 获取表头数据(初始化表格)
  214. async getTableHeader() {
  215. let params = {
  216. orders: "sort asc, name desc",
  217. pageNumber: 1,
  218. pageSize: 1000,
  219. type: this.tabVal
  220. };
  221. await getDataDictionary(params, res => {
  222. this.tableHeader = res.content;
  223. this.tableHeader.forEach(item => {
  224. if (item.path) {
  225. this.inputMap[item.path] = item
  226. }
  227. })
  228. this.getTableData();
  229. });
  230. },
  231. //获取表格数据
  232. async getTableData() {
  233. let params = {
  234. pageNumber: this.page.pageNumber,
  235. pageSize: this.page.pageSize,
  236. orders: "createTime desc, localName desc, localId desc, id desc",
  237. filters: `category='${this.tabVal}';parentId='${this.deviceId}'`
  238. };
  239. await getEquipPartsCon(params, res => {
  240. this.tableData = res.content;
  241. this.copyTableData = tools.deepCopy(res.content);
  242. this.page.pageNumber = res.pageNumber;
  243. this.page.total = res.total;
  244. if (this.tableData && this.tableData.length) {
  245. this.initTable();
  246. }
  247. });
  248. },
  249. // 修改表格内容
  250. async updateTableData(data, change) {
  251. let param = {
  252. projectId: this.projectId,
  253. data: {
  254. content: [],
  255. projection: []
  256. }
  257. }, keyList = [];
  258. //生成要修改字段列表
  259. change.map((item) => {
  260. let key = item[1].split(".")[0]
  261. if (item[1] && keyList.indexOf(key) == -1) {
  262. keyList.push(key)
  263. }
  264. if (item[1] && item[3] == "" && param.data.projection.indexOf(key) == -1) {
  265. param.data.projection.push(key)
  266. }
  267. })
  268. //生成对应修改数据
  269. data.map((item, index) => {
  270. keyList.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. param.projection = []
  286. await updateParts(param, res => {
  287. });
  288. },
  289. // 删除表格数据
  290. async deleteTableData(params) {
  291. await deleteParts(params, res => {
  292. this.$message.success("删除成功!");
  293. this.getTypes();
  294. });
  295. },
  296. //保存元空间关联
  297. async saveSpaceList() {
  298. let data = {
  299. shaftId: this.shaftId,
  300. spaceId: this.spaceList
  301. };
  302. const params = {
  303. projId: this.projectId,
  304. secret: this.secret,
  305. data: data
  306. };
  307. await saveCenoteRelateSpace(params, res => {
  308. this.$message.success("关联成功!");
  309. this.getTableHeader();
  310. });
  311. },
  312. // 添加部件
  313. handleCreateTableData() {
  314. this.activeTab.deviceId = this.deviceId;
  315. this.$router.push({
  316. name: "partsadd",
  317. query: {
  318. ...this.activeTab,
  319. pageNo: this.queryParam.pageNo,
  320. pageSize: this.queryParam.pageSize,
  321. showType: this.showType
  322. }
  323. });
  324. },
  325. // 删除表格行
  326. handleDeleteTableRow() {
  327. let params = tools.differenceArr(this.tableData, this.copyTableData);
  328. if (params.length < 1 || this.tableData > this.copyTableData) {
  329. return;
  330. }
  331. let param = {
  332. projectId: this.projectId,
  333. data: []
  334. };
  335. params.map(item => {
  336. param.data.push({ id: item.id });
  337. });
  338. this.$confirm("此操作将删除部件,是否继续?", "提示", {
  339. confirmButtonText: "确定",
  340. cancelButtonText: "取消",
  341. type: "warning"
  342. })
  343. .then(() => {
  344. this.deleteTableData(param);
  345. })
  346. .catch(() => {
  347. this.getTableHeader();
  348. this.$message("取消删除");
  349. });
  350. },
  351. //修改
  352. handleUpdataTable(changeData, source) {
  353. if (!this.onlyRead) {
  354. if (changeData) {
  355. let trimmedArr = this.trimmedRows();
  356. let param = handsonUtils.getParam(
  357. changeData,
  358. source,
  359. this.tableExample,
  360. trimmedArr
  361. );
  362. let data = [];
  363. for (let i = 0; i < param.length; i++) {
  364. data.push(param[i]);
  365. }
  366. //如果data中包含/且data长度为1,将其转换成.
  367. if (
  368. changeData.length == 1 &&
  369. changeData[0][1] &&
  370. changeData[0][1].indexOf("/") > 0
  371. ) {
  372. changeData[0][1] = changeData[0][1].split("/").join(".");
  373. }
  374. // 存在data进行修改请求
  375. if (data && data.length) {
  376. this.updateTableData(data, changeData);
  377. }
  378. }
  379. }
  380. },
  381. //撤回
  382. undo() {
  383. this.tableExample.undo();
  384. },
  385. //切换每页显示多少条数据
  386. handleSizeChange(val) {
  387. this.page.pageSize = val;
  388. this.getTableHeader();
  389. },
  390. //切换页数
  391. handleCurrentChange(val) {
  392. this.page.pageNumber = val;
  393. this.getTableHeader();
  394. },
  395. formatHeaderData(list) {
  396. //格式化表头显示的数据
  397. let arr = tools.copyArr(list)
  398. let data = showTools.headerTextFilter(arr, "parts", this.onlyRead, this.showType, true)
  399. data.unshift("查看详情", "当前关联的资产")
  400. return data
  401. },
  402. formatHeaderType(list) {
  403. //格式化表头头映射的数据
  404. let arr = tools.copyArr(list);
  405. let data = showTools.headerTypeFilter(arr, "parts", this.onlyRead, this.showType, true)
  406. data.unshift(
  407. {
  408. data: "caozuo",
  409. renderer: tools.lookDetails,
  410. readOnly: true
  411. },
  412. {
  413. data: "propertyLocalName",
  414. readOnly: true
  415. }
  416. );
  417. return data;
  418. },
  419. initTable() {
  420. //实例化表格
  421. let settings = {
  422. data: this.tableData,
  423. colHeaders: this.formatHeaderData(this.tableHeader),
  424. columns: this.formatHeaderType(this.tableHeader),
  425. rowHeights: 30,
  426. maxRows: this.tableData.length,
  427. contextMenu: this.onlyRead ? false : {
  428. items: {
  429. remove_row: {
  430. name: "删除部件"
  431. }
  432. }
  433. },
  434. // 事件
  435. afterChange: this.handleUpdataTable, //修改后
  436. afterRemoveRow: this.handleDeleteTableRow, //右键删除
  437. afterOnCellMouseDown: this.handleTdClick //鼠标点击
  438. };
  439. this.$nextTick(() => {
  440. this.tableExample = this.$refs.table.init(settings);
  441. });
  442. },
  443. //去除数组中相同的元素
  444. array_diff(a, b) {
  445. for (var i = 0; i < b.length; i++) {
  446. for (var j = 0; j < a.length; j++) {
  447. if (a[j] == b[i]) {
  448. a.splice(j, 1);
  449. j = j - 1;
  450. }
  451. }
  452. }
  453. return a;
  454. },
  455. //修改关联的资产
  456. changeProperty(val) {
  457. this.setDataToMain(val.propertyId, 'propertyId', this.row);
  458. this.setDataToMain(val.linkEquipLocalName, 'linkEquipLocalName', this.row);
  459. },
  460. //上传文件弹窗触发事件
  461. fileChange(keys) {
  462. this.setDataToMain(keys, this.messKey, this.row);
  463. },
  464. //上传图片弹窗触发事件
  465. imgChange(keys) {
  466. this.setDataToMain(keys, this.messKey, this.row);
  467. },
  468. //设备图片弹窗改变事件
  469. changePics(keys) {
  470. this.setDataToMain(keys, this.messKey, this.row);
  471. },
  472. //表格点击事件
  473. handleTdClick(el, rowArr) {
  474. //点击的是表头
  475. if (rowArr.row < 0) {
  476. return;
  477. }
  478. //被筛选过后的数组
  479. let trimmedArr = this.trimmedRows();
  480. //是否启用了排序
  481. let isSort = this.tableExample.getPlugin("columnSorting").isSorted();
  482. if (trimmedArr.length && isSort) {
  483. let sortArr = this.myHotArr.getPlugin("columnSorting").rowsMapper
  484. .__arrayMap;
  485. let infos = this.tableData[trimmedArr[sortArr[rowArr.row]]];
  486. this.getInfors(infos, { row: sortArr[rowArr.row], col: rowArr.col });
  487. } else if (isSort) {
  488. //排序后的数组
  489. let sortArr = this.tableExample.getPlugin("columnSorting").rowsMapper
  490. .__arrayMap;
  491. let infos = this.tableData[sortArr[rowArr.row]];
  492. this.getInfors(infos, { row: sortArr[rowArr.row], col: rowArr.col });
  493. } else if (trimmedArr.length) {
  494. let infos = this.tableData[trimmedArr[rowArr.row]];
  495. this.getInfors(infos, { row: trimmedArr[rowArr.row], col: rowArr.col });
  496. } else {
  497. let infos = this.tableData[rowArr.row];
  498. this.getInfors(infos, rowArr);
  499. }
  500. },
  501. //获取被筛选掉的行号
  502. trimmedRows() {
  503. var plugin = this.tableExample.getPlugin("trimRows").trimmedRows;
  504. let dataLength = this.tableData.length;
  505. let dataArr = new Array();
  506. for (let i = 0; i < dataLength; i++) {
  507. dataArr.push(i);
  508. }
  509. if (plugin.length <= 0) {
  510. dataArr = undefined;
  511. } else {
  512. dataArr = this.array_diff(dataArr, plugin);
  513. }
  514. return dataArr || [];
  515. },
  516. getInfors(infos, row) {
  517. this.row = row.row;
  518. let val = this.tableExample.colToProp(row.col);
  519. let inputData = this.inputMap[val];
  520. this.messKey = val;
  521. switch (val) {
  522. //操作
  523. case 'caozuo':
  524. // window.open(`http://adm.sagacloud.cn:8058/spread?id=${infos.EquipID}&pid=${this.projectId}&secret=${this.secret}`,"_blank")
  525. this.$message("开发中...")
  526. break;
  527. //设备二维码图片
  528. case 'qRCodePic':
  529. this.qrcodeUrl = this.tableData[row.row].EquipQRCode;
  530. if (!!this.qrcodeUrl) {
  531. this.myDialog.qrcode = true;
  532. } else {
  533. this.$message("此设备没有设备二维码");
  534. }
  535. break;
  536. //关联系统
  537. case 'linkSystem':
  538. if (!this.onlyRead) {
  539. this.curDevice = infos.EquipID;
  540. this.systemList = this.tableData[row.row].linkSystem || [];
  541. this.myDialog.systemType = true;
  542. }
  543. break;
  544. //关联资产
  545. case 'propertyLocalName':
  546. if (this.linkNameFalg) {
  547. this.myDialog.changeRea = true;
  548. }
  549. break;
  550. /**
  551. * 关联资产后才可维护的信息点
  552. */
  553. // case 'flowBuild': //所属建筑楼层
  554. // case 'infos.productDate': //生产日期
  555. // case 'infos.serialNum': //出厂编号
  556. // case 'infos.assetID': //资产编号
  557. // case 'infos.purchasePrice': //采购价格
  558. // case 'infos.insuranceNum': //保险单号
  559. // case 'infos.insuranceFile': //保险文件
  560. // const propertyId = this.tableData[row.row].propertyId;
  561. // if (!propertyId) { //未关联资产
  562. // this.$confirm('您暂未关联设备对应的资产,该信息点不可编辑', '提示', {
  563. // confirmButtonText: '我知道了',
  564. // showCancelButton: false,
  565. // type: 'warning',
  566. // center: true
  567. // }).then(() => {
  568. // return false;
  569. // });
  570. // }
  571. // break
  572. //保险文件--设备文档--安装质检报告
  573. case 'infos.insuranceFile': //保险文件
  574. case 'infos.archive': //设备文档
  575. case 'infos.checkReport': //安装质检报告
  576. case 'infos.maintainManual': //维修保养手册
  577. case 'infos.approachingAcceptance': //进场验收单
  578. case 'infos.acceptanceReport': //验收报告
  579. case 'infos.operationManual': //操作说明书
  580. case 'infos.originalCertificate': //原厂证明
  581. case 'infos.testReport': //检测报告
  582. case 'infos.productCertification': //产品合格证
  583. case 'infos.installInstruction': //安装说明书
  584. case 'infos.supplierContract': //供应合同
  585. case 'infos.drawing': //设备图纸
  586. case 'infos.installDrawing': //安装图纸
  587. let IPSdata = tools.dataForKey(this.tableData[row.row], val);
  588. this.filesArr = IPSdata ? IPSdata : [];
  589. this.myDialog.uploadFiles = true;
  590. break;
  591. //安装照片--设备铭牌照片
  592. case 'infos.installPic':
  593. case 'infos.nameplate':
  594. let SSPPdata = tools.dataForKey(this.tableData[row.row], val);
  595. this.imgsArr = SSPPdata ? SSPPdata : [];
  596. this.myDialog.uploadImgs = true;
  597. break;
  598. //设备照片
  599. case 'infos.pic':
  600. let Pdata = tools.dataForKey(this.tableData[row.row], val);
  601. this.picsArr = Pdata ? Pdata : [];
  602. this.myDialog.pic = true;
  603. break;
  604. //包含的部件字段
  605. case 'count':
  606. if (this.onlyRead) {
  607. this.$router.push({ path: '/ledger/parts', query: { deviceId: infos.EquipID } });
  608. } else {
  609. this.$router.push({
  610. path: '/ledger/partsmanage',
  611. query: { deviceId: infos.EquipID, typeId: this.mess.deviceId }
  612. });
  613. }
  614. break;
  615. default:
  616. break;
  617. }
  618. if (!this.onlyRead && !inputData.editable) {
  619. this.$message("该信息点的值为自动生成,不可人工维护!");
  620. return false;
  621. }
  622. if (!this.onlyRead && showTools.inputModeArr.indexOf(inputData.dataType) == '-1') {
  623. this.updateInfoPoint = val;
  624. this.updateInput = tools.dataForKey(this.tableData[row.row], val);
  625. this.myDialog.update = true;
  626. return false;
  627. }
  628. },
  629. //关闭临时维护弹窗回调
  630. handleCloseUpdate() {
  631. this.updateInputShow = false
  632. this.updateInfoPoint = ''
  633. this.updateInput = ''
  634. },
  635. //更新临时维护信息点
  636. handleClickUpdate() {
  637. tools.setDataForKey(this.tableData[this.row], this.updateInfoPoint, this.updateInput)
  638. this.handleUpdataTable([[this.row, this.updateInfoPoint, null, this.updateInput]], "edit")
  639. this.updateInputShow = false
  640. this.myDialog.update = false
  641. this.updateInput = ''
  642. },
  643. utilToKey(key, name, data, messName) {
  644. if (key == name) {
  645. this.setDataToMain(data[key], messName, this.row);
  646. }
  647. },
  648. //判断是否有值,有值赋值
  649. setDataToMain(data, key, row) {
  650. if (!!data && data != "--") {
  651. if (!!this.tableData[row]) {
  652. tools.setDataForKey(this.tableData[row], key, data);
  653. this.handleUpdataTable([[row, key, null, data]], "edit");
  654. } else {
  655. this.tableData[row] = {};
  656. tools.setDataForKey(this.tableData[row], key, data);
  657. }
  658. } else {
  659. tools.setDataForKey(this.tableData[row], key, "");
  660. }
  661. },
  662. //修改资产
  663. changeAssetsFalg() {
  664. if (this.linkNameFalg) {
  665. this.linkNameFalg = false
  666. } else {
  667. this.$confirm('<p>真的要在这里修改部件关联的资产么?</p><p>真的能通过列表信息找到想关联的资产么?</p><p>在这里修改关联的资产一定是因为之前关联错了要修改么?</p>', '提示', {
  668. dangerouslyUseHTMLString: true,
  669. confirmButtonText: '没错!我要改关联的资产',
  670. cancelButtonText: '我就点开看看',
  671. confirmButtonClass: 'cancelButtonClass',
  672. cancelButtonClass: 'cancelButtonClass'
  673. }).then(_ => {
  674. this.linkNameFalg = true
  675. }).catch(_ => {
  676. this.$message("取消")
  677. })
  678. }
  679. },
  680. // 返回
  681. goback() {
  682. this.$router.push({
  683. name: 'facilityLedger',
  684. params: {
  685. deviceId: this.queryParam.typeId,
  686. pageNo: this.queryParam.pageNo,
  687. pageSize: this.queryParam.pageSize,
  688. readOnly: false
  689. }
  690. })
  691. }
  692. }
  693. };
  694. </script>
  695. <style lang="less" scoped>
  696. #deviceList {
  697. overflow: hidden;
  698. height: 100%;
  699. background-color: #fff;
  700. padding: 10px;
  701. position: relative;
  702. .right {
  703. background: #fff;
  704. }
  705. .search-header {
  706. overflow: hidden;
  707. padding: 0 10px 10px 10px;
  708. border-bottom: 1px solid #bcbcbc;
  709. }
  710. .tableBox {
  711. display: flex;
  712. height: calc(100% - 150px);
  713. margin-top: 10px;
  714. .tableLeft,
  715. .middle_sty {
  716. flex: 1;
  717. }
  718. }
  719. }
  720. .el-pagination button,
  721. .el-pagination span:not([class*="suffix"]) {
  722. vertical-align: middle;
  723. }
  724. </style>