detail.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355
  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" 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. })
  162. } else if (res.cancel) {
  163. console.log('用户点击取消');
  164. }
  165. }
  166. });
  167. },
  168. handleAudit(pass) {
  169. if (!this.reason) {
  170. uni.showModal({
  171. title: "提示",
  172. content: "请填写审批意见",
  173. showCancel: false,
  174. confirmText: "确定"
  175. })
  176. return;
  177. } else {
  178. const data = {
  179. id: this.form.taskId,
  180. reason: this.reason,
  181. }
  182. if (pass) {
  183. agree(data).then(response => {
  184. uni.showToast({
  185. title: "审批通过成功!"
  186. })
  187. this.$emit('popupClose');
  188. });
  189. } else {
  190. disagree(data).then(response => {
  191. uni.showToast({
  192. title: "驳回成功!"
  193. })
  194. this.$emit('popupClose');
  195. });
  196. }
  197. }
  198. },
  199. }
  200. }
  201. </script>
  202. <style lang="scss">
  203. .container {
  204. padding: 15px;
  205. background-color: #fff;
  206. }
  207. .segmented-control {
  208. margin-bottom: 15px;
  209. }
  210. .button-group {
  211. margin-top: 15px;
  212. display: flex;
  213. }
  214. .form-item {
  215. display: flex;
  216. align-items: center;
  217. flex: 1;
  218. }
  219. .button {
  220. display: flex;
  221. align-items: center;
  222. height: 35px;
  223. line-height: 35px;
  224. margin-left: 10px;
  225. }
  226. </style>
  227. <style lang="scss" scoped>
  228. .user-avatar {
  229. width: 22px;
  230. height: 22px;
  231. line-height: 19px;
  232. font-size: 12px;
  233. background: #46c26f;
  234. border: 1px solid transparent;
  235. border-radius: 5px;
  236. color: #fff;
  237. display: inline-block;
  238. overflow: hidden;
  239. text-align: center;
  240. line-height: 22px;
  241. margin-bottom: 2px;
  242. }
  243. .popup-body{
  244. z-index: 99;
  245. height: 450px;
  246. overflow-x: auto;
  247. // margin-bottom: 60px;
  248. }
  249. .popup-close{
  250. cursor: pointer;
  251. height: 40px;
  252. line-height: 40px;
  253. padding-left: 10px;
  254. border-bottom: 1px solid #eaecef;
  255. }
  256. .popup-content{
  257. margin: 20px;
  258. }
  259. .btn-click {
  260. transition: all 0.3s;
  261. opacity: 1;
  262. }
  263. .btn-click:active {
  264. opacity: 0.5;
  265. }
  266. .mgb-16 {
  267. margin-bottom: 16rpx;
  268. &:last-child {
  269. margin-bottom: 0;
  270. }
  271. }
  272. .upload-wrap {
  273. width: 100%;
  274. border-radius: 16rpx;
  275. background: white;
  276. // padding: 32rpx;
  277. .upload-btn {
  278. width: 100%;
  279. height: 176rpx;
  280. border: 2rpx dashed #AAAAAA;
  281. background: #FAFAFA;
  282. border-radius: 16rpx;
  283. display: flex;
  284. align-items: center;
  285. justify-content: center;
  286. flex-direction: column;
  287. .upload-icon {
  288. width: 48rpx;
  289. height: 48rpx;
  290. margin-bottom: 8rpx;
  291. }
  292. .upload-text {
  293. font-size: 26rpx;
  294. color: #9E9E9E;
  295. line-height: 40rpx;
  296. }
  297. }
  298. .file-wrap {
  299. .file-line {
  300. width: 100%;
  301. background: #F5F5F5;
  302. border-radius: 8rpx;
  303. padding: 16rpx;
  304. font-size: 26rpx;
  305. color: #1A1A1A;
  306. line-height: 40rpx;
  307. display: flex;
  308. align-items: center;
  309. justify-content: space-between;
  310. .file-info {
  311. width: 90%;
  312. display: flex;
  313. align-items: center;
  314. .file-name {
  315. max-width: 80%;
  316. padding-left: 16rpx;
  317. overflow: hidden;
  318. text-overflow: ellipsis;
  319. white-space: nowrap;
  320. }
  321. }
  322. .file-icon {
  323. width: 40rpx;
  324. height: 40rpx;
  325. flex-shrink: 0;
  326. }
  327. .file-empty {
  328. color: #999999;
  329. }
  330. }
  331. }
  332. }
  333. </style>