detail.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  1. <template>
  2. <view class="container">
  3. <uni-forms ref="form" :model="form" labelWidth="120px" :label-position="alignment">
  4. <uni-forms-item label="离职人">
  5. <uni-easyinput v-model="form.employeeName" disabled />
  6. </uni-forms-item>
  7. <uni-forms-item label="部门">
  8. <uni-easyinput v-model="form.deptName" disabled />
  9. </uni-forms-item>
  10. <uni-forms-item label="职位">
  11. <uni-easyinput v-model="form.position" disabled />
  12. </uni-forms-item>
  13. <uni-forms-item label="手机号">
  14. <uni-easyinput v-model="form.employeePhone" disabled />
  15. </uni-forms-item>
  16. <uni-forms-item label="入职日期">
  17. <uni-easyinput v-model="form.entryDate" disabled />
  18. </uni-forms-item>
  19. <uni-forms-item label="离职日期">
  20. <uni-easyinput v-model="form.turnoverDate" disabled />
  21. </uni-forms-item>
  22. <uni-forms-item label="离职原因">
  23. <uni-easyinput v-model="form.turnoverReasonDesc" disabled />
  24. </uni-forms-item>
  25. <uni-forms-item label="附件">
  26. <view class="upload-wrap">
  27. <view class="mgb-16 file-wrap" v-for="(item, index) in form.fileList" :key="index">
  28. <view class="btn-click file-line" @click="handlePreview(item)">
  29. <view class="file-info">
  30. <image :src="icons.file" mode="aspectFill" class="file-icon" />
  31. <text class="file-name">{{ item.name || title[type] }}</text>
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. </uni-forms-item>
  37. <uni-forms-item label="备注">
  38. <uni-easyinput autoHeight type="textarea" v-model="form.remarks" disabled />
  39. </uni-forms-item>
  40. <uni-forms-item label="审批意见" required v-if="(form.auditStatus==2 || form.auditStatus==1) && name=='0'">
  41. <uni-easyinput autoHeight maxlength="200" type="textarea" v-model="reason" placeholder="请输入审批建议" />
  42. </uni-forms-item>
  43. <uni-forms-item label="流程动态">
  44. <uni-steps active-icon="medal" :options="tasks" active-color="#007AFF" :active="tasks.length" direction="column" />
  45. </uni-forms-item>
  46. </uni-forms>
  47. <view class="button-group" v-if="name=='0'">
  48. <button type="primary" size="mini" @click="handleAudit(true)">同意</button>
  49. <button size="mini" @click="handleAudit(false)">驳回</button>
  50. </view>
  51. <view class="button-group" v-if="name=='2'">
  52. <button type="warning" v-if="form.auditStatus==1" size="mini" @click="handleRevocation('form')">撤回</button>
  53. </view>
  54. </view>
  55. </template>
  56. <script>
  57. import { getDetail,revocation,agree,disagree } from "@/api/oa/turnover.js"
  58. export default {
  59. props: {
  60. id: {
  61. type: [String, Number],
  62. default: undefined
  63. },
  64. name: {
  65. type: String,
  66. default: undefined
  67. },
  68. },
  69. data() {
  70. return {
  71. reason:'',
  72. active: -1,
  73. tasks: [],
  74. alignment:'top',
  75. fileList: [],
  76. icons: {
  77. file: '/static/icon_file.png',
  78. },
  79. // 表单数据
  80. form: {},
  81. }
  82. },
  83. watch: {
  84. id: {
  85. immediate: true,
  86. handler(val) {
  87. this.getDetail(val);
  88. }
  89. }
  90. },
  91. methods: {
  92. /** 获得详情信息 */
  93. getDetail(val) {
  94. getDetail(val).then(response => {
  95. let gender = response.data.gender==1?'男':'女';
  96. this.form = response.data;
  97. this.form.gender = gender;
  98. let auditRecordList = response.data.auditRecordList;
  99. let tasks = [];
  100. auditRecordList.forEach(v => {
  101. tasks.push({
  102. title:'任务:' + v.assigneeUser.nickname + v.name,
  103. desc:this.parseTime(v.endTime),
  104. })
  105. })
  106. this.tasks = tasks;
  107. });
  108. },
  109. // 预览
  110. handlePreview(val) {
  111. console.log('PreviewFile', val);
  112. const fileType = this.getFileType(val.name);
  113. if (fileType === 'image') {
  114. uni.previewImage({
  115. current: 0,
  116. urls: [val.url],
  117. });
  118. }
  119. else if (fileType === 'office') {
  120. return uni.downloadFile({
  121. url: val.url,
  122. success: function (res) {
  123. let filePath = res.filePath || res.tempFilePath;
  124. uni.openDocument({
  125. filePath: filePath,
  126. showMenu: true,
  127. success: function (res) {
  128. console.log('打开文档成功');
  129. }
  130. });
  131. }
  132. });
  133. }
  134. else{
  135. uni.showModal({
  136. title: '该类型文件无法预览',
  137. content: val.name,
  138. showCancel: false,
  139. });
  140. }
  141. },
  142. handleRevocation(){
  143. console.log(this.form.taskId);
  144. let that = this
  145. uni.showModal({
  146. title: '提示',
  147. content: '是否确认撤回?',
  148. success: function (res) {
  149. if (res.confirm) {
  150. console.log('用户点击确定');
  151. revocation({id:that.form.taskId}).then(response => {
  152. uni.showToast({
  153. title: "撤回成功!"
  154. })
  155. that.$emit('popupClose');
  156. })
  157. } else if (res.cancel) {
  158. console.log('用户点击取消');
  159. }
  160. }
  161. });
  162. },
  163. handleAudit(pass) {
  164. if (!this.reason) {
  165. uni.showModal({
  166. title: "提示",
  167. content: "请填写审批意见",
  168. showCancel: false,
  169. confirmText: "确定"
  170. })
  171. return;
  172. } else {
  173. const data = {
  174. id: this.form.taskId,
  175. reason: this.reason,
  176. }
  177. if (pass) {
  178. agree(data).then(response => {
  179. uni.showToast({
  180. title: "审批通过成功!"
  181. })
  182. this.$emit('popupClose');
  183. });
  184. } else {
  185. disagree(data).then(response => {
  186. uni.showToast({
  187. title: "驳回成功!"
  188. })
  189. this.$emit('popupClose');
  190. });
  191. }
  192. }
  193. },
  194. }
  195. }
  196. </script>
  197. <style lang="scss">
  198. .container {
  199. padding: 15px;
  200. background-color: #fff;
  201. }
  202. .segmented-control {
  203. margin-bottom: 15px;
  204. }
  205. .button-group {
  206. margin-top: 15px;
  207. display: flex;
  208. }
  209. .form-item {
  210. display: flex;
  211. align-items: center;
  212. flex: 1;
  213. }
  214. .button {
  215. display: flex;
  216. align-items: center;
  217. height: 35px;
  218. line-height: 35px;
  219. margin-left: 10px;
  220. }
  221. </style>
  222. <style lang="scss" scoped>
  223. .user-avatar {
  224. width: 22px;
  225. height: 22px;
  226. line-height: 19px;
  227. font-size: 12px;
  228. background: #46c26f;
  229. border: 1px solid transparent;
  230. border-radius: 5px;
  231. color: #fff;
  232. display: inline-block;
  233. overflow: hidden;
  234. text-align: center;
  235. line-height: 22px;
  236. margin-bottom: 2px;
  237. }
  238. .popup-body{
  239. z-index: 99;
  240. height: 450px;
  241. overflow-x: auto;
  242. // margin-bottom: 60px;
  243. }
  244. .popup-close{
  245. cursor: pointer;
  246. height: 40px;
  247. line-height: 40px;
  248. padding-left: 10px;
  249. border-bottom: 1px solid #eaecef;
  250. }
  251. .popup-content{
  252. margin: 20px;
  253. }
  254. .btn-click {
  255. transition: all 0.3s;
  256. opacity: 1;
  257. }
  258. .btn-click:active {
  259. opacity: 0.5;
  260. }
  261. .mgb-16 {
  262. margin-bottom: 16rpx;
  263. &:last-child {
  264. margin-bottom: 0;
  265. }
  266. }
  267. .upload-wrap {
  268. width: 100%;
  269. border-radius: 16rpx;
  270. background: white;
  271. // padding: 32rpx;
  272. .upload-btn {
  273. width: 100%;
  274. height: 176rpx;
  275. border: 2rpx dashed #AAAAAA;
  276. background: #FAFAFA;
  277. border-radius: 16rpx;
  278. display: flex;
  279. align-items: center;
  280. justify-content: center;
  281. flex-direction: column;
  282. .upload-icon {
  283. width: 48rpx;
  284. height: 48rpx;
  285. margin-bottom: 8rpx;
  286. }
  287. .upload-text {
  288. font-size: 26rpx;
  289. color: #9E9E9E;
  290. line-height: 40rpx;
  291. }
  292. }
  293. .file-wrap {
  294. .file-line {
  295. width: 100%;
  296. background: #F5F5F5;
  297. border-radius: 8rpx;
  298. padding: 16rpx;
  299. font-size: 26rpx;
  300. color: #1A1A1A;
  301. line-height: 40rpx;
  302. display: flex;
  303. align-items: center;
  304. justify-content: space-between;
  305. .file-info {
  306. width: 90%;
  307. display: flex;
  308. align-items: center;
  309. .file-name {
  310. max-width: 80%;
  311. padding-left: 16rpx;
  312. overflow: hidden;
  313. text-overflow: ellipsis;
  314. white-space: nowrap;
  315. }
  316. }
  317. .file-icon {
  318. width: 40rpx;
  319. height: 40rpx;
  320. flex-shrink: 0;
  321. }
  322. .file-empty {
  323. color: #999999;
  324. }
  325. }
  326. }
  327. }
  328. </style>