detail.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358
  1. <template>
  2. <view class="container">
  3. <uni-forms ref="form" :model="form" labelWidth="80px" :label-position="alignment">
  4. <uni-forms-item label="入职人">
  5. <uni-easyinput v-model="form.entryName" 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.employeeTypeDesc" disabled />
  15. </uni-forms-item>
  16. <uni-forms-item label="性别">
  17. <uni-easyinput v-model="form.gender" disabled />
  18. </uni-forms-item>
  19. <uni-forms-item label="出生日期">
  20. <uni-easyinput v-model="form.birthday" disabled />
  21. </uni-forms-item>
  22. <uni-forms-item label="联系电话">
  23. <uni-easyinput v-model="form.contactNumber" disabled />
  24. </uni-forms-item>
  25. <uni-forms-item label="电子邮箱">
  26. <uni-easyinput v-model="form.email" disabled />
  27. </uni-forms-item>
  28. <uni-forms-item label="教育背景">
  29. <uni-easyinput autoHeight type="textarea" v-model="form.education" disabled />
  30. </uni-forms-item>
  31. <uni-forms-item label="工作经验">
  32. <uni-easyinput autoHeight type="textarea" v-model="form.workExperience" disabled />
  33. </uni-forms-item>
  34. <uni-forms-item label="附件">
  35. <view class="upload-wrap">
  36. <view class="mgb-16 file-wrap" v-for="(item, index) in form.fileList" :key="index">
  37. <view class="btn-click file-line" @click="handlePreview(item)">
  38. <view class="file-info">
  39. <image :src="icons.file" mode="aspectFill" class="file-icon" />
  40. <text class="file-name">{{ item.name || title[type] }}</text>
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. </uni-forms-item>
  46. <uni-forms-item label="备注">
  47. <uni-easyinput autoHeight type="textarea" v-model="form.remarks" disabled />
  48. </uni-forms-item>
  49. <uni-forms-item label="审批意见" required v-if="(form.auditStatus==2 || form.auditStatus==1) && name=='0'">
  50. <uni-easyinput autoHeight maxlength="200" type="textarea" v-model="reason" placeholder="请输入审批建议" />
  51. </uni-forms-item>
  52. <uni-forms-item label="流程动态">
  53. <uni-steps active-icon="medal" :options="tasks" active-color="#007AFF" :active="tasks.length" direction="column" />
  54. </uni-forms-item>
  55. </uni-forms>
  56. <view class="button-group" v-if="name=='0'">
  57. <button type="primary" size="mini" @click="handleAudit(true)">同意</button>
  58. <button size="mini" @click="handleAudit(false)">驳回</button>
  59. </view>
  60. <view class="button-group" v-if="name=='2'">
  61. <button type="warning" size="mini" @click="handleRevocation('form')">撤回</button>
  62. </view>
  63. </view>
  64. </template>
  65. <script>
  66. import { getDetail,revocation,agree,disagree } from "@/api/oa/conversion.js"
  67. export default {
  68. props: {
  69. id: {
  70. type: [String, Number],
  71. default: undefined
  72. },
  73. name: {
  74. type: String,
  75. default: undefined
  76. },
  77. },
  78. data() {
  79. return {
  80. reason:'',
  81. active: -1,
  82. tasks: [],
  83. alignment:'top',
  84. fileList: [],
  85. icons: {
  86. file: '/static/icon_file.png',
  87. },
  88. // 表单数据
  89. form: {},
  90. }
  91. },
  92. watch: {
  93. id: {
  94. immediate: true,
  95. handler(val) {
  96. this.getDetail(val);
  97. }
  98. }
  99. },
  100. methods: {
  101. /** 获得详情信息 */
  102. getDetail(val) {
  103. getDetail(val).then(response => {
  104. let gender = response.data.gender==1?'男':'女';
  105. this.form = response.data;
  106. this.form.gender = gender;
  107. let auditRecordList = response.data.auditRecordList;
  108. let tasks = [];
  109. auditRecordList.forEach(v => {
  110. tasks.push({
  111. title:'任务:' + v.assigneeUser.nickname + v.name,
  112. desc:this.parseTime(v.endTime),
  113. })
  114. })
  115. this.tasks = tasks;
  116. });
  117. },
  118. // 预览
  119. handlePreview(val) {
  120. console.log('PreviewFile', val);
  121. const fileType = this.getFileType(val.name);
  122. if (fileType === 'image') {
  123. uni.previewImage({
  124. current: 0,
  125. urls: [val.url],
  126. });
  127. }
  128. else if (fileType === 'office') {
  129. return uni.downloadFile({
  130. url: val.url,
  131. success: function (res) {
  132. let filePath = res.filePath || res.tempFilePath;
  133. uni.openDocument({
  134. filePath: filePath,
  135. showMenu: true,
  136. success: function (res) {
  137. console.log('打开文档成功');
  138. }
  139. });
  140. }
  141. });
  142. }
  143. else{
  144. uni.showModal({
  145. title: '该类型文件无法预览',
  146. content: val.name,
  147. showCancel: false,
  148. });
  149. }
  150. },
  151. handleRevocation(){
  152. console.log(this.form.taskId);
  153. let that = this
  154. uni.showModal({
  155. title: '提示',
  156. content: '是否确认撤回?',
  157. success: function (res) {
  158. if (res.confirm) {
  159. console.log('用户点击确定');
  160. revocation({id:that.form.taskId}).then(response => {
  161. uni.showToast({
  162. title: "撤回成功!"
  163. })
  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>