ItdmRunFlowPathForm.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <template>
  2. <a-spin :spinning="confirmLoading">
  3. <j-form-container :disabled="formDisabled">
  4. <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
  5. <a-row>
  6. <a-col :span="24">
  7. <a-form-model-item label="流程" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="flowPathId">
  8. <j-search-select-tag placeholder="请选择流程id" v-model="model.flowPathId" :dictOptions="flowPathOptions"/>
  9. </a-form-model-item>
  10. </a-col>
  11. <a-col :span="24">
  12. <a-form-model-item label="委托编号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="weituoNo">
  13. <a-input v-model="model.weituoNo" placeholder="请输入委托编号" ></a-input>
  14. </a-form-model-item>
  15. </a-col>
  16. </a-row>
  17. </a-form-model>
  18. </j-form-container>
  19. </a-spin>
  20. </template>
  21. <script>
  22. import { httpAction, getAction } from '@/api/manage'
  23. import { validateDuplicateValue } from '@/utils/util'
  24. import { queryFlowPathSelectList } from '@api/api'
  25. export default {
  26. name: 'ItdmRunFlowPathForm',
  27. components: {
  28. },
  29. props: {
  30. //表单禁用
  31. disabled: {
  32. type: Boolean,
  33. default: false,
  34. required: false
  35. }
  36. },
  37. data () {
  38. return {
  39. flowPathOptions:[],
  40. model:{
  41. },
  42. labelCol: {
  43. xs: { span: 24 },
  44. sm: { span: 5 },
  45. },
  46. wrapperCol: {
  47. xs: { span: 24 },
  48. sm: { span: 16 },
  49. },
  50. confirmLoading: false,
  51. validatorRules: {
  52. },
  53. url: {
  54. add: "/flowpath/itdmRunFlowPath/add",
  55. edit: "/flowpath/itdmRunFlowPath/edit",
  56. queryById: "/flowpath/itdmRunFlowPath/queryById"
  57. }
  58. }
  59. },
  60. computed: {
  61. formDisabled(){
  62. return this.disabled
  63. },
  64. },
  65. created () {
  66. //备份model原始值
  67. this.modelDefault = JSON.parse(JSON.stringify(this.model));
  68. this.initFlowPathDictData()
  69. },
  70. methods: {
  71. initFlowPathDictData() {
  72. queryFlowPathSelectList().then(response => {
  73. this.flowPathOptions = response.result
  74. })
  75. },
  76. add () {
  77. this.edit(this.modelDefault);
  78. },
  79. edit (record) {
  80. this.model = Object.assign({}, record);
  81. console.log(this.model)
  82. this.visible = true;
  83. },
  84. submitForm () {
  85. const that = this;
  86. // 触发表单验证
  87. this.$refs.form.validate(valid => {
  88. if (valid) {
  89. that.confirmLoading = true;
  90. let httpurl = '';
  91. let method = '';
  92. if(!this.model.id){
  93. httpurl+=this.url.add;
  94. method = 'post';
  95. }else{
  96. httpurl+=this.url.edit;
  97. method = 'put';
  98. }
  99. httpAction(httpurl,this.model,method).then((res)=>{
  100. if(res.success){
  101. that.$message.success(res.message);
  102. that.$emit('ok');
  103. }else{
  104. that.$message.warning(res.message);
  105. }
  106. }).finally(() => {
  107. that.confirmLoading = false;
  108. })
  109. }
  110. })
  111. },
  112. }
  113. }
  114. </script>