detail.vue 8.5 KB

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