index.uvue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378
  1. <template>
  2. <uni-navbar-lite :showLeft=false :show-right=false title="工作台"></uni-navbar-lite>
  3. <view class="page-container">
  4. <!-- view>
  5. <text class="page-header"> 工作台 </text>
  6. </view> -->
  7. <!-- 头部背景图 -->
  8. <!-- <image class="header-bg" src="/static/images/workbench/1.png" mode="widthFix"></image> -->
  9. <scroll-view class="page-content">
  10. <!-- 库区管理 -->
  11. <view class="section">
  12. <view class="section-header">
  13. <view class="section-indicator"></view>
  14. <text class="section-title">库区管理</text>
  15. </view>
  16. <view class="management-grid">
  17. <view v-for="(item, index) in filteredManagementList" :key="index" class="management-item" @click="handleManagementClick(item)" :style="{ backgroundColor: item.bgColor }">
  18. <view class="management-icon-box">
  19. <image class="management-icon" :src="item.icon" mode="aspectFit"></image>
  20. </view>
  21. <text class="management-title">{{ item.title }}</text>
  22. <view v-if="item.badge" class="management-badge">
  23. <text class="badge-text">{{ item.badge }}</text>
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. <!-- 生产板块 -->
  29. <view class="section production-section" v-if="filteredProductionList.length > 0">
  30. <view class="section-header">
  31. <view class="section-indicator"></view>
  32. <text class="section-title">生产管理</text>
  33. </view>
  34. <view class="management-grid">
  35. <view v-for="(item, index) in filteredProductionList" :key="index" class="management-item" @click="handleManagementClick(item)" :style="{ backgroundColor: item.bgColor }">
  36. <view class="management-icon-box">
  37. <image class="management-icon" :src="item.icon" mode="aspectFit"></image>
  38. </view>
  39. <text class="management-title">{{ item.title }}</text>
  40. <view v-if="item.badge" class="management-badge">
  41. <text class="badge-text">{{ item.badge }}</text>
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. <!-- 基础资料板块 -->
  47. <view class="section data-section" v-if="filteredDataList.length > 0">
  48. <view class="section-header">
  49. <view class="section-indicator"></view>
  50. <text class="section-title">基础资料</text>
  51. </view>
  52. <view class="management-grid">
  53. <view v-for="(item, index) in filteredDataList" :key="index" class="management-item" @click="handleManagementClick(item)" :style="{ backgroundColor: item.bgColor }">
  54. <view class="management-icon-box">
  55. <image class="management-icon" :src="item.icon" mode="aspectFit"></image>
  56. </view>
  57. <text class="management-title">{{ item.title }}</text>
  58. <view v-if="item.badge" class="management-badge">
  59. <text class="badge-text">{{ item.badge }}</text>
  60. </view>
  61. </view>
  62. </view>
  63. </view>
  64. </scroll-view>
  65. <!-- 底部 TabBar -->
  66. <custom-tabbar :current="1" />
  67. </view>
  68. </template>
  69. <script setup lang="uts">
  70. import { ref, computed } from 'vue'
  71. import { checkPermission } from '../../utils/permission'
  72. // 库区管理功能类型
  73. type ManagementItem = {
  74. id: number
  75. title: string
  76. icon: string
  77. bgColor: string
  78. path: string
  79. badge: string
  80. permission: string
  81. }
  82. // 库区管理功能列表
  83. const managementList = ref<ManagementItem[]>([
  84. {
  85. id: 1,
  86. title: '物料申请',
  87. icon: '/static/images/workbench/8.png',
  88. bgColor: '#E3F2FD',
  89. path: '/pages/apply/index',
  90. badge: '',
  91. permission: 'mes:wm:purchaseApply:list'
  92. },
  93. {
  94. id: 2,
  95. title: '手动出库',
  96. icon: '/static/images/workbench/2.png',
  97. bgColor: '#FFF3E0',
  98. path: '/pages/out/index',
  99. badge: '',
  100. permission: 'mes:wm:productsalse:list'
  101. },
  102. {
  103. id: 3,
  104. title: '采购订单',
  105. icon: '/static/images/workbench/6.png',
  106. bgColor: '#FCE4EC',
  107. path: '/pages/purchase/index',
  108. badge: '',
  109. permission: 'wm:purchase:list'
  110. },
  111. {
  112. id: 4,
  113. title: '库存查询',
  114. icon: '/static/images/workbench/10.png',
  115. bgColor: '#EDE7F6',
  116. path: '/pages/stock/index',
  117. badge: '',
  118. permission: 'mes:wm:wmstock:list'
  119. },
  120. ])
  121. const filteredManagementList = computed(() => {
  122. return managementList.value.filter(item => {
  123. if (!item.permission || item.permission.length === 0) return true
  124. return checkPermission(item.permission)
  125. })
  126. })
  127. // 生产管理功能列表
  128. const productionList = ref<ManagementItem[]>([
  129. {
  130. id: 4,
  131. title: '生产汇报',
  132. icon: '/static/images/workbench/5.png',
  133. bgColor: '#E8F5E9',
  134. path: '/pages/pro/index',
  135. badge: '',
  136. permission: 'mes:pro:proreport:list'
  137. },
  138. ])
  139. const filteredProductionList = computed(() => {
  140. return productionList.value.filter(item => {
  141. if (!item.permission || item.permission.length === 0) return true
  142. return checkPermission(item.permission)
  143. })
  144. })
  145. // 基础资料功能列表
  146. const dataList = ref<ManagementItem[]>([
  147. {
  148. id: 5,
  149. title: '系统物料',
  150. icon: '/static/images/workbench/4.png',
  151. bgColor: '#EDE7F6',
  152. path: '/pages/item/index',
  153. badge: '',
  154. permission: 'mes:md:mditem:list'
  155. },
  156. ])
  157. const filteredDataList = computed(() => {
  158. return dataList.value.filter(item => {
  159. if (!item.permission || item.permission.length === 0) return true
  160. return checkPermission(item.permission)
  161. })
  162. })
  163. // 库区管理功能点击
  164. const handleManagementClick = (item: ManagementItem): void => {
  165. if (item.path.length > 0) {
  166. uni.navigateTo({
  167. url: item.path,
  168. fail: (err: any) => {
  169. console.log('导航失败', err)
  170. }
  171. })
  172. } else {
  173. uni.showToast({
  174. title: item.title,
  175. icon: 'none'
  176. })
  177. }
  178. }
  179. </script>
  180. <style lang="scss">
  181. .page-container {
  182. flex: 1;
  183. background-color: #f5f8fe;
  184. padding-top: env(safe-area-inset-top);
  185. background-color: #e8f0f9;
  186. padding: 20rpx;
  187. }
  188. .page-header{
  189. font-size: 32rpx;
  190. color: #333333;
  191. font-weight: bold;
  192. padding-top:20px;
  193. padding-bottom: 10px;
  194. }
  195. .page-content {
  196. flex: 1;
  197. padding: 10rpx;
  198. padding-bottom: 150rpx;
  199. box-sizing: border-box;
  200. // border-radius: 24rpx;
  201. // border: 1rpx solid rgba(255, 255, 255, 0.3);
  202. // background: #f5f8fe;
  203. // background: linear-gradient(180deg, rgba(255, 255, 255, 0.3) 0%, #f5f8fe 100%);
  204. // backdrop-filter: blur(20rpx);
  205. }
  206. .header-bg {
  207. position: absolute;
  208. top: 0;
  209. left: 0;
  210. width: 100%;
  211. height: auto;
  212. z-index: 0;
  213. }
  214. .quick-cards {
  215. flex-direction: row;
  216. flex-wrap: wrap;
  217. justify-content: space-between;
  218. .quick-card {
  219. position: relative;
  220. width: 212rpx;
  221. height: 120rpx;
  222. margin-bottom: 20rpx;
  223. overflow: hidden;
  224. border-radius: 16rpx;
  225. &-bg {
  226. position: absolute;
  227. top: 0;
  228. left: 0;
  229. width: 226rpx;
  230. height: 140rpx;
  231. z-index: 0;
  232. }
  233. &-content {
  234. position: relative;
  235. z-index: 1;
  236. padding: 20rpx;
  237. height: 140rpx;
  238. justify-content: flex-start;
  239. }
  240. &-title {
  241. font-size: 28rpx;
  242. color: #333333;
  243. font-weight: bold;
  244. }
  245. .management-badge {
  246. position: absolute;
  247. top: 20rpx;
  248. right: 20rpx;
  249. width: 32rpx;
  250. height: 32rpx;
  251. background-color: #ff3b30;
  252. border-radius: 16rpx;
  253. justify-content: center;
  254. align-items: center;
  255. .badge-text {
  256. font-size: 20rpx;
  257. color: #ffffff;
  258. line-height: 20rpx;
  259. }
  260. }
  261. }
  262. }
  263. .section {
  264. padding: 0 20rpx 30rpx;
  265. background: #ffffff;
  266. border-radius: 16rpx;
  267. &-header {
  268. flex-direction: row;
  269. align-items: center;
  270. padding: 30rpx 10rpx 20rpx;
  271. }
  272. &-indicator {
  273. width: 6rpx;
  274. height: 32rpx;
  275. background-color: #007aff;
  276. border-radius: 3rpx;
  277. margin-right: 12rpx;
  278. }
  279. &-title {
  280. font-size: 36rpx;
  281. color: #333333;
  282. font-weight: bold;
  283. }
  284. }
  285. .production-section {
  286. margin-top: 30rpx;
  287. }
  288. .data-section {
  289. margin-top: 30rpx;
  290. }
  291. .management-grid {
  292. flex-direction: row;
  293. flex-wrap: wrap;
  294. margin: 0 -8rpx;
  295. .management-item {
  296. position: relative;
  297. width: calc(33.33% - 16rpx);
  298. height: 156rpx;
  299. margin: 8rpx;
  300. background-color: #edf5ff;
  301. border-radius: 8rpx;
  302. align-items: flex-start;
  303. justify-content: center;
  304. padding: 24rpx;
  305. box-sizing: border-box;
  306. .management-icon-box {
  307. width: 64rpx;
  308. height: 64rpx;
  309. justify-content: center;
  310. align-items: center;
  311. margin-bottom: 16rpx;
  312. }
  313. .management-icon {
  314. width: 100%;
  315. height: 100%;
  316. }
  317. .management-title {
  318. font-weight: bold;
  319. font-size: 24rpx;
  320. color: #333333;
  321. text-align: center;
  322. }
  323. .management-badge {
  324. position: absolute;
  325. top: 20rpx;
  326. right: 20rpx;
  327. width: 32rpx;
  328. height: 32rpx;
  329. background-color: #ff3b30;
  330. border-radius: 16rpx;
  331. justify-content: center;
  332. align-items: center;
  333. .badge-text {
  334. font-size: 20rpx;
  335. color: #ffffff;
  336. line-height: 20rpx;
  337. }
  338. }
  339. }
  340. }
  341. </style>