addLegend.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <template>
  2. <div class='add-legend'>
  3. <el-dialog :title='title' :visible.sync='dialogVisible'>
  4. <add-list v-if='title==""' ref='searchList' :GraphCategoryId='GraphCategoryId' @mesg='mesg'></add-list>
  5. <add-form v-else ref='add' :ruleForm='info' @addSuccess='addSuccess' @updateSuccess='updateSuccess'></add-form>
  6. <span slot='footer' class='dialog-footer'>
  7. <el-button @click='dialogVisible = false' size='small'>取 消</el-button>
  8. <el-button type='primary' @click='save' size='small'>确 定</el-button>
  9. </span>
  10. </el-dialog>
  11. </div>
  12. </template>
  13. <script>
  14. import addForm from './addForm'
  15. import addList from '../legendRules/addList'
  16. export default {
  17. data() {
  18. return {
  19. dialogVisible: false,
  20. info: {
  21. Name: '',
  22. Type: 'None',
  23. Unit: '',
  24. FillColor: '',
  25. Url: ''
  26. },
  27. title: '',
  28. GraphCategoryId: ''
  29. }
  30. },
  31. components: { addForm, addList },
  32. methods: {
  33. open(row, title, GraphCategoryId) {
  34. this.dialogVisible = true
  35. this.title = title
  36. this.GraphCategoryId = GraphCategoryId
  37. if (title == '新增图例库') {
  38. this.info = {
  39. Name: '',
  40. Type: '',
  41. Unit: ''
  42. }
  43. }
  44. if (title == '修改图例库') {
  45. this.info = row
  46. }
  47. if (!title && this.$refs.searchList) {
  48. this.$refs.searchList.queryAll()
  49. }
  50. },
  51. cancal() {
  52. this.info = {
  53. Name: '',
  54. Type: 'None',
  55. Unit: '',
  56. FillColor: '',
  57. Url: ''
  58. }
  59. },
  60. mesg() {
  61. this.$emit('mesg')
  62. },
  63. updateSuccess() {
  64. this.$emit('updateSuccess')
  65. },
  66. addSuccess() {
  67. this.$emit('addSuccess')
  68. this.cancal()
  69. },
  70. save() {
  71. this.$refs.add.saveImg()
  72. console.log('go')
  73. return
  74. // this.dialogVisible = false
  75. // if (this.title == '添加图例库') {
  76. // this.$refs.add.create()
  77. // }
  78. // if (this.title == '修改图例库') {
  79. // this.$refs.add.update()
  80. // }
  81. // if (!this.title) {
  82. // this.$refs.searchList.save()
  83. // }
  84. }
  85. }
  86. }
  87. </script>
  88. <style lang='less' scoped>
  89. .add-legend {
  90. }
  91. </style>
  92. <style lang='less'>
  93. .add-legend {
  94. .el-dialog {
  95. width: 840px;
  96. height: 509px;
  97. }
  98. .el-dialog__footer {
  99. position: absolute;
  100. bottom: 20px;
  101. right: 20px;
  102. }
  103. }
  104. </style>