ExecuteBaseFormList.vue 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <template>
  2. <a-modal
  3. :title="modalTitle"
  4. :width="800"
  5. :visible="visible"
  6. :confirmLoading="confirmLoading"
  7. class="ant-modal2"
  8. @cancel="handleCancel"
  9. >
  10. <a-form :form="form">
  11. <row-list :col="1">
  12. <row-item>
  13. <a-form-item
  14. label="说明"
  15. :labelCol="BaseTool.Constant.labelCol2"
  16. :wrapperCol="BaseTool.Constant.wrapperCol2"
  17. >
  18. <a-textarea
  19. :rows="4"
  20. v-decorator="['handleRemark',{initialValue: model.remark}]"/>
  21. </a-form-item>
  22. </row-item>
  23. </row-list>
  24. </a-form>
  25. <template slot="footer">
  26. <a-button :loading="confirmLoading" type="primary" @click="save()">保存</a-button>
  27. </template>
  28. </a-modal>
  29. </template>
  30. <script>
  31. import { updateOilSbOilList } from '@/api/sb/oil'
  32. export default {
  33. name: 'BaseSbOil',
  34. components: {
  35. },
  36. data () {
  37. return {
  38. confirmLoading: false,
  39. modalTitle: null,
  40. form: this.$form.createForm(this),
  41. status: 2,
  42. model: {},
  43. visible: false,
  44. // 下拉框map
  45. statusMap: {},
  46. ids: []
  47. }
  48. },
  49. props: {},
  50. created () {
  51. // 下拉框map
  52. this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_OIL_STATUS)
  53. },
  54. methods: {
  55. base (ids) {
  56. this.visible = true
  57. // 如果是空标识添加
  58. this.modalTitle = '批量加油'
  59. this.ids = ids
  60. },
  61. statusChange (val) {
  62. console.log(val)
  63. this.status = val
  64. },
  65. save () {
  66. const { form: { validateFieldsAndScroll } } = this
  67. this.confirmLoading = true
  68. validateFieldsAndScroll((errors, values) => {
  69. if (errors) {
  70. this.confirmLoading = false
  71. return
  72. }
  73. values.ids = this.ids
  74. updateOilSbOilList(values)
  75. .then(() => {
  76. this.handleCancel(values)
  77. }).catch(() => {
  78. this.confirmLoading = false
  79. })
  80. })
  81. },
  82. handleCancel (values) {
  83. this.visible = false
  84. this.confirmLoading = false
  85. this.form.resetFields()
  86. if (this.BaseTool.Object.isNotBlank(values)) {
  87. this.$emit('ok', values)
  88. }
  89. }
  90. }
  91. }
  92. </script>