shenhe.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461
  1. <template>
  2. <view>
  3. <view class="content">
  4. <view class="section">
  5. <view class="title">申请人</view>
  6. <view class="inner">
  7. <view class="user">
  8. <!-- <view class="img">
  9. <view class="avatar" :style="{backgroundColor:bgColor[1]}">{{detail.staff.split('').pop()}}</view>
  10. </view> -->
  11. <view class="info">
  12. <view class="name">{{detail.staff}}</view>
  13. <view class="section">{{detail.staff_section}}</view>
  14. </view>
  15. </view>
  16. </view>
  17. </view>
  18. <view class="section">
  19. <view class="title">申请时间</view>
  20. <view class="inner">{{detail.created_at}}</view>
  21. </view>
  22. <view class="section">
  23. <view class="title">业务分类</view>
  24. <view class="inner">{{detail.classify}}</view>
  25. </view>
  26. <view class="section">
  27. <view class="title">业务名称</view>
  28. <view class="inner">{{detail.title}}</view>
  29. </view>
  30. <view class="section">
  31. <view class="title">业务介绍</view>
  32. <view class="inner">{{detail.introduce}}</view>
  33. </view>
  34. <view class="section" v-if="detail.filelist">
  35. <view class="title">需审核文件</view>
  36. <view class="inner">
  37. <view class="file_list">
  38. <view class="item" v-for="(item,index) in detail.filelist" :key="index"
  39. @click="open_file(item.path)">
  40. <view class="left">
  41. <view class="icon"></view>
  42. <view class="info">
  43. <view class="name">{{item.fileName}}</view>
  44. <!-- <view class="size">{{item.fileSize}}KB</view> -->
  45. </view>
  46. </view>
  47. <view class="right">
  48. <uni-icons type="arrowright"></uni-icons>
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. </view>
  54. <view class="section" v-if="detail.$photos">
  55. <view class="title">需审核图片</view>
  56. <view class="inner">
  57. <view class="img_list">
  58. <view class="item" v-for="(item,index) in detail.$photos" :key="index">
  59. <image :src="item.path" @click="open_img(item.path)"></image>
  60. </view>
  61. </view>
  62. </view>
  63. </view>
  64. <view class="section">
  65. <view class="title">审批流程</view>
  66. <view class="inner">
  67. <view class="shenpi_list">
  68. <view class="item" v-for="(item,index) in detail.approval_list" :key="index">
  69. <view class="name">{{item.title}}</view>
  70. <view class="list">
  71. <view class="box" v-for="(item_2,index_2) in item.member" :key="index_2">
  72. <view class="label">{{item_2.title}}:{{item_2.name}}</view>
  73. <view v-if="!item_2.state" style="color: #F0AD4E;">待审核。</view>
  74. <view class="label" v-if="item_2.state == 2 && item_2.remark == ''"
  75. style="color: #E94C3D;">驳回。</view>
  76. <view class="label" v-if="item_2.state == 0 && item_2.remark == ''"
  77. style="color: #E94C3D;">驳回。</view>
  78. <view class="label" v-if="item_2.state == 1 && item_2.remark == ''"
  79. style="color: #17A086;">通过。</view>
  80. <view class="remark" v-if="item_2.state == 1" style="color: #17A086;">
  81. {{item_2.remark}}
  82. </view>
  83. <view class="remark"
  84. v-if="item_2.state == 2 || item_2.state == 0 || item_2.state == 3"
  85. style="color: #E94C3D;">{{item_2.remark}}</view>
  86. <view v-if="item_2.state == 1">
  87. <image :src="item_2.base_img" style="width: 300rpx; height: 90rpx;"></image>
  88. </view>
  89. </view>
  90. </view>
  91. </view>
  92. </view>
  93. </view>
  94. </view>
  95. <view class="section">
  96. <view class="title">审批意见</view>
  97. <view class="inner">
  98. <view class="remark_text">
  99. <textarea value="" v-model="remark_text" placeholder="请输入审批意见。"
  100. style="height: 80px; padding: 10px;" />
  101. </view>
  102. </view>
  103. </view>
  104. </view>
  105. <view class="bottom">
  106. <view class="btn" style="background-color: #16A086;" @click="btn_shenhe(1)">通过</view>
  107. <view class="btn" style="background-color: #E94C3D;" @click="btn_shenhe(0)">驳回</view>
  108. </view>
  109. </view>
  110. </template>
  111. <script>
  112. export default {
  113. data() {
  114. return {
  115. // 业务id
  116. id: 0,
  117. // 业务详情
  118. detail: {},
  119. // 审核留言
  120. remark_text: "",
  121. // 头像随即色
  122. bgColor: [],
  123. // 单据是否需要强制浏览类型 0 不强制 1 强制浏览
  124. is_browse: 0,
  125. // 职位是否需要强制浏览 1是 2否
  126. is_force: 2,
  127. // 职位浏览时长
  128. browse_duration: 0,
  129. // 是否浏览完成
  130. is_read: true,
  131. // 工号
  132. staff_num:""
  133. };
  134. },
  135. onLoad(option) {
  136. // console.log(option.id)
  137. // 设置业务id
  138. this.id = option.id
  139. // 设置标题
  140. uni.setNavigationBarTitle({
  141. title: option.title
  142. })
  143. // 获取业务详情
  144. this.get_worksheet_checkmei(option.id)
  145. this.staff_num = uni.getStorageSync('user').staff_num
  146. },
  147. methods: {
  148. // 获取业务详情
  149. get_worksheet_checkmei(id) {
  150. // 业务详情接口
  151. this.$api.worksheet_checkmei({
  152. id: id
  153. }).then((res) => {
  154. console.log(res.data.data)
  155. for (let i = 0; i < 2; i++) {
  156. // 获取随机色
  157. let r = parseInt(Math.random() * 256)
  158. let g = parseInt(Math.random() * 256)
  159. let b = parseInt(Math.random() * 256)
  160. // ES6 字符串拼接
  161. // this.bgColor = `rgba(${r},${g},${b},0.3)`
  162. let color = "rgba(" + r + "," + g + "," + b + "," + 0.3 + ")"
  163. // console.log(color)
  164. this.bgColor.push(color)
  165. }
  166. this.detail = res.data.data
  167. this.is_browse = res.data.data.is_browse
  168. if (this.is_browse == 1) {
  169. // 1 需要强制浏览
  170. this.is_read = false
  171. // 强制浏览限制时间
  172. this.$api.worksheet_force_query({
  173. staff_num: this.staff_num
  174. }).then((res) => {
  175. console.log(res.data.data)
  176. this.is_force = res.data.data.is_force
  177. // 1强制 2不强制
  178. if (this.is_force == 1) {
  179. this.browse_duration = res.data.data.browse_duration
  180. // 计时
  181. setTimeout(() => {
  182. this.is_read = true
  183. }, this.browse_duration*60000)
  184. } else if (this.is_force == 2) {
  185. }
  186. })
  187. }
  188. })
  189. },
  190. // 审核事件
  191. btn_shenhe(type) {
  192. // 判断是否浏览相应时长
  193. if (!this.is_read) {
  194. uni.showToast({
  195. icon: "none",
  196. title: "至少浏览" + this.browse_duration + "分钟、才可审批"
  197. })
  198. return
  199. }
  200. // 提交审核接口
  201. this.$api.worksheet_checkmei_tijiao({
  202. id: this.id,
  203. allow: type,
  204. remark: this.remark_text
  205. }).then((res) => {
  206. console.log(res.data)
  207. // 审核过
  208. if (res.data.code == 1) {
  209. uni.showToast({
  210. icon: "none",
  211. title: res.data.message
  212. })
  213. } else {
  214. // uni.switchTab({
  215. // url: "../../../tabbar/my/my"
  216. // })
  217. uni.navigateBack()
  218. }
  219. })
  220. },
  221. // 预览文件
  222. open_file(path) {
  223. uni.downloadFile({
  224. url: path,
  225. success: (res) => {
  226. var filePath = res.tempFilePath;
  227. uni.openDocument({
  228. filePath: filePath,
  229. success: (res) => {
  230. console.log('打开文档成功');
  231. }
  232. });
  233. }
  234. });
  235. },
  236. // 预览图片
  237. open_img(path) {
  238. const urls = [];
  239. urls.push(path)
  240. // console.log(urls[0])
  241. uni.previewImage({
  242. urls: urls,
  243. });
  244. }
  245. }
  246. }
  247. </script>
  248. <style lang="scss">
  249. page {
  250. margin-bottom: 40px;
  251. background-color: #F3F3F3;
  252. width: 749rpx;
  253. box-sizing: border-box;
  254. padding: 24rpx;
  255. }
  256. .content {
  257. width: 700rpx;
  258. min-height: 90vh;
  259. background-color: #FFFFFF;
  260. border-radius: 4px;
  261. box-sizing: border-box;
  262. padding: 25rpx;
  263. }
  264. .section {
  265. .title {
  266. padding-left: 8px;
  267. border-left: 2px solid #009FE8;
  268. font-weight: 700;
  269. }
  270. .inner {
  271. padding: 10px;
  272. .user {
  273. display: flex;
  274. align-items: center;
  275. .img {
  276. width: 66px;
  277. height: 66px;
  278. border-radius: 50%;
  279. overflow: hidden;
  280. image {
  281. width: 66px;
  282. height: 66px;
  283. }
  284. .avatar {
  285. width: 66px;
  286. height: 66px;
  287. text-align: center;
  288. line-height: 66px;
  289. color: #FFFFFF;
  290. font-size: 28px;
  291. }
  292. }
  293. .info {
  294. // margin-left: 12px;
  295. .name {
  296. font-size: 19px;
  297. font-family: PingFangSC-Medium, PingFang SC;
  298. font-weight: 500;
  299. color: #232627;
  300. line-height: 26px;
  301. }
  302. .section {
  303. margin-top: 4px;
  304. font-size: 14px;
  305. font-family: PingFangSC-Medium, PingFang SC;
  306. font-weight: 500;
  307. color: #232627;
  308. line-height: 19px;
  309. }
  310. }
  311. }
  312. .file_list {
  313. .item {
  314. height: 49px;
  315. display: flex;
  316. justify-content: space-between;
  317. align-items: center;
  318. border-bottom: 1px solid #ECF0F1;
  319. padding: 8px 0;
  320. .left {
  321. display: flex;
  322. align-items: center;
  323. .icon {}
  324. .info {
  325. height: 49px;
  326. display: flex;
  327. flex-flow: column;
  328. justify-content: space-around;
  329. .name {
  330. font-size: 16px;
  331. font-family: MicrosoftYaHei;
  332. color: #2C3E50;
  333. }
  334. .size {
  335. font-size: 13px;
  336. font-family: MicrosoftYaHei;
  337. color: #BDC3C7;
  338. }
  339. }
  340. }
  341. .right {}
  342. }
  343. }
  344. .img_list {
  345. overflow: hidden;
  346. .item {
  347. float: left;
  348. width: 284rpx;
  349. height: 260rpx;
  350. margin-right: 40rpx;
  351. margin-bottom: 40rpx;
  352. image {
  353. width: 284rpx;
  354. height: 260rpx;
  355. }
  356. }
  357. .item:nth-child(2n) {
  358. margin-right: 0;
  359. }
  360. }
  361. .shenpi_list {
  362. width: 612rpx;
  363. .item {
  364. display: flex;
  365. .name {
  366. width: 200rpx;
  367. color: #009FE8;
  368. }
  369. .list {
  370. width: 412rpx;
  371. .box {
  372. margin-bottom: 8px;
  373. .label {}
  374. .remark {}
  375. }
  376. }
  377. }
  378. }
  379. .remark_text {
  380. border: 1px solid #BDC3C7;
  381. }
  382. }
  383. }
  384. .bottom {
  385. margin-top: 20px;
  386. display: flex;
  387. justify-content: space-around;
  388. .btn {
  389. padding: 8px 40px;
  390. color: #FFFFFF;
  391. border-radius: 60px;
  392. }
  393. }
  394. </style>