RecordEdit.vue 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <template>
  2. <div>
  3. <el-dialog
  4. v-loading="loading"
  5. :show-close="false"
  6. :close-on-click-modal="false"
  7. :visible.sync="isShow"
  8. :title="curObj.id ? '编辑报备进度' : '更新报备进度'"
  9. :fullscreen="false"
  10. width="400px"
  11. custom-class="xl-dialog"
  12. center
  13. >
  14. <div class="scoped-tips">当前报备进度:<span class="t">{{reportStepStr}}</span></div>
  15. <base-form ref="ruleForm" class="lib-edit" :data="formData" :is-inline="false" label-width="110px">
  16. <div slot="footer" style="padding-top: 20px;">
  17. <el-button class="xl-form-btn t2" @click="close">关 闭</el-button>
  18. <el-button class="xl-form-btn t1" @click="close('confirm')">确定</el-button>
  19. </div>
  20. </base-form>
  21. </el-dialog>
  22. </div>
  23. </template>
  24. <script>
  25. import { arrToObj } from '@/utils'
  26. export default {
  27. components: { },
  28. mixins,
  29. props: {
  30. isShow: Boolean,
  31. curObj: Object,
  32. pObj: Object,
  33. },
  34. inject: ['parentData'],
  35. data() {
  36. return {
  37. formData: [],
  38. loading: true,
  39. cObj: {},
  40. curEstateObj: {},
  41. }
  42. },
  43. computed: {
  44. reportStepStr () {
  45. return arrToObj(this.$dictData.report_step)[this.pObj.report_step]
  46. }
  47. },
  48. watch: {
  49. isShow: function(val) {
  50. if (val) {
  51. this.getDef()
  52. }
  53. },
  54. },
  55. methods: {
  56. getDef() {
  57. let params = { ...this.curObj }
  58. this.formData = [
  59. { label: '新报备进度', key: 'report_step', rules: 1, type: 'select', options: this.$dictData.report_step },
  60. { label: '备注', key: 'remark', type: 'textarea' },
  61. ]
  62. this.setDefaultValue(params)
  63. },
  64. close(str) {
  65. if (str === 'confirm') {
  66. this.$refs['ruleForm'].$refs['baseForm'].validate((valid) => {
  67. if (valid) {
  68. const oldform = this.$refs.ruleForm.baseForm
  69. const newForm = { ...oldform }
  70. let apiStr = 'admreportstepadd'
  71. if (this.pObj.id) {
  72. newForm.id = this.pObj.id
  73. }
  74. this.$api.cust[apiStr](newForm).then(data => {
  75. this.$msgs(newForm.id ? '编辑成功' : '新增成功')
  76. this.$emit('close', newForm)
  77. })
  78. }
  79. })
  80. } else {
  81. this.$emit('close')
  82. this.setDefaultValue()
  83. }
  84. }
  85. }
  86. }
  87. </script>
  88. <style lang="scss" scoped>
  89. .scoped-tips {
  90. padding-bottom: 6px;
  91. text-align: center;
  92. .t {
  93. font-size: 18px;
  94. font-weight: bold;
  95. color: #0c78b1;
  96. }
  97. }
  98. </style>