detail.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364
  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.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.stampTitle" disabled />
  18. </uni-forms-item>
  19. <uni-forms-item label="用章类型">
  20. <uni-data-checkbox v-model="form.stampSealId" multiple :localdata="oaStampSeal" disabled/>
  21. </uni-forms-item>
  22. <uni-forms-item label="用印事由">
  23. <uni-easyinput autoHeight type="textarea" v-model="form.reason" disabled />
  24. </uni-forms-item>
  25. <uni-forms-item label="附件">
  26. <view class="upload-wrap">
  27. <view class="mgb-16 file-wrap" v-for="(item, index) in form.fileList" :key="index">
  28. <view class="btn-click file-line" @click="handlePreview(item)">
  29. <view class="file-info">
  30. <image :src="icons.file" mode="aspectFill" class="file-icon" />
  31. <text class="file-name">{{ item.name || title[type] }}</text>
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. </uni-forms-item>
  37. <uni-forms-item label="备注">
  38. <uni-easyinput autoHeight maxlength="200" type="textarea" v-model="form.remarks" disabled />
  39. </uni-forms-item>
  40. <uni-forms-item label="审批意见" required v-if="(form.auditStatus==2 || form.auditStatus==1) && name=='0'">
  41. <uni-easyinput autoHeight maxlength="200" type="textarea" v-model="reason" placeholder="请输入审批建议" />
  42. </uni-forms-item>
  43. <uni-forms-item label="流程动态">
  44. <uni-steps active-icon="medal" :options="tasks" active-color="#007AFF" :active="tasks.length" direction="column" />
  45. </uni-forms-item>
  46. </uni-forms>
  47. <view class="button-group" v-if="name=='0'">
  48. <button type="primary" size="mini" @click="handleAudit(true)">同意</button>
  49. <button size="mini" @click="handleAudit(false)">驳回</button>
  50. </view>
  51. <view class="button-group" v-if="name=='2'">
  52. <button type="warning" v-if="form.auditStatus==1" size="mini" @click="handleRevocation('form')">撤回</button>
  53. </view>
  54. </view>
  55. </template>
  56. <script>
  57. import { typeList,getDetail,revocation,agree,disagree } from "@/api/oa/stamp.js"
  58. export default {
  59. props: {
  60. id: {
  61. type: [String, Number],
  62. default: undefined
  63. },
  64. name: {
  65. type: String,
  66. default: undefined
  67. },
  68. },
  69. data() {
  70. return {
  71. oaStampSeal:[],
  72. reason:'',
  73. active: -1,
  74. tasks: [],
  75. userInfo:uni.getStorageSync('userInfo'),
  76. alignment:'top',
  77. fileList: [],
  78. icons: {
  79. file: '/static/icon_file.png',
  80. },
  81. // 表单数据
  82. form: {},
  83. }
  84. },
  85. watch: {
  86. id: {
  87. immediate: true,
  88. handler(val) {
  89. this.getTypeList();
  90. this.getDetail(val);
  91. }
  92. }
  93. },
  94. methods: {
  95. // 类型信息列表
  96. getTypeList(){
  97. typeList().then(response => {
  98. response.data.forEach(v => {
  99. this.oaStampSeal.push({
  100. text: v.sealName,
  101. value: v.id,
  102. })
  103. })
  104. });
  105. },
  106. /** 获得详情信息 */
  107. getDetail(val) {
  108. getDetail(val).then(response => {
  109. this.form = response.data;
  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>