index.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698
  1. <template>
  2. <div class='legend-library'>
  3. <!-- <div class='nav'>
  4. <img class='img-menu' src='@/assets/imgs/menu.png' alt />
  5. <el-divider direction='vertical'></el-divider>
  6. <img class='img-logo' src='@/assets/imgs/logo_tu.png' alt />
  7. <span class='nav-span1'>万达管理说明书</span>
  8. <span class='circular'></span>
  9. <Dropdown v-model='selVal' :data='dataSelect'>
  10. <span style=' font-size: 14px;color: #1f2329 ;'>{{selText}}</span>
  11. </Dropdown>
  12. </div>-->
  13. <div class='legend-library-top'>
  14. <span style='display:inline-block;font-size:16px'>图例库管理</span>
  15. <span class='library-btn'>
  16. <el-button size='small' @click='dumpRules'>图例绘制规则</el-button>
  17. <el-button size='small' type='primary' @click='add'>添加图例</el-button>
  18. </span>
  19. </div>
  20. <div class='legend-library-bottom'>
  21. <div class='select-box'>
  22. <Select
  23. width='180'
  24. tipPlace='top'
  25. caption='所属分类:'
  26. v-model='Type'
  27. :selectdata='typeOptions'
  28. :placeholder='"请选择"'
  29. @change='getTableList'
  30. :hideClear='true'
  31. ></Select>
  32. <span class='instructions'>
  33. <TreeSelect
  34. title='已选项'
  35. caption='说明书位置:'
  36. tipPlace='top'
  37. width='220'
  38. style='margin:0 0 0 12px'
  39. :returnParentNode='false'
  40. :isShowAllChoice='true'
  41. :choseArea='true'
  42. :lastStage='true'
  43. :data='positionSelect'
  44. @change='treeConfirmPosition'
  45. />
  46. </span>
  47. <span class='device-position'>
  48. <TreeSelect
  49. caption='专业/设备、位置类型:'
  50. tipPlace='top'
  51. width='280'
  52. style='margin:0 12px'
  53. :isShowAllChoice='true'
  54. :returnParentNode='false'
  55. :choseArea='true'
  56. :data='deviceList'
  57. :lastStage='true'
  58. @change='treeConfirmDevice'
  59. />
  60. </span>
  61. <!-- <TreeSelect
  62. caption='专业:'
  63. tipPlace='top'
  64. height='180'
  65. style='margin:0 12px'
  66. :returnParentNode='false'
  67. :isShowAllChoice='true'
  68. :choseArea='true'
  69. :data='majorList'
  70. @change='treeConfirmMajor'
  71. :hideClear='true'
  72. />-->
  73. <span class='visualization'>
  74. <TreeSelect
  75. caption='铺位可视化:'
  76. tipPlace='top'
  77. width='250'
  78. :returnParentNode='false'
  79. :isShowAllChoice='true'
  80. :choseArea='true'
  81. :data='typeVisualization'
  82. @change='treeConfirm'
  83. :lastStage='true'
  84. @focusChange='focusChange'
  85. />
  86. </span>
  87. <Select
  88. width='150'
  89. tipPlace='top'
  90. caption='状态:'
  91. v-model='state'
  92. :selectdata='stateSelect'
  93. @change='getTableList'
  94. :placeholder='"请选择"'
  95. style='margin:0 12px'
  96. :hideClear='true'
  97. ></Select>
  98. <el-input
  99. size='small'
  100. @keyup.enter.native='getTableList'
  101. prefix-icon='el-icon-search'
  102. v-model='keyword'
  103. clearable
  104. class='search-input'
  105. @clear='keyword = ""'
  106. ></el-input>
  107. </div>
  108. <el-table :data='tableData' v-loading='loading' :key='key' :border='true' style='width: 100%'>
  109. <el-table-column prop='Name' label='图例编码' width='73'>
  110. <template slot-scope='{row}'>{{row.Id }}</template>
  111. </el-table-column>
  112. <el-table-column prop='Name' label='图例名称' width='180'>
  113. <template slot-scope='{row}'>{{row.Name }}</template>
  114. </el-table-column>
  115. <el-table-column prop='style' label='图例样式' width='83'>
  116. <template slot-scope='{row}'>
  117. <img :class='`${row.Type=="Zone"?"img1":"img"}`' :src='`/serve/topology-wanda/Picture/query/${row.Url}`' alt />
  118. </template>
  119. </el-table-column>
  120. <el-table-column prop='Unit' label='单位' width='60'>
  121. <template slot-scope='{row}'>{{row.Unit}}</template>
  122. </el-table-column>
  123. <el-table-column prop='position' label='对应广场说明书的位置' show-overflow-tooltip>
  124. <template slot-scope='{row}'>
  125. <span>{{ row.GraphCategorys.length?row.GraphCategorys.map(item => item.Name).join(' ,'):'' }}</span>
  126. </template>
  127. </el-table-column>
  128. <el-table-column label='对应工程信息化中的专业/位置、设备分类' show-overflow-tooltip>
  129. <template slot-scope='{row}'>
  130. <span>{{row.InfoLocal.length?row.InfoLocal.map(item => item.name).join(' ,') :''}}</span>
  131. </template>
  132. </el-table-column>
  133. <!-- <el-table-column prop='system' label='专业' show-overflow-tooltip width='120'>
  134. <template slot-scope='{row}'>
  135. <span>{{row.InfoSystem.length ?row.InfoSystem.map(item => item.Name).join(' ,') :''}}</span>
  136. </template>
  137. </el-table-column>-->
  138. <el-table-column prop='typeId' resizable label='铺位可视化typeid' show-overflow-tooltip>
  139. <template slot-scope='{row}'>
  140. <span>{{row.InfoTypes.length ?row.InfoTypes.map(item => `${item.Id }-${item.Name}`).join(' ,'):'' }}</span>
  141. </template>
  142. </el-table-column>
  143. <el-table-column label='操作' width='100' v-if='state==1'>
  144. <template slot-scope='scope' v-if='state==1'>
  145. <el-button @click='modifyClick(scope.row)' type='text'>修改</el-button>
  146. <el-button @click='deleteClick(scope.row)' type='text'>作废</el-button>
  147. </template>
  148. </el-table-column>
  149. <el-table-column v-if='state==0' prop='DeleteTime' label='作废时间' width='180'>
  150. <template v-if='state==0' slot-scope='{row}'>{{row.DeleteTime}}</template>
  151. </el-table-column>
  152. </el-table>
  153. <div class='foot'>
  154. <el-pagination
  155. background
  156. layout='prev, pager, next'
  157. :total='total'
  158. :page-size='size'
  159. :current-page.sync='currentPage'
  160. @prev-click='pageChanged'
  161. @next-click='pageChanged'
  162. @current-change='pageChanged'
  163. ></el-pagination>
  164. </div>
  165. </div>
  166. <add-legend ref='addLegend' @updateSuccess='updateSuccess' @addSuccess='addSuccess' @cancal='cancal'></add-legend>
  167. <Modal :show='modalStatusTip' title='确定要作废图例吗?' mode='tip' type='error' @close='modalStatusTip=false'>
  168. <template #content>作废后则不可更改</template>
  169. <template #handle>
  170. <Button @click='modalStatusTip=false' type='default'>取消</Button>
  171. <Button @click='modalConfirm' type='error'>作废</Button>
  172. </template>
  173. </Modal>
  174. </div>
  175. </template>
  176. <script>
  177. import addLegend from './addLegend'
  178. import transparency from './transparency.js'
  179. import Select from '@/components/Select/Select.vue'
  180. import {
  181. queryDeviceAndPOsition,
  182. graphElementSearch,
  183. getLegendTree,
  184. queryLegend,
  185. deleteLegend,
  186. queryTypeId,
  187. getVisualization,
  188. queryRelation
  189. } from '@/api/legendLibrary.js'
  190. function hexToRgba(hex) {
  191. let opacity = '',
  192. a = hex.slice(7, 9)
  193. transparency.forEach((i, index) => {
  194. if (i == a) {
  195. opacity = index / 100
  196. }
  197. })
  198. return (
  199. 'rgba(' +
  200. parseInt('0x' + hex.slice(1, 3)) +
  201. ',' +
  202. parseInt('0x' + hex.slice(3, 5)) +
  203. ',' +
  204. parseInt('0x' + hex.slice(5, 7)) +
  205. ',' +
  206. opacity +
  207. ')'
  208. )
  209. }
  210. export default {
  211. components: { addLegend, Select },
  212. data() {
  213. return {
  214. loading: true,
  215. deleteObject: {},
  216. modalStatusTip: false,
  217. tableData: [],
  218. key: 1,
  219. dataSelect2: [
  220. { id: 'test1', name: '选择项' },
  221. { id: 'test2', name: '单平米' },
  222. { id: 'test3', name: '下级分项' },
  223. { id: 'test4', name: '滑动平均滑动平均' }
  224. ],
  225. stateSelect: [
  226. { id: '1', name: '正常' },
  227. { id: '0', name: '已作废' }
  228. ],
  229. Type: 'all', //所属分类
  230. selText: '图例库管理',
  231. selVal: '0',
  232. dataSelect: [
  233. { id: '0', name: '图例库管理' },
  234. { id: '1', name: '图例绘制规则' }
  235. ],
  236. typeOptions: [
  237. {
  238. id: 'all',
  239. name: '全部'
  240. },
  241. {
  242. id: 'None',
  243. name: '非图例'
  244. },
  245. {
  246. id: 'Zone',
  247. name: '区域'
  248. },
  249. {
  250. id: 'Image',
  251. name: '图标'
  252. },
  253. {
  254. id: 'Line',
  255. name: '线条'
  256. }
  257. ],
  258. TypeId: '',
  259. typeIdSelect: [{ id: 'Zone', name: '铺位面' }],
  260. size: 10,
  261. total: 0,
  262. currentPage: 1,
  263. state: '1',
  264. position: [],
  265. positionSelect: [],
  266. keyword: undefined,
  267. typeVisualization: [],
  268. visualizationList: [], //已选铺位可视化
  269. // majorList: [], //专业
  270. deviceList: [],
  271. GraphCategoryIds: [], //说明书位置勾选集合
  272. InfoLocals: [], //工程信息化
  273. InfoSystems: [], //工程信息化专业/系统
  274. InfoTypeIds: [] //铺位可视化typeid
  275. }
  276. },
  277. filters: {
  278. filterName(val, index, arr) {
  279. if (arr.length != 1) {
  280. return val + ','
  281. } else {
  282. return val
  283. }
  284. }
  285. },
  286. watch: {
  287. selVal(n, o) {
  288. if (n === o) return
  289. this.selText = this.dataSelect.find(d => d.id === n).name
  290. console.log(n, o)
  291. if (n == 0) {
  292. this.$router.push({ path: 'legendLibrary' })
  293. }
  294. if (n == 1) {
  295. this.$router.push({ path: 'legendRules' })
  296. }
  297. }
  298. },
  299. methods: {
  300. //业下设备分类和位置分类树形结构
  301. initQueryDeviceAndPOsition() {
  302. let postParams = {}
  303. queryDeviceAndPOsition({ postParams }).then(res => {
  304. // let data = res.data
  305. // data.forEach(data => {
  306. // const map = {
  307. // 1: [],
  308. // 2: []
  309. // }
  310. // data.children.forEach(child => map[child.type].push(child))
  311. // data.children = [
  312. // {
  313. // id: `1--${data.id}`,
  314. // name: '位置类型',
  315. // children: map[1]
  316. // },
  317. // {
  318. // id: `2--${data.id}`,
  319. // name: '设备类型',
  320. // children: map[2]
  321. // }
  322. // ]
  323. // })
  324. // data.map(i => {
  325. // i.children.map(i => {
  326. // console.log(i)
  327. // if (!i.children.length) {
  328. // i.disabled = true
  329. // }
  330. // })
  331. // })
  332. this.deviceList = res.data
  333. })
  334. },
  335. //说明书位置
  336. instruction() {
  337. let getParams = {}
  338. getLegendTree({ getParams }).then(res => {
  339. this.positionSelect = res.Content && res.Content.map(i => this.getTree(i))
  340. })
  341. },
  342. //监听取消 修改的时候取消会导致表格不刷新
  343. cancal(info) {
  344. console.log(info)
  345. this.key++
  346. this.getTableList()
  347. },
  348. dumpRules() {
  349. this.$router.push('/home/legendRules')
  350. },
  351. getTypeId() {
  352. let postParams = {}
  353. queryTypeId({ postParams }).then(res => {
  354. this.typeIdSelect = res.Content
  355. })
  356. },
  357. visualization() {
  358. getVisualization({}).then(res => {
  359. this.typeVisualization =
  360. res.Data &&
  361. res.Data.map(i => {
  362. return {
  363. id: i.Id,
  364. name: i.Name,
  365. children: i.Children
  366. ? i.Children.map(j => {
  367. return {
  368. id: j.Id,
  369. name: j.Id + '-' + j.Name
  370. }
  371. })
  372. : []
  373. }
  374. })
  375. })
  376. },
  377. getTree(data) {
  378. let child = data.Children || data.Category
  379. return {
  380. id: data.Id,
  381. name: data.Name,
  382. children: child ? child.map(i => this.getTree(i)) : []
  383. }
  384. },
  385. add() {
  386. this.$refs.addLegend.open('', '添加图例库')
  387. },
  388. modifyClick(row) {
  389. this.$refs.addLegend.open(row, '修改图例库')
  390. },
  391. modalConfirm() {
  392. let postParams = [
  393. {
  394. Id: this.deleteObject.Id
  395. }
  396. ]
  397. deleteLegend({ postParams })
  398. .then(res => {
  399. if (res.Result == 'success') {
  400. this.$message({
  401. type: 'success',
  402. message: '作废成功!'
  403. })
  404. this.modalStatusTip = false
  405. this.getTableList()
  406. }
  407. })
  408. .catch(() => {
  409. this.$message({
  410. type: 'info',
  411. message: '已取消删除'
  412. })
  413. })
  414. },
  415. deleteClick(row) {
  416. this.deleteObject = row
  417. this.modalStatusTip = true
  418. },
  419. pageChanged(page, size) {
  420. this.currentPage = page
  421. this.getTableTata()
  422. },
  423. getTableListPosition(val) {
  424. let postParams = val.map(({ id }) => id)
  425. let data = {}
  426. queryRelation({ data, postParams }).then(res => {
  427. this.tableData = res.data.Content
  428. this.loading = false
  429. this.total = res.Total
  430. })
  431. },
  432. transformDate(arr) {
  433. arr.map(({ GraphCategorys, InfoLocal, InfoSystems, InfoTypes }) => {
  434. if (GraphCategorys.length) {
  435. GraphCategorys.map(i => i)
  436. }
  437. if (InfoLocal.length) {
  438. GraphCategorys.map(i => {
  439. i.name
  440. })
  441. }
  442. if (InfoSystems.length) {
  443. GraphCategorys.map()
  444. }
  445. if (InfoTypes.length) {
  446. GraphCategorys.map()
  447. }
  448. })
  449. return arr
  450. },
  451. getTableTata() {
  452. let postParams = {
  453. Deleted: this.state == 1 ? false : true,
  454. GraphCategoryIds: this.GraphCategoryIds.length ? this.GraphCategoryIds : undefined, //说明书位置
  455. InfoLocals: this.InfoLocals.length ? this.InfoLocals : undefined, //工程信息化位置与设备分类
  456. InfoSystems: this.InfoSystems.length ? this.InfoSystems : undefined, //工程信息化专业/系统
  457. InfoTypeIds: this.InfoTypeIds.length ? this.InfoTypeIds : undefined, //铺位可视化typeid
  458. Name: this.keyword,
  459. PageNumber: this.currentPage,
  460. PageSize: this.size,
  461. Type: this.Type == 'all' ? undefined : this.Type
  462. }
  463. graphElementSearch({ postParams }).then(res => {
  464. this.key++
  465. // this.tableData = res.Content
  466. this.total = res.Total
  467. this.tableData =
  468. res.Content &&
  469. res.Content.map(i => {
  470. if (i.FillColor.length == '9') {
  471. i.FillColor = hexToRgba(i.FillColor)
  472. }
  473. return i
  474. })
  475. this.loading = false
  476. })
  477. },
  478. getTableList() {
  479. this.currentPage = 1
  480. this.getTableTata()
  481. },
  482. updateSuccess() {
  483. this.getTableList()
  484. },
  485. addSuccess() {
  486. this.getTableList()
  487. },
  488. // 铺位可视化
  489. treeConfirm(id, info) {
  490. this.InfoTypeIds = id
  491. this.getTableList()
  492. },
  493. //专业
  494. // treeConfirmMajor(id, info) {
  495. // this.InfoSystems = id
  496. // this.getTableList()
  497. // },
  498. //位置/设备
  499. treeConfirmDevice(id, info) {
  500. let InfoSystem = []
  501. this.InfoSystems = []
  502. this.InfoLocals = []
  503. this.deviceList.forEach(i => {
  504. i.children.length > 0 &&
  505. i.children.forEach(j => {
  506. if (id.includes(j.id)) {
  507. InfoSystem.push(i.id)
  508. }
  509. })
  510. })
  511. this.InfoSystems = [...new Set(JSON.parse(JSON.stringify(InfoSystem)))]
  512. this.InfoLocals = id
  513. this.getTableList()
  514. },
  515. //说明书位置
  516. treeConfirmPosition(id, info) {
  517. this.GraphCategoryIds = id
  518. this.getTableList()
  519. },
  520. focusChange(status) {
  521. // console.log('focusChange', status)
  522. }
  523. },
  524. mounted() {
  525. this.getTypeId()
  526. this.instruction()
  527. this.visualization()
  528. this.getTableList()
  529. this.initQueryDeviceAndPOsition()
  530. }
  531. }
  532. </script>
  533. <style lang="less" scoped>
  534. .legend-library {
  535. display: flex;
  536. flex-direction: column;
  537. height: 100%;
  538. .search-input {
  539. width: 180px;
  540. margin-right: 12px;
  541. float: right;
  542. position: absolute;
  543. right: 6px;
  544. top: 45px;
  545. }
  546. .nav {
  547. height: 48px;
  548. line-height: 48px;
  549. width: 100%;
  550. background: #fff;
  551. margin-left: 17px;
  552. display: flex;
  553. align-items: center;
  554. .img-menu {
  555. margin-right: 9px;
  556. }
  557. .img-logo {
  558. margin: 0 9px;
  559. }
  560. .nav-span1 {
  561. height: 26px;
  562. font-size: 14px;
  563. font-family: MicrosoftYaHei;
  564. color: rgba(31, 35, 41, 1);
  565. line-height: 26px;
  566. }
  567. .circular {
  568. display: inline-block;
  569. width: 4px;
  570. height: 4px;
  571. background: rgba(195, 198, 203, 1);
  572. border-radius: 50%;
  573. margin: 0 8px 0px 8px;
  574. }
  575. }
  576. /deep/ .p-drop {
  577. height: 48px;
  578. }
  579. /deep/ .p-drop .p-drop-title .p-drop-triangle {
  580. margin-top: -5px;
  581. }
  582. .legend-library-top {
  583. height: 45px;
  584. background: rgba(247, 249, 250, 1);
  585. text-align: center;
  586. line-height: 48px;
  587. color: #1f2329;
  588. font-size: 14px;
  589. font-family: MicrosoftYaHei;
  590. color: rgba(31, 36, 41, 1);
  591. .library-btn {
  592. float: right;
  593. margin-right: 16px;
  594. }
  595. }
  596. .legend-library-bottom {
  597. flex: 1;
  598. background: #fff;
  599. padding: 0 16px;
  600. .select-box {
  601. height: 56px;
  602. line-height: 56px;
  603. min-width: 1344px;
  604. display: flex;
  605. align-items: center;
  606. }
  607. .img {
  608. width: 28px;
  609. height: 28px;
  610. }
  611. .img1 {
  612. width: 32px;
  613. height: 18px;
  614. }
  615. }
  616. .foot {
  617. height: 32px;
  618. display: flex;
  619. justify-content: flex-end;
  620. margin-top: 28px;
  621. }
  622. /deep/ .p-select-input-content {
  623. line-height: 32px;
  624. }
  625. .device-position {
  626. /deep/ .p-select-input-caption {
  627. display: block !important;
  628. width: 250px !important;
  629. max-width: 250px !important;
  630. }
  631. }
  632. .instructions {
  633. /deep/ .p-select-input-caption {
  634. display: block !important;
  635. width: 100px !important;
  636. max-width: 200px !important;
  637. }
  638. }
  639. .visualization {
  640. /deep/ .p-select-input-caption {
  641. display: block !important;
  642. width: 100px !important;
  643. max-width: 200px !important;
  644. }
  645. }
  646. }
  647. </style>
  648. <style lang="less">
  649. @media screen and (max-height: 800px) {
  650. .legend-library-bottom {
  651. overflow-y: auto;
  652. margin-bottom: 20px;
  653. z-index: 333;
  654. }
  655. .search-input {
  656. right: 10px !important;
  657. }
  658. .library-btn {
  659. margin-right: 20px !important;
  660. }
  661. }
  662. .legend-library {
  663. th {
  664. font-size: 12px;
  665. color: #646a73 !important;
  666. padding: 6px 0 !important;
  667. background: rgba(248, 249, 250, 1);
  668. }
  669. td {
  670. color: #1f2429 !important;
  671. padding: 6px 0 !important;
  672. }
  673. .ant-select {
  674. margin-right: 12px;
  675. }
  676. }
  677. .p-select-option-box {
  678. background: #fff;
  679. border: 1px solid #ccc;
  680. }
  681. .p-transfer-select {
  682. height: 44px !important;
  683. }
  684. .p-tree-node-check,
  685. .p-tree-node-check .p-tree-node-title {
  686. vertical-align: top !important;
  687. }
  688. .p-checkbox .p-checkbox-box {
  689. top: 4px !important;
  690. }
  691. </style>