device.vue 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356
  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" @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.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.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. // debugger
  402. _this.copyMain = tools.deepCopy(res.Content)
  403. _this.page.total = res.TotalCount
  404. if (!!_this.hot) {
  405. _this.hot.destroy();
  406. _this.hot = null;
  407. }
  408. if (!!res.Content && res.Content.length) {
  409. _this.initHot();
  410. }
  411. } else {
  412. this.loading = false
  413. this.$message.error("请求错误:" + res.ResultMsg)
  414. }
  415. })
  416. }
  417. },
  418. //获取动态参数
  419. getBatch(data) {
  420. let param = {
  421. secret: this.secret,
  422. ProjId: this.projectId,
  423. data: {
  424. criterias: []
  425. }
  426. }
  427. if (!!data && data.length) {
  428. //一级遍历list
  429. data.map(item => {
  430. if (!!item.infos) {
  431. // 二级遍历对象infos
  432. for (let key in item.infos) {
  433. //判断是否是设定参数和动态参数
  434. if (!!item.infos[key]) {
  435. this.headers.map(child => {
  436. //如果一级标签为动态参数或者设定参数放入数据等待请求
  437. if (key == child.InfoPointCode && (child.InputMode == "L" || child.InputMode == "L1" || child.InputMode == "L2")) {
  438. param.data.criterias.push({
  439. id: item.id,
  440. code: key
  441. })
  442. }
  443. })
  444. }
  445. }
  446. }
  447. })
  448. if (param.data.criterias.length) {
  449. BeatchQueryParam(param, res => {
  450. if (!this.onlyRead) {
  451. return false
  452. }
  453. this.main = data.map(item => {
  454. res.Content.map(child => {
  455. if (item.id == child.id) {
  456. if (!!child.data || child.data == 0) {
  457. item.infos[child.code] = child.data
  458. } else {
  459. item.infos[child.code] = child.error ? "表号功能号格式错误" : "表号功能号不存在"
  460. }
  461. }
  462. })
  463. return item
  464. })
  465. this.hot.loadData(this.main)
  466. })
  467. }
  468. }
  469. },
  470. changeAssetsFalg() {
  471. if (this.linkNameFalg) {
  472. this.linkNameFalg = false
  473. } else {
  474. this.$confirm('<p>真的要在这里修改设备关联的资产么?</p><p>真的能通过列表信息找到想关联的资产么?</p><p>在这里修改关联的资产一定是因为之前关联错了要修改么?</p>', '提示', {
  475. dangerouslyUseHTMLString: true,
  476. confirmButtonText: '没错!我要改关联的资产',
  477. cancelButtonText: '我就点开看看',
  478. confirmButtonClass: 'cancelButtonClass',
  479. cancelButtonClass: 'cancelButtonClass'
  480. }).then(_ => {
  481. this.linkNameFalg = true
  482. }).catch(_ => {
  483. this.$message("取消")
  484. })
  485. }
  486. },
  487. //switch改变
  488. changeWatch() {
  489. this.reset()
  490. },
  491. //撤回
  492. undo() {
  493. this.hot.undo();
  494. },
  495. //刷新
  496. reset() {
  497. this.getMain();
  498. },
  499. //添加设备
  500. addDevice() {
  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"]
  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. // 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 == "Count") {
  1028. let partsVal = this.hot.getDataAtCell(row.row,row.col);//获取被点击的单元格的数据
  1029. if(this.onlyRead){
  1030. this.$router.push({ path: '/ledger/parts', query: { deviceId: infos.infos.EquipID }});
  1031. }else{
  1032. this.$router.push({ path: '/ledger/partsmanage', query: { deviceId: infos.infos.EquipID,typeId: this.mess.deviceId }});
  1033. }
  1034. }
  1035. if (val == "infos.Pic") {
  1036. this.picsArr = this.main[row.row].infos ? (this.main[row.row].infos[val.split(".")[1]] ? this.main[row.row].infos[val.split(".")[1]] : []) : []
  1037. if (this.onlyRead) {
  1038. this.dialog.lookPic = true
  1039. } else {
  1040. this.dialog.pic = true
  1041. }
  1042. }
  1043. if (val == "infos.InsuranceFile" || val == "infos.Archive" || val == "infos.CheckReport") {
  1044. this.filesArr = this.main[row.row].infos ? (this.main[row.row].infos[val.split(".")[1]] ? this.main[row.row].infos[val.split(".")[1]] : []) : []
  1045. this.dialog.uploadFiles = true
  1046. }
  1047. if (val == "linkName" && this.linkNameFalg) {
  1048. this.category = this.main[row.row]
  1049. this.dialog.changeRea = true
  1050. }
  1051. if (val == "infos.EquipQRCode") {
  1052. this.qrcodeUrl = this.main[row.row].infos.EquipQRCode
  1053. if (!!this.qrcodeUrl) {
  1054. this.dialog.qrcode = true;
  1055. } else {
  1056. this.$message("此设备没有设备二维码")
  1057. }
  1058. }
  1059. if (this.onlyRead) {
  1060. return
  1061. }
  1062. if (val == "infos.DPManufacturerID") {
  1063. this.dialog.firm = true;
  1064. }
  1065. if (val == "infos.SupplierContractID") {
  1066. let falg = null
  1067. if (!!this.main[row.row].infos) {
  1068. if (!!this.main[row.row].infos.DPSupplierID) {
  1069. falg = this.main[row.row].infos.DPSupplierID.split("-")[0]
  1070. }
  1071. }
  1072. if (!!falg) {
  1073. this.id = falg
  1074. this.dialog.supply = true;
  1075. } else {
  1076. this.$message("请先选择供应商")
  1077. }
  1078. }
  1079. if (val == "infos.InsuranceNum") {
  1080. //选择保单
  1081. let falg = null
  1082. if (!!this.main[row.row].infos) {
  1083. if (!!this.main[row.row].infos.DPInsurerID) {
  1084. falg = this.main[row.row].infos.DPInsurerID.split("-")[0]
  1085. }
  1086. }
  1087. if (!!falg) {
  1088. this.id = falg
  1089. this.dialog.guarantee = true;
  1090. } else {
  1091. this.$message("请先选择保险商")
  1092. }
  1093. }
  1094. if (
  1095. val == "infos.DPSupplierID"
  1096. ) {
  1097. if (!!infos.linkId) {
  1098. this.dialog.supplier = true;
  1099. } else {
  1100. this.$message("该设备无关联资产")
  1101. }
  1102. }
  1103. if (val == "infos.DPMaintainerID") {
  1104. if (!!infos.linkId) {
  1105. this.dialog.maintainer = true;
  1106. } else {
  1107. this.$message("该设备无关联资产")
  1108. }
  1109. }
  1110. if (
  1111. val == "infos.DPInsurerID") {
  1112. if (!!infos.linkId) {
  1113. this.dialog.insurer = true;
  1114. } else {
  1115. this.$message("该设备无关联资产")
  1116. }
  1117. }
  1118. },
  1119. //获取被筛选掉的行号
  1120. trimmedRows() {
  1121. // var plugin = hot.getPlugin('trimRows').trimmedRows;//获取被筛选掉的行号
  1122. var plugin = this.hot.getPlugin("trimRows").trimmedRows;
  1123. let dataLength = this.main.length;
  1124. let dataArr = new Array();
  1125. for (let i = 0; i < dataLength; i++) {
  1126. dataArr.push(i);
  1127. }
  1128. if (plugin.length <= 0) {
  1129. dataArr = undefined;
  1130. } else {
  1131. dataArr = this.array_diff(dataArr, plugin);
  1132. }
  1133. return dataArr || [];
  1134. // var DataArray = new Array();
  1135. // for (var i = 0; i < plugin.length; i++) {
  1136. // // 通过行号获取数据
  1137. // DataArray.push(this.hot.getSourceDataAtRow(plugin[i]));
  1138. // }
  1139. },
  1140. //去除数组中相同的元素
  1141. array_diff(a, b) {
  1142. for (var i = 0; i < b.length; i++) {
  1143. for (var j = 0; j < a.length; j++) {
  1144. if (a[j] == b[i]) {
  1145. a.splice(j, 1);
  1146. j = j - 1;
  1147. }
  1148. }
  1149. }
  1150. return a;
  1151. },
  1152. //如果选择供应商之后
  1153. supplierChange(data) {
  1154. for (let key in data) {
  1155. if (key == "venderId") {
  1156. data[key] = data[key] + "-" + data.name
  1157. this.utilToKey(key, "venderId", data, "DPSupplierID")
  1158. }
  1159. }
  1160. // tools.setItem(this.deviceType.code, this.main)
  1161. },
  1162. supplyChange(data) {
  1163. let changeData = { id: data }
  1164. this.utilToKey("id", "id", changeData, "SupplierContractID")
  1165. // tools.setItem(this.deviceType.code, this.main)
  1166. },
  1167. //保险合同
  1168. guaranteeChange(data) {
  1169. for (let key in data) {
  1170. this.utilToKey(key, "insuranceNo", data, "InsuranceNum")
  1171. if (key == "contractFile") {
  1172. if (!!data[key]) {
  1173. data[key] = [data[key]]
  1174. }
  1175. }
  1176. this.utilToKey(key, "contractFile", data, "InsuranceFile")
  1177. }
  1178. // tools.setItem(this.deviceType.code, this.main)
  1179. },
  1180. //选择型号修改
  1181. firmChange(data) {
  1182. for (let key in data) {
  1183. // this.utilToKey(key, "name", data, "Supplier")
  1184. // this.utilToKey(key, "email", data, "SupplierEmail")
  1185. // this.utilToKey(key, "website", data, "SupplierWeb")
  1186. // this.utilToKey(key, "phone", data, "SupplierPhone")
  1187. // this.utilToKey(key, "fox", data, "SupplierFax")
  1188. // this.utilToKey(key, "man", data, "SupplierContactor")
  1189. if (key == "venderId") {
  1190. data[key] = data[key] + "-" + data.name + "/" + data.brand
  1191. this.utilToKey(key, "venderId", data, "DPManufacturerID")
  1192. }
  1193. this.utilToKey(key, "specificationId", data, "DPSpecificationID")
  1194. }
  1195. },
  1196. //保险商变更
  1197. changeInsurer(data) {
  1198. for (let key in data) {
  1199. // this.utilToKey(key, "name", data, "Insurer")
  1200. // this.utilToKey(key, "email", data, "InsurerEmail")
  1201. // this.utilToKey(key, "website", data, "InsurerWeb")
  1202. // this.utilToKey(key, "phone", data, "InsurerFax")
  1203. // this.utilToKey(key, "man", data, "InsurerContactor")
  1204. if (key == "venderId") {
  1205. data[key] = data[key] + "-" + data.name
  1206. this.utilToKey(key, "venderId", data, "DPInsurerID")
  1207. }
  1208. }
  1209. // tools.setItem(this.deviceType.code, this.main)
  1210. },
  1211. //维修商变更
  1212. changeMaintainer(data) {
  1213. for (let key in data) {
  1214. // this.utilToKey(key, "name", data, "Maintainer")
  1215. // this.utilToKey(key, "email", data, "MaintainerEmail")
  1216. // this.utilToKey(key, "website", data, "MaintainerWeb")
  1217. // this.utilToKey(key, "phone", data, "MaintainerPhone")
  1218. // this.utilToKey(key, "fox", data, "MaintainerFax")
  1219. // this.utilToKey(key, "man", data, "MaintainerContactor")
  1220. if (key == "venderId") {
  1221. data[key] = data[key] + "-" + data.name
  1222. this.utilToKey(key, "venderId", data, "DPMaintainerID")
  1223. }
  1224. }
  1225. // tools.setItem(this.deviceType.code, this.main)
  1226. },
  1227. //上传文件弹窗触发事件
  1228. fileChange(keys) {
  1229. this.setDataToMain(keys, this.messKey.split(".")[1], this.row)
  1230. // tools.setItem(this.deviceType.code, this.main)
  1231. },
  1232. //上传图片弹窗触发事件
  1233. imgChange(keys) {
  1234. this.setDataToMain(keys, this.messKey.split(".")[1], this.row)
  1235. // tools.setItem(this.deviceType.code, this.main)
  1236. },
  1237. //设备图片弹窗改变事件
  1238. changePics(keys) {
  1239. this.setDataToMain(keys, this.messKey.split(".")[1], this.row)
  1240. // tools.setItem(this.deviceType.code, this.main)
  1241. },
  1242. utilToKey(key, name, data, messName) {
  1243. if (key == name) {
  1244. this.setDataToMain(data[key], messName, this.row)
  1245. }
  1246. },
  1247. //判断是否有值,有值赋值
  1248. setDataToMain(data, key, row) {
  1249. if (!!data && data != '--') {
  1250. if (!!this.main[row].infos) {
  1251. //falg确定每个的是否有值
  1252. this.main[row].infos[key] = data
  1253. this.updateBusiness([this.main[row]], [[0, "infos." + key, null, data]])
  1254. } else {
  1255. this.main[row].infos = {}
  1256. this.main[row].infos[key] = data
  1257. }
  1258. } else {
  1259. this.main[row].infos[key] = ''
  1260. }
  1261. }
  1262. },
  1263. watch: {
  1264. projectId(){
  1265. this.main = []
  1266. this.mess.deviceId = null
  1267. this.page.total = 0
  1268. }
  1269. }
  1270. };
  1271. </script>
  1272. <style lang="less">
  1273. .hanson-bar {
  1274. height: 40px;
  1275. padding: 5px 10px;
  1276. font-size: 14px;
  1277. overflow: hidden;
  1278. margin-top: 0;
  1279. line-height: 40px;
  1280. .iconfont {
  1281. font-size: 12px;
  1282. }
  1283. .el-button {
  1284. // margin-right: 10px;
  1285. }
  1286. }
  1287. .cancelButtonClass {
  1288. width: 180px;
  1289. }
  1290. </style>