综合办公系统
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

declareList.vue 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459
  1. <!--
  2. * @Author: ysh
  3. * @Date: 2025-08-04 11:04:25
  4. * @LastEditors: Please set LastEditors
  5. * @LastEditTime: 2025-08-04 14:50:13
  6. -->
  7. <template>
  8. <view class="container">
  9. <mescroll-uni ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption"
  10. :up="upOption" :fixed="false" :top="10" style="padding: 30rpx;">
  11. <view>
  12. <view v-for="(item, index) in declareList" :key="index" class="modern-card">
  13. <view class="modern-card-header">
  14. <view class="modern-card-title">
  15. <text class="project-number">{{ formatterProjectNumber(item) }}</text>
  16. <text class="project-name">{{ formatterProjectName(item) }}</text>
  17. </view>
  18. </view>
  19. <view class="modern-card-body">
  20. <view class="avatar-section">
  21. <view class="avatar">
  22. <text>{{ item.user && item.user.nickName ? item.user.nickName[0] : '' }}</text>
  23. </view>
  24. <view>
  25. <text class="applier-name">{{ item.user ? item.user.nickName : '' }}</text>
  26. <text class="dept-name">填报人</text>
  27. </view>
  28. </view>
  29. <view class="info-row">
  30. <text class="info-label">工作类别:</text>
  31. <text class="info-value">{{ item.workType }}</text>
  32. </view>
  33. <view class="info-row">
  34. <text class="info-label">工作项目:</text>
  35. <text class="info-value">{{ item.workItem }}</text>
  36. </view>
  37. <view class="info-row">
  38. <text class="info-label">工作内容:</text>
  39. <text class="info-value">{{ item.workContent }}</text>
  40. </view>
  41. <view class="info-row">
  42. <text class="info-label">工作时间:</text>
  43. <text class="info-value">{{ item.beginDate }} ~ {{ item.endDate }}</text>
  44. </view>
  45. <view class="info-row">
  46. <text class="info-label">工天数量:</text>
  47. <text class="info-value">{{ item.workLoad }}天</text>
  48. </view>
  49. <view class="info-row">
  50. <text class="info-label">工天单价:</text>
  51. <text>{{ item.price }}</text>
  52. </view>
  53. <view class="info-row">
  54. <text class="info-label">系数:</text>
  55. <text class="info-value">{{ item.coefficient }}</text>
  56. </view>
  57. <view class="info-row">
  58. <text class="info-label">预估绩效:</text>
  59. <text class="amount-highlight">¥{{ predictMoney(item) }}</text>
  60. </view>
  61. <view class="info-row">
  62. <text class="info-label">填报时间:</text>
  63. <text class="info-value">{{ parseTime(item.submitTime, '{y}-{m}-{d}') }}</text>
  64. </view>
  65. <!-- 审核状态 -->
  66. <view class="status-section">
  67. <view class="status-item">
  68. <text class="status-label">一审:</text>
  69. <view class="status-tag" :class="formatFn(item, 'checkStatus') ? 'success' : 'warning'">
  70. <text>{{ formatFn(item, 'checkStatus') ? '已通过' : '待审核' }}</text>
  71. </view>
  72. </view>
  73. <view class="status-item">
  74. <text class="status-label">二审:</text>
  75. <view class="status-tag" :class="formatFn(item, 'auditStatus') ? 'success' : 'warning'">
  76. <text>{{ formatFn(item, 'auditStatus') ? '已通过' : '待审核' }}</text>
  77. </view>
  78. </view>
  79. <view class="status-item">
  80. <text class="status-label">确认:</text>
  81. <view class="status-tag" :class="formatFn(item, 'confirmStatus') ? 'success' : 'warning'">
  82. <text>{{ formatFn(item, 'confirmStatus') ? '已确认' : '待确认' }}</text>
  83. </view>
  84. </view>
  85. </view>
  86. </view>
  87. <view class="modern-card-footer">
  88. <button class="footer-btn detail-btn" @click="openFormInfo(item)">表单信息</button>
  89. <button class="footer-btn form-btn" @click="handleUpdate(item)">修改</button>
  90. </view>
  91. </view>
  92. </view>
  93. </mescroll-uni>
  94. </view>
  95. </template>
  96. <script>
  97. import { listDeclare, getDeclare, updateDeclare } from '@/api/oa/declare/declare';
  98. import MescrollMixin from '@/uni_modules/mescroll/components/mescroll-uni/mescroll-mixins.js'
  99. export default {
  100. mixins: [MescrollMixin],
  101. data() {
  102. return {
  103. mescroll: null, // mescroll实例
  104. downOption: {
  105. auto: true,
  106. textOutOffset: '下拉刷新',
  107. textLoading: '加载中...'
  108. },
  109. upOption: {
  110. auto: false,
  111. page: { num: 1, size: 10 },
  112. noMoreSize: 5,
  113. empty: { tip: '暂无工作填报数据' },
  114. textNoMore: '~ 没有更多数据了 ~'
  115. },
  116. declareList: [],
  117. queryParams: {
  118. pageNum: 1,
  119. pageSize: 10,
  120. projectId: null,
  121. userId: null,
  122. submitTime: null
  123. }
  124. }
  125. },
  126. onLoad: function (options) {
  127. uni.startPullDownRefresh();
  128. },
  129. methods: {
  130. // 加载数据
  131. async loadData() {
  132. try {
  133. // 权限控制逻辑
  134. if (this.$store.getters.deptId > 103) {
  135. this.queryParams.deptId = this.$store.getters.deptId;
  136. }
  137. if (this.$store.getters.roles.includes('projectLeader')) {
  138. this.queryParams.projectLeader = this.$store.getters.userId
  139. }
  140. if (this.$store.getters.roles.includes('dept')) {
  141. this.queryParams.projectLeader = null
  142. }
  143. if (this.$store.getters.userId == 1) {
  144. this.queryParams.deptId = null
  145. this.queryParams.projectLeader = null
  146. }
  147. const res = await listDeclare(this.queryParams)
  148. return { data: res.rows, total: res.total }
  149. } catch (e) {
  150. return { data: [], error: true }
  151. }
  152. },
  153. mescrollInit(mescroll) {
  154. this.mescroll = mescroll;
  155. },
  156. // mescroll下拉刷新回调
  157. async downCallback() {
  158. this.declareList = []; // 清空列表
  159. this.queryParams.pageNum = 1
  160. const res = await this.loadData()
  161. if (res.error) {
  162. this.mescroll.endErr();
  163. } else {
  164. this.declareList = res.data;
  165. this.mescroll.endSuccess(res.data.length, res.total);
  166. }
  167. uni.stopPullDownRefresh();
  168. },
  169. // mescroll上拉加载回调
  170. async upCallback(page) {
  171. this.queryParams.pageNum = page.num
  172. const res = await this.loadData()
  173. if (res.error) {
  174. this.mescroll.endErr();
  175. } else {
  176. this.declareList = this.declareList.concat(res.data)
  177. this.mescroll.endSuccess(res.data.length, res.total);
  178. }
  179. },
  180. // 格式化项目编号
  181. formatterProjectNumber(row) {
  182. if (!row.projectId) {
  183. return '无'
  184. } else {
  185. return row.project.projectNumber
  186. }
  187. },
  188. // 格式化项目名称
  189. formatterProjectName(row) {
  190. if (!row.projectId) {
  191. let year = row.submitTime.substring(0, 4)
  192. return year + '年借调、零星项目'
  193. } else {
  194. return row.project.projectName
  195. }
  196. },
  197. // 格式化状态
  198. formatFn(row, type) {
  199. if (row[type] && row[type] == '1') {
  200. return true
  201. } else {
  202. return false
  203. }
  204. },
  205. // 计算预估绩效
  206. predictMoney(row) {
  207. let result = parseFloat(row.price * row.workLoad * row.coefficient)
  208. return result.toFixed(2)
  209. },
  210. // 时间解析函数
  211. parseTime(time, cFormat) {
  212. if (!time) return ''
  213. const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}'
  214. let date
  215. if (typeof time === 'object') {
  216. date = time
  217. } else {
  218. if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) {
  219. time = parseInt(time)
  220. }
  221. date = new Date(time)
  222. }
  223. const formatObj = {
  224. y: date.getFullYear(),
  225. m: date.getMonth() + 1,
  226. d: date.getDate(),
  227. h: date.getHours(),
  228. i: date.getMinutes(),
  229. s: date.getSeconds(),
  230. a: date.getDay()
  231. }
  232. const time_str = format.replace(/{([ymdhisa])+}/g, (result, key) => {
  233. const value = formatObj[key]
  234. if (key === 'a') {
  235. return ['日', '一', '二', '三', '四', '五', '六'][value]
  236. }
  237. return value.toString().padStart(2, '0')
  238. })
  239. return time_str
  240. },
  241. // 打开表单信息
  242. openFormInfo(item) {
  243. console.log(item)
  244. uni.navigateTo({
  245. url: `/pages/components/formInfo?formId=${item.formId}&formType=declare`
  246. });
  247. },
  248. // 修改操作
  249. handleUpdate(item) {
  250. }
  251. }
  252. }
  253. </script>
  254. <style lang="scss" scoped>
  255. .container {
  256. padding: 20rpx;
  257. background-color: #f5f5f5;
  258. height: 100vh;
  259. display: flex;
  260. flex-direction: column;
  261. }
  262. .modern-card {
  263. background: #fff;
  264. border-radius: 18rpx;
  265. margin-bottom: 32rpx;
  266. box-shadow: 0 6rpx 16rpx rgba(0, 0, 0, 0.08);
  267. overflow: hidden;
  268. transition: box-shadow 0.2s;
  269. border: 1rpx solid #f0f0f0;
  270. }
  271. .modern-card-header {
  272. display: flex;
  273. justify-content: space-between;
  274. align-items: center;
  275. background: linear-gradient(90deg, #e0e7ff 0%, #f8fafc 100%);
  276. padding: 24rpx 28rpx 16rpx 28rpx;
  277. }
  278. .modern-card-title {
  279. display: flex;
  280. flex-direction: column;
  281. }
  282. .project-number {
  283. font-size: 26rpx;
  284. color: #6366f1;
  285. font-weight: 600;
  286. }
  287. .project-name {
  288. font-size: 28rpx;
  289. color: #22223b;
  290. font-weight: bold;
  291. margin-top: 4rpx;
  292. }
  293. .amount-highlight {
  294. background: #fef3c7;
  295. color: #d97706;
  296. font-size: 28rpx;
  297. font-weight: bold;
  298. border-radius: 10rpx;
  299. padding: 8rpx 20rpx;
  300. min-width: 120rpx;
  301. text-align: center;
  302. }
  303. .amount-highlight-detail {
  304. background: #fef3c7;
  305. color: #d97706;
  306. font-size: 28rpx;
  307. font-weight: bold;
  308. border-radius: 10rpx;
  309. padding: 4rpx 18rpx;
  310. margin-left: 8rpx;
  311. }
  312. .modern-card-body {
  313. padding: 20rpx 28rpx 24rpx 28rpx;
  314. }
  315. .avatar-section {
  316. display: flex;
  317. align-items: center;
  318. margin-bottom: 18rpx;
  319. }
  320. .avatar {
  321. width: 56rpx;
  322. height: 56rpx;
  323. border-radius: 50%;
  324. background: #a5b4fc;
  325. color: #fff;
  326. display: flex;
  327. align-items: center;
  328. justify-content: center;
  329. font-size: 28rpx;
  330. font-weight: bold;
  331. margin-right: 18rpx;
  332. }
  333. .applier-name {
  334. font-size: 28rpx;
  335. color: #22223b;
  336. font-weight: 500;
  337. }
  338. .dept-name {
  339. font-size: 24rpx;
  340. color: #64748b;
  341. margin-left: 8rpx;
  342. }
  343. .info-row {
  344. display: flex;
  345. margin-bottom: 10rpx;
  346. }
  347. .info-label {
  348. color: #64748b;
  349. font-size: 24rpx;
  350. min-width: 120rpx;
  351. }
  352. .info-value {
  353. color: #22223b;
  354. font-size: 24rpx;
  355. flex: 1;
  356. word-break: break-all;
  357. }
  358. // 审核状态样式
  359. .status-section {
  360. margin-top: 16rpx;
  361. padding-top: 16rpx;
  362. border-top: 1px solid #f0f0f0;
  363. }
  364. .status-item {
  365. display: flex;
  366. align-items: center;
  367. margin-bottom: 8rpx;
  368. }
  369. .status-label {
  370. color: #64748b;
  371. font-size: 24rpx;
  372. min-width: 80rpx;
  373. }
  374. .status-tag {
  375. padding: 4rpx 12rpx;
  376. border-radius: 6rpx;
  377. font-size: 22rpx;
  378. margin-left: 8rpx;
  379. }
  380. .status-tag.success {
  381. background: #dcfce7;
  382. color: #16a34a;
  383. }
  384. .status-tag.warning {
  385. background: #fef3c7;
  386. color: #d97706;
  387. }
  388. .modern-card-footer {
  389. display: flex;
  390. justify-content: flex-end;
  391. gap: 20rpx;
  392. padding: 16rpx 28rpx 20rpx 28rpx;
  393. border-top: 1px solid #f0f0f0;
  394. background: #fafbfc;
  395. }
  396. .footer-btn {
  397. font-size: 26rpx;
  398. border-radius: 8rpx;
  399. border: none;
  400. outline: none;
  401. background: #e0e7ff;
  402. color: #3b3b4f;
  403. }
  404. .detail-btn {
  405. background: #6366f1;
  406. color: #fff;
  407. }
  408. .form-btn {
  409. background: #f4c542;
  410. color: #fff;
  411. }
  412. </style>