detail.vue 8.7 KB

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