device.vue 53 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309
  1. <template>
  2. <div style="height: calc(100% - 44.5px);padding: 0px 10px 10px;box-sizing: border-box;">
  3. <div class="hanson-bar">
  4. <div style="float:right;overflow:hidden;">
  5. <!-- <span style="width:20px;float:left;display:block;height:20px;cursor: pointer;" @click="changeAssetsFalg">
  6. <i v-show="!onlyRead" class="el-icon-fa el-icon-fa-compass"></i>
  7. </span> -->
  8. <span>当前筛选条件下共{{page.total || '--'}}设备</span>
  9. </div>
  10. <el-select v-model="onlyRead" @change="getHeaderData(mess)" style="width:100px;margin-right:20px;vertical-align:bottom;">
  11. <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"></el-option>
  12. </el-select>
  13. <el-select v-model="showType" @change="initTable" style="width:100px;margin-right:10px;vertical-align:bottom;">
  14. <el-option v-for="item in showTypes" :key="item.value" :label="item.label" :value="item.value"></el-option>
  15. </el-select>
  16. <!-- <el-button size="small" style='width: 80px;' @click="download" icon="iconfont icon-xiazai">下载</el-button> -->
  17. <el-button size="small" style='width: 80px;' @click="addDevice">添加设备</el-button>
  18. <el-button size="small" @click="Batch" :disabled="batchDate">批量维护信息点</el-button>
  19. <el-button size="small" style='width: 80px;' @click="reset">刷新</el-button>
  20. <el-button size="small" style='width: 80px;' v-show="!onlyRead" @click="undo">撤销</el-button>
  21. </div>
  22. <!-- 二维码弹窗 -->
  23. <qrcode :dialog="myDialog" :qrcodeUrl="qrcodeUrl" :addBody="true" ref="qrcode"></qrcode>
  24. <!-- 型号弹窗 -->
  25. <firm
  26. :mess="{deviceId: deviceType.assetType}"
  27. :firmDataType="firmDataType"
  28. ref="firm"
  29. @changeFirm="firmChange"
  30. :dialog="myDialog"
  31. ></firm>
  32. <!-- 供应商合同弹窗 -->
  33. <supply-dialog ref="supply" @change="supplyChange" :id="id" :dialog="myDialog"/>
  34. <!-- 供应商弹窗 -->
  35. <supplier-dialog ref="supplier" :firmDataType="firmDataType" @changeSupplier="supplierChange" :dialog="myDialog"/>
  36. <guarantee-dialog :id="id" ref="guarantee" @change="guaranteeChange" :dialog="myDialog"/>
  37. <!-- 上传文件-->
  38. <upload-files-dialog
  39. :read="onlyRead ? true : false"
  40. ref="upload"
  41. @changeFile="fileChange"
  42. :keysArr="filesArr"
  43. :firmDataType="firmDataType"
  44. :information="information"
  45. :infoType="infoType"
  46. :dialog="myDialog"
  47. />
  48. <!-- 上传图片-->
  49. <upload-img-dialog
  50. :read="onlyRead ? true : false"
  51. @changeFile="imgChange"
  52. :keysArr="imgsArr"
  53. :dialog="myDialog"
  54. :firmDataType="firmDataType"
  55. :information="information"
  56. :infoType="infoType"
  57. />
  58. <!-- 维修商信息-->
  59. <maintainer-dialog @changeMaintainer="changeMaintainer" :firmDataType="firmDataType" ref="maintainer"
  60. :dialog="myDialog"/>
  61. <insurer-dialog @changeInsurer="changeInsurer" :firmDataType="firmDataType" ref="insurer" :dialog="myDialog"/>
  62. <pic-dialog
  63. :read="onlyRead ? true : false"
  64. :dialog="myDialog"
  65. :keysArr="picsArr"
  66. @change="changePics"
  67. :firmDataType="firmDataType"
  68. :information="information"
  69. :infoType="infoType"
  70. />
  71. <div class=" middle_sty" style="height: 91%; text-align:center" v-show="!mess.deviceId && (!tableData || !tableData.length)">
  72. <p>
  73. <i class="icon-wushuju iconfont"></i>
  74. 请选择设备族
  75. </p>
  76. </div>
  77. <div class="center middle_sty" style="height: 91%" v-show="mess.deviceId && (!tableData || !tableData.length)">
  78. <p>
  79. <i class="icon-wushuju iconfont"></i>
  80. 暂无数据
  81. </p>
  82. </div>
  83. <div v-show="mess.deviceId && tableData && tableData.length" v-loading="loading" id="handsontable" ref="handsontable"></div>
  84. <div v-show="mess.deviceId && tableData && tableData.length" class="right">
  85. <my-pagination @change="getTableData" :page="page"></my-pagination>
  86. </div>
  87. <details-dialog :iframeSrc="iframeSrc" v-if="myDialog.details" :dialog="myDialog"></details-dialog>
  88. <!-- 关联的系统 -->
  89. <system-type :device="mess" :curDevice="curDevice" :dialog="myDialog" :type="onlyRead?'read':'edit'" @change="changeSystemType"
  90. :list="systemList"></system-type>
  91. <!-- 关联资产 -->
  92. <change-rea @changeProperty="changeProperty" :dialog="myDialog" :category="deviceType"></change-rea>
  93. <look-pic :dialog="myDialog" :keysArr="picsArr"></look-pic>
  94. <!-- 不支持的输入方式 -->
  95. <el-dialog title="临时维护信息点" :visible.sync="myDialog.update" @close="handleCloseUpdate" width="670px">
  96. <el-row>
  97. 该信息点未定义对应组件,现在维护数据不确定后续是否可用。如确实需要维护,请点击<el-link @click="updateInputShow = true" type="primary" :underline="false">继续维护</el-link>。
  98. </el-row>
  99. <el-row style="margin-top:20px;" v-show="updateInputShow">
  100. <el-input type="textarea" :autosize="{ minRows: 4, maxRows: 8}" placeholder="请输入内容" v-model="updateInput"></el-input>
  101. </el-row>
  102. <span slot="footer" class="dialog-footer">
  103. <el-button @click="myDialog.update = false">取 消</el-button>
  104. <el-button type="primary" @click="handleClickUpdate">确 认</el-button>
  105. </span>
  106. </el-dialog>
  107. <!-- 新增设备 -->
  108. <el-dialog title="确定新增设备的类型" :visible.sync="myDialog.addDevice" width="670px">
  109. <el-row>
  110. <my-cascader ref="cascader" @change="changeAddType" :all="true"></my-cascader>
  111. </el-row>
  112. <span slot="footer" class="dialog-footer">
  113. <el-button type="primary" @click="toAddDevice">下 一 步</el-button>
  114. </span>
  115. </el-dialog>
  116. <!-- 维护信息弹窗-->
  117. <batchDialog
  118. ref="batchDialogs"
  119. @code="fourVendors"
  120. :firmName="firmName"
  121. :allObject="allObject"
  122. :page="batchPage"
  123. :information="information"
  124. @getAllData="getAllData"
  125. @multiple="multiple"
  126. @upDataDevice="upDataDevice"
  127. />
  128. </div>
  129. </template>
  130. <script>
  131. import {
  132. BeatchQueryParam,
  133. deleteEquip,
  134. getDataDictionary,
  135. getEquipBelongs,
  136. getEquipTableCon,
  137. queryEquip,
  138. queryUpdate,
  139. updateEquip
  140. } from "@/api/scan/request";
  141. import tools from "@/utils/scan/tools"
  142. import handsonUtils from "@/utils/hasontableUtils"
  143. import showTools from "@/utils/handsontable/notShow"
  144. import text from "@/utils/handsontable/mainText"
  145. import myCascader from "@/components/ledger/lib/cascader"
  146. import buildFloor from '@/utils/handsontable/buildFloorData'
  147. import qrcode from "@/components/ledger/lib/qrcode"
  148. import firm from "@/components/dialogs/list/firm"
  149. import supplyDialog from "@/components/dialogs/list/supplyDialog"
  150. import supplierDialog from "@/components/dialogs/list/supplierDialog"
  151. import maintainerDialog from "@/components/dialogs/list/maintainerDialog"
  152. import insurerDialog from "@/components/dialogs/list/insurerDialog"
  153. import guaranteeDialog from "@/components/dialogs/list/guaranteeDialog"
  154. import uploadFilesDialog from "@/components/dialogs/list/filesDialog"
  155. import uploadImgDialog from "@/components/dialogs/list/uploadImgDialog"
  156. import picDialog from "@/components/dialogs/list/picDialog"
  157. import batchDialog from "../../dialogs/list/batchDialog";
  158. import systemType from "@/components/dialogs/list/systemType"
  159. import myPagination from "@/components/ledger/lib/myPagination"
  160. import detailsDialog from "@/components/ledger/lib/detailsDia"
  161. import changeRea from "@/components/dialogs/changeRea"
  162. import {mapGetters} from "vuex"
  163. //图片查看
  164. import lookPic from "@/components/ledger/lib/lookImages"
  165. import Handsontable from "handsontable-pro"
  166. import 'handsontable-pro/dist/handsontable.full.css'
  167. import lStorage from '@/utils/localStorage'
  168. //下拉插件
  169. // import "@/assets/js/chosen.jquery.min";
  170. // import "@/assets/js/handsontable-chosen-editor";
  171. export default {
  172. props: ["myParam"],
  173. components: {
  174. qrcode, //二维码页面
  175. firm, //
  176. supplyDialog,
  177. supplierDialog,
  178. guaranteeDialog,
  179. uploadFilesDialog,
  180. maintainerDialog,
  181. insurerDialog,
  182. uploadImgDialog,
  183. picDialog,
  184. myPagination,
  185. systemType,
  186. detailsDialog,
  187. changeRea,
  188. lookPic,
  189. myCascader,
  190. batchDialog
  191. },
  192. created() {
  193. buildFloor.getData(this.buildFloorData)
  194. },
  195. computed: {
  196. ...mapGetters("layout", ["projectId", "secret", "userId"]),
  197. showTypes() {
  198. return this.onlyRead ?
  199. [{value: "Visible", label: '只看采集信息'}, {value: "all", label: '全部'}] :
  200. [{value: "partInfo", label: '隐藏信息点'}, {value: "all", label: '全部'}, {value: "Visible", label: '只看采集信息'}]
  201. },
  202. batchDate() {
  203. // return !(!this.onlyRead && this.copyMain)
  204. return !(!this.onlyRead && this.page.total > 1)
  205. },
  206. batchDialogShow() {
  207. return this.$refs.batchDialogs.batchDialog
  208. }
  209. },
  210. data() {
  211. return {
  212. options: [{
  213. value: true,
  214. label: '只读模式'
  215. }, {
  216. value: false,
  217. label: '编辑模式'
  218. }],
  219. buildFloorData: [], //楼层数据
  220. tableData: [],
  221. mess: {},
  222. tableHeader: null,
  223. page: {
  224. size: 50,
  225. sizes: [10, 30, 50, 100, 150, 200],
  226. total: 0,
  227. currentPage: 1
  228. },
  229. batchPage: {
  230. size: 50,
  231. sizes: [10, 30, 50, 100, 150, 200],
  232. total: 0,
  233. currentPage: 1
  234. },
  235. myDialog: {
  236. qrcode: false, //二维码弹窗
  237. firm: false, //厂商弹窗
  238. supply: false, //选择供应合同
  239. supplier: false, //供应商选择
  240. guarantee: false, //选择保单
  241. maintainer: false, //选择维修商
  242. insurer: false, //选择保险公司
  243. uploadFiles: false,//上传文件
  244. uploadImgs: false,//上传单个图片
  245. pic: false, //多个图片
  246. addDevice: false,//添加设备
  247. systemType: false,//关联系统
  248. details: false,//详情页
  249. changeRea: false,//关联资产
  250. lookPic: false,//图片查看
  251. update: false,//临时维护信息点
  252. },
  253. row: null, //被修改的row
  254. filesArr: [], //保存临时的文件key
  255. messKey: null,
  256. imgsArr: [], //临时保存的图片key数组
  257. picsArr: [], //临时设备图片keys数组
  258. systemList: [], //关联的系统
  259. copyMain: null,
  260. iframeSrc: "",
  261. id: 0,
  262. onlyRead: true,
  263. showType: 'Visible',
  264. linkNameFalg: true,
  265. qrcodeUrl: "", //二维码图片地址
  266. loading: false,
  267. deviceType: {}, //族3位编码及名称
  268. floorData: [],
  269. curDevice: '',//当前点击的设备id
  270. addData: {}, //添加设备选择的设备类型
  271. inputMap: {
  272. flowBuild: 'D1'
  273. }, //信息点和输入方式映射表
  274. updateInputShow: false, //是否显示临时维护输入框
  275. updateInfoPoint: '',//临时维护信息点
  276. updateInput: '', //临时维护信息点值
  277. firmName: '',//维护信息显示厂家名称
  278. firmDataType: 'row',
  279. allObject: [],
  280. information: {
  281. archive: {
  282. Archive: [], //设备文档
  283. name: '设备文档',
  284. code: 'LedgerParam.PhotoDoc.Archive',
  285. num: 14
  286. },
  287. checkReport: {
  288. CheckReport: [],//安装质检报告
  289. name: '安装质检报告',
  290. code: 'LedgerParam.Siteinstall.CheckReport',
  291. num: 18
  292. },
  293. drawing: {
  294. Drawing: [],//设备图纸
  295. name: '设备图纸',
  296. code: 'LedgerParam.PhotoDoc.Drawing',
  297. num: 13
  298. },
  299. installDrawing: {
  300. InstallDrawing: [],//安装图纸
  301. name: '安装图纸',
  302. code: 'LedgerParam.Siteinstall.InstallDrawing',
  303. num: 16
  304. },
  305. installPic: {
  306. InstallPic: [],//安装照片
  307. name: '安装照片',
  308. code: 'LedgerParam.Siteinstall.InstallPic',
  309. num: 17
  310. },
  311. insuranceFile: {
  312. InsuranceFile: [],//保险文件
  313. name: '保险文件',
  314. code: 'LedgerParam.InsuranceDoc.InsuranceFile',
  315. num: 11
  316. },
  317. nameplate: {
  318. Nameplate: [],//设备铭牌照片
  319. name: '设备铭牌照片',
  320. code: 'LedgerParam.PhotoDoc.Nameplate',
  321. num: 12
  322. },
  323. pic: {
  324. Pic: [],//设备照片
  325. name: '设备照片',
  326. code: 'LedgerParam.PhotoDoc.Pic',
  327. num: 15
  328. }
  329. },
  330. infoType: ''
  331. };
  332. },
  333. methods: {
  334. //获取表头
  335. getHeaderData(code) {
  336. this.page.currentPage = 1
  337. this.mess = code
  338. this.changeCader()
  339. if (this.mess.deviceId) {
  340. let params = {
  341. data: {
  342. Orders: "sort asc",
  343. PageNumber: 1,
  344. PageSize: 1000
  345. },
  346. type: this.mess.deviceId
  347. };
  348. getDataDictionary(params, res => {
  349. this.tableHeader = res.Content;
  350. this.tableHeader.forEach(item => {
  351. if (item.Path && item.InputMode) {
  352. this.inputMap[item.Path] = item.InputMode
  353. }
  354. })
  355. this.getTableData()
  356. this.getAllData()
  357. });
  358. }
  359. },
  360. //获取主体数据
  361. getTableData() {
  362. this.loading = true
  363. //type存在发送请求
  364. if (!!this.mess.deviceId) {
  365. let param = {
  366. PageSize: this.page.size,
  367. Orders: "createTime desc, EquipID desc",
  368. PageNumber: this.page.currentPage,
  369. Filters: `category='${this.mess.deviceId}'`
  370. }
  371. if (this.mess.buildId == "noKnow") {
  372. param.Filters += `;buildingId isNull`
  373. } else if (this.mess.buildId && this.mess.buildId != "all") {
  374. param.Filters += `;buildingId='${this.mess.buildId}'`
  375. }
  376. if (this.mess.floorId == "noKnow") {
  377. param.Filters += `;floorId isNull`
  378. } else if (this.mess.floorId && this.mess.floorId != "all") {
  379. param.Filters += `;floorId='${this.mess.floorId}'`
  380. }
  381. getEquipTableCon(param, res => {
  382. this.loading = false;
  383. this.tableData = res.Content.map((item) => {
  384. if (item.hasOwnProperty("BuildingId") && item.hasOwnProperty("FloorId")) {
  385. item.flowBuild = item.BuildingId + "-" + item.FloorId
  386. } else if (item.hasOwnProperty("BuildingId") && !item.hasOwnProperty("FloorId")) {
  387. item.flowBuild = item.BuildingId
  388. }
  389. return item
  390. });
  391. this.copyMain = tools.deepCopy(this.tableData);
  392. this.page.total = res.Total;
  393. if (this.tableData && this.tableData.length) {
  394. if (this.onlyRead) {
  395. this.getBatch(this.tableData)
  396. }
  397. this.initTable();
  398. }
  399. })
  400. }
  401. },
  402. //获取所以主体数据---用于维护信息
  403. getAllData() {
  404. if (!!this.mess.deviceId) {
  405. // 查询step2
  406. let params = {
  407. "Cascade": [
  408. {
  409. "Name": "property",
  410. "Projection": [
  411. "Family", "EquipLocalName", "EquipLocalID", "EquipID", "CodeType"
  412. ]
  413. },
  414. {
  415. "Name": "building",
  416. "Projection": [
  417. "BuildLocalName", "BuildName", "BuildID"
  418. ]
  419. },
  420. {
  421. "Name": "floor",
  422. "Projection": [
  423. "FloorLocalName", "FloorName", "FloorID"
  424. ]
  425. }
  426. ],
  427. Filters: `category='${this.mess.deviceId}'`,
  428. PageSize: this.batchPage.size,
  429. Orders: "createTime desc, EquipID desc",
  430. PageNumber: this.batchPage.currentPage,
  431. "Projection": [
  432. "BuildingId", "FloorId", "Category", "EquipLocalName", "EquipLocalID", "EquipID", "BIMID"
  433. ]
  434. };
  435. if (this.mess.buildId == "noKnow") {
  436. params.Filters += `;buildingId isNull`
  437. } else if (this.mess.buildId && this.mess.buildId != "all") {
  438. params.Filters += `;buildingId='${this.mess.buildId}'`
  439. }
  440. if (this.mess.floorId == "noKnow") {
  441. params.Filters += `;floorId isNull`
  442. } else if (this.mess.floorId && this.mess.floorId != "all") {
  443. params.Filters += `;floorId='${this.mess.floorId}'`
  444. }
  445. queryEquip(params, res => {
  446. this.allObject = res.Content
  447. this.batchPage.total = res.Total
  448. })
  449. }
  450. },
  451. //获取动态参数
  452. getBatch(data) {
  453. let param = {
  454. secret: this.secret,
  455. ProjId: this.projectId,
  456. data: {
  457. criterias: []
  458. }
  459. }
  460. //一级遍历list
  461. this.tableHeader.map(head => {
  462. //如果一级标签为动态参数或者设定参数放入数据等待请求
  463. if (
  464. head.InputMode == "L" ||
  465. head.InputMode == "L1" ||
  466. head.InputMode == "L2" ||
  467. head.InputMode == "M"
  468. ) {
  469. data.map(item => {
  470. let cur = tools.dataForKey(item, head.Path);
  471. if (cur) {
  472. param.data.criterias.push({
  473. id: item.EquipID,
  474. code: head.InfoPointCode
  475. });
  476. }
  477. });
  478. }
  479. })
  480. if (param.data.criterias.length) {
  481. BeatchQueryParam(param, res => {
  482. if (!this.onlyRead) {
  483. return false
  484. }
  485. this.tableData = data.map(item => {
  486. res.Content.map(child => {
  487. if (item.EquipID == child.id) {
  488. if (!!child.data || child.data == 0) {
  489. this.tableHeader.map(head => {
  490. if (head.InfoPointCode == child.code) {
  491. tools.setDataForKey(item, head.Path, child.data);
  492. }
  493. });
  494. } else {
  495. this.tableHeader.map(head => {
  496. if (head.InfoPointCode == child.code) {
  497. tools.setDataForKey(
  498. item,
  499. head.Path,
  500. child.error ? child.value ? "表号功能号格式错误" : "表号功能号不存在" : "暂未采集到实时数据"
  501. );
  502. }
  503. });
  504. }
  505. }
  506. })
  507. return item
  508. })
  509. this.hot.loadData(this.tableData)
  510. })
  511. }
  512. },
  513. //修改资产
  514. changeAssetsFalg() {
  515. if (this.linkNameFalg) {
  516. this.linkNameFalg = false
  517. } else {
  518. this.$confirm('<p>真的要在这里修改设备关联的资产么?</p><p>真的能通过列表信息找到想关联的资产么?</p><p>在这里修改关联的资产一定是因为之前关联错了要修改么?</p>', '提示', {
  519. dangerouslyUseHTMLString: true,
  520. confirmButtonText: '没错!我要改关联的资产',
  521. cancelButtonText: '我就点开看看',
  522. confirmButtonClass: 'cancelButtonClass',
  523. cancelButtonClass: 'cancelButtonClass'
  524. }).then(_ => {
  525. this.linkNameFalg = true
  526. }).catch(_ => {
  527. this.$message("取消")
  528. })
  529. }
  530. },
  531. //撤回
  532. undo() {
  533. this.hot.undo();
  534. },
  535. //刷新-switch改变
  536. reset() {
  537. this.getTableData();
  538. },
  539. //添加设备
  540. addDevice() {
  541. this.myDialog.addDevice = true
  542. if (this.mess.deviceId) {
  543. this.$nextTick(() => {
  544. this.$refs.cascader.setValue(this.mess.deviceId)
  545. })
  546. }
  547. },
  548. //下一步
  549. toAddDevice() {
  550. if (this.addData.deviceId) {
  551. this.$router.push({
  552. path: "/ledger/deviceadd",
  553. query: this.addData
  554. });
  555. }
  556. },
  557. //选择设备类型-添加设备
  558. changeAddType(val) {
  559. this.addData.deviceId = val.code;
  560. this.addData.name = val.facility;
  561. },
  562. //下载
  563. download() {
  564. if (!this.onlyRead) {
  565. if (!!this.hot) {
  566. let fileName = this.mess.name + "-页数:" + this.page.currentPage + "-个数:" + this.tableData.length + "-总个数:" + this.page.total
  567. this.hot.getPlugin('exportFile').downloadFile("csv", {
  568. filename: fileName,
  569. columnHeaders: true,
  570. exportHiddenRows: true,
  571. exportHiddenColumns: true,
  572. rowHeaders: true
  573. })
  574. } else {
  575. this.$message("请确定存在表格")
  576. }
  577. } else {
  578. this.$message("下载需在编辑状态下")
  579. }
  580. },
  581. //格式化表头
  582. formatHeaderData(list) {
  583. let arr = tools.copyArr(list)
  584. let data = showTools.headerTextFilter(arr, 'equipment', this.onlyRead, this.showType, true)
  585. data.unshift("操作", "当前关联的资产", "所属系统实例", "包含的部件");
  586. if (this.showType == "all") {
  587. data.splice(6, 0, "所属建筑楼层")
  588. }
  589. return data;
  590. },
  591. //格式化表内容
  592. formatHeaderType(list) {
  593. let arr = tools.copyArr(list)
  594. let data = showTools.headerTypeFilter(arr, 'equipment', this.onlyRead, this.showType, true)
  595. data.unshift(
  596. {
  597. data: "caozuo",
  598. renderer: tools.lookDetails,
  599. readOnly: true
  600. },
  601. {
  602. data: "LinkEquipLocalName",
  603. readOnly: true,
  604. renderer: tools.LinkEquipLocalName
  605. }, {
  606. data: "LinkSystem",
  607. renderer: text.systemList,
  608. readOnly: true
  609. }, {
  610. data: "Count",
  611. readOnly: true,
  612. renderer: tools.lookDetails
  613. }
  614. );
  615. if (this.showType == "all") {
  616. data.splice(6, 0, {
  617. data: "flowBuild",
  618. renderer: tools.customDropdownRenderer,
  619. editor: "chosen",
  620. chosenOptions: {
  621. data: this.buildFloorData
  622. },
  623. readOnly: this.onlyRead
  624. })
  625. }
  626. return data;
  627. },
  628. //初始化插件
  629. initTable() {
  630. var container = document.getElementById("handsontable");
  631. let winHeight = document.documentElement.clientHeight;
  632. if (this.hot) {
  633. this.hot.destroy();
  634. this.hot = null;
  635. }
  636. this.hot = new Handsontable(container, {
  637. data: this.tableData,
  638. fixedColumnsLeft: 6,
  639. colHeaders: this.formatHeaderData(this.tableHeader), //表头文案
  640. columns: this.formatHeaderType(this.tableHeader), //数据显示格式
  641. filters: true,
  642. maxRows: this.tableData.length,
  643. height: winHeight - 335,
  644. columnSorting: true, //添加排序
  645. sortIndicator: true, //添加排序
  646. renderAllRows: true,
  647. // colWidths: 200,
  648. autoColumnSize: true,
  649. language: "zh-CN",
  650. manualColumnResize: true,
  651. manualColumnMove: true,
  652. dropdownMenu: [
  653. "filter_by_condition",
  654. "filter_by_value",
  655. "filter_action_bar"
  656. ],
  657. contextMenu: this.onlyRead ? false : {
  658. items: {
  659. remove_row: {
  660. name: "删除选中设备"
  661. }
  662. }
  663. },
  664. // 事件
  665. afterChange: this.handleUpdataTable, //修改后
  666. afterFilter: this.trimmedRows, //排序前
  667. afterRemoveRow: this.handleDeleteTableRow, //右键删除
  668. afterOnCellMouseDown: this.eventClick //鼠标点击
  669. });
  670. let pro = document.getElementById("hot-display-license-info");
  671. if (!!pro) {
  672. pro.parentNode.removeChild(pro);
  673. }
  674. this.isLoading = false;
  675. },
  676. //表格中的点击
  677. eventClick(el, rowArr) {
  678. //点击的是表头
  679. if (rowArr.row < 0) {
  680. return;
  681. }
  682. //被筛选过后的数组
  683. let trimmedArr = this.trimmedRows();
  684. //是否启用了排序
  685. let isSort = this.hot.getPlugin("columnSorting").isSorted();
  686. if (trimmedArr.length && isSort) {
  687. let sortArr = this.myHotArr.getPlugin("columnSorting").rowsMapper
  688. .__arrayMap;
  689. let infos = this.tableData[trimmedArr[sortArr[rowArr.row]]];
  690. this.getInfors(infos, {row: sortArr[rowArr.row], col: rowArr.col}, el);
  691. } else if (isSort) {
  692. //排序后的数组
  693. let sortArr = this.hot.getPlugin("columnSorting").rowsMapper.__arrayMap;
  694. let infos = this.tableData[sortArr[rowArr.row]];
  695. this.getInfors(infos, {row: sortArr[rowArr.row], col: rowArr.col}, el);
  696. } else if (trimmedArr.length) {
  697. let infos = this.tableData[trimmedArr[rowArr.row]];
  698. this.getInfors(infos, {row: trimmedArr[rowArr.row], col: rowArr.col}, el);
  699. } else {
  700. let infos = this.tableData[rowArr.row];
  701. this.getInfors(infos, rowArr, el);
  702. }
  703. },
  704. // 更新
  705. handleUpdataTable(changeData, source) {
  706. if (!this.onlyRead) {
  707. if (changeData) {
  708. let trimmedArr = this.trimmedRows();
  709. let param = handsonUtils.getParam(changeData, source, this.hot, trimmedArr);
  710. let data = [];
  711. for (let i = 0; i < param.length; i++) {
  712. data.push(param[i]);
  713. }
  714. //如果data中包含/且data长度为1,将其转换成.
  715. if (changeData.length == 1 && changeData[0][1].indexOf("/") > 0) {
  716. changeData[0][1] = changeData[0][1].split("/").join(".")
  717. }
  718. //存在data进行修改请求
  719. if (data && data.length) {
  720. this.updateBusiness(data, changeData);
  721. }
  722. }
  723. }
  724. },
  725. //删除设备
  726. handleDeleteTableRow() {
  727. let params = tools.differenceArr(this.tableData, this.copyMain)
  728. let _this = this
  729. if (params.length < 1) {
  730. return
  731. }
  732. let param = []
  733. params.map(item => {
  734. this.deleteCode = item.Category
  735. param.push({EquipID: item.EquipID})
  736. })
  737. this.$confirm("此操作将删除设备,是否继续?", "提示", {
  738. confirmButtonText: '确定',
  739. cancelButtonText: '取消',
  740. type: 'warning'
  741. }).then(() => {
  742. this.removeDevice(param)
  743. }).catch(() => {
  744. this.reset()
  745. this.$message("取消删除")
  746. })
  747. },
  748. // 删除设备
  749. async removeDevice(param) {
  750. await deleteEquip(param, res => {
  751. this.$message.success("删除成功")
  752. this.$emit('close', {code: this.deleteCode})
  753. this.getTableData()
  754. })
  755. },
  756. // 更新
  757. updateBusiness(data, change) {
  758. let param = {
  759. Content: [],
  760. Projection: []
  761. }, keyList = [];
  762. //生成要修改字段列表
  763. change.map(item => {
  764. let key = item[1].split(".")[0]
  765. if (key == "flowBuild" && keyList.indexOf(key) == -1) {
  766. keyList.push("BuildingId", "FloorId")
  767. param.Projection.push("BuildingId", "FloorId")
  768. }
  769. if (item[1] && keyList.indexOf(key) == -1 && item[1] != 'PropertyId') {
  770. keyList.push(key);
  771. }
  772. if (item[1] && item[3] == "" && param.Projection.indexOf(key) == -1 && item[1] != 'PropertyId') {
  773. param.Projection.push(key);
  774. }
  775. });
  776. //生成对应修改数据
  777. data.map((item, index) => {
  778. keyList.map(value => {
  779. if (value == "BuildingId") {
  780. let itemData = tools.dataForKey(item, "flowBuild")
  781. if (itemData == "") {
  782. tools.setDataForKey(item, "BuildingId", null)
  783. tools.setDataForKey(item, "FloorId", null)
  784. } else {
  785. let BuildingId = itemData.split("-")[0]
  786. let FloorId = itemData.split("-")[1]
  787. if (BuildingId && FloorId) {
  788. tools.setDataForKey(item, "BuildingId", BuildingId)
  789. tools.setDataForKey(item, "FloorId", FloorId)
  790. } else if (BuildingId && !FloorId) {
  791. tools.setDataForKey(item, "BuildingId", BuildingId)
  792. tools.setDataForKey(item, "FloorId", null)
  793. }
  794. }
  795. } else {
  796. let itemData = tools.dataForKey(item, value)
  797. tools.setDataForKey(item, value, itemData == "" ? null : itemData)
  798. }
  799. });
  800. param.Content.push(item);
  801. });
  802. updateEquip(param, res => {
  803. });
  804. },
  805. //修改设备类型
  806. changeCader() {
  807. if (this.mess.deviceId) {
  808. let param = {
  809. data: {
  810. Filters: `EquipCode='${this.mess.deviceId}'`,
  811. PageNumber: 1,
  812. PageSize: 50
  813. }
  814. }
  815. getEquipBelongs(param, res => {
  816. if (res.Content.length) {
  817. this.deviceType.assetType = res.Content[0].Family
  818. this.deviceType.assetName = res.Content[0].FamilyName
  819. }
  820. })
  821. }
  822. },
  823. // 接受维护信息传来的code,显示弹窗
  824. fourVendors(code) {
  825. this.firmDataType = 'dialog'
  826. switch (code) {
  827. //品牌型号弹窗
  828. case 'DPManufacturerID':
  829. // this.dataFirmType = 'dia'
  830. this.myDialog.firm = true;
  831. break;
  832. //供应商信息弹窗
  833. case 'DPSupplierID':
  834. this.myDialog.supplier = true;
  835. break;
  836. //维修商信息弹窗
  837. case 'DPMaintainerID':
  838. this.myDialog.maintainer = true;
  839. break;
  840. //保险公司信息
  841. case 'DPInsurerID':
  842. this.myDialog.insurer = true;
  843. break;
  844. }
  845. },
  846. multiple(val) {
  847. this.firmDataType = 'dialog'
  848. switch (val) {
  849. //设备文档--安装质检报告--保险文件
  850. case 'archive':
  851. let adata = this.information.archive.Archive;
  852. this.filesArr = adata ? adata : [];
  853. this.infoType = 'archive';
  854. this.myDialog.uploadFiles = true;
  855. break;
  856. case 'checkReport':
  857. let cdata = this.information.checkReport.CheckReport;
  858. this.filesArr = cdata ? cdata : [];
  859. this.infoType = 'checkReport'
  860. this.myDialog.uploadFiles = true;
  861. break;
  862. case 'insuranceFile':
  863. let idata = this.information.insuranceFile.InsuranceFile;
  864. this.filesArr = idata ? idata : [];
  865. this.infoType = 'insuranceFile';
  866. this.myDialog.uploadFiles = true;
  867. break;
  868. //安装照片--安装图纸--设备铭牌照片--设备图纸
  869. case 'installPic':
  870. let insData = this.information.installPic.InstallPic;
  871. this.imgsArr = insData ? insData : [];
  872. this.infoType = 'installPic';
  873. this.myDialog.uploadImgs = true;
  874. break;
  875. case 'installDrawing':
  876. let drawData = this.information.installDrawing.InstallDrawing;
  877. this.imgsArr = drawData ? drawData : [];
  878. this.infoType = 'installDrawing';
  879. this.myDialog.uploadImgs = true;
  880. break;
  881. case 'nameplate':
  882. let nDate = this.information.nameplate.Nameplate;
  883. this.imgsArr = nDate ? nDate : [];
  884. this.infoType = 'nameplate';
  885. this.myDialog.uploadImgs = true;
  886. break;
  887. case 'drawing':
  888. let dDate = this.information.drawing.Drawing;
  889. this.imgsArr = dDate ? dDate : [];
  890. this.infoType = 'drawing';
  891. this.myDialog.uploadImgs = true;
  892. break;
  893. //设备照片
  894. case 'pic':
  895. let picData = this.information.pic.Pic;
  896. this.picsArr = picData ? picData : [];
  897. this.infoType = 'pic';
  898. this.myDialog.pic = true;
  899. break;
  900. }
  901. },
  902. //获取到了正确的信息
  903. getInfors(infos, row, el) {
  904. let val = this.hot.colToProp(row.col);
  905. let inputMode = this.inputMap[val];
  906. this.row = row.row;
  907. this.messKey = val;
  908. this.firmDataType = 'row'
  909. lStorage.set('screen_data', { path: this.$route.path, data: { equip: infos } })
  910. switch (val) {
  911. //操作
  912. case 'caozuo':
  913. // window.open(`http://adm.sagacloud.cn:8058/spread?id=${infos.EquipID}&pid=${this.projectId}&secret=${this.secret}`,"_blank")
  914. this.$message("开发中...")
  915. return false
  916. //设备二维码图片
  917. case 'EquipQRCode':
  918. this.qrcodeUrl = this.tableData[row.row].EquipQRCode;
  919. if (!!this.qrcodeUrl) {
  920. this.myDialog.qrcode = true;
  921. } else {
  922. this.$message("此设备没有设备二维码");
  923. }
  924. return false
  925. //关联系统
  926. case 'LinkSystem':
  927. if (!this.onlyRead) {
  928. this.curDevice = infos.EquipID;
  929. this.systemList = this.tableData[row.row].LinkSystem || [];
  930. this.myDialog.systemType = true;
  931. }
  932. return false
  933. //关联资产
  934. case 'LinkEquipLocalName':
  935. if (!this.onlyRead) {
  936. this.myDialog.changeRea = true;
  937. }
  938. return false
  939. //品牌型号弹窗
  940. case 'DPManufacturerID':
  941. if (!this.onlyRead) {
  942. this.myDialog.firm = true;
  943. }
  944. return false
  945. //供应商信息弹窗
  946. case 'DPSupplierID':
  947. if (!this.onlyRead) {
  948. this.myDialog.supplier = true;
  949. }
  950. return false
  951. //维修商信息弹窗
  952. case 'DPMaintainerID':
  953. if (!this.onlyRead) {
  954. this.myDialog.maintainer = true;
  955. }
  956. return false
  957. //保险公司信息
  958. case 'DPInsurerID':
  959. if (!this.onlyRead) {
  960. this.myDialog.insurer = true;
  961. }
  962. return false
  963. //供应合同编号
  964. case 'LedgerParam.SupplyPurchase.SupplierContractID':
  965. if (!this.onlyRead) {
  966. let ContractIDflag = null;
  967. let DPSdata = this.tableData[row.row].DPSupplierID;
  968. if (DPSdata) {
  969. ContractIDflag = DPSdata.split("-")[0];
  970. }
  971. if (!!ContractIDflag) {
  972. this.id = ContractIDflag;
  973. this.myDialog.supply = true;
  974. } else {
  975. this.$message("请先选择供应商");
  976. }
  977. }
  978. return false
  979. //保险单号
  980. case 'LedgerParam.InsuranceDoc.InsuranceNum':
  981. if (!this.onlyRead) {
  982. let DPInsurerIDflag = null;
  983. let DPIdata = this.tableData[row.row].DPInsurerID;
  984. if (DPIdata) {
  985. DPInsurerIDflag = DPIdata.split("-")[0];
  986. }
  987. if (!!DPInsurerIDflag) {
  988. this.id = DPInsurerIDflag;
  989. this.myDialog.guarantee = true;
  990. } else {
  991. this.$message("请先选择保险商");
  992. }
  993. }
  994. return false
  995. //保险文件--设备文档--安装质检报告
  996. case 'LedgerParam.InsuranceDoc.InsuranceFile':
  997. case 'LedgerParam.PhotoDoc.Archive':
  998. case 'LedgerParam.Siteinstall.CheckReport':
  999. let IPSdata = tools.dataForKey(this.tableData[row.row], val);
  1000. this.filesArr = IPSdata ? IPSdata : [];
  1001. this.myDialog.uploadFiles = true;
  1002. return false
  1003. //安装照片--安装图纸--设备铭牌照片--设备图纸
  1004. case 'LedgerParam.Siteinstall.InstallPic':
  1005. case 'LedgerParam.Siteinstall.InstallDrawing':
  1006. case 'LedgerParam.PhotoDoc.Nameplate':
  1007. case 'LedgerParam.PhotoDoc.Drawing':
  1008. let SSPPdata = tools.dataForKey(this.tableData[row.row], val);
  1009. this.imgsArr = SSPPdata ? SSPPdata : [];
  1010. this.myDialog.uploadImgs = true;
  1011. return false
  1012. //设备照片
  1013. case 'LedgerParam.PhotoDoc.Pic':
  1014. let Pdata = tools.dataForKey(this.tableData[row.row], val);
  1015. this.picsArr = Pdata ? Pdata : [];
  1016. this.myDialog.pic = true;
  1017. return false
  1018. //包含的部件字段
  1019. case 'Count':
  1020. if (this.onlyRead) {
  1021. this.$router.push({path: '/ledger/parts', query: {deviceId: infos.EquipID}});
  1022. } else {
  1023. this.$router.push({
  1024. path: '/ledger/partsmanage',
  1025. query: {deviceId: infos.EquipID, typeId: this.mess.deviceId}
  1026. });
  1027. }
  1028. return false
  1029. default:
  1030. break;
  1031. }
  1032. if (!this.onlyRead && showTools.InputModeArr.indexOf(inputMode) == '-1') {
  1033. this.updateInfoPoint = val
  1034. this.updateInput = tools.dataForKey(this.tableData[row.row], val)
  1035. this.myDialog.update = true
  1036. }
  1037. },
  1038. //关闭临时维护弹窗回调
  1039. handleCloseUpdate() {
  1040. this.updateInputShow = false
  1041. this.updateInfoPoint = ''
  1042. this.updateInput = ''
  1043. },
  1044. //更新临时维护信息点
  1045. handleClickUpdate() {
  1046. tools.setDataForKey(this.tableData[this.row], this.updateInfoPoint, this.updateInput)
  1047. this.handleUpdataTable([[this.row, this.updateInfoPoint, null, this.updateInput]], "edit")
  1048. this.updateInputShow = false
  1049. this.myDialog.update = false
  1050. this.updateInput = ''
  1051. },
  1052. //获取被筛选掉的行号
  1053. trimmedRows() {
  1054. var plugin = this.hot.getPlugin("trimRows").trimmedRows;
  1055. let dataLength = this.tableData.length;
  1056. let dataArr = new Array();
  1057. for (let i = 0; i < dataLength; i++) {
  1058. dataArr.push(i);
  1059. }
  1060. if (plugin.length <= 0) {
  1061. dataArr = undefined;
  1062. } else {
  1063. dataArr = this.array_diff(dataArr, plugin);
  1064. }
  1065. return dataArr || [];
  1066. },
  1067. //去除数组中相同的元素
  1068. array_diff(a, b) {
  1069. for (var i = 0; i < b.length; i++) {
  1070. for (var j = 0; j < a.length; j++) {
  1071. if (a[j] == b[i]) {
  1072. a.splice(j, 1);
  1073. j = j - 1;
  1074. }
  1075. }
  1076. }
  1077. return a;
  1078. },
  1079. //如果选择供应商之后
  1080. supplierChange(data, type) {
  1081. if (type === 'dialog') {
  1082. let firm = {...data, num: 8}
  1083. this.firmName = firm
  1084. } else {
  1085. tools.setDataForKey(this.tableData[this.row], "DPSupplierID", data.venderId)
  1086. tools.setDataForKey(this.tableData[this.row], "LedgerParam.SupplyPurchase.Supplier", data.name)
  1087. this.handleUpdataTable(
  1088. [
  1089. [this.row, "DPSupplierID", null, data.venderId],
  1090. [this.row, "LedgerParam.SupplyPurchase.Supplier", null, data.name]
  1091. ],
  1092. "edit"
  1093. )
  1094. // this.handleUpdataTable([[this.row, "LedgerParam.SupplyPurchase.Supplier", null, data.name]], "edit")
  1095. }
  1096. },
  1097. //供应合同编号
  1098. supplyChange(data) {
  1099. tools.setDataForKey(this.tableData[this.row], "LedgerParam.SupplyPurchase.SupplierContractID", {id: data})
  1100. },
  1101. //保险单号-保险文件
  1102. guaranteeChange(data) {
  1103. for (let key in data) {
  1104. this.utilToKey(key, "insuranceNo", data, "InsuranceNum")
  1105. if (key == "contractFile") {
  1106. if (!!data[key]) {
  1107. data[key] = [data[key]]
  1108. }
  1109. }
  1110. this.utilToKey(key, "contractFile", data, "InsuranceFile")
  1111. }
  1112. },
  1113. //选择型号修改
  1114. firmChange(data, type) {
  1115. if (type === 'dialog') { // 如果是批量信息维护
  1116. let venderName = data.venderName ? data.venderName : '空'
  1117. let brandName = data.brandName ? data.brandName : '空'
  1118. let name = data.name ? data.name : '空'
  1119. let firm = {
  1120. ...data,
  1121. num: 2,
  1122. Specification: data.name,
  1123. name: `${venderName}/${brandName}/${name}`
  1124. }
  1125. this.firmName = firm //批量维护dialog显示对象的字段
  1126. } else { //如果是表格操作
  1127. tools.setDataForKey(this.tableData[this.row], "DPManufacturerID", data.venderId)
  1128. tools.setDataForKey(this.tableData[this.row], "LedgerParam.EquipManufactor.Brand", data.brand)
  1129. tools.setDataForKey(this.tableData[this.row], "LedgerParam.EquipManufactor.Specification", data.name)
  1130. this.handleUpdataTable(
  1131. [
  1132. [this.row, "DPManufacturerID", null, data.venderId],
  1133. [this.row, "LedgerParam.EquipManufactor.Brand", null, data.brand],
  1134. [this.row, "LedgerParam.EquipManufactor.Specification", null, data.name]
  1135. ],
  1136. "edit"
  1137. )
  1138. // this.handleUpdataTable([[this.row, "LedgerParam.EquipManufactor.Brand", null, data.brand]], "edit")
  1139. // this.handleUpdataTable([[this.row, "LedgerParam.EquipManufactor.Specification", null, data.name]], "edit")
  1140. }
  1141. },
  1142. //保险商变更
  1143. changeInsurer(data, type) {
  1144. if (type === 'dialog') {
  1145. let firm = {...data, num: 42}
  1146. this.firmName = firm
  1147. } else {
  1148. tools.setDataForKey(this.tableData[this.row], "DPInsurerID", data.venderId)
  1149. tools.setDataForKey(this.tableData[this.row], "LedgerParam.InsuranceDoc.Insurer", data.name)
  1150. this.handleUpdataTable(
  1151. [
  1152. [this.row, "DPInsurerID", null, data.venderId],
  1153. [this.row, "LedgerParam.InsuranceDoc.Insurer", null, data.name]
  1154. ],
  1155. "edit"
  1156. )
  1157. // this.handleUpdataTable([[this.row, "LedgerParam.InsuranceDoc.Insurer", null, data.name]], "edit")
  1158. }
  1159. },
  1160. //维修商变更
  1161. changeMaintainer(data, type) {
  1162. if (type === 'dialog') {
  1163. let firm = {...data, num: 35}
  1164. this.firmName = firm
  1165. } else {
  1166. tools.setDataForKey(this.tableData[this.row], "DPMaintainerID", data.venderId)
  1167. tools.setDataForKey(this.tableData[this.row], "LedgerParam.OperationMainte.Maintainer", data.name)
  1168. this.handleUpdataTable(
  1169. [
  1170. [this.row, "DPMaintainerID", null, data.venderId],
  1171. [this.row, "LedgerParam.OperationMainte.Maintainer", null, data.name]
  1172. ],
  1173. "edit"
  1174. )
  1175. // this.handleUpdataTable([[this.row, "LedgerParam.OperationMainte.Maintainer", null, data.name]], "edit")
  1176. }
  1177. },
  1178. //修改关联的资产
  1179. changeProperty(val) {
  1180. this.setDataToMain(val.PropertyId, 'PropertyId', this.row);
  1181. this.setDataToMain(val.LinkEquipLocalName, 'LinkEquipLocalName', this.row);
  1182. },
  1183. //上传文件弹窗触发事件
  1184. fileChange(keys, type) {
  1185. if (type === 'dialog') {
  1186. this.information = keys
  1187. } else {
  1188. console.log(keys, 'file keys')
  1189. this.setDataToMain(keys, this.messKey, this.row);
  1190. }
  1191. },
  1192. //上传图片弹窗触发事件
  1193. imgChange(keys, type) {
  1194. if (type === 'dialog') {
  1195. this.information = keys
  1196. } else {
  1197. this.setDataToMain(keys, this.messKey, this.row);
  1198. }
  1199. },
  1200. //关联系统更改
  1201. changeSystemType(data) {
  1202. tools.setDataForKey(this.tableData[this.row], "LinkSystem", data)
  1203. },
  1204. //设备图片弹窗改变事件
  1205. changePics(keys, type) {
  1206. if (type === 'dialog') {
  1207. this.information = keys
  1208. } else {
  1209. this.setDataToMain(keys, this.messKey, this.row);
  1210. }
  1211. },
  1212. utilToKey(key, name, data, messName) {
  1213. if (key == name) {
  1214. this.setDataToMain(data[key], messName, this.row)
  1215. }
  1216. },
  1217. //判断是否有值,有值赋值
  1218. setDataToMain(data, key, row) {
  1219. if (!!data && data != '--') {
  1220. if (!!this.tableData[row]) {
  1221. tools.setDataForKey(this.tableData[row], key, data);
  1222. this.handleUpdataTable([[row, key, null, data]], "edit");
  1223. } else {
  1224. this.tableData[row] = {};
  1225. tools.setDataForKey(this.tableData[row], key, data);
  1226. }
  1227. } else {
  1228. tools.setDataForKey(this.tableData[row], key, "");
  1229. }
  1230. },
  1231. // 批量信息维护
  1232. Batch() {
  1233. this.firmDataType = 'dialog'
  1234. this.$refs.batchDialogs.batchDialog = true
  1235. },
  1236. upDataDevice(type, data1, data2) {
  1237. let param = {Content: data1}
  1238. let param1 = {Content: data2}
  1239. if (type === 1) { //增量
  1240. queryUpdate(param1, res => {
  1241. })
  1242. updateEquip(param, res => {
  1243. });
  1244. }
  1245. if (type === 2) {//覆盖
  1246. updateEquip(param, res => {
  1247. });
  1248. }
  1249. this.getTableData()
  1250. this.getAllData()
  1251. }
  1252. },
  1253. watch: {
  1254. projectId() {
  1255. this.buildFloorData = []
  1256. buildFloor.getData(this.buildFloorData)
  1257. this.tableData = []
  1258. this.mess.deviceId = null
  1259. this.page.total = 0
  1260. },
  1261. showTypes: {
  1262. handler(newName, oldName) {
  1263. if (newName && newName[0] && newName[0].value) {
  1264. this.showType = newName[0].value
  1265. } else {
  1266. this.showType = ""
  1267. }
  1268. },
  1269. immediate: true,
  1270. deep: true
  1271. }
  1272. }
  1273. };
  1274. </script>
  1275. <style lang="less">
  1276. .hanson-bar {
  1277. height: 40px;
  1278. padding: 5px 0;
  1279. font-size: 14px;
  1280. overflow: hidden;
  1281. margin-top: 0;
  1282. line-height: 40px;
  1283. .iconfont {
  1284. font-size: 12px;
  1285. }
  1286. }
  1287. .cancelButtonClass {
  1288. width: 180px;
  1289. }
  1290. </style>