device.vue 56 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861
  1. <template>
  2. <div
  3. style="height: calc(100% - 44.5px);padding: 0px 10px 10px;box-sizing: border-box;"
  4. v-loading="loading"
  5. >
  6. <div class="hanson-bar">
  7. <div style="float:right;overflow:hidden;">
  8. <!-- <span style="width:20px;float:left;display:block;height:20px;cursor: pointer;" @click="changeAssetsFalg">
  9. <i v-show="!onlyRead" class="el-icon-fa el-icon-fa-compass"></i>
  10. </span>-->
  11. <span>当前筛选条件下共{{ page.total || "--" }}设备</span>
  12. </div>
  13. <el-select
  14. v-model="onlyRead"
  15. @change="getHeaderData(mess)"
  16. style="width:100px;margin-right:20px;vertical-align:bottom;"
  17. >
  18. <el-option
  19. v-for="item in options"
  20. :key="item.value"
  21. :label="item.label"
  22. :value="item.value"
  23. ></el-option>
  24. </el-select>
  25. <el-select
  26. v-model="showType"
  27. @change="initTable"
  28. style="width:100px;margin-right:10px;vertical-align:bottom;"
  29. >
  30. <el-option
  31. v-for="item in showTypes"
  32. :key="item.value"
  33. :label="item.label"
  34. :value="item.value"
  35. ></el-option>
  36. </el-select>
  37. <!-- <el-button size="small" style='width: 80px;' @click="download" icon="iconfont icon-xiazai">下载</el-button> -->
  38. <el-button size="small" style="width: 80px;" @click="addDevice"
  39. >添加设备
  40. </el-button
  41. >
  42. <el-button
  43. size="small"
  44. @click="Batch"
  45. v-show="!onlyRead"
  46. :disabled="!(tableData && tableData.length)"
  47. >批量维护信息点
  48. </el-button
  49. >
  50. <el-button size="small" style="width: 80px;" @click="reset"
  51. >刷新
  52. </el-button
  53. >
  54. <el-button
  55. size="small"
  56. style="width: 80px;"
  57. v-show="!onlyRead"
  58. @click="undo"
  59. >撤销
  60. </el-button
  61. >
  62. </div>
  63. <!-- 二维码弹窗 -->
  64. <qrcode
  65. :dialog="myDialog"
  66. :qrcodeUrl="qrcodeUrl"
  67. :addBody="true"
  68. ref="qrcode"
  69. ></qrcode>
  70. <!-- bim坐标弹框 -->
  71. <bimDialog
  72. :dialog="myDialog"
  73. :bimcodeobj="bimcodeobj"
  74. @closeBIM="closeBIM"
  75. :addBody="true"
  76. ref="bimdialog"
  77. ></bimDialog>
  78. <!-- 型号弹窗 -->
  79. <firm
  80. :mess="{ deviceId: deviceType.assetType }"
  81. :firmDataType="firmDataType"
  82. ref="firm"
  83. @changeFirm="firmChange"
  84. :dialog="myDialog"
  85. ></firm>
  86. <!-- 供应商合同弹窗 -->
  87. <supply-dialog
  88. ref="supply"
  89. @change="supplyChange"
  90. :id="id"
  91. :dialog="myDialog"
  92. />
  93. <!-- 供应商弹窗 -->
  94. <supplier-dialog
  95. ref="supplier"
  96. :firmDataType="firmDataType"
  97. @changeSupplier="supplierChange"
  98. :dialog="myDialog"
  99. />
  100. <guarantee-dialog
  101. :id="id"
  102. ref="guarantee"
  103. @change="guaranteeChange"
  104. :dialog="myDialog"
  105. />
  106. <!-- 上传文件-->
  107. <upload-files-dialog
  108. :read="onlyRead ? true : false"
  109. ref="upload"
  110. @changeFile="fileChange"
  111. :keysArr="filesArr"
  112. :firmDataType="firmDataType"
  113. :information="information"
  114. :infoType="infoType"
  115. :dialog="myDialog"
  116. />
  117. <!-- 上传图片-->
  118. <upload-img-dialog
  119. :read="onlyRead ? true : false"
  120. @changeFile="imgChange"
  121. :keysArr="imgsArr"
  122. :dialog="myDialog"
  123. :firmDataType="firmDataType"
  124. :information="information"
  125. :infoType="infoType"
  126. />
  127. <!-- 维修商信息-->
  128. <maintainer-dialog
  129. @changeMaintainer="changeMaintainer"
  130. :firmDataType="firmDataType"
  131. ref="maintainer"
  132. :dialog="myDialog"
  133. />
  134. <insurer-dialog
  135. @changeInsurer="changeInsurer"
  136. :firmDataType="firmDataType"
  137. ref="insurer"
  138. :dialog="myDialog"
  139. />
  140. <pic-dialog
  141. :read="onlyRead ? true : false"
  142. :dialog="myDialog"
  143. :keysArr="picsArr"
  144. @change="changePics"
  145. :firmDataType="firmDataType"
  146. :information="information"
  147. :infoType="infoType"
  148. />
  149. <div
  150. class="middle_sty"
  151. style="height: 91%; text-align:center"
  152. v-show="!mess.deviceId && (!tableData || !tableData.length)"
  153. >
  154. <p>
  155. <i class="icon-wushuju iconfont"></i>
  156. 请选择设备族
  157. </p>
  158. </div>
  159. <div
  160. class="center middle_sty"
  161. style="height: 91%;"
  162. v-show="mess.deviceId && (!tableData || !tableData.length)"
  163. >
  164. <p>
  165. <i class="icon-wushuju iconfont"></i>
  166. 暂无数据
  167. </p>
  168. </div>
  169. <div
  170. v-show="mess.deviceId && tableData && tableData.length"
  171. id="handsontable"
  172. ref="handsontable"
  173. ></div>
  174. <div v-show="mess.deviceId && tableData && tableData.length" class="right">
  175. <my-pagination
  176. @change="getTableData"
  177. :page="page"
  178. :key="pageKey"
  179. ></my-pagination>
  180. </div>
  181. <details-dialog
  182. :iframeSrc="iframeSrc"
  183. v-if="myDialog.details"
  184. :dialog="myDialog"
  185. ></details-dialog>
  186. <!-- 关联的系统 -->
  187. <system-type
  188. :device="mess"
  189. :curDevice="curDevice"
  190. :dialog="myDialog"
  191. :type="onlyRead ? 'read' : 'edit'"
  192. @change="changeSystemType"
  193. :list="systemList"
  194. ></system-type>
  195. <!-- 关联资产 -->
  196. <change-rea
  197. @changeProperty="changeProperty"
  198. :dialog="myDialog"
  199. :category="deviceType"
  200. ></change-rea>
  201. <look-pic :dialog="myDialog" :keysArr="picsArr"></look-pic>
  202. <!-- 不支持的输入方式 -->
  203. <el-dialog
  204. title="临时维护信息点"
  205. :visible.sync="myDialog.update"
  206. @close="handleCloseUpdate"
  207. width="670px"
  208. >
  209. <el-row>
  210. 该信息点未定义对应组件,现在维护数据不确定后续是否可用。如确实需要维护,请点击
  211. <el-link
  212. @click="updateInputShow = true"
  213. type="primary"
  214. :underline="false"
  215. >继续维护
  216. </el-link
  217. >
  218. </el-row>
  219. <el-row style="margin-top:20px;" v-show="updateInputShow">
  220. <el-input
  221. type="textarea"
  222. :autosize="{ minRows: 4, maxRows: 8 }"
  223. placeholder="请输入内容"
  224. v-model="updateInput"
  225. ></el-input>
  226. </el-row>
  227. <span slot="footer" class="dialog-footer">
  228. <el-button @click="myDialog.update = false">取 消</el-button>
  229. <el-button type="primary" @click="handleClickUpdate">确 认</el-button>
  230. </span>
  231. </el-dialog>
  232. <!-- 新增设备 -->
  233. <el-dialog
  234. title="确定新增设备的类型"
  235. :visible.sync="myDialog.addDevice"
  236. width="670px"
  237. >
  238. <el-row>
  239. <my-cascader
  240. ref="cascader"
  241. @change="changeAddType"
  242. :all="true"
  243. ></my-cascader>
  244. </el-row>
  245. <span slot="footer" class="dialog-footer">
  246. <el-button type="primary" @click="toAddDevice">下 一 步</el-button>
  247. </span>
  248. </el-dialog>
  249. <!-- 维护信息弹窗-->
  250. <batchDialog
  251. ref="batchDialogs"
  252. @code="fourVendors"
  253. :firmName="firmName"
  254. :allObject="allObject"
  255. :page="batchPage"
  256. :information="information"
  257. :newEnclosure="newEnclosure"
  258. @getAllData="getAllData"
  259. @multiples="multiples"
  260. @upDataDevice="upDataDevice"
  261. />
  262. </div>
  263. </template>
  264. <script>
  265. import {
  266. BeatchQueryParam,
  267. deleteEquip,
  268. getEquipBelongs,
  269. queryUpdate,
  270. updateEquip
  271. } from "@/api/scan/request";
  272. import { getEquipTableCon, queryEquip } from "@/api/object/equip";
  273. import { getDataDictionary } from "@/api/dict";
  274. import tools from "@/utils/scan/tools";
  275. import handsonUtils from "@/utils/hasontableUtils";
  276. import showTools from "@/utils/handsontable/notShow";
  277. import text from "@/utils/handsontable/mainText";
  278. import myCascader from "@/components/ledger/lib/cascader";
  279. import buildFloor from "@/utils/handsontable/buildFloorData";
  280. import qrcode from "@/components/ledger/lib/qrcode";
  281. import bimDialog from "@/components/ledger/lib/bimDialog";
  282. import firm from "@/components/dialogs/list/firm";
  283. import supplyDialog from "@/components/dialogs/list/supplyDialog";
  284. import supplierDialog from "@/components/dialogs/list/supplierDialog";
  285. import maintainerDialog from "@/components/dialogs/list/maintainerDialog";
  286. import insurerDialog from "@/components/dialogs/list/insurerDialog";
  287. import guaranteeDialog from "@/components/dialogs/list/guaranteeDialog";
  288. import uploadFilesDialog from "@/components/dialogs/list/filesDialog";
  289. import uploadImgDialog from "@/components/dialogs/list/uploadImgDialog";
  290. import picDialog from "@/components/dialogs/list/picDialog";
  291. import batchDialog from "../../dialogs/list/batchDialog";
  292. import systemType from "@/components/dialogs/list/systemType";
  293. import myPagination from "@/components/ledger/lib/myPagination";
  294. import detailsDialog from "@/components/ledger/lib/detailsDia";
  295. import changeRea from "@/components/dialogs/changeRea";
  296. import { mapGetters } from "vuex";
  297. //图片查看
  298. import lookPic from "@/components/ledger/lib/lookImages";
  299. import Handsontable from "handsontable-pro";
  300. import "handsontable-pro/dist/handsontable.full.css";
  301. import lStorage from "@/utils/localStorage";
  302. //下拉插件
  303. // import "@/assets/js/chosen.jquery.min";
  304. // import "@/assets/js/handsontable-chosen-editor";
  305. export default {
  306. props: ["myParam"],
  307. components: {
  308. qrcode, //二维码页面
  309. firm, //
  310. supplyDialog,
  311. supplierDialog,
  312. guaranteeDialog,
  313. uploadFilesDialog,
  314. maintainerDialog,
  315. insurerDialog,
  316. uploadImgDialog,
  317. picDialog,
  318. myPagination,
  319. systemType,
  320. detailsDialog,
  321. changeRea,
  322. lookPic,
  323. myCascader,
  324. batchDialog,
  325. bimDialog
  326. },
  327. created() {
  328. buildFloor.getData(this.buildFloorData);
  329. },
  330. computed: {
  331. ...mapGetters("layout", ["projectId", "secret", "userId"]),
  332. showTypes() {
  333. return this.onlyRead
  334. ? [
  335. { value: "Visible", label: "只看采集信息" },
  336. { value: "all", label: "全部" }
  337. ]
  338. : [
  339. { value: "partInfo", label: "隐藏信息点" },
  340. { value: "all", label: "全部" },
  341. { value: "Visible", label: "只看采集信息" }
  342. ];
  343. },
  344. // batchDate() {
  345. // // return !(!this.onlyRead && this.copyMain)
  346. // return !(!this.onlyRead && this.page.total > 1)
  347. // },
  348. batchDialogShow() {
  349. return this.$refs.batchDialogs.batchDialog;
  350. }
  351. },
  352. data() {
  353. return {
  354. options: [
  355. {
  356. value: true,
  357. label: "只读模式"
  358. },
  359. {
  360. value: false,
  361. label: "编辑模式"
  362. }
  363. ],
  364. buildFloorData: [], //楼层数据
  365. tableData: [],
  366. mess: {},
  367. tableHeader: null,
  368. page: {
  369. size: 50,
  370. sizes: [10, 30, 50, 100, 150, 200],
  371. total: 0,
  372. currentPage: 1
  373. },
  374. pageKey: new Date().getTime(),
  375. batchPage: {
  376. size: 100,
  377. sizes: [100, 200, 500, 1000],
  378. total: 0,
  379. currentPage: 1
  380. },
  381. myDialog: {
  382. qrcode: false, //二维码弹窗
  383. bimcode: false, //bim弹窗
  384. firm: false, //厂商弹窗
  385. supply: false, //选择供应合同
  386. supplier: false, //供应商选择
  387. guarantee: false, //选择保单
  388. maintainer: false, //选择维修商
  389. insurer: false, //选择保险公司
  390. uploadFiles: false, //上传文件
  391. uploadImgs: false, //上传单个图片
  392. pic: false, //多个图片
  393. addDevice: false, //添加设备
  394. systemType: false, //关联系统
  395. details: false, //详情页
  396. changeRea: false, //关联资产
  397. lookPic: false, //图片查看
  398. update: false //临时维护信息点
  399. },
  400. row: null, //被修改的row
  401. filesArr: [], //保存临时的文件key
  402. messKey: null,
  403. imgsArr: [], //临时保存的图片key数组
  404. picsArr: [], //临时设备图片keys数组
  405. systemList: [], //关联的系统
  406. copyMain: null,
  407. iframeSrc: "",
  408. id: 0,
  409. onlyRead: true,
  410. showType: "Visible",
  411. linkNameFalg: true,
  412. qrcodeUrl: "", //二维码图片地址
  413. bimcodeobj: "", //BIM对象
  414. loading: false,
  415. deviceType: {}, //族3位编码及名称
  416. floorData: [],
  417. curDevice: "", //当前点击的设备id
  418. addData: {}, //
  419. showParts: false,
  420. inputMap: {
  421. flowBuild: {
  422. InputMode: "D1",
  423. Editable: true,
  424. InfoPointCode: "flowBuild",
  425. InfoPointName: "建筑楼层",
  426. Path: "flowBuild"
  427. }
  428. }, //信息点和输入方式映射表
  429. updateInputShow: false, //是否显示临时维护输入框
  430. updateInfoPoint: "", //临时维护信息点
  431. updateInput: "", //临时维护信息点值
  432. firmName: "", //维护信息显示厂家名称
  433. firmDataType: "row",
  434. allObject: [],
  435. information: {
  436. archive: {
  437. Archive: [], //设备文档
  438. name: "设备文档",
  439. code: "infos.PhotoDoc.Archive",
  440. num: 14
  441. },
  442. checkReport: {
  443. CheckReport: [], //安装质检报告
  444. name: "安装质检报告",
  445. code: "infos.Siteinstall.CheckReport",
  446. num: 18
  447. },
  448. drawing: {
  449. Drawing: [], //设备图纸
  450. name: "设备图纸",
  451. code: "infos.PhotoDoc.Drawing",
  452. num: 13
  453. },
  454. installDrawing: {
  455. InstallDrawing: [], //安装图纸
  456. name: "安装图纸",
  457. code: "infos.Siteinstall.InstallDrawing",
  458. num: 16
  459. },
  460. installPic: {
  461. InstallPic: [], //安装照片
  462. name: "安装照片",
  463. code: "infos.Siteinstall.InstallPic",
  464. num: 17
  465. },
  466. insuranceFile: {
  467. InsuranceFile: [], //保险文件
  468. name: "保险文件",
  469. code: "infos.InsuranceDoc.InsuranceFile",
  470. num: 11
  471. },
  472. nameplate: {
  473. Nameplate: [], //设备铭牌照片
  474. name: "设备铭牌照片",
  475. code: "infos.PhotoDoc.Nameplate",
  476. num: 12
  477. },
  478. pic: {
  479. Pic: [], //设备照片
  480. name: "设备照片",
  481. code: "infos.PhotoDoc.Pic",
  482. num: 15
  483. }
  484. },
  485. infoType: "",
  486. newEnclosure: []
  487. };
  488. },
  489. methods: {
  490. //获取表头
  491. getHeaderData(code) {
  492. let tempParams = this.$route.params;
  493. if (!tempParams.used && tempParams.pageSize) {
  494. this.page.currentPage = tempParams.pageNo;
  495. this.page.size = tempParams.pageSize;
  496. this.onlyRead = tempParams.readOnly;
  497. tempParams.used = true;
  498. } else {
  499. this.page.currentPage = 1;
  500. }
  501. this.pageKey = new Date().getTime();
  502. this.mess = code;
  503. this.changeCader();
  504. if (this.mess.deviceId) {
  505. let params = {
  506. type: this.mess.deviceId
  507. };
  508. getDataDictionary(params, res => {
  509. this.tableHeader = res.content;
  510. this.tableHeader.forEach(item => {
  511. if (item.path) {
  512. this.inputMap[item.path] = item;
  513. }
  514. });
  515. this.getTableData();
  516. this.getAllData();
  517. // 信息维护
  518. this.newEnclosure = res.content.filter(i => i.inputMode == "F2");
  519. });
  520. }
  521. },
  522. //关闭弹窗
  523. closeBIM(val) {
  524. this.myDialog.bimcode = false;
  525. if (val == "update") {
  526. this.getTableData();
  527. this.getAllData();
  528. }
  529. },
  530. //获取主体数据
  531. getTableData() {
  532. this.loading = true;
  533. //type存在发送请求
  534. if (this.mess.deviceId) {
  535. let param = {
  536. pageSize: this.page.size,
  537. orders: "createTime desc,id desc,localId desc,localName desc",
  538. pageNumber: this.page.currentPage,
  539. filters: `classCode='${this.mess.deviceId}'`
  540. };
  541. if (this.mess.buildId == "noKnow") {
  542. param.filters += `;buildingId isNull`;
  543. } else if (this.mess.buildId && this.mess.buildId != "all") {
  544. param.filters += `;buildingId='${this.mess.buildId}'`;
  545. }
  546. if (this.mess.floorId == "noKnow") {
  547. param.filters += `;floorId isNull`;
  548. } else if (this.mess.floorId && this.mess.floorId != "all") {
  549. param.filters += `;floorId='${this.mess.floorId}'`;
  550. }
  551. getEquipTableCon(param, res => {
  552. this.loading = false;
  553. this.showParts = res.message == "1" ? true : false; // 判断是否显示包含的部件列
  554. this.tableData = res.content.map(item => {
  555. if (
  556. item.hasOwnProperty("buildingId") &&
  557. item.hasOwnProperty("floorId")
  558. ) {
  559. item.flowBuild = item.buildingId + "-" + item.floorId;
  560. } else if (
  561. item.hasOwnProperty("buildingId") &&
  562. !item.hasOwnProperty("floorId")
  563. ) {
  564. item.flowBuild = item.buildingId;
  565. }
  566. return item;
  567. });
  568. this.copyMain = tools.deepCopy(this.tableData);
  569. this.page.total = res.total;
  570. if (this.tableData && this.tableData.length) {
  571. if (this.onlyRead) {
  572. this.getBatch(this.tableData);
  573. }
  574. this.initTable();
  575. }
  576. });
  577. }
  578. },
  579. //获取所有主体数据---用于维护信息
  580. getAllData() {
  581. if (!!this.mess.deviceId) {
  582. // 查询step2
  583. let params = {
  584. cascade: [
  585. {
  586. name: "property"
  587. // projection: [
  588. // "Family",
  589. // "EquipLocalName",
  590. // "EquipLocalID",
  591. // "EquipID",
  592. // "CodeType"
  593. // ]
  594. },
  595. {
  596. Name: "building",
  597. Projection: ["localName", "name", "id"]
  598. },
  599. {
  600. Name: "floor",
  601. Projection: ["localName", "name", "id"]
  602. }
  603. ],
  604. filters: `classCode='${this.mess.deviceId}'`,
  605. pageSize: this.batchPage.size,
  606. orders: "createTime desc, id desc",
  607. pageNumber: this.batchPage.currentPage,
  608. projection: [
  609. "buildingId",
  610. "floorId",
  611. "classCode",
  612. "localName",
  613. "localID",
  614. "id",
  615. "bimId"
  616. ]
  617. };
  618. if (this.mess.buildId == "noKnow") {
  619. params.filters += `;buildingId isNull`;
  620. } else if (this.mess.buildId && this.mess.buildId != "all") {
  621. params.filters += `;buildingId='${this.mess.buildId}'`;
  622. }
  623. if (this.mess.floorId == "noKnow") {
  624. params.filters += `;floorId isNull`;
  625. } else if (this.mess.floorId && this.mess.floorId != "all") {
  626. params.filters += `;floorId='${this.mess.floorId}'`;
  627. }
  628. queryEquip(params, res => {
  629. this.allObject = res.content;
  630. this.batchPage.total = res.total;
  631. });
  632. }
  633. },
  634. //获取动态参数
  635. getBatch(data) {
  636. let param = {
  637. secret: this.secret,
  638. ProjId: this.projectId,
  639. data: {
  640. criterias: []
  641. }
  642. };
  643. //一级遍历list
  644. this.tableHeader.map(head => {
  645. //如果一级标签为动态参数或者设定参数放入数据等待请求
  646. if (
  647. head.inputMode == "L" ||
  648. head.inputMode == "L1" ||
  649. head.inputMode == "L2" ||
  650. head.inputMode == "M"
  651. ) {
  652. data.map(item => {
  653. let cur = tools.dataForKey(item, head.path);
  654. if (cur) {
  655. param.data.criterias.push({
  656. id: item.id,
  657. code: head.code
  658. });
  659. }
  660. });
  661. }
  662. });
  663. if (param.data.criterias.length) {
  664. BeatchQueryParam(param, res => {
  665. if (!this.onlyRead) {
  666. return false;
  667. }
  668. this.tableData = data.map(item => {
  669. res.Content.map(child => {
  670. if (item.id == child.id) {
  671. if (!!child.data || child.data == 0) {
  672. this.tableHeader.map(head => {
  673. if (head.code == child.code) {
  674. tools.setDataForKey(item, head.path, child.data);
  675. }
  676. });
  677. } else {
  678. this.tableHeader.map(head => {
  679. if (head.code == child.code) {
  680. tools.setDataForKey(
  681. item,
  682. head.path,
  683. child.error
  684. ? child.value
  685. ? "表号功能号格式错误"
  686. : "表号功能号不存在"
  687. : "暂未采集到实时数据"
  688. );
  689. }
  690. });
  691. }
  692. }
  693. });
  694. return item;
  695. });
  696. this.hot.loadData(this.tableData);
  697. });
  698. }
  699. },
  700. //修改资产
  701. changeAssetsFalg() {
  702. if (this.linkNameFalg) {
  703. this.linkNameFalg = false;
  704. } else {
  705. this.$confirm(
  706. "<p>真的要在这里修改设备关联的资产么?</p><p>真的能通过列表信息找到想关联的资产么?</p><p>在这里修改关联的资产一定是因为之前关联错了要修改么?</p>",
  707. "提示",
  708. {
  709. dangerouslyUseHTMLString: true,
  710. confirmButtonText: "没错!我要改关联的资产",
  711. cancelButtonText: "我就点开看看",
  712. confirmButtonClass: "cancelButtonClass",
  713. cancelButtonClass: "cancelButtonClass"
  714. }
  715. )
  716. .then(_ => {
  717. this.linkNameFalg = true;
  718. })
  719. .catch(_ => {
  720. this.$message("取消");
  721. });
  722. }
  723. },
  724. //撤回
  725. undo() {
  726. this.hot.undo();
  727. },
  728. //刷新-switch改变
  729. reset() {
  730. this.getTableData();
  731. },
  732. //添加设备
  733. addDevice() {
  734. this.myDialog.addDevice = true;
  735. if (this.mess.deviceId) {
  736. this.$nextTick(() => {
  737. this.$refs.cascader.setValue(this.mess.deviceId);
  738. });
  739. }
  740. },
  741. //下一步
  742. toAddDevice() {
  743. if (this.addData.deviceId) {
  744. this.$router.push({
  745. path: "/ledger/deviceadd",
  746. query: this.addData
  747. });
  748. }
  749. },
  750. //选择设备类型-添加设备
  751. changeAddType(val) {
  752. this.addData.deviceId = val.code;
  753. this.addData.name = val.facility;
  754. this.addData.showType = this.showType;
  755. },
  756. //下载
  757. download() {
  758. if (!this.onlyRead) {
  759. if (!!this.hot) {
  760. let fileName =
  761. this.mess.name +
  762. "-页数:" +
  763. this.page.currentPage +
  764. "-个数:" +
  765. this.tableData.length +
  766. "-总个数:" +
  767. this.page.total;
  768. this.hot.getPlugin("exportFile").downloadFile("csv", {
  769. filename: fileName,
  770. columnHeaders: true,
  771. exportHiddenRows: true,
  772. exportHiddenColumns: true,
  773. rowHeaders: true
  774. });
  775. } else {
  776. this.$message("请确定存在表格");
  777. }
  778. } else {
  779. this.$message("下载需在编辑状态下");
  780. }
  781. },
  782. //格式化表头
  783. formatHeaderData(list) {
  784. let arr = tools.copyArr(list);
  785. let data = showTools.headerTextFilter(
  786. arr,
  787. "equipment",
  788. this.onlyRead,
  789. this.showType,
  790. true
  791. );
  792. if (this.showParts) {
  793. data.unshift("操作", "当前关联的资产", "所属系统实例", "包含的部件");
  794. } else {
  795. data.unshift("操作", "当前关联的资产", "所属系统实例");
  796. }
  797. if (this.showType == "all" && this.showParts) {
  798. data.splice(6, 0, "所属建筑楼层");
  799. } else if (this.showType == "all" && !this.showParts) {
  800. data.splice(5, 0, "所属建筑楼层");
  801. }
  802. return data;
  803. },
  804. //格式化表内容
  805. formatHeaderType(list) {
  806. let arr = tools.copyArr(list);
  807. let data = showTools.headerTypeFilter(
  808. arr,
  809. "equipment",
  810. this.onlyRead,
  811. this.showType,
  812. true
  813. );
  814. if (this.showParts) {
  815. data.unshift(
  816. {
  817. data: "caozuo",
  818. renderer: tools.lookDetails,
  819. readOnly: true
  820. },
  821. {
  822. data: "LinkEquipLocalName",
  823. readOnly: true,
  824. renderer: tools.LinkEquipLocalName
  825. },
  826. {
  827. data: "LinkSystem",
  828. renderer: text.systemList,
  829. readOnly: true
  830. },
  831. {
  832. data: "Count",
  833. readOnly: true,
  834. renderer: tools.lookDetails
  835. }
  836. );
  837. } else {
  838. data.unshift(
  839. {
  840. data: "caozuo",
  841. renderer: tools.lookDetails,
  842. readOnly: true
  843. },
  844. {
  845. data: "LinkEquipLocalName",
  846. readOnly: true,
  847. renderer: tools.LinkEquipLocalName
  848. },
  849. {
  850. data: "LinkSystem",
  851. renderer: text.systemList,
  852. readOnly: true
  853. }
  854. );
  855. }
  856. if (this.showType == "all" && this.showParts) {
  857. data.splice(6, 0, {
  858. data: "flowBuild",
  859. renderer: tools.customDropdownRenderer,
  860. editor: "chosen",
  861. chosenOptions: {
  862. data: this.buildFloorData
  863. },
  864. readOnly: this.onlyRead
  865. });
  866. } else if (this.showType == "all" && !this.showParts) {
  867. data.splice(5, 0, {
  868. data: "flowBuild",
  869. renderer: tools.customDropdownRenderer,
  870. editor: "chosen",
  871. chosenOptions: {
  872. data: this.buildFloorData
  873. },
  874. readOnly: this.onlyRead
  875. });
  876. }
  877. return data;
  878. },
  879. //初始化插件
  880. initTable() {
  881. var container = document.getElementById("handsontable");
  882. let winHeight = document.documentElement.clientHeight;
  883. if (this.hot) {
  884. this.hot.destroy();
  885. this.hot = null;
  886. }
  887. this.hot = new Handsontable(container, {
  888. data: this.tableData,
  889. fixedColumnsLeft: this.showParts ? 6 : 5,
  890. colHeaders: this.formatHeaderData(this.tableHeader), //表头文案
  891. columns: this.formatHeaderType(this.tableHeader), //数据显示格式
  892. filters: true,
  893. maxRows: this.tableData.length,
  894. height: winHeight - 335,
  895. columnSorting: true, //添加排序
  896. sortIndicator: true, //添加排序
  897. renderAllRows: true,
  898. // colWidths: 200,
  899. autoColumnSize: true,
  900. language: "zh-CN",
  901. manualColumnResize: true,
  902. manualColumnMove: true,
  903. dropdownMenu: [
  904. "filter_by_condition",
  905. "filter_by_value",
  906. "filter_action_bar"
  907. ],
  908. contextMenu: this.onlyRead
  909. ? false
  910. : {
  911. items: {
  912. remove_row: {
  913. name: "删除选中设备"
  914. }
  915. }
  916. },
  917. // 事件
  918. afterChange: this.handleUpdataTable, //修改后
  919. afterFilter: this.trimmedRows, //排序前
  920. afterRemoveRow: this.handleDeleteTableRow, //右键删除
  921. afterOnCellMouseDown: this.eventClick //鼠标点击
  922. });
  923. let pro = document.getElementById("hot-display-license-info");
  924. if (!!pro) {
  925. pro.parentNode.removeChild(pro);
  926. }
  927. this.isLoading = false;
  928. },
  929. //表格中的点击
  930. eventClick(el, rowArr) {
  931. //点击的是表头
  932. if (rowArr.row < 0) {
  933. return;
  934. }
  935. //被筛选过后的数组
  936. let trimmedArr = this.trimmedRows();
  937. //是否启用了排序
  938. let isSort = this.hot.getPlugin("columnSorting").isSorted();
  939. if (trimmedArr.length && isSort) {
  940. let sortArr = this.myHotArr.getPlugin("columnSorting").rowsMapper
  941. .__arrayMap;
  942. let infos = this.tableData[trimmedArr[sortArr[rowArr.row]]];
  943. this.getInfors(
  944. infos,
  945. { row: sortArr[rowArr.row], col: rowArr.col },
  946. el
  947. );
  948. } else if (isSort) {
  949. //排序后的数组
  950. let sortArr = this.hot.getPlugin("columnSorting").rowsMapper.__arrayMap;
  951. let infos = this.tableData[sortArr[rowArr.row]];
  952. this.getInfors(
  953. infos,
  954. { row: sortArr[rowArr.row], col: rowArr.col },
  955. el
  956. );
  957. } else if (trimmedArr.length) {
  958. let infos = this.tableData[trimmedArr[rowArr.row]];
  959. this.getInfors(
  960. infos,
  961. { row: trimmedArr[rowArr.row], col: rowArr.col },
  962. el
  963. );
  964. } else {
  965. let infos = this.tableData[rowArr.row];
  966. this.getInfors(infos, rowArr, el);
  967. }
  968. },
  969. // 更新
  970. handleUpdataTable(changeData, source) {
  971. if (!this.onlyRead && source != "ObserveChanges.change") {
  972. if (changeData) {
  973. let trimmedArr = this.trimmedRows();
  974. let param = handsonUtils.getParam(
  975. changeData,
  976. source,
  977. this.hot,
  978. trimmedArr
  979. );
  980. let data = [];
  981. for (let i = 0; i < param.length; i++) {
  982. data.push(param[i]);
  983. }
  984. //如果data中包含/且data长度为1,将其转换成.
  985. if (changeData.length == 1 && changeData[0][1].indexOf("/") > 0) {
  986. changeData[0][1] = changeData[0][1].split("/").join(".");
  987. }
  988. //存在data进行修改请求
  989. if (data && data.length) {
  990. this.updateBusiness(data, changeData);
  991. }
  992. }
  993. }
  994. },
  995. //删除设备
  996. handleDeleteTableRow() {
  997. let params = tools.differenceArr(this.tableData, this.copyMain);
  998. let _this = this;
  999. if (params.length < 1) {
  1000. return;
  1001. }
  1002. let param = [];
  1003. params.map(item => {
  1004. this.deleteCode = item.classCode;
  1005. param.push({ equipId: item.equipId });
  1006. });
  1007. this.$confirm("此操作将删除设备,是否继续?", "提示", {
  1008. confirmButtonText: "确定",
  1009. cancelButtonText: "取消",
  1010. type: "warning"
  1011. })
  1012. .then(() => {
  1013. this.removeDevice(param);
  1014. })
  1015. .catch(() => {
  1016. this.reset();
  1017. this.$message("取消删除");
  1018. });
  1019. },
  1020. // 删除设备
  1021. async removeDevice(param) {
  1022. await deleteEquip(param, res => {
  1023. this.$message.success("删除成功");
  1024. this.$emit("close", { code: this.deleteCode });
  1025. // this.getTableData()
  1026. });
  1027. },
  1028. // 更新
  1029. updateBusiness(data, change) {
  1030. let param = {
  1031. content: [],
  1032. projection: []
  1033. },
  1034. keyList = [];
  1035. //生成要修改字段列表
  1036. change.map(item => {
  1037. let key = item[1].split(".")[0];
  1038. if (key == "flowBuild" && keyList.indexOf(key) == -1) {
  1039. keyList.push("buildingId", "floorId");
  1040. param.projection.push("buildingId", "floorId");
  1041. }
  1042. if (item[1] && keyList.indexOf(key) == -1 && item[1] != "propertyId") {
  1043. keyList.push(key);
  1044. }
  1045. if (
  1046. item[1] &&
  1047. item[3] == "" &&
  1048. param.projection.indexOf(key) == -1 &&
  1049. item[1] != "propertyId"
  1050. ) {
  1051. param.projection.push(key);
  1052. }
  1053. });
  1054. //生成对应修改数据
  1055. data.map((item, index) => {
  1056. keyList.map(value => {
  1057. if (value == "buildingId") {
  1058. let itemData = tools.dataForKey(item, "flowBuild");
  1059. if (itemData == "") {
  1060. tools.setDataForKey(item, "buildingId", null);
  1061. tools.setDataForKey(item, "floorId", null);
  1062. } else {
  1063. let BuildingId = itemData.split("-")[0];
  1064. let FloorId = itemData.split("-")[1];
  1065. if (BuildingId && FloorId) {
  1066. tools.setDataForKey(item, "buildingId", BuildingId);
  1067. tools.setDataForKey(item, "floorId", FloorId);
  1068. } else if (BuildingId && !FloorId) {
  1069. tools.setDataForKey(item, "buildingId", BuildingId);
  1070. tools.setDataForKey(item, "floorId", null);
  1071. }
  1072. }
  1073. } else {
  1074. let itemData = tools.dataForKey(item, value);
  1075. tools.setDataForKey(item, value, itemData == "" ? null : itemData);
  1076. }
  1077. });
  1078. param.content.push(item);
  1079. });
  1080. updateEquip(param, res => {
  1081. });
  1082. },
  1083. //修改设备类型
  1084. changeCader() {
  1085. if (this.mess.deviceId) {
  1086. let param = {
  1087. data: {
  1088. filters: `equipCode='${this.mess.deviceId}'`,
  1089. pageNumber: 1,
  1090. pageSize: 50
  1091. }
  1092. };
  1093. getEquipBelongs(param, res => {
  1094. if (res.content.length) {
  1095. this.deviceType.assetType = res.content[0].family;
  1096. this.deviceType.assetName = res.content[0].familyName;
  1097. }
  1098. });
  1099. }
  1100. },
  1101. // 接受维护信息传来的code,显示弹窗
  1102. fourVendors(code) {
  1103. this.firmDataType = "dialog";
  1104. switch (code) {
  1105. //品牌型号弹窗
  1106. case "DPManufacturerID":
  1107. // this.dataFirmType = 'dia'
  1108. this.myDialog.firm = true;
  1109. break;
  1110. //供应商信息弹窗
  1111. case "DPSupplierID":
  1112. this.myDialog.supplier = true;
  1113. break;
  1114. //维修商信息弹窗
  1115. case "DPMaintainerID":
  1116. this.myDialog.maintainer = true;
  1117. break;
  1118. //保险公司信息
  1119. case "DPInsurerID":
  1120. this.myDialog.insurer = true;
  1121. break;
  1122. }
  1123. },
  1124. forValue(arr, val) {
  1125. let enclosure = [];
  1126. arr &&
  1127. arr.length &&
  1128. arr.map(i => {
  1129. if (i.path == val) {
  1130. enclosure = i.value;
  1131. }
  1132. });
  1133. return enclosure;
  1134. },
  1135. multiples(val) {
  1136. this.firmDataType = "dialog";
  1137. switch (val) {
  1138. case "infos.insuranceFile": //保险文件
  1139. this.filesArr = this.forValue(this.newEnclosure, val)
  1140. ? this.forValue(this.newEnclosure, val)
  1141. : [];
  1142. this.infoType = val;
  1143. this.myDialog.uploadFiles = true;
  1144. break;
  1145. case "infos.archive": //设备文档
  1146. this.filesArr = this.forValue(this.newEnclosure, val)
  1147. ? this.forValue(this.newEnclosure, val)
  1148. : [];
  1149. this.infoType = val;
  1150. this.myDialog.uploadFiles = true;
  1151. break;
  1152. case "infos.checkReport": //安装质检报告
  1153. this.filesArr = this.forValue(this.newEnclosure, val)
  1154. ? this.forValue(this.newEnclosure, val)
  1155. : [];
  1156. this.infoType = val;
  1157. this.myDialog.uploadFiles = true;
  1158. break;
  1159. case "infos.maintainManual": //维修保养手册
  1160. this.filesArr = this.forValue(this.newEnclosure, val)
  1161. ? this.forValue(this.newEnclosure, val)
  1162. : [];
  1163. this.infoType = val;
  1164. this.myDialog.uploadFiles = true;
  1165. break;
  1166. case "infos.approachingAcceptance": //进场验收单
  1167. this.filesArr = this.forValue(this.newEnclosure, val)
  1168. ? this.forValue(this.newEnclosure, val)
  1169. : [];
  1170. this.infoType = val;
  1171. this.myDialog.uploadFiles = true;
  1172. break;
  1173. case "infos.acceptanceReport": //验收报告
  1174. this.filesArr = this.forValue(this.newEnclosure, val)
  1175. ? this.forValue(this.newEnclosure, val)
  1176. : [];
  1177. this.infoType = val;
  1178. this.myDialog.uploadFiles = true;
  1179. break;
  1180. case "infos.operationManual": //操作说明书
  1181. this.filesArr = this.forValue(this.newEnclosure, val)
  1182. ? this.forValue(this.newEnclosure, val)
  1183. : [];
  1184. this.infoType = val;
  1185. this.myDialog.uploadFiles = true;
  1186. break;
  1187. case "infos.originalCertificate": //原厂证明
  1188. this.filesArr = this.forValue(this.newEnclosure, val)
  1189. ? this.forValue(this.newEnclosure, val)
  1190. : [];
  1191. this.infoType = val;
  1192. this.myDialog.uploadFiles = true;
  1193. break;
  1194. case "infos.testReport": //检测报告
  1195. this.filesArr = this.forValue(this.newEnclosure, val)
  1196. ? this.forValue(this.newEnclosure, val)
  1197. : [];
  1198. this.infoType = val;
  1199. this.myDialog.uploadFiles = true;
  1200. break;
  1201. case "infos.productCertification": //产品合格证
  1202. this.filesArr = this.forValue(this.newEnclosure, val)
  1203. ? this.forValue(this.newEnclosure, val)
  1204. : [];
  1205. this.infoType = val;
  1206. this.myDialog.uploadFiles = true;
  1207. break;
  1208. case "infos.installInstruction": //安装说明书
  1209. this.filesArr = this.forValue(this.newEnclosure, val)
  1210. ? this.forValue(this.newEnclosure, val)
  1211. : [];
  1212. this.infoType = val;
  1213. this.myDialog.uploadFiles = true;
  1214. break;
  1215. case "infos.drawing": //设备图纸
  1216. this.filesArr = this.forValue(this.newEnclosure, val)
  1217. ? this.forValue(this.newEnclosure, val)
  1218. : [];
  1219. this.infoType = val;
  1220. this.myDialog.uploadFiles = true;
  1221. break;
  1222. case "infos.installDrawing": //安装图纸
  1223. this.filesArr = this.forValue(this.newEnclosure, val)
  1224. ? this.forValue(this.newEnclosure, val)
  1225. : [];
  1226. this.infoType = val;
  1227. this.myDialog.uploadFiles = true;
  1228. break;
  1229. case "infos.supplierContract": //供应合同
  1230. this.filesArr = this.forValue(this.newEnclosure, val)
  1231. ? this.forValue(this.newEnclosure, val)
  1232. : [];
  1233. this.infoType = val;
  1234. this.myDialog.uploadFiles = true;
  1235. break;
  1236. case "infos.installPic"://安装照片
  1237. this.imgsArr = this.forValue(this.newEnclosure, val)
  1238. ? this.forValue(this.newEnclosure, val)
  1239. : [];
  1240. this.infoType = val;
  1241. this.myDialog.uploadImgs = true;
  1242. break;
  1243. case "infos.nameplate"://设备铭牌照片
  1244. this.imgsArr = this.forValue(this.newEnclosure, val)
  1245. ? this.forValue(this.newEnclosure, val)
  1246. : [];
  1247. this.infoType = val;
  1248. this.myDialog.uploadImgs = true;
  1249. break;
  1250. case "infos.pic"://设备照片
  1251. this.picsArr = this.forValue(this.newEnclosure, val)
  1252. ? this.forValue(this.newEnclosure, val)
  1253. : [];
  1254. this.infoType = val;
  1255. this.myDialog.pic = true;
  1256. break;
  1257. }
  1258. },
  1259. getInfors(infos, row, el) {
  1260. console.log(infos, row, el)
  1261. let val = this.hot.colToProp(row.col);
  1262. let inputData = this.inputMap[val];
  1263. this.row = row.row;
  1264. this.messKey = val;
  1265. this.firmDataType = "row";
  1266. lStorage.set("screen_data", {
  1267. path: this.$route.path,
  1268. data: { equip: infos }
  1269. });
  1270. console.log(val, '=================================')
  1271. switch (val) {
  1272. //操作
  1273. case "caozuo":
  1274. // window.open(`http://adm.sagacloud.cn:8058/spread?id=${infos.EquipID}&pid=${this.projectId}&secret=${this.secret}`,"_blank")
  1275. // this.$message("开发中...")
  1276. this.$router.push({
  1277. path: "deviceDetails",
  1278. query: {
  1279. type: this.mess.deviceId,
  1280. equipId: infos.id,
  1281. equipName: infos.localName
  1282. ? infos.localName
  1283. : infos.name
  1284. ? infos.name
  1285. : "",
  1286. equipCode: infos.localId ? infos.localId : "",
  1287. data: this.tableData.map(item => {
  1288. return {
  1289. value: item.id,
  1290. label: item.localName
  1291. ? item.localName
  1292. : item.name
  1293. ? item.name
  1294. : ""
  1295. };
  1296. })
  1297. }
  1298. });
  1299. return false;
  1300. //设备二维码图片(infos.defaultQRCode)
  1301. // case "infos.defaultQRCode":
  1302. case "defaultQRCode":
  1303. this.qrcodeUrl = this.tableData[row.row][val];
  1304. if (this.qrcodeUrl) {
  1305. this.myDialog.qrcode = true;
  1306. } else {
  1307. this.$message("此设备没有设备二维码");
  1308. }
  1309. return false;
  1310. //BIM模型中坐标(bimLocation)
  1311. case "BIMLocation":
  1312. this.bimcodeobj = this.tableData[row.row];
  1313. if (Object.keys(this.bimcodeobj).length > 0) {
  1314. this.myDialog.bimcode = true;
  1315. } else {
  1316. this.$message("此设备没有BIM模型中坐标");
  1317. }
  1318. return false;
  1319. //关联系统()
  1320. case "LinkSystem":
  1321. this.curDevice = infos.EquipID;
  1322. this.systemList = this.tableData[row.row].linkSystem || [];
  1323. this.myDialog.systemType = true;
  1324. return false;
  1325. //关联资产()
  1326. case "LinkEquipLocalName":
  1327. if (!this.onlyRead) {
  1328. this.myDialog.changeRea = true;
  1329. }
  1330. return false;
  1331. //品牌型号弹窗
  1332. case "DPManufacturerID":
  1333. if (!this.onlyRead) {
  1334. this.myDialog.firm = true;
  1335. }
  1336. return false;
  1337. //供应商信息弹窗
  1338. case "DPSupplierID":
  1339. if (!this.onlyRead) {
  1340. this.myDialog.supplier = true;
  1341. }
  1342. return false;
  1343. //维修商信息弹窗
  1344. case "DPMaintainerID":
  1345. if (!this.onlyRead) {
  1346. this.myDialog.maintainer = true;
  1347. }
  1348. return false;
  1349. //保险公司信息
  1350. case "DPInsurerID":
  1351. if (!this.onlyRead) {
  1352. this.myDialog.insurer = true;
  1353. }
  1354. return false;
  1355. //供应合同编号(B1)
  1356. case "infos.supplierContractID":
  1357. if (!this.onlyRead) {
  1358. let ContractIDflag = null;
  1359. let DPSdata = this.tableData[row.row].DPSupplierID;
  1360. if (DPSdata) {
  1361. ContractIDflag = DPSdata.split("-")[0];
  1362. }
  1363. if (!!ContractIDflag) {
  1364. this.id = ContractIDflag;
  1365. this.myDialog.supply = true;
  1366. } else {
  1367. this.$message("请先选择供应商");
  1368. }
  1369. }
  1370. return false;
  1371. //保险单号(B1)
  1372. case "infos.insuranceNum":
  1373. if (!this.onlyRead) {
  1374. let DPInsurerIDflag = null;
  1375. let DPIdata = this.tableData[row.row].DPInsurerID;
  1376. if (DPIdata) {
  1377. DPInsurerIDflag = DPIdata.split("-")[0];
  1378. }
  1379. if (!!DPInsurerIDflag) {
  1380. this.id = DPInsurerIDflag;
  1381. this.myDialog.guarantee = true;
  1382. } else {
  1383. this.$message("请先选择保险商");
  1384. }
  1385. }
  1386. return false;
  1387. //保险文件--设备文档--安装质检报告
  1388. case "infos.insuranceFile": //保险文件(F2)
  1389. case "infos.archive": //设备文档(F2)
  1390. case "infos.checkReport": //安装质检报告(F2)
  1391. case "infos.maintainManual": //维修保养手册(F2)
  1392. case "infos.approachingAcceptance": //进场验收单(F2)
  1393. case "infos.acceptanceReport": //验收报告(F2)
  1394. case "infos.operationManual": //操作说明书(F2)
  1395. case "infos.originalCertificate": //原厂证明(F2)
  1396. case "infos.testReport": //检测报告(F2)
  1397. case "infos.productCertification": //产品合格证(F2)
  1398. case "infos.installInstruction": //安装说明书(F2)
  1399. case "infos.supplierContract": //供应合同(F2)
  1400. case "infos.drawing": //设备图纸(F2)
  1401. case "infos.installDrawing": //安装图纸(F2)
  1402. let IPSdata = tools.dataForKey(this.tableData[row.row], val);
  1403. this.filesArr = IPSdata ? IPSdata : [];
  1404. if (!this.onlyRead || this.filesArr.length) {
  1405. this.myDialog.uploadFiles = true;
  1406. }
  1407. return false;
  1408. //安装照片--设备铭牌照片(F2)
  1409. case "infos.installPic":
  1410. case "infos.nameplate":
  1411. let SSPPdata = tools.dataForKey(this.tableData[row.row], val);
  1412. this.imgsArr = SSPPdata ? SSPPdata : [];
  1413. if (!this.onlyRead || this.imgsArr.length) {
  1414. this.myDialog.uploadImgs = true;
  1415. }
  1416. return false;
  1417. //设备照片(F2)
  1418. case "infos.pic":
  1419. let Pdata = tools.dataForKey(this.tableData[row.row], val);
  1420. this.picsArr = Pdata ? Pdata : [];
  1421. if (!this.onlyRead || this.picsArr.length) {
  1422. this.myDialog.pic = true;
  1423. }
  1424. return false;
  1425. //包含的部件字段
  1426. case "Count":
  1427. let countUrl = this.onlyRead ? "/ledger/parts" : "/ledger/partsmanage";
  1428. this.$router.push({
  1429. path: countUrl,
  1430. query: {
  1431. deviceId: infos.EquipID,
  1432. typeId: this.mess.deviceId,
  1433. pageNo: this.page.currentPage,
  1434. pageSize: this.page.size
  1435. }
  1436. });
  1437. return false;
  1438. default:
  1439. break;
  1440. }
  1441. if (!this.onlyRead && !inputData.Editable) {
  1442. this.$message("该信息点的值为自动生成,不可人工维护!");
  1443. return false;
  1444. }
  1445. if (
  1446. !this.onlyRead &&
  1447. showTools.InputModeArr.indexOf(inputData.InputMode) == "-1"
  1448. ) {
  1449. this.updateInfoPoint = val;
  1450. this.updateInput = tools.dataForKey(this.tableData[row.row], val);
  1451. this.myDialog.update = true;
  1452. return false;
  1453. }
  1454. },
  1455. //关闭临时维护弹窗回调
  1456. handleCloseUpdate() {
  1457. this.updateInputShow = false;
  1458. this.updateInfoPoint = "";
  1459. this.updateInput = "";
  1460. },
  1461. //更新临时维护信息点
  1462. handleClickUpdate() {
  1463. tools.setDataForKey(
  1464. this.tableData[this.row],
  1465. this.updateInfoPoint,
  1466. this.updateInput
  1467. );
  1468. this.handleUpdataTable(
  1469. [[this.row, this.updateInfoPoint, null, this.updateInput]],
  1470. "edit"
  1471. );
  1472. this.updateInputShow = false;
  1473. this.myDialog.update = false;
  1474. this.updateInput = "";
  1475. },
  1476. //获取被筛选掉的行号
  1477. trimmedRows() {
  1478. var plugin = this.hot.getPlugin("trimRows").trimmedRows;
  1479. let dataLength = this.tableData.length;
  1480. let dataArr = new Array();
  1481. for (let i = 0; i < dataLength; i++) {
  1482. dataArr.push(i);
  1483. }
  1484. if (plugin.length <= 0) {
  1485. dataArr = undefined;
  1486. } else {
  1487. dataArr = this.array_diff(dataArr, plugin);
  1488. }
  1489. return dataArr || [];
  1490. },
  1491. //去除数组中相同的元素
  1492. array_diff(a, b) {
  1493. for (var i = 0; i < b.length; i++) {
  1494. for (var j = 0; j < a.length; j++) {
  1495. if (a[j] == b[i]) {
  1496. a.splice(j, 1);
  1497. j = j - 1;
  1498. }
  1499. }
  1500. }
  1501. return a;
  1502. },
  1503. //如果选择供应商之后
  1504. supplierChange(data, type) {
  1505. if (type === "dialog") {
  1506. let firm = { ...data, num: 8 };
  1507. this.firmName = firm;
  1508. } else {
  1509. tools.setDataForKey(
  1510. this.tableData[this.row],
  1511. "DPSupplierID",
  1512. data.venderId
  1513. );
  1514. tools.setDataForKey(
  1515. this.tableData[this.row],
  1516. "infos.SupplyPurchase.Supplier",
  1517. data.name
  1518. );
  1519. this.handleUpdataTable(
  1520. [
  1521. [this.row, "DPSupplierID", null, data.venderId],
  1522. [this.row, "infos.SupplyPurchase.Supplier", null, data.name]
  1523. ],
  1524. "edit"
  1525. );
  1526. // this.handleUpdataTable([[this.row, "infos.SupplyPurchase.Supplier", null, data.name]], "edit")
  1527. }
  1528. },
  1529. //供应合同编号
  1530. supplyChange(data) {
  1531. tools.setDataForKey(
  1532. this.tableData[this.row],
  1533. "infos.SupplyPurchase.SupplierContractID",
  1534. { id: data }
  1535. );
  1536. },
  1537. //保险单号-保险文件
  1538. guaranteeChange(data) {
  1539. for (let key in data) {
  1540. this.utilToKey(key, "insuranceNo", data, "InsuranceNum");
  1541. if (key == "contractFile") {
  1542. if (!!data[key]) {
  1543. data[key] = [data[key]];
  1544. }
  1545. }
  1546. this.utilToKey(key, "contractFile", data, "InsuranceFile");
  1547. }
  1548. },
  1549. //选择型号修改
  1550. firmChange(data, type) {
  1551. if (type === "dialog") {
  1552. // 如果是批量信息维护
  1553. let venderName = data.venderName ? data.venderName : "空";
  1554. let brandName = data.brandName ? data.brandName : "空";
  1555. let name = data.name ? data.name : "空";
  1556. let firm = {
  1557. ...data,
  1558. num: 2,
  1559. Specification: data.name,
  1560. name: `${venderName}/${brandName}/${name}`
  1561. };
  1562. this.firmName = firm; //批量维护dialog显示对象的字段
  1563. } else {
  1564. //如果是表格操作
  1565. tools.setDataForKey(
  1566. this.tableData[this.row],
  1567. "DPManufacturerID",
  1568. data.venderId
  1569. ); //生产商ID
  1570. tools.setDataForKey(
  1571. this.tableData[this.row],
  1572. "DPBrandID",
  1573. data.brandId
  1574. ); //品牌ID
  1575. tools.setDataForKey(
  1576. this.tableData[this.row],
  1577. "DPSpecificationID",
  1578. data.specificationId
  1579. ); //型号ID
  1580. tools.setDataForKey(
  1581. this.tableData[this.row],
  1582. "infos.testReport",
  1583. data.venderName
  1584. );
  1585. tools.setDataForKey(
  1586. this.tableData[this.row],
  1587. "infos.Brand",
  1588. data.brandName
  1589. );
  1590. tools.setDataForKey(
  1591. this.tableData[this.row],
  1592. "infos.specification",
  1593. data.name
  1594. );
  1595. this.handleUpdataTable(
  1596. [
  1597. [this.row, "DPManufacturerID", null, data.venderId],
  1598. [this.row, "DPBrandID", null, data.brandId],
  1599. [this.row, "DPSpecificationID", null, data.specificationId],
  1600. [
  1601. this.row,
  1602. "infos.EquipManufactor.Manufacturer",
  1603. null,
  1604. data.venderName
  1605. ],
  1606. [
  1607. this.row,
  1608. "infos.EquipManufactor.Brand",
  1609. null,
  1610. data.brandName
  1611. ],
  1612. [
  1613. this.row,
  1614. "infos.EquipManufactor.Specification",
  1615. null,
  1616. data.name
  1617. ]
  1618. ],
  1619. "edit"
  1620. );
  1621. // this.handleUpdataTable([[this.row, "infos.EquipManufactor.Brand", null, data.brand]], "edit")
  1622. // this.handleUpdataTable([[this.row, "infos.EquipManufactor.Specification", null, data.name]], "edit")
  1623. }
  1624. },
  1625. //保险商变更
  1626. changeInsurer(data, type) {
  1627. if (type === "dialog") {
  1628. let firm = { ...data, num: 42 };
  1629. this.firmName = firm;
  1630. } else {
  1631. tools.setDataForKey(
  1632. this.tableData[this.row],
  1633. "DPInsurerID",
  1634. data.venderId
  1635. );
  1636. tools.setDataForKey(
  1637. this.tableData[this.row],
  1638. "infos.InsuranceDoc.Insurer",
  1639. data.name
  1640. );
  1641. this.handleUpdataTable(
  1642. [
  1643. [this.row, "DPInsurerID", null, data.venderId],
  1644. [this.row, "infos.InsuranceDoc.Insurer", null, data.name]
  1645. ],
  1646. "edit"
  1647. );
  1648. // this.handleUpdataTable([[this.row, "infos.InsuranceDoc.Insurer", null, data.name]], "edit")
  1649. }
  1650. },
  1651. //维修商变更
  1652. changeMaintainer(data, type) {
  1653. if (type === "dialog") {
  1654. let firm = { ...data, num: 35 };
  1655. this.firmName = firm;
  1656. } else {
  1657. tools.setDataForKey(
  1658. this.tableData[this.row],
  1659. "DPMaintainerID",
  1660. data.venderId
  1661. );
  1662. tools.setDataForKey(
  1663. this.tableData[this.row],
  1664. "infos.OperationMainte.Maintainer",
  1665. data.name
  1666. );
  1667. this.handleUpdataTable(
  1668. [
  1669. [this.row, "DPMaintainerID", null, data.venderId],
  1670. [
  1671. this.row,
  1672. "infos.OperationMainte.Maintainer",
  1673. null,
  1674. data.name
  1675. ]
  1676. ],
  1677. "edit"
  1678. );
  1679. // this.handleUpdataTable([[this.row, "infos.OperationMainte.Maintainer", null, data.name]], "edit")
  1680. }
  1681. },
  1682. //修改关联的资产
  1683. changeProperty(val) {
  1684. this.setDataToMain(val.PropertyId, "PropertyId", this.row);
  1685. this.setDataToMain(
  1686. val.LinkEquipLocalName,
  1687. "LinkEquipLocalName",
  1688. this.row
  1689. );
  1690. },
  1691. //上传文件弹窗触发事件
  1692. fileChange(keys, type, file) {
  1693. if (type === "dialog") {
  1694. // this.information = keys
  1695. this.newEnclosure.forEach(i => {
  1696. if (i.path == keys) {
  1697. this.$set(i, "value", file);
  1698. }
  1699. return i;
  1700. });
  1701. } else {
  1702. this.setDataToMain(keys, this.messKey, this.row);
  1703. }
  1704. },
  1705. //上传图片弹窗触发事件
  1706. imgChange(keys, type, file) {
  1707. if (type === "dialog") {
  1708. // this.information = keys
  1709. this.newEnclosure.forEach(i => {
  1710. if (i.path == keys) {
  1711. this.$set(i, "value", file);
  1712. }
  1713. return i;
  1714. });
  1715. } else {
  1716. this.setDataToMain(keys, this.messKey, this.row);
  1717. }
  1718. },
  1719. //关联系统更改
  1720. changeSystemType(data) {
  1721. tools.setDataForKey(this.tableData[this.row], "LinkSystem", data);
  1722. },
  1723. //设备图片弹窗改变事件
  1724. changePics(keys, type, file) {
  1725. if (type === "dialog") {
  1726. // this.information = keys
  1727. this.newEnclosure.forEach(i => {
  1728. if (i.path == keys) {
  1729. this.$set(i, "value", file);
  1730. }
  1731. return i;
  1732. });
  1733. } else {
  1734. this.setDataToMain(keys, this.messKey, this.row);
  1735. }
  1736. },
  1737. utilToKey(key, name, data, messName) {
  1738. if (key == name) {
  1739. this.setDataToMain(data[key], messName, this.row);
  1740. }
  1741. },
  1742. //判断是否有值,有值赋值
  1743. setDataToMain(data, key, row) {
  1744. if (!!data && data != "--") {
  1745. if (!!this.tableData[row]) {
  1746. tools.setDataForKey(this.tableData[row], key, data);
  1747. this.handleUpdataTable([[row, key, null, data]], "edit");
  1748. } else {
  1749. this.tableData[row] = {};
  1750. tools.setDataForKey(this.tableData[row], key, data);
  1751. }
  1752. } else {
  1753. tools.setDataForKey(this.tableData[row], key, "");
  1754. }
  1755. },
  1756. // 批量信息维护
  1757. Batch() {
  1758. this.firmDataType = "dialog";
  1759. this.$refs.batchDialogs.batchDialog = true;
  1760. },
  1761. upDataDevice(type, data1, data2) {
  1762. let param = { content: data1 };
  1763. let param1 = { content: data2 };
  1764. if (type === 1) {
  1765. //增量
  1766. //LedgerParam
  1767. let filterParam = this.filterCheck(param, "sole");
  1768. let filterParam1 = this.filterCheck(param1, "multiple");
  1769. if (filterParam) {
  1770. updateEquip(param, res => {
  1771. });
  1772. }
  1773. if (filterParam1) {
  1774. setTimeout(() => {
  1775. queryUpdate(param1, res => {
  1776. });
  1777. });
  1778. }
  1779. }
  1780. if (type === 2) {
  1781. //覆盖
  1782. let filterParams = this.filterCheck(param, "sole");
  1783. if (filterParams) {
  1784. updateEquip(param, res => {
  1785. });
  1786. }
  1787. }
  1788. setTimeout(() => {
  1789. this.getTableData();
  1790. this.getAllData();
  1791. }, 10);
  1792. },
  1793. filterCheck(arr, type) {
  1794. if (type === "sole") {
  1795. for (let i of arr.content) {
  1796. return Object.keys(i.infos).length;
  1797. }
  1798. } else if (type === "multiple") {
  1799. let nArr = [];
  1800. arr.content.forEach(i => {
  1801. let { equipId, ...value } = i;
  1802. nArr.push({ infos: value });
  1803. });
  1804. for (let j of nArr) {
  1805. return Object.keys(j.infos).length;
  1806. }
  1807. }
  1808. }
  1809. },
  1810. watch: {
  1811. projectId() {
  1812. this.buildFloorData = [];
  1813. buildFloor.getData(this.buildFloorData);
  1814. this.tableData = [];
  1815. this.mess.deviceId = null;
  1816. this.page.total = 0;
  1817. },
  1818. showTypes: {
  1819. handler(newName, oldName) {
  1820. if (newName && newName[0] && newName[0].value) {
  1821. this.showType = newName[0].value;
  1822. } else {
  1823. this.showType = "";
  1824. }
  1825. },
  1826. immediate: true,
  1827. deep: true
  1828. }
  1829. }
  1830. };
  1831. </script>
  1832. <style lang="less">
  1833. .hanson-bar {
  1834. height: 40px;
  1835. padding: 5px 0;
  1836. font-size: 14px;
  1837. overflow: hidden;
  1838. margin-top: 0;
  1839. line-height: 40px;
  1840. .iconfont {
  1841. font-size: 12px;
  1842. }
  1843. }
  1844. .cancelButtonClass {
  1845. width: 180px;
  1846. }
  1847. </style>