detail.vue 8.8 KB

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