device.vue 43 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354
  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 v-show="!onlyRead" 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" @change="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.assetType}" 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.getHeaderData(this.mess)
  308. },
  309. getEquipmentFamilyList() {
  310. getEquipmentFamily(res => {
  311. this.EquipmentList = res.Content
  312. })
  313. },
  314. //触发父组件change
  315. getClose(val) {
  316. this.$emit("close", val)
  317. },
  318. setGraphyId(graphyId, assetGroupList) {
  319. this.graphyId = graphyId
  320. this.assetGroupList = assetGroupList
  321. },
  322. //获取表头
  323. getHeaderData(code) {
  324. this.page.currentPage = 1
  325. this.mess = code
  326. this.changeCader()
  327. if(this.mess.deviceId){
  328. getTableHeader({
  329. code: this.mess.deviceId,
  330. ProjId: this.projectId
  331. }).then(res => {
  332. this.headers = res.data.Content;
  333. this.getMain()
  334. });
  335. }
  336. },
  337. //获取主体数据
  338. getMain() {
  339. let _this = this
  340. this.loading = true
  341. let param = {
  342. data: {
  343. customInfo: true,
  344. "limit": { // 分页查询, 选填.
  345. "skip": this.page.size * (this.page.currentPage - 1), // 跳过多少数据
  346. "count": this.page.size // 查询跳过300条数据之后的50条 (默认按照创建时间从大-->小排序)
  347. },
  348. id: "",
  349. type: [this.mess.deviceId]
  350. },
  351. secret: this.secret,
  352. ProjId: this.projectId
  353. }
  354. if (this.mess.buildId == "all") {
  355. param.data.id = this.mess.ProjId
  356. } else if (this.mess.buildId == "noKnow") {
  357. param.data.id = this.mess.ProjId
  358. param.data.direct = true
  359. } else if (this.mess.floorId == "noKnow") {
  360. param.data.id = this.mess.buildId
  361. param.data.direct = true
  362. } else if (this.mess.floorId && this.mess.floorId != "all") {
  363. param.data.id = this.mess.floorId
  364. } else if (this.mess.floorId == 'all') {
  365. param.data.id = this.mess.buildId
  366. } else {
  367. param.data.id = this.mess.ProjId
  368. }
  369. //type存在发送请求
  370. if (!!this.mess.deviceId) {
  371. getBillEquipList(param, res => {
  372. if (res.Result == "success") {
  373. this.loading = false
  374. res.Content = res.Content.map(item => {
  375. item.linkName = item.linkEquipLocalName || item.linkEquipName
  376. if (!!item.linkFamily) {
  377. this.assetGroupList.map(child => {
  378. if (item.linkFamily == child.code) {
  379. item.linkFamily = child.name
  380. }
  381. })
  382. }
  383. if (!!item.infos.DPManufacturerID) {
  384. item.infos.DPManufacturerID = item.infos.DPManufacturerID + "-" + item.infos.Brand + "/" + item.infos.Specification
  385. }
  386. if (!!item.infos.DPSupplierID) {
  387. item.infos.DPSupplierID = item.infos.DPSupplierID + "-" + item.infos.Supplier
  388. }
  389. if (!!item.infos.DPMaintainerID) {
  390. item.infos.DPMaintainerID = item.infos.DPMaintainerID + "-" + item.infos.Maintainer
  391. }
  392. if (!!item.infos.DPInsurerID) {
  393. item.infos.DPInsurerID = item.infos.DPInsurerID + "-" + item.infos.Insurer
  394. }
  395. return item
  396. })
  397. if (_this.onlyRead) {
  398. this.getBatch(res.Content)
  399. }
  400. _this.main = res.Content
  401. _this.copyMain = tools.deepCopy(res.Content)
  402. _this.page.total = res.TotalCount
  403. if (!!_this.hot) {
  404. _this.hot.destroy();
  405. _this.hot = null;
  406. }
  407. if (!!res.Content && res.Content.length) {
  408. _this.initHot();
  409. }
  410. } else {
  411. this.loading = false
  412. this.$message.error("请求错误:" + res.ResultMsg)
  413. }
  414. })
  415. }
  416. },
  417. //获取动态参数
  418. getBatch(data) {
  419. let param = {
  420. secret: this.secret,
  421. ProjId: this.projectId,
  422. data: {
  423. criterias: []
  424. }
  425. }
  426. if (!!data && data.length) {
  427. //一级遍历list
  428. data.map(item => {
  429. if (!!item.infos) {
  430. // 二级遍历对象infos
  431. for (let key in item.infos) {
  432. //判断是否是设定参数和动态参数
  433. if (!!item.infos[key]) {
  434. this.headers.map(child => {
  435. //如果一级标签为动态参数或者设定参数放入数据等待请求
  436. if (key == child.InfoPointCode && (child.InputMode == "L" || child.InputMode == "L1" || child.InputMode == "L2" || child.InputMode == "M")) {
  437. param.data.criterias.push({
  438. id: item.id,
  439. code: key
  440. })
  441. }
  442. })
  443. }
  444. }
  445. }
  446. })
  447. if (param.data.criterias.length) {
  448. BeatchQueryParam(param, res => {
  449. if (!this.onlyRead) {
  450. return false
  451. }
  452. this.main = data.map(item => {
  453. res.Content.map(child => {
  454. if (item.id == child.id) {
  455. if (!!child.data || child.data == 0) {
  456. item.infos[child.code] = child.data
  457. } else {
  458. item.infos[child.code] = child.error ? "表号功能号格式错误" : "表号功能号不存在"
  459. }
  460. }
  461. })
  462. return item
  463. })
  464. this.hot.loadData(this.main)
  465. })
  466. }
  467. }
  468. },
  469. changeAssetsFalg() {
  470. if (this.linkNameFalg) {
  471. this.linkNameFalg = false
  472. } else {
  473. this.$confirm('<p>真的要在这里修改设备关联的资产么?</p><p>真的能通过列表信息找到想关联的资产么?</p><p>在这里修改关联的资产一定是因为之前关联错了要修改么?</p>', '提示', {
  474. dangerouslyUseHTMLString: true,
  475. confirmButtonText: '没错!我要改关联的资产',
  476. cancelButtonText: '我就点开看看',
  477. confirmButtonClass: 'cancelButtonClass',
  478. cancelButtonClass: 'cancelButtonClass'
  479. }).then(_ => {
  480. this.linkNameFalg = true
  481. }).catch(_ => {
  482. this.$message("取消")
  483. })
  484. }
  485. },
  486. //switch改变
  487. changeWatch() {
  488. this.reset()
  489. },
  490. //撤回
  491. undo() {
  492. this.hot.undo();
  493. },
  494. //刷新
  495. reset() {
  496. this.getMain();
  497. },
  498. //添加设备
  499. addDevice() {
  500. // this.$router.push({ path: '/ledger/addevice' })
  501. this.dialog.addDevice = true
  502. this.$nextTick(() => {
  503. this.$refs.assets.step(0)
  504. })
  505. },
  506. //下载
  507. download() {
  508. if (!this.onlyRead) {
  509. if (!!this.hot) {
  510. let fileName = this.mess.name + "-页数:" + this.page.currentPage + "-个数:" + this.main.length + "-总个数:" + this.page.total
  511. this.hot.getPlugin('exportFile').downloadFile("csv", { filename: fileName, columnHeaders: true, exportHiddenRows: true, exportHiddenColumns: true, rowHeaders: true })
  512. } else {
  513. this.$message("请确定存在表格")
  514. }
  515. } else {
  516. this.$message("下载需在编辑状态下")
  517. }
  518. },
  519. /**
  520. * 表头文案处理函数
  521. * @param list header数组数据
  522. *
  523. * @return 处理好的文案
  524. */
  525. delHeader(list) {
  526. let arr = tools.copyArr(list)
  527. // 如果不是只读状态,添加四大厂商选择
  528. if (!this.onlyRead) {
  529. arr = showTools.arrToArr(arr)
  530. }
  531. let readArr = ["A1", "A2", "B1", "C5", "D1", "D2", "X", "L", "L1", "L2", "F1", "F2", "M"]
  532. if (!this.onlyRead) {
  533. readArr.push("Own")
  534. }
  535. let data = showTools.changeHeader(arr, readArr, this.onlyRead, this.isWatch, this.allMess)
  536. data.unshift("操作", "当前关联的资产", "所属系统实例", "包含的部件");
  537. return data;
  538. },
  539. /**
  540. * 表头数据处理函数
  541. * @param list header数组数据
  542. *
  543. * @return 处理好的数据格式
  544. */
  545. getType(list) {
  546. let arr = tools.copyArr(list)
  547. // 如果不是只读状态,添加四大厂商选择
  548. if (!this.onlyRead) {
  549. arr = showTools.arrToArr(arr)
  550. }
  551. let data = showTools.showTypes(arr, this.onlyRead, this.isWatch, this.allMess)
  552. data.map(item => {
  553. if (
  554. item.data == "infos." + "Drawing" ||
  555. item.data == "infos." + "Pic" ||
  556. item.data == "infos." + "Nameplate" ||
  557. item.data == "infos." + "InstallPic" ||
  558. item.data == "infos." + "InstallDrawing"
  559. ) {
  560. item.renderer = text.picType
  561. }
  562. if (item.data == "infos." + "Archive" ||
  563. item.data == "infos." + "CheckReport" ||
  564. item.data == "infos." + "InsuranceFile") {
  565. item.renderer = text.fileType
  566. }
  567. })
  568. data.unshift(
  569. {
  570. data: "caozuo",
  571. renderer: tools.lookDetails,
  572. readOnly: true
  573. },
  574. {
  575. data: "linkName",
  576. readOnly: true
  577. }, {
  578. data: "linkSystem",
  579. renderer: text.systemList,
  580. readOnly: true
  581. }, {
  582. data: "Count",
  583. readOnly: true,
  584. renderer: tools.lookDetails
  585. }
  586. );
  587. if (!!this.onlyRead) {
  588. data.map(item => {
  589. item.readOnly = true
  590. })
  591. }
  592. return data;
  593. },
  594. messShow(item) {
  595. //二维码
  596. if (item.infopoint_code == "EquipQRCode") {
  597. return {
  598. data: "infos." + item.infopoint_code,
  599. renderer: text.lookQRCode,
  600. readOnly: true
  601. }
  602. }
  603. if (item.collection_cmpt_code == "Enum") {
  604. return {
  605. data: "infos." + item.infopoint_code,
  606. renderer: this.customDropdownRenderer,
  607. editor: "chosen",
  608. chosenOptions: {
  609. // multiple: true,//多选
  610. data: item.dataSource || ""
  611. }
  612. };
  613. } else if (item.collection_cmpt_code == "Num") {
  614. return {
  615. data: "infos." + item.infopoint_code,
  616. type: "numeric",
  617. numericFormat: {
  618. pattern: "0,0.00"
  619. // culture: 'de-DE' // use this for EUR (German),
  620. // more cultures available on http://numbrojs.com/languages.html
  621. }
  622. };
  623. } else if (item.collection_cmpt_code == "Time") {
  624. return {
  625. data: "infos." + item.infopoint_code,
  626. type: "date",
  627. dateFormat: "YYYY-MM-DD",
  628. correctFormat: true
  629. };
  630. } else if (item.collection_cmpt_code == "text") {
  631. return {
  632. data: "infos." + item.infopoint_code
  633. };
  634. } else if (
  635. (item.info_point_code == "设备ID" ||
  636. item.info_point_code == "设备名称")
  637. ) {
  638. return {
  639. data: "infos." + item.infopoint_code,
  640. readOnly: true
  641. };
  642. } else if (item.collection_cmpt_code == "checkBox") {
  643. return {
  644. data: "infos." + item.infopoint_code,
  645. renderer: this.customDropdownRenderer,
  646. editor: "chosen",
  647. chosenOptions: {
  648. multiple: true,//多选
  649. data: item.dataSource || ""
  650. }
  651. };
  652. } else {
  653. return {
  654. data: "infos." + item.infopoint_code,
  655. }
  656. }
  657. },
  658. changeItem(item) {
  659. //二维码
  660. if (item.infopoint_code == "EquipQRCode" && item.visible) {
  661. return {
  662. data: "infos." + item.infopoint_code,
  663. renderer: text.lookQRCode,
  664. readOnly: true
  665. }
  666. }
  667. //厂商选择
  668. // if ((item.infopoint_code == "Brand" || item.infopoint_code == "Specification") && item.visible) {
  669. // return {
  670. // data: "infos." + item.infopoint_code,
  671. // renderer: tools.lookDetails,
  672. // readOnly: true
  673. // }
  674. // }
  675. // if (item.infopoint_code == "SupplierContractID" && item.visible) {
  676. // return {
  677. // data: "infos." + item.infopoint_code,
  678. // renderer: tools.lookDetails,
  679. // readOnly: true
  680. // }
  681. // }
  682. if (item.infopoint_code == "InsuranceNum" && item.visible) {
  683. //选择保单
  684. return {
  685. data: "infos." + item.infopoint_code,
  686. renderer: tools.lookDetails,
  687. readOnly: true
  688. }
  689. }
  690. if ((item.infopoint_code == "InsuranceFile" || item.infopoint_code == "Archive") && item.visible) {
  691. return {
  692. data: "infos." + item.infopoint_code,
  693. renderer: tools.lookDetails,
  694. readOnly: true
  695. }
  696. }
  697. if (
  698. (
  699. item.infopoint_code == "InstallPic" ||
  700. item.infopoint_code == "InstallDrawing" ||
  701. item.infopoint_code == "Nameplate" ||
  702. item.infopoint_code == "Pic" ||
  703. item.infopoint_code == "Drawing"
  704. ) && item.visible
  705. ) {
  706. return {
  707. data: "infos." + item.infopoint_code,
  708. renderer: tools.lookDetails,
  709. readOnly: true
  710. }
  711. }
  712. if (
  713. (
  714. item.infopoint_code == "Maintainer" ||
  715. item.infopoint_code == "Supplier" ||
  716. item.infopoint_code == "Insurer" ||
  717. item.infopoint_code == "InsurerContactor"
  718. )
  719. && item.visible
  720. ) {
  721. return {
  722. data: "infos." + item.infopoint_code,
  723. }
  724. }
  725. if (item.collection_cmpt_code == "Enum" && item.visible) {
  726. return {
  727. data: "infos." + item.infopoint_code,
  728. renderer: this.customDropdownRenderer,
  729. editor: "chosen",
  730. chosenOptions: {
  731. // multiple: true,//多选
  732. data: item.dataSource || ""
  733. }
  734. };
  735. } else if (item.collection_cmpt_code == "Num" && item.visible) {
  736. return {
  737. data: "infos." + item.infopoint_code,
  738. type: "numeric",
  739. numericFormat: {
  740. pattern: "0,0.00"
  741. // culture: 'de-DE' // use this for EUR (German),
  742. // more cultures available on http://numbrojs.com/languages.html
  743. }
  744. };
  745. } else if (item.collection_cmpt_code == "Time" && item.visible) {
  746. return {
  747. data: "infos." + item.infopoint_code,
  748. type: "date",
  749. dateFormat: "YYYY-MM-DD",
  750. correctFormat: true
  751. };
  752. } else if (item.collection_cmpt_code == "text" && item.visible) {
  753. return {
  754. data: "infos." + item.infopoint_code
  755. };
  756. } else if (
  757. (item.info_point_code == "设备ID" ||
  758. item.info_point_code == "设备名称") && item.visible
  759. ) {
  760. return {
  761. data: "infos." + item.infopoint_code,
  762. readOnly: true
  763. };
  764. } else if (item.collection_cmpt_code == "checkBox" && item.visible) {
  765. return {
  766. data: "infos." + item.infopoint_code,
  767. renderer: this.customDropdownRenderer,
  768. editor: "chosen",
  769. chosenOptions: {
  770. multiple: true,//多选
  771. data: item.dataSource || ""
  772. }
  773. };
  774. } else if (item.collection_cmpt_code == "Own" && item.visible) {
  775. return {
  776. data: "infos." + item.infopoint_code,
  777. renderer: text.idType,
  778. }
  779. } else {
  780. return undefined
  781. }
  782. },
  783. //初始化插件
  784. initHot() {
  785. var container = document.getElementById("handsontable");
  786. let winHeight = document.documentElement.clientHeight;
  787. this.hot = new Handsontable(container, {
  788. data: this.main,
  789. fixedColumnsLeft: 6,
  790. colHeaders: this.delHeader(this.headers), //表头文案
  791. columns: this.getType(this.headers), //数据显示格式
  792. filters: true,
  793. maxRows: this.main.length,
  794. height: winHeight - 335,
  795. columnSorting: true, //添加排序
  796. sortIndicator: true, //添加排序
  797. renderAllRows: true,
  798. // colWidths: 200,
  799. autoColumnSize: true,
  800. language: "zh-CN",
  801. manualColumnResize: true,
  802. manualColumnMove: true,
  803. dropdownMenu: [
  804. "filter_by_condition",
  805. "filter_by_value",
  806. "filter_action_bar"
  807. ],
  808. contextMenu: {
  809. items: {
  810. remove_row: {
  811. name: "删除选中设备"
  812. }
  813. }
  814. },
  815. // 事件
  816. afterChange: this.tdChange, //修改后
  817. afterFilter: this.trimmedRows, //排序前
  818. afterRemoveRow: this.romoveFm, //右键删除
  819. afterOnCellMouseDown: this.eventClick //鼠标点击
  820. });
  821. let pro = document.getElementById("hot-display-license-info");
  822. if (!!pro) {
  823. pro.parentNode.removeChild(pro);
  824. }
  825. this.isLoading = false;
  826. },
  827. //表格中的点击
  828. eventClick(el, rowArr) {
  829. //点击的是表头
  830. if (rowArr.row < 0) {
  831. return;
  832. }
  833. //被筛选过后的数组
  834. let trimmedArr = this.trimmedRows();
  835. //是否启用了排序
  836. let isSort = this.hot.getPlugin("columnSorting").isSorted();
  837. if (trimmedArr.length && isSort) {
  838. let sortArr = this.myHotArr.getPlugin("columnSorting").rowsMapper
  839. .__arrayMap;
  840. let infos = this.main[trimmedArr[sortArr[rowArr.row]]];
  841. this.getInfors(infos, { row: sortArr[rowArr.row], col: rowArr.col }, el);
  842. } else if (isSort) {
  843. //排序后的数组
  844. let sortArr = this.hot.getPlugin("columnSorting").rowsMapper.__arrayMap;
  845. let infos = this.main[sortArr[rowArr.row]];
  846. this.getInfors(infos, { row: sortArr[rowArr.row], col: rowArr.col }, el);
  847. } else if (trimmedArr.length) {
  848. let infos = this.main[trimmedArr[rowArr.row]];
  849. this.getInfors(infos, { row: trimmedArr[rowArr.row], col: rowArr.col }, el);
  850. } else {
  851. let infos = this.main[rowArr.row];
  852. this.getInfors(infos, rowArr, el);
  853. }
  854. },
  855. tdChange(changeData, source) {
  856. if (!this.onlyRead) {
  857. if (changeData) {
  858. let trimmedArr = this.trimmedRows();
  859. let param = handsonUtils.getParam(changeData, source, this.hot, trimmedArr);
  860. let data = [];
  861. for (let i = 0; i < param.length; i++) {
  862. data.push(param[i]);
  863. }
  864. //如果data中包含/且data长度为1,将其转换成.
  865. if (changeData.length == 1 && changeData[0][1].indexOf("/") > 0) {
  866. changeData[0][1] = changeData[0][1].split("/").join(".")
  867. }
  868. //存在data进行修改请求
  869. if (data && data.length) {
  870. this.updateBusiness(data, changeData);
  871. }
  872. }
  873. }
  874. },
  875. //删除资产
  876. romoveFm() {
  877. let params = tools.differenceArr(this.main, this.copyMain)
  878. let _this = this
  879. if (params.length < 1) {
  880. return
  881. }
  882. let param = {
  883. secret: this.mess.secret,
  884. ProjId: this.mess.ProjId,
  885. data: {
  886. "criterias": []
  887. }
  888. }
  889. params.map(item => {
  890. param.data.criterias.push({ id: item.id })
  891. })
  892. this.$confirm("此操作将删除设备,是否继续?", "提示", {
  893. confirmButtonText: '确定',
  894. cancelButtonText: '取消',
  895. type: 'warning'
  896. }).then(() => {
  897. this.removeSys(param)
  898. }).catch(() => {
  899. this.reset()
  900. this.$message("取消删除")
  901. })
  902. // delProperty(param, res => {
  903. // _this.$message.success("删除成功")
  904. // _this.getMain()
  905. // })
  906. },
  907. async removeSys(param) {
  908. await delBatchList(param, res => {
  909. this.$message.success("删除成功")
  910. this.getMain()
  911. })
  912. },
  913. // 修改
  914. updateBusiness(data, change) {
  915. // data.map(item => {
  916. // if (!!item.flowBuild) {
  917. // item.building_id = item.flowBuild.split("-")[0]
  918. // item.floor_id = item.flowBuild.split("-")[1] || null
  919. // //不存在floor字段去除floor
  920. // if (!item.floor_id) {
  921. // delete item.floor_id
  922. // }
  923. // delete item.flowBuild
  924. // }
  925. // })
  926. let param = {
  927. ProjId: this.mess.ProjId,
  928. secret: this.mess.secret,
  929. data: {
  930. criterias: []
  931. }
  932. };
  933. //生成对应修改数据
  934. data.map((item, index) => {
  935. let arr = change[index][1].split(".");
  936. let info = {};
  937. info[arr[1]] = [{ value: item[arr[0]][arr[1]] != "" ? item[arr[0]][arr[1]] : null }];
  938. param.data.criterias.push({
  939. id: item.id,
  940. infos: info
  941. });
  942. });
  943. //对五大厂商进行特殊处理
  944. param.data.criterias.map(item => {
  945. if (!!item.infos.DPSupplierID) {
  946. item.infos.DPSupplierID[0].value = item.infos.DPSupplierID[0].value.split("-")[0]
  947. }
  948. if (!!item.infos.DPManufacturerID) {
  949. item.infos.DPManufacturerID[0].value = item.infos.DPManufacturerID[0].value.split("-")[0]
  950. }
  951. if (!!item.infos.DPInsurerID) {
  952. item.infos.DPInsurerID[0].value = item.infos.DPInsurerID[0].value.split("-")[0]
  953. }
  954. if (!!item.infos.DPMaintainerID) {
  955. item.infos.DPMaintainerID[0].value = item.infos.DPMaintainerID[0].value.split("-")[0]
  956. }
  957. if (!!item.infos.DPSpecificationID) {
  958. item.infos.DPSpecificationID[0].value = item.infos.DPSpecificationID[0].value.split("-")[0]
  959. }
  960. return item
  961. })
  962. updateBusiness(param).then(res => {
  963. });
  964. },
  965. //修改设备类型
  966. changeCader() {
  967. this.EquipmentList.map(item => {
  968. if (!!item.content && item.content.length) {
  969. item.content.map(child => {
  970. if (child.code == this.mess.deviceId) {
  971. this.deviceType.assetType = item.code
  972. this.deviceType.assetName = item.name
  973. }
  974. })
  975. }
  976. })
  977. },
  978. //获取到了正确的信息
  979. getInfors(infos, row, el) {
  980. //其他的开始判断
  981. let val = this.hot.colToProp(row.col);
  982. this.row = row.row
  983. this.messKey = val
  984. this.systemId = infos.id
  985. if (val == "caozuo") {
  986. // window.open(`http://adm.sagacloud.cn:8058/spread?id=${infos.id}&pid=${this.projectId}&secret=${this.secret}`,"_blank")
  987. this.$message("开发中...")
  988. // this.iframeSrc =
  989. // process.env.BASE_URL +
  990. // ":8889/#/details?perjectId=" +
  991. // this.projectId +
  992. // "&secret=" +
  993. // this.secret +
  994. // "&FmId=" +
  995. // infos.id +
  996. // "&type=1&code=" +
  997. // infos.category.substring(2, 6);
  998. // this.dialog.details = true
  999. }
  1000. //图片弹窗
  1001. if (
  1002. val == "infos.InstallPic" ||
  1003. val == "infos.InstallDrawing" ||
  1004. val == "infos.Nameplate" ||
  1005. val == "infos.Drawing"
  1006. ) {
  1007. if (this.onlyRead) {
  1008. this.dialog.lookPic = true
  1009. this.picsArr = this.main[row.row].infos ? (this.main[row.row].infos[val.split(".")[1]] ? this.main[row.row].infos[val.split(".")[1]] : []) : []
  1010. } else {
  1011. this.imgsArr = this.main[row.row].infos ? (this.main[row.row].infos[val.split(".")[1]] ? this.main[row.row].infos[val.split(".")[1]] : []) : []
  1012. this.dialog.uploadImgs = true
  1013. }
  1014. }
  1015. if (val == "linkSystem") {
  1016. this.dialog.systemType = true
  1017. }
  1018. //包含的部件字段
  1019. if (val == "Count") {
  1020. let partsVal = this.hot.getDataAtCell(row.row,row.col);//获取被点击的单元格的数据
  1021. if(this.onlyRead){
  1022. this.$router.push({ path: '/ledger/parts', query: { deviceId: infos.infos.EquipID }});
  1023. }else{
  1024. this.$router.push({ path: '/ledger/partsmanage', query: { deviceId: infos.infos.EquipID,typeId: this.mess.deviceId }});
  1025. }
  1026. }
  1027. if (val == "infos.Pic") {
  1028. this.picsArr = this.main[row.row].infos ? (this.main[row.row].infos[val.split(".")[1]] ? this.main[row.row].infos[val.split(".")[1]] : []) : []
  1029. if (this.onlyRead) {
  1030. this.dialog.lookPic = true
  1031. } else {
  1032. this.dialog.pic = true
  1033. }
  1034. }
  1035. if (val == "infos.InsuranceFile" || val == "infos.Archive" || val == "infos.CheckReport") {
  1036. this.filesArr = this.main[row.row].infos ? (this.main[row.row].infos[val.split(".")[1]] ? this.main[row.row].infos[val.split(".")[1]] : []) : []
  1037. this.dialog.uploadFiles = true
  1038. }
  1039. if (val == "linkName") {
  1040. if (this.linkNameFalg && !this.onlyRead) {
  1041. this.category = this.main[row.row]
  1042. this.dialog.changeRea = true
  1043. } else if(this.onlyRead) {
  1044. // window.open(`http://adm.sagacloud.cn:8058/asset?id=${infos.linkId}&pid=${this.projectId}&secret=${this.secret}`,"_blank")
  1045. this.$message("开发中...")
  1046. }
  1047. }
  1048. if (val == "infos.EquipQRCode") {
  1049. this.qrcodeUrl = this.main[row.row].infos.EquipQRCode
  1050. if (!!this.qrcodeUrl) {
  1051. this.dialog.qrcode = true;
  1052. } else {
  1053. this.$message("此设备没有设备二维码")
  1054. }
  1055. }
  1056. if (this.onlyRead) {
  1057. return
  1058. }
  1059. if (val == "infos.DPManufacturerID") {
  1060. if (!!infos.linkId) {
  1061. this.dialog.firm = true
  1062. } else {
  1063. this.$message("该设备无关联资产")
  1064. }
  1065. }
  1066. if (val == "infos.SupplierContractID") {
  1067. let falg = null
  1068. if (!!this.main[row.row].infos) {
  1069. if (!!this.main[row.row].infos.DPSupplierID) {
  1070. falg = this.main[row.row].infos.DPSupplierID.split("-")[0]
  1071. }
  1072. }
  1073. if (!!falg) {
  1074. this.id = falg
  1075. this.dialog.supply = true;
  1076. } else {
  1077. this.$message("请先选择供应商")
  1078. }
  1079. }
  1080. if (val == "infos.InsuranceNum") {
  1081. //选择保单
  1082. let falg = null
  1083. if (!!this.main[row.row].infos) {
  1084. if (!!this.main[row.row].infos.DPInsurerID) {
  1085. falg = this.main[row.row].infos.DPInsurerID.split("-")[0]
  1086. }
  1087. }
  1088. if (!!falg) {
  1089. this.id = falg
  1090. this.dialog.guarantee = true;
  1091. } else {
  1092. this.$message("请先选择保险商")
  1093. }
  1094. }
  1095. if (val == "infos.DPSupplierID") {
  1096. if (!!infos.linkId) {
  1097. this.dialog.supplier = true;
  1098. } else {
  1099. this.$message("该设备无关联资产")
  1100. }
  1101. }
  1102. if (val == "infos.DPMaintainerID") {
  1103. // if (!!infos.linkId) {
  1104. this.dialog.maintainer = true;
  1105. // } else {
  1106. // this.$message("该设备无关联资产")
  1107. // }
  1108. }
  1109. if (val == "infos.DPInsurerID") {
  1110. if (!!infos.linkId) {
  1111. this.dialog.insurer = true;
  1112. } else {
  1113. this.$message("该设备无关联资产")
  1114. }
  1115. }
  1116. },
  1117. //获取被筛选掉的行号
  1118. trimmedRows() {
  1119. // var plugin = hot.getPlugin('trimRows').trimmedRows;//获取被筛选掉的行号
  1120. var plugin = this.hot.getPlugin("trimRows").trimmedRows;
  1121. let dataLength = this.main.length;
  1122. let dataArr = new Array();
  1123. for (let i = 0; i < dataLength; i++) {
  1124. dataArr.push(i);
  1125. }
  1126. if (plugin.length <= 0) {
  1127. dataArr = undefined;
  1128. } else {
  1129. dataArr = this.array_diff(dataArr, plugin);
  1130. }
  1131. return dataArr || [];
  1132. // var DataArray = new Array();
  1133. // for (var i = 0; i < plugin.length; i++) {
  1134. // // 通过行号获取数据
  1135. // DataArray.push(this.hot.getSourceDataAtRow(plugin[i]));
  1136. // }
  1137. },
  1138. //去除数组中相同的元素
  1139. array_diff(a, b) {
  1140. for (var i = 0; i < b.length; i++) {
  1141. for (var j = 0; j < a.length; j++) {
  1142. if (a[j] == b[i]) {
  1143. a.splice(j, 1);
  1144. j = j - 1;
  1145. }
  1146. }
  1147. }
  1148. return a;
  1149. },
  1150. //如果选择供应商之后
  1151. supplierChange(data) {
  1152. for (let key in data) {
  1153. if (key == "venderId") {
  1154. data[key] = data[key] + "-" + data.name
  1155. this.utilToKey(key, "venderId", data, "DPSupplierID")
  1156. }
  1157. }
  1158. // tools.setItem(this.deviceType.code, this.main)
  1159. },
  1160. supplyChange(data) {
  1161. let changeData = { id: data }
  1162. this.utilToKey("id", "id", changeData, "SupplierContractID")
  1163. // tools.setItem(this.deviceType.code, this.main)
  1164. },
  1165. //保险合同
  1166. guaranteeChange(data) {
  1167. for (let key in data) {
  1168. this.utilToKey(key, "insuranceNo", data, "InsuranceNum")
  1169. if (key == "contractFile") {
  1170. if (!!data[key]) {
  1171. data[key] = [data[key]]
  1172. }
  1173. }
  1174. this.utilToKey(key, "contractFile", data, "InsuranceFile")
  1175. }
  1176. // tools.setItem(this.deviceType.code, this.main)
  1177. },
  1178. //选择型号修改
  1179. firmChange(data) {
  1180. for (let key in data) {
  1181. // this.utilToKey(key, "name", data, "Supplier")
  1182. // this.utilToKey(key, "email", data, "SupplierEmail")
  1183. // this.utilToKey(key, "website", data, "SupplierWeb")
  1184. // this.utilToKey(key, "phone", data, "SupplierPhone")
  1185. // this.utilToKey(key, "fox", data, "SupplierFax")
  1186. // this.utilToKey(key, "man", data, "SupplierContactor")
  1187. if (key == "venderId") {
  1188. data[key] = data[key] + "-" + data.name + "/" + data.brand
  1189. this.utilToKey(key, "venderId", data, "DPManufacturerID")
  1190. }
  1191. this.utilToKey(key, "specificationId", data, "DPSpecificationID")
  1192. }
  1193. },
  1194. //保险商变更
  1195. changeInsurer(data) {
  1196. for (let key in data) {
  1197. // this.utilToKey(key, "name", data, "Insurer")
  1198. // this.utilToKey(key, "email", data, "InsurerEmail")
  1199. // this.utilToKey(key, "website", data, "InsurerWeb")
  1200. // this.utilToKey(key, "phone", data, "InsurerFax")
  1201. // this.utilToKey(key, "man", data, "InsurerContactor")
  1202. if (key == "venderId") {
  1203. data[key] = data[key] + "-" + data.name
  1204. this.utilToKey(key, "venderId", data, "DPInsurerID")
  1205. }
  1206. }
  1207. // tools.setItem(this.deviceType.code, this.main)
  1208. },
  1209. //维修商变更
  1210. changeMaintainer(data) {
  1211. for (let key in data) {
  1212. // this.utilToKey(key, "name", data, "Maintainer")
  1213. // this.utilToKey(key, "email", data, "MaintainerEmail")
  1214. // this.utilToKey(key, "website", data, "MaintainerWeb")
  1215. // this.utilToKey(key, "phone", data, "MaintainerPhone")
  1216. // this.utilToKey(key, "fox", data, "MaintainerFax")
  1217. // this.utilToKey(key, "man", data, "MaintainerContactor")
  1218. if (key == "venderId") {
  1219. data[key] = data[key] + "-" + data.name
  1220. this.utilToKey(key, "venderId", data, "DPMaintainerID")
  1221. }
  1222. }
  1223. // tools.setItem(this.deviceType.code, this.main)
  1224. },
  1225. //上传文件弹窗触发事件
  1226. fileChange(keys) {
  1227. this.setDataToMain(keys, this.messKey.split(".")[1], this.row)
  1228. // tools.setItem(this.deviceType.code, this.main)
  1229. },
  1230. //上传图片弹窗触发事件
  1231. imgChange(keys) {
  1232. this.setDataToMain(keys, this.messKey.split(".")[1], this.row)
  1233. // tools.setItem(this.deviceType.code, this.main)
  1234. },
  1235. //设备图片弹窗改变事件
  1236. changePics(keys) {
  1237. this.setDataToMain(keys, this.messKey.split(".")[1], this.row)
  1238. // tools.setItem(this.deviceType.code, this.main)
  1239. },
  1240. utilToKey(key, name, data, messName) {
  1241. if (key == name) {
  1242. this.setDataToMain(data[key], messName, this.row)
  1243. }
  1244. },
  1245. //判断是否有值,有值赋值
  1246. setDataToMain(data, key, row) {
  1247. if (!!data && data != '--') {
  1248. if (!!this.main[row].infos) {
  1249. //falg确定每个的是否有值
  1250. this.main[row].infos[key] = data
  1251. this.updateBusiness([this.main[row]], [[0, "infos." + key, null, data]])
  1252. } else {
  1253. this.main[row].infos = {}
  1254. this.main[row].infos[key] = data
  1255. }
  1256. } else {
  1257. this.main[row].infos[key] = ''
  1258. }
  1259. }
  1260. },
  1261. watch: {
  1262. projectId(){
  1263. this.main = []
  1264. this.mess.deviceId = null
  1265. this.page.total = 0
  1266. }
  1267. }
  1268. };
  1269. </script>
  1270. <style lang="less">
  1271. .hanson-bar {
  1272. height: 40px;
  1273. padding: 5px 10px;
  1274. font-size: 14px;
  1275. overflow: hidden;
  1276. margin-top: 0;
  1277. line-height: 40px;
  1278. .iconfont {
  1279. font-size: 12px;
  1280. }
  1281. .el-button {
  1282. // margin-right: 10px;
  1283. }
  1284. }
  1285. .cancelButtonClass {
  1286. width: 180px;
  1287. }
  1288. </style>