assets.vue 51 KB

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