enquiryVerifyProcess.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. <template>
  2. <a-drawer :title="title" placement="right" :closable="true" :visible="visible" @close="onClose" destroyOnClose :width="600">
  3. <a-spin :spinning="loading">
  4. <a-steps :current="current" direction="vertical" class="self_step">
  5. <a-step v-for="(item, index) in stepData" :key="index">
  6. <template #title>
  7. <div v-if="item.status == 1" style="width: 100%; line-height: 21px">
  8. <span>{{ item.name }}</span>
  9. <a-button
  10. style="margin-left: 16px"
  11. ghost
  12. disabled
  13. v-if="!isCustomer"
  14. type="primary"
  15. size="small"
  16. @click="finishOrRollbackStep(item.id, 0, null, item.nodeType, item.description)"
  17. >
  18. 撤销
  19. </a-button>
  20. <span style="margin-left: 40px">{{ item.finTime }}</span>
  21. </div>
  22. <div style="margin: 2.5px 0" v-if="item.finName !== null">
  23. <span>审核人: {{ item.finName }}</span>
  24. </div>
  25. <div style="width: 100%; line-height: 21px" v-else-if="index === current">
  26. <span :style="{ color: 'blue' }">{{ item.name }}</span>
  27. <a-button
  28. style="margin-left: 16px"
  29. v-if="showFinBtn && !isCustomer"
  30. ghost
  31. type="primary"
  32. size="small"
  33. @click="finishOrRollbackStep(item.id, 1, item.finTime, item.nodeType, item.description)"
  34. >
  35. 完成
  36. </a-button>
  37. {{ item.finTime }}
  38. </div>
  39. <div style="width: 100%; line-height: 21px" v-else>
  40. <span :style="{ color: '#606266' }">{{ item.name }}</span>
  41. <a-button
  42. style="margin-left: 16px"
  43. v-if="showFinBtn && !isCustomer"
  44. ghost
  45. type="primary"
  46. size="small"
  47. @click="finishOrRollbackStep(item.id, 1, item.finTime, item.nodeType, item.description)"
  48. >完成</a-button
  49. >
  50. </div>
  51. </template>
  52. <template #description>
  53. <div style="margin: 2.5px 0" v-if="item.timeDesc !== null">{{ item.timeDesc }}</div>
  54. <div style="margin: 2.5px 0" v-if="item.status == 1">
  55. <a-textarea v-model:value="item.description" disabled="disabled" :rows="8" placeholder="请输入审核日志记录" />
  56. </div>
  57. <div style="margin: 2.5px 0" v-if="item.status == 0">
  58. <a-textarea v-model:value="item.description" :rows="8" placeholder="请输入审核日志记录" />
  59. </div>
  60. </template>
  61. </a-step>
  62. </a-steps>
  63. </a-spin>
  64. </a-drawer>
  65. </template>
  66. <script lang="ts" setup>
  67. import '/@/assets/less/common.less';
  68. import { getAction, postAction } from '/@/api/manage/manage';
  69. import { computed, reactive, ref } from 'vue';
  70. import { useMessage } from '@/hooks/web/useMessage';
  71. import { RoleEnum } from '@/enums/roleEnum';
  72. import { useUserStore } from '@/store/modules/user';
  73. const userStore = useUserStore();
  74. const visible = ref(false);
  75. const title = ref('询盘审核流程');
  76. const url = ref('');
  77. const current = ref(0);
  78. let stepData = ref([{ id: '', status: 0, name: '未提交', description: '未提交', nodeType: 4, finName: '', finTime: '', timeDesc: '', finUid: '' }]);
  79. let record = reactive({});
  80. const showFinBtn = ref(false);
  81. const isCustomer = ref(false);
  82. // const finishTime = ref('');
  83. // const dateFormat = 'YYYY-MM-DD HH:mm:ss';
  84. const loading = ref(false);
  85. const emit = defineEmits(['close', 'reload']);
  86. const { createMessage } = useMessage();
  87. const isAdmin = computed(() => {
  88. return (
  89. userStore.getRoleList.includes(RoleEnum.ADMIN) ||
  90. userStore.getRoleList.includes(RoleEnum.ADWEB_ADMIN) ||
  91. userStore.getRoleList.includes(RoleEnum.SEO_ADMIN) ||
  92. userStore.getRoleList.includes(RoleEnum.ADWEB_SITE_MANAGER) ||
  93. userStore.getRoleList.includes(RoleEnum.ADWEB_SEO_MANAGER) ||
  94. userStore.getRoleList.includes(RoleEnum.ADWEB_CHANNEL_ADMIN)
  95. );
  96. });
  97. const enquiryMaster = ref(false);
  98. // 判断询盘所有者是否已经审核过该询盘
  99. const enquiryMasterHasBeenVerify = ref(false);
  100. function init(r, t) {
  101. record = r;
  102. visible.value = true;
  103. if (t === 'seo') {
  104. url.value = '/adweb/executeNode/querySEOFlow?siteCode=' + r.code + '&historyId=' + r.historyId;
  105. } else if (t === 'enquiry') {
  106. url.value = '/adweb/executeNode/queryEnquiryVerifyFlow?enquiryId=' + r.id;
  107. } else {
  108. url.value = '/adweb/executeNode/querySiteBuildFlow?siteCode=' + r.code;
  109. }
  110. showStep();
  111. // 判断当前询盘是否属于当前登录用户
  112. if (r.uid == userStore.userInfo?.id) {
  113. enquiryMaster.value = true;
  114. }
  115. }
  116. function onClose() {
  117. emit('close');
  118. closeStep();
  119. }
  120. function showStep() {
  121. stepData.value = [];
  122. loading.value = true;
  123. getAction(url.value, {})
  124. .then((res) => {
  125. loading.value = false;
  126. if (res.code === 200) {
  127. stepData.value = res.result;
  128. // 当前步骤
  129. for (let i = 0; i < res.result.length; i++) {
  130. if (res.result[i].status === 0) {
  131. current.value = i;
  132. showFinBtn.value = true;
  133. return;
  134. }
  135. }
  136. current.value = res.result.length;
  137. showFinBtn.value = false;
  138. }
  139. })
  140. .catch((e) => {
  141. createMessage.warn('获取数据失败!' + e.message());
  142. loading.value = false;
  143. });
  144. }
  145. function closeStep() {
  146. showFinBtn.value = false;
  147. current.value = 0;
  148. stepData.value = [];
  149. visible.value = false;
  150. }
  151. function finishOrRollbackStep(id, status, finishTime, nodeType, description) {
  152. for (let i = 0; i < stepData.value.length; i++) {
  153. // 判断当前登录用户是否是询盘所有者,并且是否已经审核过询盘
  154. if (enquiryMaster.value && stepData.value[i].status === 1 && stepData.value[i].finUid === record.uid) {
  155. createMessage.warn('询盘所有者已经审核过,请等待其他管理员审核!');
  156. return;
  157. }
  158. if (isAdmin.value && stepData.value[i].status === 1 && stepData.value[i].finUid !== record.uid) {
  159. createMessage.warn('管理员用户已经审核过,请等待询盘所有者审核!');
  160. return;
  161. }
  162. }
  163. if (status == 1 && description == '') {
  164. createMessage.warn('审核日志记录不能为空');
  165. return;
  166. }
  167. loading.value = true;
  168. let params = {
  169. id: id,
  170. status: status,
  171. hostId: record.id,
  172. finTime: finishTime,
  173. nodeType: nodeType,
  174. stepCount: stepData.value.length,
  175. description: description,
  176. };
  177. postAction('/adweb/executeNode/finishOrRollbackEnquiryVerifyStep', params, 120000).then((res) => {
  178. if (res.code === 200) {
  179. createMessage.success('操作成功');
  180. showStep();
  181. emit('reload');
  182. }
  183. loading.value = false;
  184. });
  185. }
  186. defineExpose({
  187. init,
  188. onClose,
  189. });
  190. </script>
  191. <style lang="less" scoped>
  192. .self_step {
  193. /deep/ .ant-steps-item-content {
  194. width: 410px;
  195. .ant-steps-item-title {
  196. width: 100%;
  197. span {
  198. font-size: 13px;
  199. color: green;
  200. &.fr {
  201. float: right;
  202. }
  203. }
  204. }
  205. .ant-steps-item-description {
  206. div {
  207. //padding-left: 20px;
  208. font-size: 14px;
  209. }
  210. }
  211. }
  212. }
  213. .doBtn {
  214. position: absolute;
  215. bottom: 15px;
  216. width: 150px;
  217. right: 150px;
  218. }
  219. </style>
  220. <style lang="less">
  221. .self_step {
  222. .ant-steps-item-finish .ant-steps-item-icon > .ant-steps-icon .ant-steps-icon-dot {
  223. background: green;
  224. }
  225. }
  226. </style>