submit.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. <template>
  2. <el-col :span="16" :offset="6">
  3. <el-form label-width="100px" ref="formRef" :model="form">
  4. <el-form-item
  5. v-if="taskDefinitionKey === 'deptLeaderAssign'"
  6. label="负责人"
  7. prop="userId"
  8. style="margin-bottom: 20px"
  9. :rules="{
  10. required: true,
  11. message: '请选择',
  12. trigger: 'change'
  13. }"
  14. >
  15. <el-select
  16. v-model="form.userId"
  17. clearable
  18. style="width: 100%"
  19. :filterable="true"
  20. >
  21. <el-option
  22. v-for="item in userOptions"
  23. :key="item.id"
  24. :label="item.name"
  25. :value="item.id"
  26. />
  27. </el-select>
  28. </el-form-item>
  29. <el-form-item
  30. label="审批建议"
  31. prop="reason"
  32. style="margin-bottom: 20px"
  33. :rules="{
  34. required: true,
  35. message: '请选择',
  36. trigger: 'change'
  37. }"
  38. >
  39. <el-input
  40. type="textarea"
  41. v-model="form.reason"
  42. placeholder="请输入审批建议"
  43. />
  44. </el-form-item>
  45. </el-form>
  46. <div style="margin-left: 10%; margin-bottom: 20px; font-size: 14px">
  47. <el-button
  48. icon="el-icon-edit-outline"
  49. type="success"
  50. size="mini"
  51. @click="handleAudit(1)"
  52. >通过
  53. </el-button>
  54. <el-dropdown @command="(command) => handleCommand(command)" style="margin-left: 30px;">
  55. <span class="el-dropdown-link">
  56. 更多<i class="el-icon-arrow-down el-icon--right"></i>
  57. </span>
  58. <el-dropdown-menu slot="dropdown">
  59. <el-dropdown-item command="cancel">作废</el-dropdown-item>
  60. </el-dropdown-menu>
  61. </el-dropdown>
  62. <!-- <el-button
  63. icon="el-icon-circle-close"
  64. type="danger"
  65. size="mini"
  66. @click="handleAudit(0)"
  67. >驳回
  68. </el-button> -->
  69. <!-- <el-button
  70. icon="el-icon-circle-close"
  71. type="danger"
  72. size="mini"
  73. @click="handleBackList"
  74. >退回
  75. </el-button> -->
  76. <!-- <el-button
  77. icon="el-icon-circle-close"
  78. type="danger"
  79. size="mini"
  80. @click="handleAudit(0)"
  81. v-if="taskDefinitionKey != 'productionSupervisorApprove1'"
  82. >不通过
  83. </el-button>
  84. <el-button
  85. icon="el-icon-edit-outline"
  86. type="primary"
  87. size="mini"
  88. v-if="taskDefinitionKey != 'productionSupervisorApprove1'"
  89. @click="handleUpdateAssignee"
  90. >转办
  91. </el-button> -->
  92. </div>
  93. </el-col>
  94. </template>
  95. <script>
  96. import { approveTaskWithVariables } from '@/api/bpm/task';
  97. import { listAllUserBind } from '@/api/system/organization';
  98. import { assign, cancel,UpdateInformation } from '@/api/bpm/components/purchasingManage/purchasePlanManage';
  99. // 流程实例的详情页,可用于审批
  100. export default {
  101. name: '',
  102. components: {
  103. // Parser
  104. },
  105. props: {
  106. businessId: {
  107. default: ''
  108. },
  109. taskId: {
  110. default: ''
  111. },
  112. id: {
  113. default: ''
  114. },
  115. taskDefinitionKey: {
  116. default: ''
  117. }
  118. },
  119. data() {
  120. return {
  121. form: {
  122. userId: '',
  123. reason: ''
  124. },
  125. userOptions: []
  126. };
  127. },
  128. created() {
  129. this.userOptions = [];
  130. listAllUserBind().then((data) => {
  131. this.userOptions.push(...data);
  132. });
  133. },
  134. methods: {
  135. /** 处理转办审批人 */
  136. handleUpdateAssignee() {
  137. this.$emit('handleUpdateAssignee');
  138. },
  139. /** 退回 */
  140. handleBackList() {
  141. this.$emit('handleBackList');
  142. },
  143. async handleAudit(status) {
  144. let userInfo = this.userOptions.find(
  145. (item) => item.id == this.form.userId
  146. );
  147. //主管指派采购员
  148. if (this.taskDefinitionKey === 'deptLeaderAssign') {
  149. if (!this.form.userId) {
  150. this.$message.warning(`请选择负责人!`);
  151. return;
  152. }
  153. await assign({
  154. userId: userInfo.id,
  155. userName: userInfo.name,
  156. id: this.taskId,
  157. reason: this.form.reason,
  158. businessId: this.businessId
  159. });
  160. }
  161. //采购员核对
  162. if (this.taskDefinitionKey === 'purchaserCheck') {
  163. let arr = await this.getTableValue();
  164. if (!arr) {
  165. return;
  166. }
  167. await UpdateInformation(arr);
  168. }
  169. approveTaskWithVariables({
  170. id: this.taskId,
  171. reason: this.form.reason,
  172. variables:{
  173. userId: userInfo?.id,
  174. pass:!!status
  175. }
  176. });
  177. this.$emit('handleAudit', {
  178. status,
  179. title: status === 0 ? '驳回' : ''
  180. });
  181. },
  182. getTableValue() {
  183. return new Promise((resolve, reject) => {
  184. this.$emit('getTableValue', async (data) => {
  185. resolve(await data);
  186. });
  187. });
  188. },
  189. //更多
  190. handleCommand(command) {
  191. if (command === 'cancel') {
  192. this.$confirm("是否确认作废?", {
  193. type: 'warning',
  194. cancelButtonText: '取消',
  195. confirmButtonText: '确定'
  196. }).then(() => {
  197. cancel({
  198. id: this.taskId,
  199. reason: this.form.reason,
  200. businessId: this.businessId,
  201. }).then(() => {
  202. this.$emit('handleClose');
  203. }).catch(() => {
  204. this.$message.error("流程作废失败");
  205. });
  206. }).catch(() => {});
  207. }
  208. },
  209. }
  210. };
  211. </script>
  212. <style lang="scss"></style>