flowAction.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <template>
  2. <div class="hui-flex hui-dialog">
  3. <div class="hui-flex-box hui-dialog-content">
  4. <el-form ref="form" :model="form" label-position="top">
  5. <el-form-item label="审核意见" class="hui-textarea">
  6. <el-input type="textarea" v-model="form.content" placeholder="请输入审核意见" maxlength="120" :rows="4"
  7. show-word-limit resize="none"></el-input>
  8. </el-form-item>
  9. <el-form-item label="审核附件" class="hui-textarea">
  10. <upload ref="upload" :list="responsibility" type="insert"></upload>
  11. </el-form-item>
  12. </el-form>
  13. </div>
  14. <div class="hui-dialog-submit">
  15. <el-button size="medium" @click="$emit('callback')">取 消</el-button>
  16. <el-button size="medium" type="primary" @click="submit" :loading="loading">确 定</el-button>
  17. </div>
  18. </div>
  19. </template>
  20. <script>
  21. import upload from '@/components/common/upload'
  22. import {
  23. userFlowAction
  24. } from '@/httpApi/property'
  25. export default {
  26. props: ['action', 'projectFlowId'],
  27. data() {
  28. return {
  29. form: {
  30. content: ''
  31. },
  32. responsibility: [],
  33. loading: false
  34. }
  35. },
  36. created() {},
  37. methods: {
  38. submit() {
  39. this.loading = true;
  40. userFlowAction(this.projectFlowId, this.action.id, {
  41. comment: JSON.stringify({
  42. text: this.form.content,
  43. enclosure: this.$refs.upload.fileList
  44. })
  45. }).then(res => {
  46. if (res.state) {
  47. this.$emit('updateFlowState', this.returnState(res.data.context.projectFlow.statusStr),
  48. this.action.viewName);
  49. this.$message.success('操作成功');
  50. this.$emit('callback', 'init');
  51. }
  52. this.loading = false;
  53. });
  54. },
  55. returnState(name) {
  56. let state = '';
  57. switch (name) {
  58. case '待提交':
  59. state = 1;
  60. break;
  61. case '审核中':
  62. state = 2;
  63. break;
  64. case '通过':
  65. state = 3;
  66. break;
  67. case '未通过':
  68. state = 4;
  69. break;
  70. default:
  71. state = 1;
  72. break;
  73. }
  74. return state;
  75. }
  76. },
  77. components: {
  78. upload
  79. }
  80. }
  81. </script>
  82. <style lang="scss"></style>