device.vue 43 KB

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