system.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716
  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>当前筛选条件下共{{ page.total || '--' }}系统</span>
  6. </div>
  7. <el-select v-model="onlyRead" @change="getHeaderData(mess)"
  8. style="width:100px;margin-right:20px;vertical-align:bottom;">
  9. <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"></el-option>
  10. </el-select>
  11. <el-select v-model="showType" @change="initTable" style="width:100px;margin-right:10px;vertical-align:bottom;">
  12. <el-option v-for="item in showTypes" :key="item.value" :label="item.label" :value="item.value"></el-option>
  13. </el-select>
  14. <el-button size="small" style="width: 80px" @click="addDevice" icon="iconfont icon-tianjia">添加系统</el-button>
  15. <el-button size="small" style="width: 80px" @click="reset" icon="iconfont icon-shuaxin">刷新</el-button>
  16. <el-button v-show="!onlyRead" size="small" style="width: 80px" @click="undo" icon="iconfont icon-undo">撤销</el-button>
  17. </div>
  18. <qrcode :dialog="myDialog" :addBody="true" ref="qrcode"></qrcode>
  19. <upload-files-dialog ref="upload" @changeFile="fileChange" :keysArr="filesArr" firmDataType="row"
  20. :dialog="myDialog"></upload-files-dialog>
  21. <upload-img-dialog :read="onlyRead ? true : false" @changeFile="imgChange" :keysArr="imgsArr" firmDataType="row" :dialog="myDialog"></upload-img-dialog>
  22. <pic-dialog :dialog="myDialog" :keysArr="picsArr" @change="changePics"></pic-dialog>
  23. <div class="center middle_sty" style="height: 91%" v-show="!mess.deviceId && (!tableData || !tableData.length)">
  24. <p><i class="icon-wushuju iconfont"></i>请选择系统类型</p>
  25. </div>
  26. <div class="center middle_sty" style="height: 91%" v-show="mess.deviceId && (!tableData || !tableData.length)">
  27. <p><i class="icon-wushuju iconfont"></i>暂无数据</p>
  28. </div>
  29. <div v-show="mess.deviceId && tableData && tableData.length" v-loading="loading" id="handsontable"
  30. ref="handsontable"></div>
  31. <div v-show="mess.deviceId && tableData && tableData.length" class="right">
  32. <my-pagination @change="getTableData" :page="page"></my-pagination>
  33. </div>
  34. <!-- <dialog-assets :assetType="[this.mess.deviceId]" @close="getClose" v-if="myDialog.addDevice" ref="assets" :dialog="myDialog"></dialog-assets> -->
  35. <details-dialog :iframeSrc="iframeSrc" v-if="myDialog.details" :dialog="myDialog"></details-dialog>
  36. <system-relevance @close="reset" :id="systemId" :dialog="myDialog"></system-relevance>
  37. <!-- 不支持的输入方式 -->
  38. <el-dialog title="临时维护信息点" :visible.sync="myDialog.update" @close="handleCloseUpdate" width="670px">
  39. <el-row>
  40. 该信息点未定义对应组件,现在维护数据不确定后续是否可用。如确实需要维护,请点击
  41. <el-link @click="updateInputShow = true" type="primary" :underline="false">继续维护</el-link>
  42. </el-row>
  43. <el-row style="margin-top:20px;" v-show="updateInputShow">
  44. <el-input type="textarea" :autosize="{ minRows: 4, maxRows: 8}" placeholder="请输入内容"
  45. v-model="updateInput"></el-input>
  46. </el-row>
  47. <span slot="footer" class="dialog-footer">
  48. <el-button @click="myDialog.update = false">取 消</el-button>
  49. <el-button type="primary" @click="handleClickUpdate">确 认</el-button>
  50. </span>
  51. </el-dialog>
  52. <!-- 关联楼层 -->
  53. <editSysfloor ref="editFloor" @relateSuccess="relateSuccess"></editSysfloor>
  54. <!-- 新增系统 -->
  55. <el-dialog title="确定新增系统的类型" :visible.sync="myDialog.addDevice" width="30%">
  56. <el-row>
  57. <my-cascader ref="cascader" @change="changeAddType" :all="true"></my-cascader>
  58. </el-row>
  59. <span slot="footer" class="dialog-footer">
  60. <el-button type="primary" @click="toAddDevice">下 一 步</el-button>
  61. </span>
  62. </el-dialog>
  63. </div>
  64. </template>
  65. <script>
  66. import {BeatchQueryParam, deleteGeneralSys, querySysLinkBuild, updateGeneralSys} from "@/api/scan/request"
  67. import {getDataDictionary} from "@/api/dict";
  68. import myCascader from "@/components/ledger/lib/system";
  69. import tools from "@/utils/scan/tools";
  70. import handsonUtils from "@/utils/scan/hasontableUtils"
  71. import showTools from "@/utils/handsontable/notShow"
  72. import qrcode from "@/components/business_space/lib/qrcode"
  73. import uploadFilesDialog from "@/components/dialogs/list/filesDialog"
  74. import uploadImgDialog from "@/components/dialogs/list/uploadImgDialog"
  75. import picDialog from "@/components/business_space/dialogs/list/picDialog"
  76. import myPagination from "@/components/common/myPagination"
  77. import detailsDialog from "@/components/business_space/lib/detailsDia"
  78. import systemRelevance from "@/components/ledger/tableTransfers"
  79. import Handsontable from "handsontable-pro"
  80. import text from "@/utils/handsontable/mainText"
  81. import 'handsontable-pro/dist/handsontable.full.css'
  82. import editSysfloor from "@/components/ledger/lib/editSysFloor";
  83. import {mapGetters} from "vuex";
  84. export default {
  85. components: {
  86. qrcode, //二维码页面
  87. uploadFilesDialog,
  88. uploadImgDialog,
  89. picDialog,
  90. myPagination,
  91. detailsDialog,
  92. systemRelevance,
  93. myCascader,
  94. editSysfloor
  95. },
  96. computed: {
  97. ...mapGetters("layout", ["projectId", "secret", "userId", "group_code"]),
  98. showTypes() {
  99. return this.onlyRead ?
  100. [{value: "Visible", label: '只看采集信息'}, {value: "all", label: '全部'}] :
  101. [{value: "Visible", label: '只看采集信息'}, {value: "all", label: '全部'}]
  102. }
  103. },
  104. data() {
  105. return {
  106. options: [{
  107. value: true,
  108. label: '只读模式'
  109. }, {
  110. value: false,
  111. label: '编辑模式'
  112. }],
  113. tableData: [],
  114. mess: {},
  115. tableHeader: null,
  116. page: {
  117. size: 50,
  118. sizes: [10, 30, 50, 100, 150, 200],
  119. total: 0,
  120. currentPage: 1
  121. },
  122. myDialog: {
  123. qrcode: false, //二维码弹窗
  124. uploadFiles: false,//上传文件
  125. uploadImgs: false,//上传单个图片
  126. pic: false, //多个图片
  127. addDevice: false,
  128. details: false,//详情页
  129. relevance: false,//关联设备
  130. update: false,//临时维护信息点
  131. },
  132. row: null,//被修改的row
  133. filesArr: [],//保存临时的文件key
  134. messKey: null,
  135. imgsArr: [],//临时保存的图片key数组
  136. picsArr: [],//临时设备图片keys数组
  137. noShowList: ["SysID", "SysName"],
  138. copyMain: null,
  139. iframeSrc: "",
  140. systemId: "",
  141. onlyRead: true,
  142. showType: 'Visible',
  143. linkNameFalg: false,
  144. qrcodeUrl: "",//二维码图片地址
  145. loading: false,
  146. addData: {}, //添加设备选择的设备类型
  147. inputMap: {
  148. flowBuild: {
  149. editable: true,
  150. code: "flowBuild",
  151. name: "建筑楼层",
  152. path: "flowBuild",
  153. category: 'STATIC',
  154. dataType: "ENUM"
  155. }
  156. }, //信息点和输入方式映射表
  157. updateInputShow: false, //是否显示临时维护输入框
  158. updateInfoPoint: '',//临时维护信息点
  159. updateInput: '', //临时维护信息点值
  160. };
  161. },
  162. created() {
  163. },
  164. mounted() {
  165. },
  166. methods: {
  167. //触发父组件change
  168. getClose(val) {
  169. this.$emit("close", val)
  170. },
  171. //获取表头
  172. getHeaderData(code) {
  173. this.mess = code;
  174. if (this.mess.deviceId) {
  175. let params = {
  176. type: this.mess.deviceId,
  177. orders: "sort asc, name desc",
  178. }
  179. getDataDictionary(params, res => {
  180. this.tableHeader = res.content;
  181. this.codeToDataSource = {}
  182. this.tableHeader.forEach(item => {
  183. if (item.path) {
  184. this.inputMap[item.path] = item
  185. }
  186. if (item.dataSource) {
  187. try {
  188. this.codeToDataSource[item.code] = {}
  189. item.dataSource.forEach(dic => {
  190. this.codeToDataSource[item.code][dic.code] = dic.name;
  191. })
  192. } catch (e) {
  193. console.log(e);
  194. }
  195. }
  196. })
  197. this.getTableData()
  198. });
  199. }
  200. },
  201. changeWatch() {
  202. this.reset()
  203. },
  204. //获取主体数据
  205. getTableData() {
  206. let _this = this
  207. this.loading = true
  208. if (!!this.mess.deviceId) {
  209. let param = {
  210. data: {
  211. pageSize: this.page.size,
  212. orders: "createTime desc, localName desc, localId desc, id desc",
  213. pageNumber: this.page.currentPage,
  214. filters: `classCode='${this.mess.deviceId}'`
  215. }
  216. }
  217. if (this.mess.buildId == "noKnow") {
  218. param.buildingId = 1;
  219. } else if (this.mess.buildId && this.mess.buildId != "all") {
  220. param.buildingId = this.mess.buildId;
  221. }
  222. if (this.mess.floorId == "noKnow") {
  223. param.floorId = 1;
  224. } else if (this.mess.floorId && this.mess.floorId != "all") {
  225. param.floorId = this.mess.floorId;
  226. }
  227. querySysLinkBuild(param, res => {
  228. this.loading = false;
  229. _this.tableData = res.content;
  230. _this.copyMain = tools.deepCopy(res.content);
  231. _this.page.total = res.total;
  232. if (res.content && res.content.length) {
  233. if (this.onlyRead) {
  234. this.getBatch(res.content)
  235. }
  236. _this.initTable();
  237. }
  238. })
  239. }
  240. },
  241. //撤回
  242. undo() {
  243. if (this.tableData.length) {
  244. this.hot.undo();
  245. }
  246. },
  247. //刷新
  248. reset() {
  249. if (this.mess.deviceId) {
  250. this.getTableData();
  251. } else {
  252. this.$message({
  253. message: '请选择系统类型',
  254. type: 'warning'
  255. });
  256. }
  257. },
  258. //添加设备
  259. addDevice() {
  260. this.myDialog.addDevice = true
  261. if (this.mess.deviceId) {
  262. this.$nextTick(() => {
  263. this.$refs.cascader.setValue(this.mess.deviceId)
  264. })
  265. }
  266. },
  267. //下一步
  268. toAddDevice() {
  269. if (this.addData.category) {
  270. this.$router.push({
  271. path: "/ledger/systemadd",
  272. query: this.addData
  273. });
  274. }
  275. },
  276. //选择设备类型-添加设备
  277. changeAddType(val) {
  278. this.addData.category = val.classCode;
  279. this.addData.categoryName = val.categoryName;
  280. this.addData.showType = this.showType;
  281. console.log('val',val,this.addData)
  282. },
  283. //格式化表头
  284. formatHeaderData(list) {
  285. let arr = tools.copyArr(list)
  286. let data = showTools.headerTextFilter(arr, 'system', this.onlyRead, this.showType)
  287. data.unshift("操作");
  288. if (this.showType == "all") {
  289. data.splice(3, 0, "所属建筑楼层")
  290. }
  291. return data;
  292. },
  293. //格式化表内容
  294. formatHeaderType(list) {
  295. let arr = tools.copyArr(list)
  296. let data = showTools.headerTypeFilter(arr, 'system', this.onlyRead, this.showType)
  297. data.unshift(
  298. {
  299. data: "caozuo",
  300. renderer: tools.lookDetails,
  301. readOnly: true
  302. },
  303. // {
  304. // data: "Count",
  305. // renderer: tools.num,
  306. // readOnly: true
  307. // }
  308. );
  309. if (this.onlyRead) {
  310. data.map(item => {
  311. item.readOnly = true
  312. })
  313. }
  314. if (this.showType == "all") {
  315. data.splice(3, 0, {
  316. data: "buildingFloorInfoList",
  317. renderer: text.sysInBuildFloor,
  318. readOnly: this.onlyRead
  319. })
  320. }
  321. return data;
  322. },
  323. //获取动态参数
  324. getBatch(data) {
  325. let param = {
  326. groupCode: this.group_code,
  327. appId: "datacenter",
  328. projectId: this.projectId,
  329. data: []
  330. };
  331. //一级遍历list
  332. this.tableHeader.map(head => {
  333. //如果一级标签为动态参数或者设定参数放入数据等待请求
  334. if (head.category != 'STATIC') {
  335. data.map(item => {
  336. let cur = tools.dataForKey(item, head.path);
  337. if (cur) {
  338. param.data.push({
  339. objectId: item.id,
  340. infoCode: head.code
  341. });
  342. }
  343. });
  344. }
  345. })
  346. if (param.data.length) {
  347. BeatchQueryParam(param, res => {
  348. if (!this.onlyRead) {
  349. return false
  350. }
  351. this.tableData = data.map(item => {
  352. res.data.map(child => {
  353. if (item.id == child.objectId) {
  354. if (!!child.data || child.data == 0) {
  355. this.tableHeader.map(head => {
  356. if (head.code == child.infoCode) {
  357. let contentVal = child.data
  358. if (this.codeToDataSource[child.infoCode]) {
  359. contentVal = this.codeToDataSource[child.infoCode][child.data]
  360. }
  361. tools.setDataForKey(item, head.path, contentVal);
  362. }
  363. });
  364. } else {
  365. this.tableHeader.map(head => {
  366. if (head.code == child.infoCode) {
  367. tools.setDataForKey(
  368. item,
  369. head.path,
  370. child.error ? child.value ? "表号功能号格式错误" : "表号功能号不存在" : "暂未采集到实时数据"
  371. );
  372. }
  373. });
  374. }
  375. }
  376. })
  377. return item
  378. })
  379. this.hot.loadData(this.tableData)
  380. })
  381. }
  382. },
  383. //初始化插件
  384. initTable() {
  385. var container = document.getElementById("handsontable");
  386. let winHeight = document.documentElement.clientHeight;
  387. if (this.hot) {
  388. this.hot.destroy();
  389. this.hot = null;
  390. }
  391. this.hot = new Handsontable(container, {
  392. data: this.tableData,
  393. fixedColumnsLeft: 3,
  394. colHeaders: this.formatHeaderData(this.tableHeader), //表头文案
  395. columns: this.formatHeaderType(this.tableHeader), //数据显示格式
  396. filters: true,
  397. maxRows: this.tableData.length,
  398. height: winHeight - 335,
  399. columnSorting: true, //添加排序
  400. sortIndicator: true, //添加排序
  401. renderAllRows: true,
  402. // observeChanges: false, //启用observeChanges插件
  403. // colWidths: 200,
  404. autoColumnSize: true,
  405. language: "zh-CN",
  406. fillHandle: 'vertical', //允许纵向填充
  407. manualColumnResize: true,
  408. manualColumnMove: true,
  409. dropdownMenu: [
  410. "filter_by_condition",
  411. "filter_by_value",
  412. "filter_action_bar"
  413. ],
  414. contextMenu: this.onlyRead ? false : {
  415. items: {
  416. remove_row: {
  417. name: "删除该系统"
  418. }
  419. }
  420. },
  421. // 事件
  422. afterChange: this.handleUpdataTable, //修改后
  423. afterFilter: this.trimmedRows, //排序前
  424. afterRemoveRow: this.handleDeleteTableRow, //右键删除
  425. afterOnCellMouseDown: this.eventClick //鼠标点击
  426. });
  427. let pro = document.getElementById("hot-display-license-info");
  428. if (!!pro) {
  429. pro.parentNode.removeChild(pro);
  430. }
  431. this.isLoading = false;
  432. },
  433. //表格中的点击
  434. eventClick(el, rowArr) {
  435. //点击的是表头
  436. if (rowArr.row < 0) {
  437. return;
  438. }
  439. //被筛选过后的数组
  440. let trimmedArr = this.trimmedRows();
  441. //是否启用了排序
  442. let isSort = this.hot.getPlugin("columnSorting").isSorted();
  443. if (trimmedArr.length && isSort) {
  444. let sortArr = this.myHotArr.getPlugin("columnSorting").rowsMapper
  445. .__arrayMap;
  446. let infos = this.tableData[trimmedArr[sortArr[rowArr.row]]];
  447. this.getInfors(infos, { row: sortArr[rowArr.row], col: rowArr.col });
  448. } else if (isSort) {
  449. //排序后的数组
  450. let sortArr = this.hot.getPlugin("columnSorting").rowsMapper.__arrayMap;
  451. let infos = this.tableData[sortArr[rowArr.row]];
  452. this.getInfors(infos, { row: sortArr[rowArr.row], col: rowArr.col });
  453. } else if (trimmedArr.length) {
  454. let infos = this.tableData[trimmedArr[rowArr.row]];
  455. this.getInfors(infos, { row: trimmedArr[rowArr.row], col: rowArr.col });
  456. } else {
  457. let infos = this.tableData[rowArr.row];
  458. this.getInfors(infos, rowArr);
  459. }
  460. },
  461. handleUpdataTable(changeData, source) {
  462. if (!this.onlyRead && source != 'ObserveChanges.change') {
  463. if (changeData) {
  464. let trimmedArr = this.trimmedRows();
  465. let param = handsonUtils.getParam(changeData, source, this.hot, trimmedArr);
  466. let data = [];
  467. for (let i = 0; i < param.length; i++) {
  468. data.push(param[i]);
  469. }
  470. //如果data中包含/且data长度为1,将其转换成.
  471. if (changeData.length == 1 && changeData[0][1].indexOf("/") > 0) {
  472. changeData[0][1] = changeData[0][1].split("/").join(".")
  473. }
  474. //存在data进行修改请求
  475. if (data && data.length) {
  476. this.updateBusiness(data, changeData);
  477. }
  478. }
  479. }
  480. },
  481. //删除资产
  482. async handleDeleteTableRow() {
  483. this.$confirm('此操作将删除该系统, 是否继续?', '提示', {
  484. confirmButtonText: '确定',
  485. cancelButtonText: '取消',
  486. type: 'warning'
  487. }).then(() => {
  488. let params = tools.differenceArr(this.tableData, this.copyMain)
  489. let param = []
  490. params.map(item => {
  491. param.push({ id: item.id })
  492. })
  493. this.removeSys(param)
  494. }).catch(() => {
  495. this.getTableData()
  496. this.$message('取消删除');
  497. });
  498. },
  499. async removeSys(param) {
  500. await deleteGeneralSys(param, res => {
  501. this.$message.success("删除成功")
  502. this.$emit('close', '')
  503. this.getTableData()
  504. })
  505. },
  506. // 修改
  507. updateBusiness(data, change) {
  508. let param = {
  509. content: [],
  510. projection: [],
  511. nullItems: []
  512. }, keyList = [];
  513. //生成要修改字段列表
  514. change.map(item => {
  515. let key = item[1].split(".")[0]
  516. if (item[1] && keyList.indexOf(key) == -1) {
  517. keyList.push(key);
  518. }
  519. if (item[1] && item[3] == "" && param.projection.indexOf(key) == -1) {
  520. param.projection.push(key);
  521. keyList.push(item[1])
  522. }
  523. // 保存置空字段
  524. if (item[1] && item[3] == "" && param.nullItems.indexOf(item[1]) == -1) {
  525. param.nullItems.push(item[1])
  526. }
  527. });
  528. //生成对应修改数据
  529. data.map((item, index) => {
  530. keyList.map(value => {
  531. let itemData = tools.dataForKey(item, value);
  532. tools.setDataForKey(item, value, itemData == "" ? null : itemData);
  533. });
  534. param.content.push(item);
  535. });
  536. updateGeneralSys(param, res => {
  537. });
  538. },
  539. //获取到了正确的信息
  540. getInfors(infos, row) {
  541. //其他的开始判断
  542. let val = this.hot.colToProp(row.col);
  543. let inputData = this.inputMap[val];
  544. this.systemId = infos.SysID;
  545. this.row = row.row
  546. this.messKey = val
  547. switch (val) {
  548. //操作
  549. case 'caozuo':
  550. // window.open(`http://adm.sagacloud.cn:8058/system?id=${infos.id}&pid=${this.projectId}&secret=${this.secret}`,"_blank")
  551. // this.$message("开发中...")
  552. console.log(infos)
  553. this.$router.push({
  554. path: "/ledger/systemDetail",
  555. query: { SysID: infos.id, Name: infos.localName || infos.name, SysType: infos.classCode }
  556. })
  557. return false
  558. //设备二维码图片
  559. // case 'EquipQRCode':
  560. case "defaultQRCode":
  561. this.qrcodeUrl = this.tableData[row.row].EquipQRCode;
  562. if (!!this.qrcodeUrl) {
  563. this.myDialog.qrcode = true;
  564. } else {
  565. this.$message("此设备没有设备二维码");
  566. }
  567. return false
  568. //关联设备数量
  569. case 'count':
  570. if (!this.onlyRead) {
  571. this.myDialog.relevance = true
  572. }
  573. return false
  574. case 'buildingFloorInfoList':
  575. if (!this.onlyRead) {
  576. this.$refs.editFloor.showDialog(this.tableData[row.row]);
  577. }
  578. return false
  579. //系统图(F2)
  580. case "infos.systemChart":
  581. let SSPPdata = tools.dataForKey(this.tableData[row.row], val);
  582. this.imgsArr = SSPPdata ? SSPPdata : [];
  583. if (!this.onlyRead || this.imgsArr.length) {
  584. this.myDialog.uploadImgs = true;
  585. }
  586. return false;
  587. default:
  588. break;
  589. }
  590. if (!this.onlyRead && !inputData.editable) {
  591. this.$confirm('该信息点的值为自动生成,不可人工维护!', '提示', {
  592. confirmButtonText: '我知道了',
  593. showCancelButton: false,
  594. type: 'warning',
  595. center: true
  596. }).then(() => {
  597. return false;
  598. });
  599. }
  600. if (!this.onlyRead && showTools.inputModeArr.indexOf(inputData.dataType) == '-1') {
  601. this.updateInfoPoint = val;
  602. this.updateInput = tools.dataForKey(this.tableData[row.row], val);
  603. this.myDialog.update = true;
  604. return false;
  605. }
  606. },
  607. //关闭临时维护弹窗回调
  608. handleCloseUpdate() {
  609. this.updateInputShow = false
  610. this.updateInfoPoint = ''
  611. this.updateInput = ''
  612. },
  613. //更新临时维护信息点
  614. handleClickUpdate() {
  615. // this.$message("更新成功");
  616. tools.setDataForKey(this.tableData[this.row], this.updateInfoPoint, this.updateInput)
  617. this.handleUpdataTable([[this.row, this.updateInfoPoint, null, this.updateInput]], "edit")
  618. this.updateInputShow = false
  619. this.myDialog.update = false
  620. this.updateInput = ''
  621. },
  622. //关联建筑楼层成功
  623. relateSuccess(data) {
  624. this.getTableData()
  625. // tools.setDataForKey(this.tableData[this.row], "BuildingFloorInfoList", data)
  626. },
  627. //获取被筛选掉的行号
  628. trimmedRows() {
  629. // var plugin = hot.getPlugin('trimRows').trimmedRows;//获取被筛选掉的行号
  630. var plugin = this.hot.getPlugin("trimRows").trimmedRows;
  631. let dataLength = this.tableData.length;
  632. let dataArr = new Array();
  633. for (let i = 0; i < dataLength; i++) {
  634. dataArr.push(i);
  635. }
  636. if (plugin.length <= 0) {
  637. dataArr = undefined;
  638. } else {
  639. dataArr = this.array_diff(dataArr, plugin);
  640. }
  641. return dataArr || [];
  642. // var DataArray = new Array();
  643. // for (var i = 0; i < plugin.length; i++) {
  644. // // 通过行号获取数据
  645. // DataArray.push(this.hot.getSourceDataAtRow(plugin[i]));
  646. // }
  647. },
  648. //上传文件弹窗触发事件
  649. fileChange(keys) {
  650. this.setDataToMain(keys, this.messKey, this.row);
  651. },
  652. //上传图片弹窗触发事件
  653. imgChange(keys) {
  654. this.setDataToMain(keys, this.messKey, this.row);
  655. },
  656. //设备图片弹窗改变事件
  657. changePics(keys) {
  658. this.setDataToMain(keys, this.messKey, this.row);
  659. },
  660. //判断是否有值,有值赋值
  661. setDataToMain(data, key, row) {
  662. if (!!data && data != "--") {
  663. if (!!this.tableData[row]) {
  664. tools.setDataForKey(this.tableData[row], key, data);
  665. this.handleUpdataTable([[row, key, null, data]], "edit");
  666. } else {
  667. this.tableData[row] = {};
  668. tools.setDataForKey(this.tableData[row], key, data);
  669. }
  670. } else {
  671. tools.setDataForKey(this.tableData[row], key, "");
  672. }
  673. }
  674. },
  675. watch: {
  676. projectId() {
  677. this.tableData = []
  678. this.mess.deviceId = null
  679. this.page.total = 0
  680. },
  681. showTypes: {
  682. handler(newName, oldName) {
  683. if (newName && newName[0] && newName[0].value) {
  684. this.showType = newName[0].value
  685. } else {
  686. this.showType = "Visible"
  687. }
  688. },
  689. immediate: true,
  690. deep: true
  691. }
  692. }
  693. };
  694. </script>
  695. <style lang="less">
  696. .hanson-bar {
  697. height: 40px;
  698. padding: 5px 0;
  699. font-size: 14px;
  700. overflow: hidden;
  701. margin-top: 0;
  702. line-height: 40px;
  703. .iconfont {
  704. font-size: 12px;
  705. }
  706. }
  707. </style>