edit-dialog.vue 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966
  1. <template>
  2. <div>
  3. <a-modal v-model="visible" title="选择编辑" width="1200px" class="edit-dialog" @cancel="handleCancel">
  4. <template slot="footer">
  5. <a-button key="back" @click="handleCancel">
  6. 取消
  7. </a-button>
  8. <a-button key="submit" type="primary" :loading="loading" @click="handleOk">
  9. 确认
  10. </a-button>
  11. </template>
  12. <div class="dialog-content">
  13. <div class="left">
  14. <div class="header">
  15. <div class="select">
  16. <a-select style="width: 316px;margin: 0 10px" :default-value="'#'" :value="majorId">
  17. <a-select-option value="#"
  18. @click="handleChange('#')">
  19. 推荐
  20. </a-select-option>
  21. <a-select-opt-group>
  22. <span slot="label">位置区域</span>
  23. <a-select-option v-for="item in locationList" :value="item.id"
  24. @click="handleChange(item)">
  25. {{item.name}}
  26. </a-select-option>
  27. <a-select-opt-group>
  28. <span slot="label">设备设施</span>
  29. <a-select-option v-for="item in majorList" :value="item.id" @click="handleChange(item)">
  30. {{item.name}}
  31. </a-select-option>
  32. </a-select-opt-group>
  33. </a-select-opt-group>
  34. </a-select>
  35. <!-- <Select style="margin: 0 10px"-->
  36. <!-- v-model="majorId"-->
  37. <!-- @change="handleMajor"-->
  38. <!-- :hideClear='true'-->
  39. <!-- :selectdata="majorList"-->
  40. <!-- :placeholder="'请选择'"-->
  41. <!-- class="search-select"-->
  42. <!-- width="236" isReadOnly-->
  43. <!-- />-->
  44. </div>
  45. <div class="search">
  46. <Select
  47. v-model="floorId"
  48. caption="所属楼层:"
  49. @change="chageFloor"
  50. :hideClear='false'
  51. :selectdata="dataFloor"
  52. :placeholder="'请选择'"
  53. class="search-select"
  54. width="236"
  55. />
  56. <a-input-search placeholder="搜索位置名称" class="press-enter" @search="onSearch" v-model="keyword"/>
  57. </div>
  58. </div>
  59. <div class="tree" >
  60. <a-spin :spinning="spinning">
  61. <a-input-search placeholder="请输入关键字" v-if="selectVal ||treeData.length" style="width: 315px;margin: 10px 10px;" v-model="selectVal" @search="onSearchTree" />
  62. <div style="height: 385px;overflow-y: scroll;">
  63. <Tree v-if="treeData.length" @change="getTreeId" :data="treeData"/>
  64. <div v-else style="margin: 40px 70px;">暂无推荐数据</div>
  65. </div>
  66. </a-spin>
  67. </div>
  68. <div class="checkbox">
  69. <a-table :pagination="false" :row-key='typeEdit=="Zone"?"location":"assetnum"'
  70. :columns="typeEdit=='Image'?columnsSys:typeEdit=='Zone'?columnsLocal:objSys"
  71. :data-source="tableData"
  72. :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange,onSelect:onSelect }"
  73. :scroll="{ y: 340 }" :loading="loading"/>
  74. <a-pagination v-if="total>0" v-model="page" :total="total" show-less-items
  75. style="margin-left: auto;" @change="handleTableChange"/>
  76. </div>
  77. </div>
  78. <div class="right">
  79. <div class="header">
  80. <span class="select-number">已选择 <b>{{arrList.length}}</b>/{{sysNum}}</span>
  81. <a-button type="link" class="link" @click="clearArrList" :disabled="arrList.length==0">清空</a-button>
  82. </div>
  83. <div class="list-box">
  84. <p v-for="(item,index) in arrList" :key="index" class="list">{{item.sbjc||item.wzjc}}
  85. <a-icon type="close" class="icon" @click="deleteItem(item,index)"/>
  86. </p>
  87. </div>
  88. </div>
  89. </div>
  90. </a-modal>
  91. <a-modal v-model="visibleBind" title="是否批量绑定图例" width="420px" class="edit-dialog" @cancel="handleClickCancel" centered>
  92. <template slot="footer">
  93. <a-checkbox @change="onChangeRemember" :checked="isRem" style="float: left;margin-top: 5px;">
  94. 记住操作,不再提醒
  95. </a-checkbox>
  96. <a-button key="back" @click="handleClickUntreated">
  97. 暂不处理
  98. </a-button>
  99. <a-button key="submit" type="primary" :loading="loading" @click="handleClickBind">
  100. 批量绑定
  101. </a-button>
  102. </template>
  103. <div>
  104. <p>{{`系统自动将其他平面图中的“${lengedName}”绑定相同台账,涉及以下平面图:`}}</p>
  105. <p>Bla bla ...</p>
  106. <p>Bla bla ...</p>
  107. </div>
  108. </a-modal>
  109. </div>
  110. </template>
  111. <script>
  112. import searchTree from "@/components/edit/search_tree";
  113. import {
  114. queryGlsmsasset,
  115. getQuerySmsxt,
  116. getPlazaFloor,
  117. getQuerySmsxtBy,
  118. queryWzfldl,
  119. queryWzflByDl,
  120. queryGlsmsLocation,
  121. graphElementOrderInfoLocal
  122. } from "@/api/editer";
  123. import bus from "@/bus";
  124. import {getUrlMsg} from '@/components/urlMsg.js';
  125. import { mapGetters } from 'vuex';
  126. export default {
  127. name: "edit-dialog",
  128. components: {searchTree},
  129. props: {
  130. sysNum: Number,//设备总数
  131. attrCards: Array,
  132. // getmajorId: String,
  133. InfoLocal: Array,
  134. GraphElementId:String,
  135. lengedName: String
  136. },
  137. computed: {
  138. ...mapGetters(["isRemember","rememberBtn"])
  139. // majorId() {
  140. // return ''
  141. // }
  142. },
  143. data() {
  144. return {
  145. spinning:false,
  146. loading: false,
  147. visible: false,
  148. model: 'test1',
  149. searchName: '',
  150. floorId: "",//所属楼层
  151. dataFloor: [],
  152. plainOptions: ['福建三明万达-供电系统-6楼-工程信息化中的区域编码ND182472e83742', '福建三明万达-供电系统-6楼-工程信息化中的区域编码ND18247283742'],
  153. majorList: [],
  154. locationList: [],
  155. checkedList: [],
  156. keyword: '',
  157. classstructureid: '',
  158. locfl: '',
  159. objSys: [
  160. {
  161. title: '对象名称',
  162. dataIndex: 'sbjc',
  163. key: 'sbjc',
  164. width: '75%',
  165. scopedSlots: {customRender: 'sbjc'},
  166. },
  167. {
  168. title: '对象内码',
  169. dataIndex: 'sbjbm',
  170. key: 'sbjbm',
  171. width: '25%',
  172. },
  173. ],
  174. columnsSys: [
  175. {
  176. title: '设备名称',
  177. dataIndex: 'sbjc',
  178. key: 'sbjc',
  179. width: '75%',
  180. scopedSlots: {customRender: 'sbjc'},
  181. },
  182. {
  183. title: '设备内码',
  184. dataIndex: 'assetnum',
  185. key: 'assetnum',
  186. width: '25%',
  187. },
  188. ],
  189. columnsLocal: [
  190. {
  191. title: '位置名称',
  192. dataIndex: 'wzjc',
  193. key: 'wzjc',
  194. width: '75%',
  195. scopedSlots: {customRender: 'wzjc'},
  196. },
  197. {
  198. title: '位置内码',
  199. dataIndex: 'location',
  200. key: 'location',
  201. width: '25%',
  202. },
  203. ],
  204. tableData: [],
  205. loading: false,
  206. page: 1,
  207. size: 10,
  208. treeData: [],
  209. total: 0,
  210. selectedRowKeys: [],
  211. arrList: [],
  212. selectList: [],
  213. typeEdit: '',
  214. selectVal:'',
  215. sysId:'',
  216. majorId:'#',
  217. visibleBind: false, // 是否显示批量绑定弹窗
  218. isRem: false, // 是否记住操作
  219. }
  220. },
  221. watch: {
  222. floorId(val) {
  223. if (val == '') {
  224. this.queryGlsmsasset();
  225. }
  226. },
  227. selectVal(val){
  228. if(val==''){
  229. if(this.majorId=='#'){
  230. this.tuijian();
  231. } else if(this.sysId!=''){
  232. this.getQuerySmsxtBy(this.sysId, this.typeEdit)
  233. }
  234. else{
  235. this.getQuerySmsxtBy(this.majorId,'Image')
  236. }
  237. }
  238. }
  239. },
  240. methods: {
  241. showModal() {
  242. this.visible = true;
  243. },
  244. handleOk(e) {
  245. // this.loading = true;
  246. // this.visible = false;
  247. // this.loading = false;
  248. const lists = [];
  249. let arr = [];
  250. arr = JSON.parse(JSON.stringify(this.arrList))
  251. arr.map(item => {
  252. if (item.type=='Zone') {
  253. lists.push({id: item.location, name: item.wzjc , type: 'Zone'})
  254. }
  255. if (item.type=='Image') {
  256. lists.push({
  257. id: item.assetnum,
  258. name: item.sbjc,
  259. type: 'Image'
  260. })
  261. }
  262. })
  263. bus.$emit('changeAttachObjectIds', lists, true)
  264. bus.$emit('updateAttachMsg', lists)
  265. if (this.isRem && this.rememberBtn == "bind") {
  266. // 直接绑定接口
  267. } else if (!this.isRem) {
  268. // 打开批量绑定弹窗并查询相关楼层
  269. this.visibleBind = true;
  270. }
  271. // setTimeout(() => {
  272. // this.visible = false;
  273. // this.loading = false;
  274. // const lists = [];
  275. // let arr = [];
  276. // arr = JSON.parse(JSON.stringify(this.arrList))
  277. // console.log(arr);
  278. // arr.map(item => {
  279. // if (item.type=='Zone') {
  280. // lists.push({id: item.location, name: item.wzjc , type: 'Zone'})
  281. // }
  282. // if (item.type=='Image') {
  283. // lists.push({
  284. // id: item.assetnum,
  285. // name: item.sbjc,
  286. // type: 'Image'
  287. // })
  288. // }
  289. // })
  290. // console.log(lists);
  291. // bus.$emit('changeAttachObjectIds', lists)
  292. // bus.$emit('updateAttachMsg', lists)
  293. // }, 1000);
  294. },
  295. // 查询相关图并打开批量绑定弹窗
  296. getBindGraphs() {
  297. const data = {
  298. "Data":{
  299. "HasPub":[ ],
  300. "NotPub":[
  301. {
  302. "Graphs":[
  303. {
  304. "BuildingId":"1",
  305. "CategoryId":"LCGN",
  306. "Floor":{
  307. "Code":"B1",
  308. "Gcode":"B1",
  309. "Gname":"b1",
  310. "Name":"地下1层",
  311. "Seq":-100
  312. },
  313. "FloorId":"b1",
  314. "Id":"3e3f48bf970a4a9b9d51cb32abe2747b",
  315. "IsPub":false,
  316. "ProjectId":"1000423"
  317. },
  318. {
  319. "BuildingId":"1",
  320. "CategoryId":"LCGN",
  321. "Floor":{
  322. "Code":"F5",
  323. "Gcode":"5F",
  324. "Gname":"f5",
  325. "Name":"第5层",
  326. "Seq":500
  327. },
  328. "FloorId":"f5",
  329. "Id":"49a886cb00df4d72ade2786d6536dc5a",
  330. "IsPub":false,
  331. "ProjectId":"1000423"
  332. }
  333. ],
  334. "Id":"LCGN",
  335. "Name":"楼层功能"
  336. },
  337. {
  338. "Graphs":[
  339. {
  340. "BuildingId":"1",
  341. "CategoryId":"XFXT",
  342. "Floor":{
  343. "Code":"F6",
  344. "Gcode":"6F",
  345. "Gname":"f6",
  346. "Name":"第6层",
  347. "Seq":600
  348. },
  349. "FloorId":"f6",
  350. "Id":"4ae0893d48a249339f53883ac2cd1b36",
  351. "IsPub":false,
  352. "ProjectId":"1000423"
  353. }
  354. ],
  355. "Id":"XFXT",
  356. "Name":"消防系统"
  357. }
  358. ]
  359. },
  360. "Message":"",
  361. "Result":"success"
  362. }
  363. },
  364. handleCancel(e) {
  365. this.visible = false;
  366. let arr = [];
  367. const lists = [];
  368. console.log(this.selectList);
  369. arr = JSON.parse(JSON.stringify(this.selectList))
  370. arr.map(item => {
  371. if (item.type=='Zone') {
  372. lists.push({id: item.location , name: item.wzjc , type: 'Zone'})
  373. }
  374. if (item.type=='Image') {
  375. lists.push({id: item.assetnum, name: item.sbjc, type: 'Image'})
  376. }
  377. })
  378. console.log(lists);
  379. bus.$emit('changeAttachObjectIds', lists, false)
  380. },
  381. // 关闭批量绑定弹窗
  382. handleClickCancel() {
  383. this.visibleBind = false;
  384. this.isRem = false;
  385. this.$store.commit("setIsRemember", this.isRem);
  386. },
  387. // 勾选记住选择复选框
  388. onChangeRemember(e) {
  389. this.isRem = e.target.checked;
  390. this.$store.commit("setIsRemember", this.isRem);
  391. },
  392. // 点击暂不处理按钮
  393. handleClickUntreated() {
  394. this.$store.commit("setRememberBtn", "untreated");
  395. this.visibleBind = false;
  396. },
  397. // 点击批量绑定按钮
  398. handleClickBind() {
  399. this.$store.commit("setRememberBtn", "bind");
  400. this.visibleBind = false;
  401. },
  402. onSearch(value) {
  403. this.queryGlsmsasset()
  404. },
  405. // ChangeCheckbox(val) {
  406. // console.log(val)
  407. // },
  408. //图例搜索--推荐
  409. tuijian(){
  410. this.treeData = [];
  411. this.spinning = true
  412. graphElementOrderInfoLocal({
  413. graphElementId:this.GraphElementId,
  414. }).then(res=>{
  415. this.spinning = false;
  416. const data = res.Data;
  417. (function recursion(newObj) {
  418. newObj.map(item => {
  419. item.label = item.name;
  420. item.checked = 'unchecked';
  421. if (item.children) {
  422. recursion(item.children);
  423. }
  424. })
  425. })(data)
  426. this.treeData = data;
  427. this.treeData.length && this.treeData.map(item=>{
  428. const index = item.name.indexOf('/');
  429. item.name = item.name.slice(index+1);
  430. })
  431. }).catch(()=>{
  432. this.spinning = false;
  433. })
  434. },
  435. handleChange(val) {
  436. this.selectVal='';
  437. this.tableData = [];
  438. this.treeData = [];
  439. if(val=='#'){
  440. this.majorId = '#';
  441. this.tuijian();
  442. }else{
  443. this.majorId = val.id;
  444. this.typeEdit = val.type;
  445. this.sysId = val.id;
  446. this.getQuerySmsxtBy(val.id, val.type)
  447. }
  448. },
  449. // handleMajor(val) {
  450. // this.tableData = [];
  451. // this.getQuerySmsxtBy(val.id)
  452. // },
  453. chageFloor(data) {
  454. this.queryGlsmsasset();
  455. },
  456. pressEnter(e) {
  457. console.log(e)
  458. },
  459. //获取treeId --classstructureid
  460. onSearchTree(val){
  461. console.log(this.majorId);
  462. const arr = [];
  463. const reg = new RegExp(val, 'g');
  464. let flag= false;
  465. if(this.majorId=='#'){
  466. this.treeData.map(item=>{
  467. if(item.name.indexOf(val)!=-1){
  468. item.name=item.name.replace(reg, `<span style="color:#F96600">${val}</span>`);
  469. arr.push(item)
  470. }
  471. })
  472. }
  473. else if(this.typeEdit=='Zone'){
  474. this.treeData.map((item)=>{
  475. if(item.name.indexOf(val)!=-1){
  476. item.name=item.name.replace(reg, `<span style="color:#F96600">${val}</span>`);
  477. arr.push(item)
  478. }
  479. });
  480. }
  481. else if(this.typeEdit=='Image'){
  482. console.log(this.treeData);
  483. this.treeData.map(item=>{
  484. if(item.name.indexOf(val)!=-1){
  485. item.name=item.name.replace(reg, `<span style="color:#F96600">${val}</span>`);
  486. arr.push(item)
  487. }else{
  488. item.children.map(item1=>{
  489. if(item1.name.indexOf(val)!=-1){
  490. flag = true;
  491. item.open=true;
  492. item1.name=item1.name.replace(reg, `<span style="color:#F96600">${val}</span>`);
  493. }
  494. })
  495. if(flag){
  496. arr.push(item)
  497. }
  498. }
  499. })
  500. }
  501. this.treeData = arr;
  502. },
  503. //获取树的数据
  504. getTreeId(id) {
  505. console.log(id);
  506. if(id.type){
  507. if(id.type==2){
  508. this.typeEdit = 'Image'
  509. }
  510. if(id.type==1){
  511. this.typeEdit = 'Zone'
  512. }
  513. }
  514. if (this.typeEdit == 'Image') {
  515. this.classstructureid = id.id;
  516. } else if (this.typeEdit == 'Zone') {
  517. this.locfl = id.id;
  518. }
  519. this.queryGlsmsasset();
  520. },
  521. //获取表格数据
  522. queryGlsmsasset() {
  523. if (!this.classstructureid && !this.locfl) {
  524. return
  525. }
  526. const data = {
  527. plazaId: getUrlMsg().projectId,//广场id 必填
  528. page: this.page,//页数
  529. size: this.size,//条数
  530. }
  531. if (this.keyword) {
  532. data.keyword = this.typeEdit == 'Image' ? `${this.keyword}:sbjc` : `${this.keyword}:wzjc`
  533. }
  534. let paramData ;
  535. let paramDataLocal;
  536. if( this.floorId =='#'||this.floorId==''){
  537. paramData = {classstructureid: this.classstructureid};
  538. paramDataLocal = {locfl: this.locfl};
  539. }else {
  540. let gcname = '';
  541. // 取gcname
  542. this.dataFloor.forEach(item=>{
  543. console.log('xxxxxxxx',item,this.floorId)
  544. if(item.gname == this.floorId){
  545. gcname=item.gcname
  546. }
  547. })
  548. paramData = {classstructureid: this.classstructureid, gname: gcname};
  549. console.log('gcname',gcname)
  550. paramDataLocal = {locfl: this.locfl, gname: gcname};
  551. }
  552. this.loading = true;
  553. if (this.typeEdit == 'Image') {
  554. queryGlsmsasset(data, paramData).then(res => {
  555. this.loading = false;
  556. if (res.data.result == 'success') {
  557. this.total = res.data.count;
  558. if (res.data.data) {
  559. const data = res.data.data;
  560. data.map(item => {
  561. item.id = item.sbjbm
  562. })
  563. this.tableData = data;
  564. } else if (res.data.count == 0) {
  565. this.tableData = [];
  566. }
  567. } else {
  568. this.$message.error('数据请求失败')
  569. }
  570. })
  571. } else if (this.typeEdit == 'Zone') {
  572. queryGlsmsLocation(data, paramDataLocal).then(res => {
  573. this.loading = false;
  574. if (res.data.result == 'success') {
  575. this.total = res.data.count;
  576. if (res.data.data) {
  577. this.tableData = res.data.data;
  578. } else if (res.data.count == 0) {
  579. this.tableData = [];
  580. }
  581. } else {
  582. this.$message.error('数据请求失败')
  583. }
  584. })
  585. }
  586. },
  587. //分页切换点击
  588. handleTableChange(page, pageSize) {
  589. this.page = page;
  590. this.queryGlsmsasset();
  591. },
  592. onSelect(record, selected, selectedRows, nativeEvent) {
  593. if (!selected && this.arrList.length > 0) {
  594. this.arrList.map((item, index) => {
  595. if (this.typeEdit == 'Zone' && item.location == record.location) {
  596. this.arrList.splice(index, 1);
  597. } else if (this.typeEdit == 'Image' && item.assetnum == record.assetnum) {
  598. this.arrList.splice(index, 1);
  599. }
  600. })
  601. }
  602. },
  603. // 中间表格勾选
  604. onSelectChange(selectedRowKeys, selectedRows) {
  605. this.selectedRowKeys = selectedRowKeys;
  606. if (this.selectedRowKeys.length > this.sysNum) {
  607. this.selectedRowKeys.pop();
  608. this.$message.error('不能超过设备数')
  609. return false;
  610. }
  611. selectedRows.map(item => {
  612. item.type = this.typeEdit;
  613. })
  614. console.log(selectedRows);
  615. this.arrList = [...this.arrList, ...selectedRows]
  616. console.log(this.arrList);
  617. const obj = {}
  618. // console.log(this.typeEdit);
  619. // if (this.typeEdit == 'Zone') {
  620. this.arrList = this.arrList.reduce(function (item, next) {
  621. obj[next.location||next.assetnum] ? ' ' : obj[next.location||next.assetnum] = true && item.push(next)
  622. return item;
  623. }, [])
  624. // console.log(this.arrList);
  625. // } else {
  626. // this.arrList = this.arrList.reduce(function (item, next) {
  627. // obj[next.assetnum] ? ' ' : obj[next.assetnum] = true && item.push(next)
  628. //
  629. // return item;
  630. //
  631. // }, [])
  632. // console.log(this.arrList);
  633. // }
  634. console.log(this.arrList);
  635. },
  636. //右侧删除
  637. deleteItem(item, index) {
  638. this.selectedRowKeys.splice(this.selectedRowKeys.indexOf(item.location || item.assetnum), 1);
  639. this.arrList.splice(index, 1);
  640. },
  641. //右侧清空
  642. clearArrList() {
  643. this.selectedRowKeys = [];
  644. this.arrList = [];
  645. },
  646. //获取楼层
  647. getPlazaFloor() {
  648. const data = {
  649. plazaId: getUrlMsg().projectId
  650. }
  651. getPlazaFloor(data).then(res => {
  652. if (res.result == 'success') {
  653. const data = res.data;
  654. data.map(item => {
  655. item.id = item.gname;
  656. item.name = item.code;
  657. })
  658. this.dataFloor = data;
  659. this.dataFloor.unshift({id:'#',name:'全部'})
  660. }
  661. })
  662. },
  663. //获取设备大类和位置大类
  664. getQuerySmsxt() {
  665. queryWzfldl({}).then(res => {
  666. if (res.result == 'success') {
  667. if (res.data) {
  668. const data = res.data;
  669. data.map(item => {
  670. item.id = item.dl;
  671. item.name = item.dl;
  672. item.type = 'Zone'
  673. })
  674. this.locationList = data;
  675. }
  676. }
  677. })
  678. // if (this.typeEdit=='Image'){
  679. getQuerySmsxt({}).then(res => {
  680. if (res.result == 'success') {
  681. if (res.data) {
  682. const data = res.data;
  683. data.map(item => {
  684. item.id = item.code;
  685. item.name = item.name;
  686. item.type = 'Image';
  687. })
  688. this.majorList = data;
  689. }
  690. }
  691. })
  692. // }else if(this.typeEdit =='Zone'){
  693. // }
  694. },
  695. // 获取设备大类下的分类和位置大类下的分类
  696. getQuerySmsxtBy(smsxt, type) {
  697. if (type == 'Image') {
  698. const data = {
  699. smsxt: smsxt
  700. }
  701. this.spinning = true
  702. getQuerySmsxtBy(data, {}).then(res => {
  703. this.spinning = false;
  704. if (res.result == 'success') {
  705. if (res.data) {
  706. const data = res.data;
  707. (function recursion(newObj) {
  708. newObj.map(item => {
  709. item.name = item.gcxxhxtname || item.classqc;
  710. item.id = item.gcxxhxtnum || item.id;
  711. item.children = item.data;
  712. item.open = false;
  713. item.checked = 'unchecked';
  714. item.type='Image';
  715. if (item.children) {
  716. recursion(item.children);
  717. }
  718. })
  719. })(data)
  720. this.treeData = data;
  721. // let that = this;
  722. // if (this.treeData.length && this.InfoLocal.length) {
  723. // let arr = [];
  724. // let infoLocalId = this.InfoLocal[0].id;
  725. // this.treeData.map((item, index) => {
  726. // item.children.map((item1, index1) => {
  727. // if (infoLocalId==item1.id) {
  728. // item.open = true;
  729. // item1.checked = 'checked';
  730. // this.typeEdit = 'Image'
  731. // that.classstructureid = item1.id;
  732. // that.queryGlsmsasset();
  733. // }
  734. //
  735. // return item1
  736. // })
  737. // return item
  738. // })
  739. // }
  740. }
  741. } else {
  742. this.$message.error('获取失败');
  743. }
  744. }).catch(()=>{
  745. this.spinning = false;
  746. })
  747. } else if (type == 'Zone') {
  748. const data = {
  749. dl: smsxt
  750. }
  751. this.spinning = true
  752. queryWzflByDl(data, {}).then(res => {
  753. this.spinning = false;
  754. if (res.result == 'success') {
  755. if (res.data) {
  756. const data = res.data;
  757. (function recursion(newObj) {
  758. newObj.map(item => {
  759. item.label = item.name;
  760. item.checked = 'unchecked';
  761. item.type='Zone';
  762. if (item.children) {
  763. recursion(item.children);
  764. }
  765. })
  766. })(data)
  767. this.treeData = data;
  768. }
  769. } else {
  770. this.$message.error('获取失败');
  771. }
  772. }).catch(()=>{
  773. this.spinning = false;
  774. })
  775. }
  776. }
  777. },
  778. created() {
  779. // 取gcname
  780. this.floorId = getUrlMsg().FloorID;
  781. // 获取vuex的isRemember赋值给isRem
  782. this.isRem = this.isRemember;
  783. //如果有专业就带过来
  784. if (this.GraphElementId) {
  785. this.tuijian();
  786. }
  787. if (this.attrCards.length) {
  788. this.attrCards.map(item => {
  789. this.selectedRowKeys.push(item.location || item.assetnum)
  790. })
  791. this.arrList = JSON.parse(JSON.stringify(this.attrCards));
  792. console.log(this.arrList);
  793. this.selectList = JSON.parse(JSON.stringify(this.attrCards));
  794. } else {
  795. this.selectedRowKeys = [];
  796. }
  797. this.getQuerySmsxt();
  798. this.getPlazaFloor();
  799. }
  800. }
  801. </script>
  802. <style scoped lang="less">
  803. .edit-dialog {
  804. .dialog-content {
  805. width: 1136px;
  806. height: 499px;
  807. background: rgba(255, 255, 255, 1);
  808. border-radius: 3px;
  809. border: 1px solid rgba(239, 240, 241, 1);
  810. display: flex;
  811. /*overflow: auto;*/
  812. .left {
  813. width: 865px;
  814. border-right: 1px solid #EFF0F1;
  815. .header {
  816. width: 865px;
  817. .select {
  818. width: 340px;
  819. border-right: 1px solid #EFF0F1;
  820. display: inline-block;
  821. }
  822. .search {
  823. width: 524px;
  824. display: inline-block;
  825. .search-select {
  826. margin-left: 10px;
  827. position: relative;
  828. top: -2px;
  829. }
  830. .press-enter {
  831. margin-left: 10px;
  832. width: 236px;
  833. }
  834. }
  835. }
  836. .tree {
  837. width: 339px;
  838. height: 441px;
  839. border-right: 1px solid #EFF0F1;
  840. display: inline-block;
  841. float: left;
  842. overflow-y: scroll;
  843. overflow: overlay;
  844. }
  845. .checkbox {
  846. /*margin-top: 17px;*/
  847. /*margin-left: 13px;*/
  848. width: 525px;
  849. height: 441px;
  850. display: inline-block;
  851. display: flex;
  852. flex-direction: column;
  853. justify-content: space-between;
  854. /deep/ .ant-table-selection-column {
  855. .ant-table-header-column {
  856. display: none;
  857. }
  858. }
  859. }
  860. }
  861. .right {
  862. flex-grow: 1;
  863. .list-box {
  864. height: 440px;
  865. overflow-y: scroll;
  866. .list {
  867. background: rgba(239, 240, 241, 1);
  868. border-radius: 2px;
  869. margin: 8px 12px;
  870. position: relative;
  871. padding: 5px;
  872. .icon {
  873. position: absolute;
  874. bottom: 5px;
  875. right: 5px;
  876. cursor: pointer;
  877. }
  878. }
  879. }
  880. .select-number {
  881. margin-left: 12px;
  882. }
  883. .link {
  884. float: right;
  885. line-height: 57px;
  886. }
  887. }
  888. .header {
  889. height: 57px;
  890. line-height: 57px;
  891. border-bottom: 1px solid #EFF0F1;
  892. }
  893. }
  894. /deep/ .ant-input-affix-wrapper .ant-input-suffix {
  895. /*left: 12px;*/
  896. /*padding-right: 12px;*/
  897. }
  898. /deep/ .ant-modal-footer {
  899. border: 0;
  900. }
  901. /deep/ .ant-checkbox-wrapper + .ant-checkbox-wrapper {
  902. margin: 0;
  903. }
  904. }
  905. </style>