submit.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <template>
  2. <el-col :span="16" :offset="6">
  3. <el-form label-width="100px" ref="formRef" :model="form">
  4. <el-form-item
  5. label="审批建议"
  6. style="margin-bottom: 20px"
  7. :rules="{
  8. required: true,
  9. message: '请选择',
  10. trigger: 'change'
  11. }"
  12. >
  13. <el-input
  14. type="textarea"
  15. v-model="form.reason"
  16. placeholder="请输入审批建议"
  17. />
  18. </el-form-item>
  19. </el-form>
  20. <div style="margin-left: 10%; margin-bottom: 20px; font-size: 14px">
  21. <el-button
  22. icon="el-icon-edit-outline"
  23. type="success"
  24. size="mini"
  25. @click="handleAudit(1)"
  26. >通过
  27. </el-button>
  28. <el-button
  29. icon="el-icon-circle-close"
  30. type="danger"
  31. size="mini"
  32. @click="handleAudit(0)">驳回
  33. </el-button>
  34. <el-dropdown @command="(command) => handleCommand(command)" style="margin-left: 30px;">
  35. <span class="el-dropdown-link">更多<i class="el-icon-arrow-down el-icon--right"></i></span>
  36. <el-dropdown-menu slot="dropdown">
  37. <el-dropdown-item command="cancel">作废</el-dropdown-item>
  38. </el-dropdown-menu>
  39. </el-dropdown>
  40. <!-- <el-button
  41. icon="el-icon-circle-close"
  42. type="danger"
  43. size="mini"
  44. @click="handleBackList"
  45. >退回
  46. </el-button> -->
  47. <!-- <el-button
  48. icon="el-icon-circle-close"
  49. type="danger"
  50. size="mini"
  51. @click="handleAudit(0)"
  52. v-if="taskDefinitionKey != 'productionSupervisorApprove1'"
  53. >不通过
  54. </el-button>
  55. <el-button
  56. icon="el-icon-edit-outline"
  57. type="primary"
  58. size="mini"
  59. v-if="taskDefinitionKey != 'productionSupervisorApprove1'"
  60. @click="handleUpdateAssignee"
  61. >转办
  62. </el-button> -->
  63. </div>
  64. </el-col>
  65. </template>
  66. <script>
  67. import {
  68. approveTaskWithVariablesAPI, updateAccountReceiptAPI,
  69. updateAccountStatementAPI, updateReceiveAndPayInfoAPI, accountStatementProcessCancel
  70. } from '@/api/bpm/components/saleManage/saleorder';
  71. import {approveTaskWithVariables} from '@/api/bpm/task';
  72. // import { listAllUserBind } from '@/api/system/organization';
  73. // 流程实例的详情页,可用于审批
  74. export default {
  75. name: '',
  76. components: {
  77. // Parser
  78. },
  79. props: {
  80. businessId: {
  81. default: ''
  82. },
  83. taskId: {
  84. default: ''
  85. },
  86. id: {
  87. default: ''
  88. },
  89. taskDefinitionKey: {
  90. default: ''
  91. }
  92. },
  93. data() {
  94. return {
  95. form: {
  96. technicianId: '',
  97. reason: ''
  98. },
  99. tabOptions: [
  100. {key: 'starter', permissionType: 'update', name: '发起人申请'},
  101. {key: 'deptLeader', permissionType: 'view', name: '销售主管审批'},
  102. {key: 'financeLeader', permissionType: 'view', name: '财务主管审核'},
  103. {key: 'leader', permissionType: 'view', name: '分管副总审批'},
  104. {key: 'uploadReceipt', permissionType: 'view', name: '上传回执'},
  105. ],
  106. permissionType: '',
  107. };
  108. },
  109. created() {
  110. },
  111. mounted() {
  112. this.permissionType = this.tabOptions.find(item => item.key == this.taskDefinitionKey).permissionType
  113. },
  114. methods: {
  115. //保存表格数据
  116. async handleAudit(pass) {
  117. let data = await this.getTableValue()
  118. this.$refs.formRef.validate(async validate => {
  119. if ((!validate || !data) && !!pass) return this.$message.warning('有必填项未填,请检查')
  120. switch (this.taskDefinitionKey) {
  121. case 'starter':
  122. await updateAccountStatementAPI(data);
  123. break;
  124. case 'uploadReceipt':
  125. await updateAccountReceiptAPI(data);
  126. break;
  127. // case 'financeLeader':
  128. // await updateReceiveAndPayInfoAPI(data)
  129. // break;
  130. }
  131. let variables = {
  132. pass: !!pass,
  133. }
  134. approveTaskWithVariablesAPI({
  135. id: this.taskId,
  136. reason: this.form.reason,
  137. variables
  138. }).then((res) => {
  139. if (res.code != '-1') {
  140. this.$emit('handleAudit', {
  141. status: pass,
  142. title: !pass ? '驳回' : ''
  143. });
  144. }
  145. });
  146. })
  147. },
  148. getTableValue() {
  149. return new Promise((resolve, reject) => {
  150. this.$emit('getTableValue', async (data) => {
  151. resolve(await data);
  152. });
  153. });
  154. },
  155. //更多
  156. handleCommand(command) {
  157. if (command === 'cancel') {
  158. this.$confirm("是否确认作废?", {
  159. type: 'warning',
  160. cancelButtonText: '取消',
  161. confirmButtonText: '确定'
  162. }).then(() => {
  163. accountStatementProcessCancel({
  164. id: this.taskId,
  165. reason: this.form.reason,
  166. businessId: this.businessId,
  167. }).then(() => {
  168. this.$emit('handleClose');
  169. }).catch(() => {
  170. this.$message.error("流程作废失败");
  171. });
  172. }).catch(() => {});
  173. }
  174. },
  175. }
  176. };
  177. </script>
  178. <style lang="scss"></style>