detail.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  1. <template>
  2. <div class="widget-wrapper">
  3. <div class="widget-list" v-loading="loading">
  4. <div class="fx-field x-grid-col-12">
  5. <div class="field-label">
  6. <span class="field-required">*</span>
  7. <div class="field-name">申请人</div>
  8. </div>
  9. <div class="field-component">
  10. <span :title="form.loginName">{{ form.employeeName }}</span>
  11. </div>
  12. </div>
  13. <div class="fx-field x-grid-col-12">
  14. <div class="field-label">
  15. <div class="field-name">部门</div>
  16. </div>
  17. <div class="field-component">
  18. <span :title="form.deptName">{{ form.deptName }}</span>
  19. </div>
  20. </div>
  21. <div class="fx-field x-grid-col-12">
  22. <div class="field-label">
  23. <div class="field-name">职位</div>
  24. </div>
  25. <div class="field-component">
  26. <span :title="form.position">{{ form.position }}</span>
  27. </div>
  28. </div>
  29. <div class="fx-field x-grid-col-12">
  30. <div class="field-label">
  31. <span class="field-required">*</span>
  32. <div class="field-name">手机号</div>
  33. </div>
  34. <div class="field-component">
  35. <span :title="form.contactNumber">{{ form.employeePhone }}</span>
  36. </div>
  37. </div>
  38. <div class="fx-field x-grid-col-12">
  39. <div class="field-label">
  40. <span class="field-required">*</span>
  41. <div class="field-name">事项标题</div>
  42. </div>
  43. <div class="field-component">
  44. <span :title="form.email">{{ form.title }}</span>
  45. </div>
  46. </div>
  47. <div class="fx-field x-grid-col-12">
  48. <div class="field-label">
  49. <div class="field-name">详细描述</div>
  50. </div>
  51. <div class="field-component">
  52. <span :title="form.education">{{ form.description }}</span>
  53. </div>
  54. </div>
  55. <div class="fx-field x-grid-col-12">
  56. <div class="field-label">
  57. <div class="field-name">附件</div>
  58. </div>
  59. <div class="field-component">
  60. <div v-for="(item, index) in form.fileList" :key="index">
  61. <a :href="item.url" target="_blank" :title="item.name" style="color: #5094d5;">{{ item.name }}</a>
  62. </div>
  63. </div>
  64. </div>
  65. <div class="fx-field x-grid-col-12">
  66. <div class="field-label">
  67. <div class="field-name">备注</div>
  68. </div>
  69. <div class="field-component">
  70. <span :title="form.remarks">{{ form.remarks }}</span>
  71. </div>
  72. </div>
  73. </div>
  74. <div class="widget-list" v-loading="loading">
  75. <div class="fx-field x-grid-col-12" v-if="(form.auditStatus==2 || form.auditStatus==1) && name=='todo'">
  76. <div class="field-label">
  77. <span class="field-required">*</span>
  78. <div class="field-name">审批意见</div>
  79. </div>
  80. <el-input type="textarea" v-model="reason" placeholder="请输入审批建议" />
  81. </div>
  82. <div class="fx-field x-grid-col-12">
  83. <div class="field-label">
  84. <div class="field-name">流程动态</div>
  85. </div>
  86. <el-timeline>
  87. <el-timeline-item v-for="(item, index) in tasks" :key="index" :icon="getTimelineItemIcon(item)"
  88. :type="getTimelineItemType(item)">
  89. <p style="font-weight: 700">任务:{{ item.name }}</p>
  90. <el-card :body-style="{ padding: '10px' }">
  91. <label v-if="item.assigneeUser" style="font-weight: normal; margin-right: 30px;">
  92. 审批人:{{ item.assigneeUser.nickname }}
  93. <el-tag type="info" size="mini">{{ item.assigneeUser.deptName }}</el-tag>
  94. </label>
  95. <label style="font-weight: normal" v-if="item.createTime">创建时间:</label>
  96. <label style="color:#8a909c; font-weight: normal">{{ parseTime(item.createTime) }}</label>
  97. <label v-if="item.endTime" style="margin-left: 30px;font-weight: normal">审批时间:</label>
  98. <label v-if="item.endTime" style="color:#8a909c;font-weight: normal"> {{
  99. parseTime(item.endTime)
  100. }}</label>
  101. <!-- <label v-if="item.durationInMillis" style="margin-left: 30px;font-weight: normal">耗时:</label>
  102. <label v-if="item.durationInMillis" style="color:#8a909c;font-weight: normal">
  103. {{ getDateStar(item.durationInMillis) }} </label> -->
  104. <p v-if="item.reason">
  105. <el-tag :type="getTimelineItemType(item)">{{ item.reason }}</el-tag>
  106. </p>
  107. </el-card>
  108. </el-timeline-item>
  109. </el-timeline>
  110. </div>
  111. <div class="fx-field x-grid-col-12" >
  112. <div v-if="name=='todo'">
  113. <el-button type="primary" @click="handleAudit(true)" v-loading.fullscreen.lock="fullscreenLoading">同意</el-button>
  114. <el-button @click="handleAudit(false)" v-loading.fullscreen.lock="fullscreenLoading">驳回</el-button>
  115. </div>
  116. <div v-if="name=='my'">
  117. <el-button v-if="form.auditStatus==1" type="warning" @click="handleRevocation()" v-loading.fullscreen.lock="fullscreenLoading">撤回</el-button>
  118. </div>
  119. </div>
  120. </div>
  121. </div>
  122. </template>
  123. <script>
  124. import { getDetail,agree,disagree,revocation } from "@/api/oa/universal"
  125. import {getDate} from "@/utils/dateUtils";
  126. export default {
  127. props: {
  128. id: {
  129. type: [String, Number],
  130. default: undefined
  131. },
  132. name: {
  133. type: String,
  134. default: undefined
  135. },
  136. },
  137. data() {
  138. return {
  139. fullscreenLoading:false,
  140. loading:false,
  141. reason: '',
  142. auditRule: {
  143. reason: [{ required: true, message: '审批建议不能为空', trigger: 'blur' }],
  144. },
  145. tasks: [],
  146. peopleList: [],
  147. // 表单参数
  148. form: {},
  149. };
  150. },
  151. created() {
  152. },
  153. watch: {
  154. id: {
  155. immediate: true,
  156. handler(val) {
  157. this.getDetail(val);
  158. }
  159. }
  160. },
  161. methods: {
  162. getDateStar(ms) {
  163. return getDate(ms);
  164. },
  165. handleRevocation(){
  166. console.log(this.form.taskId);
  167. this.$modal.confirm('是否确认撤回?').then(() => {
  168. this.fullscreenLoading = true;
  169. revocation({id:this.form.taskId}).then(response => {
  170. this.fullscreenLoading = false;
  171. this.$modal.msgSuccess("撤回成功");
  172. this.$parent.$parent.closeEdit();
  173. })
  174. }).catch(() => { });
  175. },
  176. handleAudit(pass) {
  177. if (!this.reason) {
  178. this.$message({
  179. message: '请填写审批意见',
  180. type: 'warning',
  181. customClass: 'myBox'
  182. });
  183. return;
  184. } else {
  185. const data = {
  186. id: this.form.taskId,
  187. reason: this.reason,
  188. }
  189. if (pass) {
  190. this.fullscreenLoading = true;
  191. agree(data).then(response => {
  192. this.fullscreenLoading = false;
  193. this.$parent.$parent.closeEdit();
  194. this.$modal.msgSuccess({
  195. message: '审批通过成功!',
  196. customClass: 'myBox'
  197. });
  198. });
  199. } else {
  200. this.fullscreenLoading = true;
  201. disagree(data).then(response => {
  202. this.fullscreenLoading = false;
  203. this.$parent.$parent.closeEdit();
  204. this.$modal.msgSuccess({
  205. message: '驳回成功!',
  206. customClass: 'myBox'
  207. });
  208. });
  209. }
  210. }
  211. },
  212. getTimelineItemIcon(item) {
  213. if (item.result === 1) {
  214. return 'el-icon-time';
  215. }
  216. if (item.result === 2) {
  217. return 'el-icon-check';
  218. }
  219. if (item.result === 3) {
  220. return 'el-icon-close';
  221. }
  222. if (item.result === 4) {
  223. return 'el-icon-remove-outline';
  224. }
  225. if (item.result === 5) {
  226. return 'el-icon-back'
  227. }
  228. return '';
  229. },
  230. getTimelineItemType(item) {
  231. if (item.result === 1) {
  232. return 'primary';
  233. }
  234. if (item.result === 2) {
  235. return 'success';
  236. }
  237. if (item.result === 3) {
  238. return 'danger';
  239. }
  240. if (item.result === 4) {
  241. return 'info';
  242. }
  243. if (item.result === 5) {
  244. return 'warning';
  245. }
  246. if (item.result === 6) {
  247. return 'default'
  248. }
  249. return '';
  250. },
  251. /** 获得详情信息 */
  252. getDetail(val) {
  253. this.$parent.$parent.detailLoading = true
  254. getDetail(val).then(response => {
  255. this.$parent.$parent.detailLoading = false
  256. this.form = response.data;
  257. this.tasks = response.data.auditRecordList;
  258. });
  259. },
  260. }
  261. };
  262. </script>
  263. <style>
  264. /* .el-timeline-item__wrapper {
  265. top: -12px !important;
  266. } */
  267. </style>
  268. <style lang="scss" scoped>
  269. .widget-wrapper>.widget-list {
  270. display: flex;
  271. flex-wrap: wrap;
  272. }
  273. .x-grid-col-6 {
  274. width: 50%;
  275. }
  276. .x-grid-col-12 {
  277. width: 100%;
  278. }
  279. .fx-field {
  280. line-height: 20px;
  281. padding: 7px 12px 12px;
  282. position: relative;
  283. }
  284. .fx-field .field-label {
  285. word-wrap: break-word;
  286. color: #141e31;
  287. display: flex;
  288. font-weight: 600;
  289. line-height: 20px;
  290. padding: 5px 0;
  291. position: relative;
  292. word-break: break-word;
  293. }
  294. .fx-field .field-label .field-required {
  295. color: #eb5050;
  296. margin-left: -6px;
  297. position: relative;
  298. }
  299. .fx-field .field-label .field-name {
  300. overflow: hidden;
  301. }
  302. .field-component {
  303. word-wrap: break-word;
  304. background: #f5f6f8;
  305. border-radius: 2px;
  306. color: #141e31;
  307. font-size: 14px;
  308. line-height: 20px;
  309. min-height: 32px;
  310. padding: 6px 8px;
  311. white-space: pre-wrap;
  312. word-break: break-word;
  313. }
  314. ul {
  315. padding-left: 0px !important;
  316. }
  317. .el-tag+.el-tag {
  318. margin-left: 10px;
  319. }
  320. </style>