device.vue 54 KB

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