chartSourceEditDialog.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <template>
  2. <el-dialog
  3. :visible.sync="isShow"
  4. :close-on-click-modal="false"
  5. :append-to-body="true"
  6. @close="cancelHandle"
  7. custom-class="marker-edit-dialog"
  8. center
  9. width="650px"
  10. v-dialogDrag
  11. top="8vh"
  12. :title="`${$t('Table.edit_btn')}${$t('Edb.Detail.source')}`"
  13. >
  14. <div style="padding-left: 20%">
  15. <el-form
  16. :model="chartSourceForm"
  17. label-width="110px"
  18. label-position="left"
  19. >
  20. <el-form-item :label="$t('Edb.Detail.source')">
  21. <el-input
  22. v-model="chartSourceForm.text"
  23. :placeholder="$t('Chart.InputHolderAll.input_content')"
  24. />
  25. </el-form-item>
  26. <el-form-item :label="$t('Chart.Detail.color')" style="margin-bottom:8px;">
  27. <el-color-picker
  28. v-model="chartSourceForm.color"
  29. show-alpha
  30. style="width:90px"
  31. />
  32. </el-form-item>
  33. <el-form-item :label="$t('Chart.Detail.text_size')">
  34. <el-input
  35. v-model="chartSourceForm.fontSize"
  36. style="width: 90px"
  37. type="number"
  38. :min="1"
  39. />
  40. </el-form-item>
  41. </el-form>
  42. </div>
  43. <div slot="footer" style="margin-top: 20px;">
  44. <el-button @click="saveSource" type="primary"><!-- 保存 -->{{$t('Dialog.confirm_save_btn')}}</el-button>
  45. <el-button @click="cancelHandle"><!-- 取消 -->{{$t('Dialog.cancel_btn')}}</el-button>
  46. </div>
  47. </el-dialog>
  48. </template>
  49. <script>
  50. export default {
  51. props: {
  52. isShow: {
  53. type: Boolean
  54. },
  55. chartInfo: {
  56. type: Object,
  57. default: () => {}
  58. }
  59. },
  60. watch: {
  61. isShow(nval) {
  62. if(!nval) return
  63. if(this.chartInfo.SourcesFrom) { //回显
  64. let { text,color,fontSize } = JSON.parse(this.chartInfo.SourcesFrom);
  65. this.chartSourceForm = {
  66. text,
  67. color,
  68. fontSize
  69. }
  70. }else {
  71. this.chartSourceForm = {
  72. text: '',
  73. color: JSON.parse(this.chartInfo.ChartThemeStyle).markerOptions.style.color,
  74. fontSize: JSON.parse(this.chartInfo.ChartThemeStyle).markerOptions.style.fontSize
  75. }
  76. }
  77. }
  78. },
  79. data() {
  80. return {
  81. chartSourceForm: {
  82. text: '',
  83. color: '',
  84. fontSize: ''
  85. }
  86. }
  87. },
  88. methods:{
  89. saveSource() {
  90. if(!this.chartSourceForm.text) return this.$message.warning('数据来源不能为空')
  91. this.$emit('update',this.chartSourceForm)
  92. this.cancelHandle()
  93. },
  94. cancelHandle() {
  95. this.$emit('update:isShow',false)
  96. }
  97. },
  98. }
  99. </script>
  100. <style scoped lang='scss'>
  101. </style>