detail.vue 8.3 KB

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