device.vue 64 KB

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