index.vue 21 KB

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