detail.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356
  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. tasks.push({
  108. title:'任务:' + v.assigneeUser.nickname + v.name,
  109. desc:this.parseTime(v.endTime),
  110. })
  111. })
  112. this.tasks = tasks;
  113. });
  114. },
  115. // 预览
  116. handlePreview(val) {
  117. console.log('PreviewFile', val);
  118. const fileType = this.getFileType(val.name);
  119. if (fileType === 'image') {
  120. uni.previewImage({
  121. current: 0,
  122. urls: [val.url],
  123. });
  124. }
  125. else if (fileType === 'office') {
  126. return uni.downloadFile({
  127. url: val.url,
  128. success: function (res) {
  129. let filePath = res.filePath || res.tempFilePath;
  130. uni.openDocument({
  131. filePath: filePath,
  132. showMenu: true,
  133. success: function (res) {
  134. console.log('打开文档成功');
  135. }
  136. });
  137. }
  138. });
  139. }
  140. else{
  141. uni.showModal({
  142. title: '该类型文件无法预览',
  143. content: val.name,
  144. showCancel: false,
  145. });
  146. }
  147. },
  148. handleRevocation(){
  149. console.log(this.form.taskId);
  150. let that = this
  151. uni.showModal({
  152. title: '提示',
  153. content: '是否确认撤回?',
  154. success: function (res) {
  155. if (res.confirm) {
  156. console.log('用户点击确定');
  157. revocation({id:that.form.taskId}).then(response => {
  158. uni.showToast({
  159. title: "撤回成功!"
  160. })
  161. that.$emit('popupClose');
  162. })
  163. } else if (res.cancel) {
  164. console.log('用户点击取消');
  165. }
  166. }
  167. });
  168. },
  169. handleAudit(pass) {
  170. if (!this.reason) {
  171. uni.showModal({
  172. title: "提示",
  173. content: "请填写审批意见",
  174. showCancel: false,
  175. confirmText: "确定"
  176. })
  177. return;
  178. } else {
  179. const data = {
  180. id: this.form.taskId,
  181. reason: this.reason,
  182. }
  183. if (pass) {
  184. agree(data).then(response => {
  185. uni.showToast({
  186. title: "审批通过成功!"
  187. })
  188. this.$emit('popupClose');
  189. });
  190. } else {
  191. disagree(data).then(response => {
  192. uni.showToast({
  193. title: "驳回成功!"
  194. })
  195. this.$emit('popupClose');
  196. });
  197. }
  198. }
  199. },
  200. }
  201. }
  202. </script>
  203. <style lang="scss">
  204. .container {
  205. padding: 15px;
  206. background-color: #fff;
  207. }
  208. .segmented-control {
  209. margin-bottom: 15px;
  210. }
  211. .button-group {
  212. margin-top: 15px;
  213. display: flex;
  214. }
  215. .form-item {
  216. display: flex;
  217. align-items: center;
  218. flex: 1;
  219. }
  220. .button {
  221. display: flex;
  222. align-items: center;
  223. height: 35px;
  224. line-height: 35px;
  225. margin-left: 10px;
  226. }
  227. </style>
  228. <style lang="scss" scoped>
  229. .user-avatar {
  230. width: 22px;
  231. height: 22px;
  232. line-height: 19px;
  233. font-size: 12px;
  234. background: #46c26f;
  235. border: 1px solid transparent;
  236. border-radius: 5px;
  237. color: #fff;
  238. display: inline-block;
  239. overflow: hidden;
  240. text-align: center;
  241. line-height: 22px;
  242. margin-bottom: 2px;
  243. }
  244. .popup-body{
  245. z-index: 99;
  246. height: 450px;
  247. overflow-x: auto;
  248. // margin-bottom: 60px;
  249. }
  250. .popup-close{
  251. cursor: pointer;
  252. height: 40px;
  253. line-height: 40px;
  254. padding-left: 10px;
  255. border-bottom: 1px solid #eaecef;
  256. }
  257. .popup-content{
  258. margin: 20px;
  259. }
  260. .btn-click {
  261. transition: all 0.3s;
  262. opacity: 1;
  263. }
  264. .btn-click:active {
  265. opacity: 0.5;
  266. }
  267. .mgb-16 {
  268. margin-bottom: 16rpx;
  269. &:last-child {
  270. margin-bottom: 0;
  271. }
  272. }
  273. .upload-wrap {
  274. width: 100%;
  275. border-radius: 16rpx;
  276. background: white;
  277. // padding: 32rpx;
  278. .upload-btn {
  279. width: 100%;
  280. height: 176rpx;
  281. border: 2rpx dashed #AAAAAA;
  282. background: #FAFAFA;
  283. border-radius: 16rpx;
  284. display: flex;
  285. align-items: center;
  286. justify-content: center;
  287. flex-direction: column;
  288. .upload-icon {
  289. width: 48rpx;
  290. height: 48rpx;
  291. margin-bottom: 8rpx;
  292. }
  293. .upload-text {
  294. font-size: 26rpx;
  295. color: #9E9E9E;
  296. line-height: 40rpx;
  297. }
  298. }
  299. .file-wrap {
  300. .file-line {
  301. width: 100%;
  302. background: #F5F5F5;
  303. border-radius: 8rpx;
  304. padding: 16rpx;
  305. font-size: 26rpx;
  306. color: #1A1A1A;
  307. line-height: 40rpx;
  308. display: flex;
  309. align-items: center;
  310. justify-content: space-between;
  311. .file-info {
  312. width: 90%;
  313. display: flex;
  314. align-items: center;
  315. .file-name {
  316. max-width: 80%;
  317. padding-left: 16rpx;
  318. overflow: hidden;
  319. text-overflow: ellipsis;
  320. white-space: nowrap;
  321. }
  322. }
  323. .file-icon {
  324. width: 40rpx;
  325. height: 40rpx;
  326. flex-shrink: 0;
  327. }
  328. .file-empty {
  329. color: #999999;
  330. }
  331. }
  332. }
  333. }
  334. </style>