submit.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. <template>
  2. <el-col :span="16" :offset="6">
  3. <el-form label-width="100px" ref="formRef" :model="form">
  4. <el-form-item label="审批建议" prop="reason" style="margin-bottom: 20px" :rules="{
  5. required: true,
  6. message: '请选择',
  7. trigger: 'change'
  8. }">
  9. <el-input type="textarea" v-model="form.reason" placeholder="请输入审批建议" />
  10. </el-form-item>
  11. </el-form>
  12. <div style="margin-left: 10%; margin-bottom: 20px; font-size: 14px">
  13. <el-button icon="el-icon-edit-outline" type="success" size="mini" @click="handleAudit(1)">通过
  14. </el-button>
  15. <el-button icon="el-icon-circle-close" type="danger" size="mini" @click="handleAudit(0)">驳回
  16. </el-button>
  17. <el-dropdown @command="(command) => handleCommand(command)" style="margin-left: 30px;">
  18. <span class="el-dropdown-link">更多<i class="el-icon-arrow-down el-icon--right"></i></span>
  19. <el-dropdown-menu slot="dropdown">
  20. <el-dropdown-item command="cancel">作废</el-dropdown-item>
  21. </el-dropdown-menu>
  22. </el-dropdown>
  23. </div>
  24. </el-col>
  25. </template>
  26. <script>
  27. import { apspurchaseplan, cancel } from '@/api/bpm/components/apsMeterialPlan';
  28. import { approveTaskWithVariables } from '@/api/bpm/task';
  29. import { listAllUserBind } from '@/api/system/organization';
  30. // 流程实例的详情页,可用于审批
  31. export default {
  32. name: '',
  33. components: {
  34. },
  35. props: {
  36. businessId: {
  37. default: ''
  38. },
  39. taskId: {
  40. default: ''
  41. },
  42. id: {
  43. default: ''
  44. },
  45. taskDefinitionKey: {
  46. default: ''
  47. }
  48. },
  49. data() {
  50. return {
  51. form: {
  52. technicianId: '',
  53. reason: ''
  54. },
  55. userOptions: []
  56. };
  57. },
  58. created() {
  59. this.userOptions = [];
  60. listAllUserBind().then((data) => {
  61. this.userOptions.push(...data);
  62. });
  63. },
  64. methods: {
  65. async handleAudit(status, type) {
  66. //生产主管审批选择技术员
  67. this._approveTaskWithVariables(status);
  68. },
  69. async _approveTaskWithVariables(status) {
  70. if (status == 1) {
  71. apspurchaseplan({
  72. businessId: this.businessId,
  73. id: this.taskId,
  74. userId: this.form.technicianId,
  75. userName: this.form.userName,
  76. reason: this.form.reason,
  77. pass: true
  78. }).then((res) => {
  79. if (res.data.code != '-1') {
  80. this.$emit('handleAudit', {
  81. status,
  82. title: ''
  83. });
  84. }
  85. });
  86. } else if (status == 0) {
  87. approveTaskWithVariables({
  88. id: this.taskId,
  89. reason: this.form.reason,
  90. pass: false
  91. }).then((res) => {
  92. if (res.data.code != '-1') {
  93. this.$emit('handleAudit', {
  94. status,
  95. title: '驳回'
  96. });
  97. }
  98. });
  99. }
  100. },
  101. getTableValue() {
  102. return new Promise((resolve, reject) => {
  103. this.$emit('getTableValue', async (data) => {
  104. resolve(await data);
  105. });
  106. });
  107. },
  108. //更多
  109. handleCommand(command) {
  110. if (command === 'cancel') {
  111. this.$confirm("是否确认作废?", {
  112. type: 'warning',
  113. cancelButtonText: '取消',
  114. confirmButtonText: '确定'
  115. }).then(() => {
  116. cancel({
  117. id: this.taskId,
  118. reason: this.form.reason,
  119. businessId: this.businessId,
  120. }).then(() => {
  121. this.$emit('handleClose');
  122. }).catch(() => {
  123. this.$message.error("流程作废失败");
  124. });
  125. }).catch(() => {});
  126. }
  127. },
  128. }
  129. };
  130. </script>
  131. <style lang="scss"></style>