HistorySp.vue 5.8 KB

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