HistorySp.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. <template>
  2. <div class="HistorySp">
  3. <div class="btn-box" v-if="isShow">
  4. <a-button type="primary" style="margin-right: 10px" @click="getPass">通过</a-button>
  5. <a-button type="plain" @click="getReject">驳回</a-button>
  6. </div>
  7. <div class="top-box">
  8. <div class="box-title">流程审批进度历史</div>
  9. <div class="box-content">
  10. <a-table size="small" :dataSource="dataSource" :columns="columns" :scroll="{ y: 730 }" :pagination="pagination" />
  11. </div>
  12. </div>
  13. <div class="bottom-box">
  14. <div class="box-title">实时流程图</div>
  15. <div class="box-content">
  16. <img :src="imgSrcs" alt="" @error="showerrimg" />
  17. </div>
  18. </div>
  19. <!-- 审批通过弹窗 -->
  20. <a-modal v-model:visible="visibleTg" centered :width="600" title="审批通过" @ok="handleTgOk" @cancel="handleTgCancel">
  21. <a-textarea
  22. v-model:value="passDes"
  23. placeholder="请输入通过原因..."
  24. :rows="4"
  25. style="width: 96%; margin: 10px; background-color: transparent; color: #fff"
  26. />
  27. </a-modal>
  28. <!-- 审批驳回弹窗 -->
  29. <a-modal v-model:visible="visibleBh" centered :width="600" title="审批驳回" @ok="handleBhOk" @cancel="handleBhCancel">
  30. <a-textarea
  31. v-model:value="rejectDes"
  32. placeholder="请输入驳回原因..."
  33. :rows="4"
  34. style="width: 96%; margin: 10px; background-color: transparent; color: #fff"
  35. />
  36. </a-modal>
  37. </div>
  38. </template>
  39. <script setup lang="ts">
  40. import { ref, reactive, defineProps, watch } from 'vue';
  41. import { columns } from './comment.data';
  42. import { pass, back } from './comment.api';
  43. import { message } from 'ant-design-vue';
  44. import errorImg from '../../../../assets/images/errorImg.png';
  45. let props = defineProps({
  46. historySpList: {
  47. type: Array,
  48. default: () => {
  49. return [];
  50. },
  51. },
  52. imgSrc: {
  53. type: String,
  54. default: '',
  55. },
  56. isShow: {
  57. type: Boolean,
  58. default: true,
  59. },
  60. spInfo: {
  61. type: Object,
  62. default: () => {
  63. return {};
  64. },
  65. },
  66. });
  67. //数据列表
  68. let dataSource = ref<any[]>([]);
  69. //分页参数配置
  70. let pagination = reactive({
  71. current: 1, // 当前页码
  72. pageSize: 10, // 每页显示条数
  73. total: 0, // 总条目数,后端返回
  74. // showTotal: (total, range) => `${range[0]}-${range[1]} 条,总共 ${total} 条`, // 分页右下角显示信息
  75. showSizeChanger: true, // 是否可改变每页显示条数
  76. pageSizeOptions: ['10', '20', '50'], // 可选的每页显示条数
  77. });
  78. //审批通过驳回参数信息
  79. let spInfos = reactive({
  80. id: '',
  81. priority: '',
  82. procInstId: '',
  83. });
  84. //审批通过
  85. let visibleTg = ref(false);
  86. let passDes = ref('');
  87. //审批驳回
  88. let visibleBh = ref(false);
  89. let rejectDes = ref('');
  90. let imgSrcs = ref('');
  91. let emit = defineEmits(['spClose']);
  92. function showerrimg() {
  93. imgSrcs.value = errorImg;
  94. }
  95. //审批通过
  96. function getPass() {
  97. visibleTg.value = true;
  98. }
  99. //审批通过-确认
  100. async function handleTgOk() {
  101. let res = await pass({
  102. comment: passDes.value,
  103. id: spInfos.id,
  104. priority: spInfos.priority,
  105. procInstId: spInfos.procInstId,
  106. sendEmail: false,
  107. sendMessage: true,
  108. sendSms: false,
  109. });
  110. visibleTg.value = false;
  111. emit('spClose');
  112. message.warning(res.message || res);
  113. }
  114. //审批通过-取消
  115. function handleTgCancel() {
  116. passDes.value = '';
  117. visibleTg.value = false;
  118. }
  119. //审批驳回
  120. function getReject() {
  121. visibleBh.value = true;
  122. }
  123. //确定驳回
  124. async function handleBhOk() {
  125. let res = await back({
  126. comment: rejectDes.value,
  127. id: spInfos.id,
  128. procInstId: spInfos.procInstId,
  129. sendEmail: false,
  130. sendMessage: true,
  131. sendSms: false,
  132. });
  133. visibleBh.value = false;
  134. emit('spClose');
  135. message.warning(res.message || res);
  136. }
  137. //取消驳回
  138. function handleBhCancel() {
  139. rejectDes.value = '';
  140. visibleBh.value = false;
  141. }
  142. watch(
  143. () => props.historySpList,
  144. (newV, oldV) => {
  145. if (newV.length != 0) {
  146. dataSource.value = newV;
  147. }
  148. },
  149. {
  150. immediate: true,
  151. deep: true,
  152. }
  153. );
  154. watch(
  155. () => props.spInfo,
  156. (newV, oldV) => {
  157. spInfos.id = newV.id;
  158. spInfos.priority = newV.priority;
  159. spInfos.procInstId = newV.procInstId;
  160. },
  161. {immediate:true, deep: true }
  162. );
  163. watch(
  164. () => props.imgSrc,
  165. (newV, oldV) => {
  166. imgSrcs.value = newV;
  167. },
  168. { immediate: true, deep: true }
  169. );
  170. </script>
  171. <style lang="less" scoped>
  172. .HistorySp {
  173. position: relative;
  174. width: 100%;
  175. height: 100%;
  176. .btn-box {
  177. width: 98%;
  178. padding: 15px 11px 0px 11px;
  179. box-sizing: border-box;
  180. }
  181. .top-box {
  182. width: 98%;
  183. height: 400px;
  184. margin: 15px auto;
  185. box-shadow: 0 0 20px rgba(68, 180, 255, 0.2) inset;
  186. border-radius: 2px;
  187. border: 1px solid rgba(68, 211, 255, 0.4392156863) !important;
  188. padding: 10px;
  189. box-sizing: border-box;
  190. .box-content {
  191. height: calc(100% - 30px);
  192. }
  193. }
  194. .bottom-box {
  195. width: 98%;
  196. height: 200px;
  197. margin: 15px auto;
  198. box-shadow: 0 0 20px rgba(68, 180, 255, 0.2) inset;
  199. border-radius: 2px;
  200. border: 1px solid rgba(68, 211, 255, 0.4392156863) !important;
  201. padding: 10px;
  202. box-sizing: border-box;
  203. .box-content {
  204. position: relative;
  205. height: calc(100% - 30px);
  206. img {
  207. width: 408px;
  208. height: 95px;
  209. position: absolute;
  210. left: 50%;
  211. top: 26px;
  212. transform: translate(-56%, 0);
  213. }
  214. }
  215. }
  216. .box-title {
  217. font-size: 14px;
  218. height: 30px;
  219. line-height: 30px;
  220. color: #fff;
  221. }
  222. }
  223. .zxm-modal .zxm-modal-body {
  224. padding: 15px !important;
  225. box-sizing: border-box;
  226. }
  227. </style>