device.vue 55 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865
  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({ id: item.id });
  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. let val = this.hot.colToProp(row.col);
  1261. let inputData = this.inputMap[val];
  1262. this.row = row.row;
  1263. this.messKey = val;
  1264. this.firmDataType = "row";
  1265. lStorage.set("screen_data", {
  1266. path: this.$route.path,
  1267. data: { equip: infos }
  1268. });
  1269. console.log(val, '=================================')
  1270. switch (val) {
  1271. //操作
  1272. case "caozuo":
  1273. // window.open(`http://adm.sagacloud.cn:8058/spread?id=${infos.EquipID}&pid=${this.projectId}&secret=${this.secret}`,"_blank")
  1274. // this.$message("开发中...")
  1275. this.$router.push({
  1276. path: "deviceDetails",
  1277. query: {
  1278. type: this.mess.deviceId,
  1279. equipId: infos.id,
  1280. equipName: infos.localName
  1281. ? infos.localName
  1282. : infos.name
  1283. ? infos.name
  1284. : "",
  1285. equipCode: infos.localId ? infos.localId : "",
  1286. data: this.tableData.map(item => {
  1287. return {
  1288. value: item.id,
  1289. label: item.localName
  1290. ? item.localName
  1291. : item.name
  1292. ? item.name
  1293. : ""
  1294. };
  1295. })
  1296. }
  1297. });
  1298. return false;
  1299. //设备二维码图片(infos.defaultQRCode)
  1300. // case "infos.defaultQRCode":
  1301. case "defaultQRCode":
  1302. this.qrcodeUrl = this.tableData[row.row][val];
  1303. if (this.qrcodeUrl) {
  1304. this.myDialog.qrcode = true;
  1305. } else {
  1306. this.$message("此设备没有设备二维码");
  1307. }
  1308. return false;
  1309. //BIM模型中坐标(bimLocation)
  1310. case "BIMLocation":
  1311. this.bimcodeobj = this.tableData[row.row];
  1312. if (Object.keys(this.bimcodeobj).length > 0) {
  1313. this.myDialog.bimcode = true;
  1314. } else {
  1315. this.$message("此设备没有BIM模型中坐标");
  1316. }
  1317. return false;
  1318. //关联系统()
  1319. case "LinkSystem":
  1320. this.curDevice = infos.EquipID;
  1321. this.systemList = this.tableData[row.row].linkSystem || [];
  1322. this.myDialog.systemType = true;
  1323. return false;
  1324. //关联资产()
  1325. case "LinkEquipLocalName":
  1326. if (!this.onlyRead) {
  1327. this.myDialog.changeRea = true;
  1328. }
  1329. return false;
  1330. //品牌型号弹窗
  1331. case "dpManufacturerId":
  1332. if (!this.onlyRead) {
  1333. this.myDialog.firm = true;
  1334. }
  1335. return false;
  1336. //供应商信息弹窗
  1337. case "dpSupplierId":
  1338. if (!this.onlyRead) {
  1339. this.myDialog.supplier = true;
  1340. }
  1341. return false;
  1342. //维修商信息弹窗
  1343. case "dpMaintainerId":
  1344. if (!this.onlyRead) {
  1345. this.myDialog.maintainer = true;
  1346. }
  1347. return false;
  1348. //保险公司信息
  1349. case "dpInsurerId":
  1350. if (!this.onlyRead) {
  1351. this.myDialog.insurer = true;
  1352. }
  1353. return false;
  1354. //供应合同编号(B1)
  1355. case "infos.supplierContractID":
  1356. if (!this.onlyRead) {
  1357. let ContractIDflag = null;
  1358. let DPSdata = this.tableData[row.row].dpSupplierId;
  1359. if (DPSdata) {
  1360. ContractIDflag = DPSdata.split("-")[0];
  1361. }
  1362. if (!!ContractIDflag) {
  1363. this.id = ContractIDflag;
  1364. this.myDialog.supply = true;
  1365. } else {
  1366. this.$message("请先选择供应商");
  1367. }
  1368. }
  1369. return false;
  1370. //保险单号(B1)
  1371. case "infos.insuranceNum":
  1372. if (!this.onlyRead) {
  1373. let DPInsurerIDflag = null;
  1374. let DPIdata = this.tableData[row.row].dpInsurerId;
  1375. if (DPIdata) {
  1376. DPInsurerIDflag = DPIdata.split("-")[0];
  1377. }
  1378. if (!!DPInsurerIDflag) {
  1379. this.id = DPInsurerIDflag;
  1380. this.myDialog.guarantee = true;
  1381. } else {
  1382. this.$message("请先选择保险商");
  1383. }
  1384. }
  1385. return false;
  1386. //保险文件--设备文档--安装质检报告
  1387. case "infos.insuranceFile": //保险文件(F2)
  1388. case "infos.archive": //设备文档(F2)
  1389. case "infos.checkReport": //安装质检报告(F2)
  1390. case "infos.maintainManual": //维修保养手册(F2)
  1391. case "infos.approachingAcceptance": //进场验收单(F2)
  1392. case "infos.acceptanceReport": //验收报告(F2)
  1393. case "infos.operationManual": //操作说明书(F2)
  1394. case "infos.originalCertificate": //原厂证明(F2)
  1395. case "infos.testReport": //检测报告(F2)
  1396. case "infos.productCertification": //产品合格证(F2)
  1397. case "infos.installInstruction": //安装说明书(F2)
  1398. case "infos.supplierContract": //供应合同(F2)
  1399. case "infos.drawing": //设备图纸(F2)
  1400. case "infos.installDrawing": //安装图纸(F2)
  1401. let IPSdata = tools.dataForKey(this.tableData[row.row], val);
  1402. this.filesArr = IPSdata ? IPSdata : [];
  1403. if (!this.onlyRead || this.filesArr.length) {
  1404. this.myDialog.uploadFiles = true;
  1405. }
  1406. return false;
  1407. //安装照片--设备铭牌照片(F2)
  1408. case "infos.installPic":
  1409. case "infos.nameplate":
  1410. let SSPPdata = tools.dataForKey(this.tableData[row.row], val);
  1411. this.imgsArr = SSPPdata ? SSPPdata : [];
  1412. if (!this.onlyRead || this.imgsArr.length) {
  1413. this.myDialog.uploadImgs = true;
  1414. }
  1415. return false;
  1416. //设备照片(F2)
  1417. case "infos.pic":
  1418. let Pdata = tools.dataForKey(this.tableData[row.row], val);
  1419. this.picsArr = Pdata ? Pdata : [];
  1420. if (!this.onlyRead || this.picsArr.length) {
  1421. this.myDialog.pic = true;
  1422. }
  1423. return false;
  1424. //包含的部件字段
  1425. case "Count":
  1426. let countUrl = this.onlyRead ? "/ledger/parts" : "/ledger/partsmanage";
  1427. this.$router.push({
  1428. path: countUrl,
  1429. query: {
  1430. deviceId: infos.EquipID,
  1431. typeId: this.mess.deviceId,
  1432. pageNo: this.page.currentPage,
  1433. pageSize: this.page.size
  1434. }
  1435. });
  1436. return false;
  1437. default:
  1438. break;
  1439. }
  1440. if (!this.onlyRead && !inputData.editable) {
  1441. this.$message("该信息点的值为自动生成,不可人工维护!");
  1442. return false;
  1443. }
  1444. if (
  1445. !this.onlyRead &&
  1446. showTools.inputModeArr.indexOf(inputData.inputMode) == "-1"
  1447. ) {
  1448. this.updateInfoPoint = val;
  1449. this.updateInput = tools.dataForKey(this.tableData[row.row], val);
  1450. this.myDialog.update = true;
  1451. return false;
  1452. }
  1453. },
  1454. //关闭临时维护弹窗回调
  1455. handleCloseUpdate() {
  1456. this.updateInputShow = false;
  1457. this.updateInfoPoint = "";
  1458. this.updateInput = "";
  1459. },
  1460. //更新临时维护信息点
  1461. handleClickUpdate() {
  1462. tools.setDataForKey(
  1463. this.tableData[this.row],
  1464. this.updateInfoPoint,
  1465. this.updateInput
  1466. );
  1467. this.handleUpdataTable(
  1468. [[this.row, this.updateInfoPoint, null, this.updateInput]],
  1469. "edit"
  1470. );
  1471. this.updateInputShow = false;
  1472. this.myDialog.update = false;
  1473. this.updateInput = "";
  1474. },
  1475. //获取被筛选掉的行号
  1476. trimmedRows() {
  1477. var plugin = this.hot.getPlugin("trimRows").trimmedRows;
  1478. let dataLength = this.tableData.length;
  1479. let dataArr = new Array();
  1480. for (let i = 0; i < dataLength; i++) {
  1481. dataArr.push(i);
  1482. }
  1483. if (plugin.length <= 0) {
  1484. dataArr = undefined;
  1485. } else {
  1486. dataArr = this.array_diff(dataArr, plugin);
  1487. }
  1488. return dataArr || [];
  1489. },
  1490. //去除数组中相同的元素
  1491. array_diff(a, b) {
  1492. for (var i = 0; i < b.length; i++) {
  1493. for (var j = 0; j < a.length; j++) {
  1494. if (a[j] == b[i]) {
  1495. a.splice(j, 1);
  1496. j = j - 1;
  1497. }
  1498. }
  1499. }
  1500. return a;
  1501. },
  1502. //如果选择供应商之后
  1503. supplierChange(data, type) {
  1504. if (type === "dialog") {
  1505. let firm = { ...data, num: 8 };
  1506. this.firmName = firm;
  1507. } else {
  1508. tools.setDataForKey(
  1509. this.tableData[this.row],
  1510. "dpSupplierId",
  1511. data.venderId
  1512. );
  1513. tools.setDataForKey(
  1514. this.tableData[this.row],
  1515. "infos.supplier",
  1516. data.name
  1517. );
  1518. this.handleUpdataTable(
  1519. [
  1520. [this.row, "dpSupplierId", null, data.venderId],
  1521. [this.row, "infos.supplier", null, data.name]
  1522. ],
  1523. "edit"
  1524. );
  1525. // this.handleUpdataTable([[this.row, "infos.SupplyPurchase.Supplier", null, data.name]], "edit")
  1526. }
  1527. },
  1528. //供应合同编号
  1529. supplyChange(data) {
  1530. tools.setDataForKey(
  1531. this.tableData[this.row],
  1532. "infos.supplierContractID",
  1533. { id: data }
  1534. );
  1535. },
  1536. //保险单号-保险文件
  1537. guaranteeChange(data) {
  1538. for (let key in data) {
  1539. this.utilToKey(key, "insuranceNo", data, "InsuranceNum");
  1540. if (key == "contractFile") {
  1541. if (!!data[key]) {
  1542. data[key] = [data[key]];
  1543. }
  1544. }
  1545. this.utilToKey(key, "contractFile", data, "InsuranceFile");
  1546. }
  1547. },
  1548. //选择型号修改
  1549. firmChange(data, type) {
  1550. if (type === "dialog") {
  1551. // 如果是批量信息维护
  1552. let venderName = data.venderName ? data.venderName : "空";
  1553. let brandName = data.brandName ? data.brandName : "空";
  1554. let name = data.name ? data.name : "空";
  1555. let firm = {
  1556. ...data,
  1557. num: 2,
  1558. Specification: data.name,
  1559. name: `${venderName}/${brandName}/${name}`
  1560. };
  1561. this.firmName = firm; //批量维护dialog显示对象的字段
  1562. } else {
  1563. //如果是表格操作
  1564. tools.setDataForKey(
  1565. this.tableData[this.row],
  1566. "dpManufacturerId",
  1567. data.venderId
  1568. ); //生产商ID
  1569. tools.setDataForKey(
  1570. this.tableData[this.row],
  1571. "dpBrandId",
  1572. data.brandId
  1573. ); //品牌ID
  1574. tools.setDataForKey(
  1575. this.tableData[this.row],
  1576. "dpSpecificationId",
  1577. data.specificationId
  1578. ); //型号ID
  1579. tools.setDataForKey(
  1580. this.tableData[this.row],
  1581. "testReport",
  1582. data.venderName
  1583. );
  1584. tools.setDataForKey(
  1585. this.tableData[this.row],
  1586. "infos.manufacturer",
  1587. data.venderName
  1588. );
  1589. tools.setDataForKey(
  1590. this.tableData[this.row],
  1591. "infos.brand",
  1592. data.name
  1593. );
  1594. tools.setDataForKey(
  1595. this.tableData[this.row],
  1596. "infos.specification",
  1597. data.brandName
  1598. );
  1599. this.handleUpdataTable(
  1600. [
  1601. [this.row, "dpManufacturerId", null, data.venderId],
  1602. [this.row, "dpBrandId", null, data.brandId],
  1603. [this.row, "dpSpecificationId", null, data.specificationId],
  1604. [
  1605. this.row,
  1606. "infos.manufacturer",
  1607. null,
  1608. data.venderName
  1609. ],
  1610. [
  1611. this.row,
  1612. "infos.brand",
  1613. null,
  1614. data.brandName
  1615. ],
  1616. [
  1617. this.row,
  1618. "infos.specification",
  1619. null,
  1620. data.name
  1621. ]
  1622. ],
  1623. "edit"
  1624. );
  1625. // this.handleUpdataTable([[this.row, "infos.equipManufactor.Brand", null, data.brand]], "edit")
  1626. // this.handleUpdataTable([[this.row, "infos.equipManufactor.Specification", null, data.name]], "edit")
  1627. }
  1628. },
  1629. //保险商变更
  1630. changeInsurer(data, type) {
  1631. if (type === "dialog") {
  1632. let firm = { ...data, num: 42 };
  1633. this.firmName = firm;
  1634. } else {
  1635. tools.setDataForKey(
  1636. this.tableData[this.row],
  1637. "dpInsurerId",
  1638. data.venderId
  1639. );
  1640. tools.setDataForKey(
  1641. this.tableData[this.row],
  1642. "infos.insurer",
  1643. data.name
  1644. );
  1645. this.handleUpdataTable(
  1646. [
  1647. [this.row, "dpInsurerId", null, data.venderId],
  1648. [this.row, "infos.insurer", null, data.name]
  1649. ],
  1650. "edit"
  1651. );
  1652. // this.handleUpdataTable([[this.row, "infos.InsuranceDoc.Insurer", null, data.name]], "edit")
  1653. }
  1654. },
  1655. //维修商变更
  1656. changeMaintainer(data, type) {
  1657. if (type === "dialog") {
  1658. let firm = { ...data, num: 35 };
  1659. this.firmName = firm;
  1660. } else {
  1661. tools.setDataForKey(
  1662. this.tableData[this.row],
  1663. "dpMaintainerId",
  1664. data.venderId
  1665. );
  1666. tools.setDataForKey(
  1667. this.tableData[this.row],
  1668. "infos.maintainer",
  1669. data.name
  1670. );
  1671. this.handleUpdataTable(
  1672. [
  1673. [this.row, "dpMaintainerId", null, data.venderId],
  1674. [
  1675. this.row,
  1676. "infos.maintainer",
  1677. null,
  1678. data.name
  1679. ]
  1680. ],
  1681. "edit"
  1682. );
  1683. // this.handleUpdataTable([[this.row, "infos.operationMainte.maintainer", null, data.name]], "edit")
  1684. }
  1685. },
  1686. //修改关联的资产
  1687. changeProperty(val) {
  1688. this.setDataToMain(val.PropertyId, "PropertyId", this.row);
  1689. this.setDataToMain(
  1690. val.LinkEquipLocalName,
  1691. "LinkEquipLocalName",
  1692. this.row
  1693. );
  1694. },
  1695. //上传文件弹窗触发事件
  1696. fileChange(keys, type, file) {
  1697. if (type === "dialog") {
  1698. // this.information = keys
  1699. this.newEnclosure.forEach(i => {
  1700. if (i.path == keys) {
  1701. this.$set(i, "value", file);
  1702. }
  1703. return i;
  1704. });
  1705. } else {
  1706. this.setDataToMain(keys, this.messKey, this.row);
  1707. }
  1708. },
  1709. //上传图片弹窗触发事件
  1710. imgChange(keys, type, file) {
  1711. if (type === "dialog") {
  1712. // this.information = keys
  1713. this.newEnclosure.forEach(i => {
  1714. if (i.path == keys) {
  1715. this.$set(i, "value", file);
  1716. }
  1717. return i;
  1718. });
  1719. } else {
  1720. this.setDataToMain(keys, this.messKey, this.row);
  1721. }
  1722. },
  1723. //关联系统更改
  1724. changeSystemType(data) {
  1725. tools.setDataForKey(this.tableData[this.row], "LinkSystem", data);
  1726. },
  1727. //设备图片弹窗改变事件
  1728. changePics(keys, type, file) {
  1729. if (type === "dialog") {
  1730. // this.information = keys
  1731. this.newEnclosure.forEach(i => {
  1732. if (i.path == keys) {
  1733. this.$set(i, "value", file);
  1734. }
  1735. return i;
  1736. });
  1737. } else {
  1738. this.setDataToMain(keys, this.messKey, this.row);
  1739. }
  1740. },
  1741. utilToKey(key, name, data, messName) {
  1742. if (key == name) {
  1743. this.setDataToMain(data[key], messName, this.row);
  1744. }
  1745. },
  1746. //判断是否有值,有值赋值
  1747. setDataToMain(data, key, row) {
  1748. if (!!data && data != "--") {
  1749. if (!!this.tableData[row]) {
  1750. tools.setDataForKey(this.tableData[row], key, data);
  1751. this.handleUpdataTable([[row, key, null, data]], "edit");
  1752. } else {
  1753. this.tableData[row] = {};
  1754. tools.setDataForKey(this.tableData[row], key, data);
  1755. }
  1756. } else {
  1757. tools.setDataForKey(this.tableData[row], key, "");
  1758. }
  1759. },
  1760. // 批量信息维护
  1761. Batch() {
  1762. this.firmDataType = "dialog";
  1763. this.$refs.batchDialogs.batchDialog = true;
  1764. },
  1765. upDataDevice(type, data1, data2) {
  1766. let param = { content: data1 };
  1767. let param1 = { content: data2 };
  1768. if (type === 1) {
  1769. //增量
  1770. //LedgerParam
  1771. let filterParam = this.filterCheck(param, "sole");
  1772. let filterParam1 = this.filterCheck(param1, "multiple");
  1773. if (filterParam) {
  1774. updateEquip(param, res => {
  1775. });
  1776. }
  1777. if (filterParam1) {
  1778. setTimeout(() => {
  1779. queryUpdate(param1, res => {
  1780. });
  1781. });
  1782. }
  1783. }
  1784. if (type === 2) {
  1785. //覆盖
  1786. let filterParams = this.filterCheck(param, "sole");
  1787. if (filterParams) {
  1788. updateEquip(param, res => {
  1789. });
  1790. }
  1791. }
  1792. setTimeout(() => {
  1793. this.getTableData();
  1794. this.getAllData();
  1795. }, 10);
  1796. },
  1797. filterCheck(arr, type) {
  1798. if (type === "sole") {
  1799. for (let i of arr.content) {
  1800. return Object.keys(i.infos).length;
  1801. }
  1802. } else if (type === "multiple") {
  1803. let nArr = [];
  1804. arr.content.forEach(i => {
  1805. let { equipId, ...value } = i;
  1806. nArr.push({ infos: value });
  1807. });
  1808. for (let j of nArr) {
  1809. return Object.keys(j.infos).length;
  1810. }
  1811. }
  1812. }
  1813. },
  1814. watch: {
  1815. projectId() {
  1816. this.buildFloorData = [];
  1817. buildFloor.getData(this.buildFloorData);
  1818. this.tableData = [];
  1819. this.mess.deviceId = null;
  1820. this.page.total = 0;
  1821. },
  1822. showTypes: {
  1823. handler(newName, oldName) {
  1824. if (newName && newName[0] && newName[0].value) {
  1825. this.showType = newName[0].value;
  1826. } else {
  1827. this.showType = "";
  1828. }
  1829. },
  1830. immediate: true,
  1831. deep: true
  1832. }
  1833. }
  1834. };
  1835. </script>
  1836. <style lang="less">
  1837. .hanson-bar {
  1838. height: 40px;
  1839. padding: 5px 0;
  1840. font-size: 14px;
  1841. overflow: hidden;
  1842. margin-top: 0;
  1843. line-height: 40px;
  1844. .iconfont {
  1845. font-size: 12px;
  1846. }
  1847. }
  1848. .cancelButtonClass {
  1849. width: 180px;
  1850. }
  1851. </style>