device.vue 43 KB

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