ItdmFlowPathStepForm.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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="流程id" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="flowPathId">
  8. <j-search-select-tag 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="name">
  13. <a-input v-model="model.name" placeholder="请输入步骤名称" disabled ></a-input>
  14. </a-form-model-item>
  15. </a-col>
  16. <a-col :span="24">
  17. <a-form-model-item label="所属用户" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="userIds">
  18. <j-select-user-by-dep v-model="model.userIds" :multi="true" />
  19. </a-form-model-item>
  20. </a-col>
  21. <a-col :span="24">
  22. <a-form-model-item label="所属角色" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="roleId">
  23. <j-dict-select-tag type="list" v-model="model.roleId" dictCode="sys_role,role_name,id" placeholder="请选择所属角色" />
  24. </a-form-model-item>
  25. </a-col>
  26. <a-col :span="24">
  27. <a-form-model-item label="步骤顺序" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="sort">
  28. <a-input v-model="model.sort" placeholder="请输入步骤顺序" disabled></a-input>
  29. </a-form-model-item>
  30. </a-col>
  31. </a-row>
  32. </a-form-model>
  33. </j-form-container>
  34. </a-spin>
  35. </template>
  36. <script>
  37. import { httpAction, getAction } from '@/api/manage'
  38. import { validateDuplicateValue } from '@/utils/util'
  39. import { queryFlowPathSelectList } from '@api/api'
  40. export default {
  41. name: 'ItdmFlowPathStepForm',
  42. components: {
  43. },
  44. props: {
  45. //表单禁用
  46. disabled: {
  47. type: Boolean,
  48. default: false,
  49. required: false
  50. }
  51. },
  52. data () {
  53. return {
  54. flowPathOptions: [],
  55. model:{
  56. },
  57. labelCol: {
  58. xs: { span: 24 },
  59. sm: { span: 5 },
  60. },
  61. wrapperCol: {
  62. xs: { span: 24 },
  63. sm: { span: 16 },
  64. },
  65. confirmLoading: false,
  66. validatorRules: {
  67. },
  68. url: {
  69. add: "/flowpath/itdmFlowPathStep/add",
  70. edit: "/flowpath/itdmFlowPathStep/edit",
  71. queryById: "/flowpath/itdmFlowPathStep/queryById"
  72. }
  73. }
  74. },
  75. computed: {
  76. formDisabled(){
  77. return this.disabled
  78. },
  79. },
  80. created () {
  81. //备份model原始值
  82. this.modelDefault = JSON.parse(JSON.stringify(this.model));
  83. this.initFlowPathDictData()
  84. },
  85. methods: {
  86. initFlowPathDictData() {
  87. queryFlowPathSelectList().then(response => {
  88. this.flowPathOptions = response.result
  89. })
  90. },
  91. add () {
  92. this.edit(this.modelDefault);
  93. },
  94. edit (record) {
  95. this.model = Object.assign({}, record);
  96. this.visible = true;
  97. },
  98. submitForm () {
  99. const that = this;
  100. // 触发表单验证
  101. this.$refs.form.validate(valid => {
  102. if (valid) {
  103. that.confirmLoading = true;
  104. let httpurl = '';
  105. let method = '';
  106. if(!this.model.id){
  107. httpurl+=this.url.add;
  108. method = 'post';
  109. }else{
  110. httpurl+=this.url.edit;
  111. method = 'put';
  112. }
  113. httpAction(httpurl,this.model,method).then((res)=>{
  114. if(res.success){
  115. that.$message.success(res.message);
  116. that.$emit('ok');
  117. }else{
  118. that.$message.warning(res.message);
  119. }
  120. }).finally(() => {
  121. that.confirmLoading = false;
  122. })
  123. }
  124. })
  125. },
  126. }
  127. }
  128. </script>