system.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723
  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"
  20. :dialog="myDialog"></upload-files-dialog>
  21. <upload-img-dialog @changeFile="imgChange" :keysArr="imgsArr" :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/business_space/dialogs/list/filesDialog"
  74. import uploadImgDialog from "@/components/business_space/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. this.hot.undo();
  244. },
  245. //刷新
  246. reset() {
  247. if (this.mess.deviceId) {
  248. this.getTableData();
  249. } else {
  250. this.$message({
  251. message: '请选择系统类型',
  252. type: 'warning'
  253. });
  254. }
  255. },
  256. //添加设备
  257. addDevice() {
  258. this.myDialog.addDevice = true
  259. if (this.mess.deviceId) {
  260. this.$nextTick(() => {
  261. this.$refs.cascader.setValue(this.mess.deviceId)
  262. })
  263. }
  264. },
  265. //下一步
  266. toAddDevice() {
  267. if (this.addData.category) {
  268. this.$router.push({
  269. path: "/ledger/systemadd",
  270. query: this.addData
  271. });
  272. }
  273. },
  274. //选择设备类型-添加设备
  275. changeAddType(val) {
  276. this.addData.category = val.classCode;
  277. this.addData.categoryName = val.categoryName;
  278. this.addData.showType = this.showType;
  279. console.log('val',val,this.addData)
  280. },
  281. //格式化表头
  282. formatHeaderData(list) {
  283. let arr = tools.copyArr(list)
  284. let data = showTools.headerTextFilter(arr, 'system', this.onlyRead, this.showType)
  285. data.unshift("操作");
  286. if (this.showType == "all") {
  287. data.splice(3, 0, "所属建筑楼层")
  288. }
  289. return data;
  290. },
  291. //格式化表内容
  292. formatHeaderType(list) {
  293. let arr = tools.copyArr(list)
  294. let data = showTools.headerTypeFilter(arr, 'system', this.onlyRead, this.showType)
  295. data.unshift(
  296. {
  297. data: "caozuo",
  298. renderer: tools.lookDetails,
  299. readOnly: true
  300. },
  301. // {
  302. // data: "Count",
  303. // renderer: tools.num,
  304. // readOnly: true
  305. // }
  306. );
  307. if (this.onlyRead) {
  308. data.map(item => {
  309. item.readOnly = true
  310. })
  311. }
  312. if (this.showType == "all") {
  313. data.splice(3, 0, {
  314. data: "buildingFloorInfoList",
  315. renderer: text.sysInBuildFloor,
  316. readOnly: this.onlyRead
  317. })
  318. }
  319. return data;
  320. },
  321. //获取动态参数
  322. getBatch(data) {
  323. let param = {
  324. groupCode: this.group_code,
  325. appId: "datacenter",
  326. projectId: this.projectId,
  327. data: []
  328. };
  329. //一级遍历list
  330. this.tableHeader.map(head => {
  331. //如果一级标签为动态参数或者设定参数放入数据等待请求
  332. if (head.category != 'STATIC') {
  333. data.map(item => {
  334. let cur = tools.dataForKey(item, head.path);
  335. if (cur) {
  336. param.data.push({
  337. objectId: item.id,
  338. infoCode: head.code
  339. });
  340. }
  341. });
  342. }
  343. })
  344. if (param.data.length) {
  345. BeatchQueryParam(param, res => {
  346. if (!this.onlyRead) {
  347. return false
  348. }
  349. this.tableData = data.map(item => {
  350. res.data.map(child => {
  351. if (item.id == child.objectId) {
  352. if (!!child.data || child.data == 0) {
  353. this.tableHeader.map(head => {
  354. if (head.code == child.infoCode) {
  355. let contentVal = child.data
  356. if (this.codeToDataSource[child.infoCode]) {
  357. contentVal = this.codeToDataSource[child.infoCode][child.data]
  358. }
  359. tools.setDataForKey(item, head.path, contentVal);
  360. }
  361. });
  362. } else {
  363. this.tableHeader.map(head => {
  364. if (head.code == child.infoCode) {
  365. tools.setDataForKey(
  366. item,
  367. head.path,
  368. child.error ? child.value ? "表号功能号格式错误" : "表号功能号不存在" : "暂未采集到实时数据"
  369. );
  370. }
  371. });
  372. }
  373. }
  374. })
  375. return item
  376. })
  377. this.hot.loadData(this.tableData)
  378. })
  379. }
  380. },
  381. //初始化插件
  382. initTable() {
  383. var container = document.getElementById("handsontable");
  384. let winHeight = document.documentElement.clientHeight;
  385. if (this.hot) {
  386. this.hot.destroy();
  387. this.hot = null;
  388. }
  389. this.hot = new Handsontable(container, {
  390. data: this.tableData,
  391. fixedColumnsLeft: 3,
  392. colHeaders: this.formatHeaderData(this.tableHeader), //表头文案
  393. columns: this.formatHeaderType(this.tableHeader), //数据显示格式
  394. filters: true,
  395. maxRows: this.tableData.length,
  396. height: winHeight - 335,
  397. columnSorting: true, //添加排序
  398. sortIndicator: true, //添加排序
  399. renderAllRows: true,
  400. // observeChanges: false, //启用observeChanges插件
  401. // colWidths: 200,
  402. autoColumnSize: true,
  403. language: "zh-CN",
  404. manualColumnResize: true,
  405. manualColumnMove: true,
  406. dropdownMenu: [
  407. "filter_by_condition",
  408. "filter_by_value",
  409. "filter_action_bar"
  410. ],
  411. contextMenu: this.onlyRead ? false : {
  412. items: {
  413. remove_row: {
  414. name: "删除该系统"
  415. }
  416. }
  417. },
  418. // 事件
  419. afterChange: this.handleUpdataTable, //修改后
  420. afterFilter: this.trimmedRows, //排序前
  421. afterRemoveRow: this.handleDeleteTableRow, //右键删除
  422. afterOnCellMouseDown: this.eventClick //鼠标点击
  423. });
  424. let pro = document.getElementById("hot-display-license-info");
  425. if (!!pro) {
  426. pro.parentNode.removeChild(pro);
  427. }
  428. this.isLoading = false;
  429. },
  430. //表格中的点击
  431. eventClick(el, rowArr) {
  432. //点击的是表头
  433. if (rowArr.row < 0) {
  434. return;
  435. }
  436. //被筛选过后的数组
  437. let trimmedArr = this.trimmedRows();
  438. //是否启用了排序
  439. let isSort = this.hot.getPlugin("columnSorting").isSorted();
  440. if (trimmedArr.length && isSort) {
  441. let sortArr = this.myHotArr.getPlugin("columnSorting").rowsMapper
  442. .__arrayMap;
  443. let infos = this.tableData[trimmedArr[sortArr[rowArr.row]]];
  444. this.getInfors(infos, { row: sortArr[rowArr.row], col: rowArr.col });
  445. } else if (isSort) {
  446. //排序后的数组
  447. let sortArr = this.hot.getPlugin("columnSorting").rowsMapper.__arrayMap;
  448. let infos = this.tableData[sortArr[rowArr.row]];
  449. this.getInfors(infos, { row: sortArr[rowArr.row], col: rowArr.col });
  450. } else if (trimmedArr.length) {
  451. let infos = this.tableData[trimmedArr[rowArr.row]];
  452. this.getInfors(infos, { row: trimmedArr[rowArr.row], col: rowArr.col });
  453. } else {
  454. let infos = this.tableData[rowArr.row];
  455. this.getInfors(infos, rowArr);
  456. }
  457. },
  458. handleUpdataTable(changeData, source) {
  459. if (!this.onlyRead && source != 'ObserveChanges.change') {
  460. if (changeData) {
  461. let trimmedArr = this.trimmedRows();
  462. let param = handsonUtils.getParam(changeData, source, this.hot, trimmedArr);
  463. let data = [];
  464. for (let i = 0; i < param.length; i++) {
  465. data.push(param[i]);
  466. }
  467. //如果data中包含/且data长度为1,将其转换成.
  468. if (changeData.length == 1 && changeData[0][1].indexOf("/") > 0) {
  469. changeData[0][1] = changeData[0][1].split("/").join(".")
  470. }
  471. //存在data进行修改请求
  472. if (data && data.length) {
  473. this.updateBusiness(data, changeData);
  474. }
  475. }
  476. }
  477. },
  478. //删除资产
  479. async handleDeleteTableRow() {
  480. this.$confirm('此操作将删除该系统, 是否继续?', '提示', {
  481. confirmButtonText: '确定',
  482. cancelButtonText: '取消',
  483. type: 'warning'
  484. }).then(() => {
  485. let params = tools.differenceArr(this.tableData, this.copyMain)
  486. let param = []
  487. params.map(item => {
  488. param.push({ id: item.id })
  489. })
  490. this.removeSys(param)
  491. }).catch(() => {
  492. this.getTableData()
  493. this.$message('取消删除');
  494. });
  495. },
  496. async removeSys(param) {
  497. await deleteGeneralSys(param, res => {
  498. this.$message.success("删除成功")
  499. this.$emit('close', '')
  500. this.getTableData()
  501. })
  502. },
  503. // 修改
  504. updateBusiness(data, change) {
  505. let param = {
  506. Content: [],
  507. Projection: []
  508. }, keyList = [];
  509. //生成要修改字段列表
  510. change.map(item => {
  511. let key = item[1].split(".")[0]
  512. if (item[1] && keyList.indexOf(key) == -1) {
  513. keyList.push(key);
  514. }
  515. if (item[1] && item[3] == "" && param.Projection.indexOf(key) == -1) {
  516. param.Projection.push(key);
  517. keyList.push(item[1])
  518. }
  519. });
  520. //生成对应修改数据
  521. data.map((item, index) => {
  522. keyList.map(value => {
  523. let itemData = tools.dataForKey(item, value);
  524. tools.setDataForKey(item, value, itemData == "" ? null : itemData);
  525. });
  526. param.Content.push(item);
  527. });
  528. updateGeneralSys(param, res => {
  529. });
  530. },
  531. //获取到了正确的信息
  532. getInfors(infos, row) {
  533. //其他的开始判断
  534. let val = this.hot.colToProp(row.col);
  535. let inputData = this.inputMap[val];
  536. this.systemId = infos.SysID
  537. this.row = row.row
  538. this.messKey = val
  539. switch (val) {
  540. //操作
  541. case 'caozuo':
  542. // window.open(`http://adm.sagacloud.cn:8058/system?id=${infos.id}&pid=${this.projectId}&secret=${this.secret}`,"_blank")
  543. // this.$message("开发中...")
  544. console.log(infos)
  545. this.$router.push({
  546. path: "/ledger/systemDetail",
  547. query: { SysID: infos.id, Name: infos.localName || infos.name, SysType: infos.classCode }
  548. })
  549. return false
  550. //设备二维码图片
  551. // case 'EquipQRCode':
  552. case "defaultQRCode":
  553. this.qrcodeUrl = this.tableData[row.row].EquipQRCode;
  554. if (!!this.qrcodeUrl) {
  555. this.myDialog.qrcode = true;
  556. } else {
  557. this.$message("此设备没有设备二维码");
  558. }
  559. return false
  560. //关联设备数量
  561. case 'count':
  562. if (!this.onlyRead) {
  563. this.myDialog.relevance = true
  564. }
  565. return false
  566. case 'buildingFloorInfoList':
  567. if (!this.onlyRead) {
  568. this.$refs.editFloor.showDialog(this.tableData[row.row]);
  569. }
  570. return false
  571. default:
  572. break;
  573. }
  574. if (!this.onlyRead && !inputData.editable) {
  575. this.$message("该信息点的值为自动生成,不可人工维护!");
  576. return false;
  577. }
  578. if (!this.onlyRead && showTools.inputModeArr.indexOf(inputData.dataType) == '-1') {
  579. this.updateInfoPoint = val;
  580. this.updateInput = tools.dataForKey(this.tableData[row.row], val);
  581. this.myDialog.update = true;
  582. return false;
  583. }
  584. },
  585. //关闭临时维护弹窗回调
  586. handleCloseUpdate() {
  587. this.updateInputShow = false
  588. this.updateInfoPoint = ''
  589. this.updateInput = ''
  590. },
  591. //更新临时维护信息点
  592. handleClickUpdate() {
  593. // this.$message("更新成功");
  594. tools.setDataForKey(this.tableData[this.row], this.updateInfoPoint, this.updateInput)
  595. this.handleUpdataTable([[this.row, this.updateInfoPoint, null, this.updateInput]], "edit")
  596. this.updateInputShow = false
  597. this.myDialog.update = false
  598. this.updateInput = ''
  599. },
  600. //关联建筑楼层成功
  601. relateSuccess(data) {
  602. this.getTableData()
  603. // tools.setDataForKey(this.tableData[this.row], "BuildingFloorInfoList", data)
  604. },
  605. //获取被筛选掉的行号
  606. trimmedRows() {
  607. // var plugin = hot.getPlugin('trimRows').trimmedRows;//获取被筛选掉的行号
  608. var plugin = this.hot.getPlugin("trimRows").trimmedRows;
  609. let dataLength = this.tableData.length;
  610. let dataArr = new Array();
  611. for (let i = 0; i < dataLength; i++) {
  612. dataArr.push(i);
  613. }
  614. if (plugin.length <= 0) {
  615. dataArr = undefined;
  616. } else {
  617. dataArr = this.array_diff(dataArr, plugin);
  618. }
  619. return dataArr || [];
  620. // var DataArray = new Array();
  621. // for (var i = 0; i < plugin.length; i++) {
  622. // // 通过行号获取数据
  623. // DataArray.push(this.hot.getSourceDataAtRow(plugin[i]));
  624. // }
  625. },
  626. //上传文件弹窗触发事件
  627. fileChange(keys) {
  628. this.setDataToMain(keys[0], this.messKey.split(".")[1], this.row)
  629. // tools.setItem(this.deviceType.code, this.tableData)
  630. },
  631. //上传图片弹窗触发事件
  632. imgChange(keys) {
  633. this.setDataToMain(keys[0], this.messKey.split(".")[1], this.row)
  634. // tools.setItem(this.deviceType.code, this.tableData)
  635. },
  636. //设备图片弹窗改变事件
  637. changePics(keys) {
  638. this.setDataToMain(keys, this.messKey.split(".")[1], this.row)
  639. // tools.setItem(this.deviceType.code, this.tableData)
  640. },
  641. //判断是否有值,有值赋值
  642. setDataToMain(data, key, row) {
  643. if (!!data && data != '--') {
  644. if (!!this.tableData[row].infos) {
  645. //falg确定每个的是否有值
  646. let falg = false
  647. if (!this.tableData[row].infos[key]) {
  648. falg = true
  649. }
  650. //铭牌照片特殊处理
  651. if (key == 'Nameplate') {
  652. this.tableData[row].infos[key] = {
  653. "systemId": "dataPlatform",
  654. "name": "铭牌照片",
  655. "type": "image",
  656. "key": data
  657. }
  658. } else {
  659. this.tableData[row].infos[key] = data
  660. }
  661. if (falg) {
  662. this.updateBusiness([this.tableData[row]], [[0, "infos." + key, null, data]])
  663. }
  664. } else {
  665. this.tableData[row].infos = {}
  666. if (key == 'Nameplate') {
  667. this.tableData[row].infos[key] = {
  668. "systemId": "dataPlatform",
  669. "name": "铭牌照片",
  670. "type": "image",
  671. "key": data
  672. }
  673. } else {
  674. this.tableData[row].infos[key] = data
  675. }
  676. }
  677. } else {
  678. this.tableData[row].infos[key] = ''
  679. }
  680. }
  681. },
  682. watch: {
  683. projectId() {
  684. this.tableData = []
  685. this.mess.deviceId = null
  686. this.page.total = 0
  687. },
  688. showTypes: {
  689. handler(newName, oldName) {
  690. if (newName && newName[0] && newName[0].value) {
  691. this.showType = newName[0].value
  692. } else {
  693. this.showType = ""
  694. }
  695. },
  696. immediate: true,
  697. deep: true
  698. }
  699. }
  700. };
  701. </script>
  702. <style lang="less">
  703. .hanson-bar {
  704. height: 40px;
  705. padding: 5px 0;
  706. font-size: 14px;
  707. overflow: hidden;
  708. margin-top: 0;
  709. line-height: 40px;
  710. .iconfont {
  711. font-size: 12px;
  712. }
  713. }
  714. </style>