device.vue 56 KB

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