展品维保小程序前端代码接口
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.

322 lines
7.8 KiB

1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
  1. <template>
  2. <view class="home-container">
  3. <!-- 顶部横幅图片 -->
  4. <view class="banner-section">
  5. <image class="banner-image" src="@/static/首页背景图.png" mode="aspectFill"></image>
  6. </view>
  7. <!-- 搜索区域 -->
  8. <SearchInput
  9. v-model="searchValue"
  10. placeholder="请输入展品名称"
  11. search-button-text="搜索"
  12. @search="handleSearch"
  13. />
  14. <!-- 展品分类 -->
  15. <view class="category-section" @click="openPicker">
  16. <view class="category-label">{{ selectedCategory.label ||'展品分类' }}</view>
  17. <uv-icon name="arrow-down-fill" size="14" color="#C70019"></uv-icon>
  18. <uv-picker ref="picker" confirmColor="#C70019" :columns="[columns[0], columns[1][0]]" keyName="label" @confirm="onCategoryConfirm" @change="onCategoryChange"></uv-picker>
  19. </view>
  20. <!-- 展品列表 -->
  21. <view class="exhibit-list">
  22. <view class="exhibit-item" v-for="(item, index) in list" :key="index" @click="handleItemClick(item)">
  23. <view class="item-header">
  24. <text class="item-id">{{ item.id }}</text>
  25. <img src="@/static/copy.png" alt="我是复制黏贴" class="item-icon" @click="copyId(item.id)">
  26. </view>
  27. <view class="item-border" />
  28. <view class="item-content">
  29. <view class="content-row">
  30. <text class="name">{{ item.title }}</text>
  31. </view>
  32. <view class="content-row">
  33. <text class="label">展品编号</text>
  34. <text class="value">{{ item.id }}</text>
  35. </view>
  36. <view class="content-row">
  37. <text class="label">展品位置</text>
  38. <text class="value">{{ item.position }}</text>
  39. </view>
  40. <view class="content-row">
  41. <text class="label">展品类型</text>
  42. <text class="value">{{ item.categoryId_dictText }}</text>
  43. </view>
  44. <view class="content-row">
  45. <text class="label">下次保养日期</text>
  46. <text class="value">{{ item.maintenanceDate }}</text>
  47. <view v-if="item.maintenanceProject" class="project">
  48. {{ item.maintenanceProject }}
  49. </view>
  50. </view>
  51. </view>
  52. <view class="item-actions">
  53. <uv-button
  54. size="small"
  55. color="#c70019"
  56. shape="circle"
  57. text="申请报修"
  58. @click.stop="handleRepair(item)"
  59. ></uv-button>
  60. <uv-button
  61. size="small"
  62. text="保养提交"
  63. color="#c70019"
  64. shape="circle"
  65. plain
  66. @click.stop="handleMaintenance(item)"
  67. ></uv-button>
  68. <uv-button
  69. color="#c70019"
  70. shape="circle"
  71. size="small"
  72. text="维修/保养记录"
  73. plain
  74. @click.stop="handleRecord(item)"
  75. ></uv-button>
  76. </view>
  77. </view>
  78. </view>
  79. <!-- 空状态 -->
  80. <uv-empty v-if="!list.length" icon="/static/暂无搜索结果.png" />
  81. </view>
  82. </template>
  83. <script>
  84. import SearchInput from '@/pages/components/SearchInput.vue'
  85. import ListMixin from '@/mixins/list'
  86. export default {
  87. mixins: [ListMixin],
  88. components: {
  89. SearchInput
  90. },
  91. data() {
  92. return {
  93. mixinListApi: 'exhibit.queryShowpieceList',
  94. searchValue: '',
  95. selectedCategory: {
  96. label: '',
  97. value: ''
  98. },
  99. }
  100. },
  101. computed: {
  102. // 从状态管理工具中拿分类大数组
  103. columns() {
  104. return this.$store.state.categoryList
  105. }
  106. },
  107. methods: {
  108. handleSearch() {
  109. console.log('搜索的数值为', this.searchValue);
  110. this.initPage()
  111. this.getList(true)
  112. },
  113. mixinSetParams() {
  114. const params = { }
  115. if (this.selectedCategory.value) {
  116. params.categoryId = this.selectedCategory.value
  117. }
  118. return {
  119. title: this.searchValue,
  120. ...params
  121. }
  122. },
  123. openPicker() {
  124. this.$refs.picker.open()
  125. },
  126. onCategoryConfirm(e) {
  127. this.selectedCategory = e.value[1]
  128. console.log('选择分类:', e)
  129. this.initPage()
  130. this.getList(true)
  131. // TODO: 根据分类筛选展品
  132. },
  133. onCategoryChange(e) {
  134. const { columnIndex , index} = e
  135. if (columnIndex === 0) {
  136. this.$refs.picker.setColumnValues(1, this.columns[1][index])
  137. }
  138. },
  139. copyId(id) {
  140. uni.setClipboardData({
  141. data: id,
  142. success: () => {
  143. uni.showToast({
  144. title: '已复制到剪贴板',
  145. icon: 'success'
  146. })
  147. }
  148. })
  149. },
  150. handleItemClick(item) {
  151. console.log('点击展品:', item)
  152. // TODO: 跳转到展品详情页
  153. },
  154. handleRepair(item) {
  155. uni.navigateTo({
  156. url: '/subPages/home/repairSubmit?id=' + item.id
  157. })
  158. // TODO: 跳转到报修页面
  159. },
  160. handleMaintenance(item) {
  161. console.log('保养提交:', item)
  162. uni.navigateTo({
  163. url: '/subPages/home/maintainanceSubmit?id=' + item.id
  164. })
  165. // TODO: 跳转到保养提交页面
  166. },
  167. handleRecord(item) {
  168. console.log('查看记录:', item)
  169. uni.navigateTo({
  170. url: '/subPages/home/RAArecord?id=' + item.id
  171. })
  172. // TODO: 跳转到维修保养记录页面
  173. }
  174. }
  175. }
  176. </script>
  177. <style lang="scss" scoped>
  178. .home-container {
  179. background-color: #fff;
  180. min-height: 100vh;
  181. }
  182. .banner-section {
  183. width: 100%;
  184. height: 500rpx;
  185. .banner-image {
  186. width: 100%;
  187. height: 100%;
  188. }
  189. }
  190. .category-section {
  191. padding: 20rpx 48rpx;
  192. display: flex;
  193. align-items: center;
  194. justify-content: start;
  195. gap: 9rpx;
  196. .category-label {
  197. font-size: 28rpx;
  198. color: $primary-color;
  199. }
  200. .category-picker {
  201. display: flex;
  202. align-items: center;
  203. padding: 10rpx 20rpx;
  204. border: 1rpx solid #ddd;
  205. border-radius: 8rpx;
  206. background-color: #fafafa;
  207. .category-text {
  208. font-size: 28rpx;
  209. color: #666;
  210. margin-right: 10rpx;
  211. }
  212. }
  213. }
  214. .exhibit-list {
  215. padding: 20rpx 30rpx;
  216. .exhibit-item {
  217. background-color: #fff;
  218. border-radius: 16rpx;
  219. padding: 30rpx 30rpx 45rpx;
  220. margin-bottom: 20rpx;
  221. border-radius: 15rpx;
  222. box-shadow: 0rpx 3rpx 6rpx 0rpx rgba(0,0,0,0.16);
  223. .item-header {
  224. display: flex;
  225. align-items: center;
  226. justify-content: start;
  227. gap: 20rpx;
  228. padding-bottom: 14rpx;
  229. .item-id {
  230. font-size: 28rpx;
  231. color: $secondary-text-color;
  232. }
  233. .item-icon {
  234. width: 25.5rpx;
  235. height: 25.5rpx;
  236. }
  237. }
  238. .item-border {
  239. border-bottom: 1rpx solid $secondary-text-color;
  240. opacity: 0.22;
  241. }
  242. .item-content {
  243. margin-top: 26.5rpx;
  244. margin-bottom: 57rpx;
  245. .content-row {
  246. display: flex;
  247. align-items: center;
  248. margin-bottom: 25rpx;
  249. .name{
  250. font-size: 30rpx;
  251. color: $primary-text-color;
  252. font-weight: bold;
  253. }
  254. &:last-child {
  255. margin-bottom: 0;
  256. }
  257. &:first-child {
  258. margin-bottom: 37rpx;
  259. }
  260. .label {
  261. font-size: 22rpx;
  262. color: $secondary-text-color;
  263. // width: 200rpx;
  264. margin-right: 19rpx;
  265. flex-shrink: 0;
  266. }
  267. .value {
  268. font-size: 22rpx;
  269. color: $primary-text-color;
  270. margin-right: 40rpx;
  271. }
  272. .project {
  273. // flex: 1;
  274. background: $primary-color;
  275. // border: 1px solid #707070;
  276. border-radius: 11rpx;
  277. color: #fff;
  278. font-size: 22rpx;
  279. padding: 6rpx 12rpx;
  280. }
  281. }
  282. }
  283. .item-actions {
  284. margin-left: -10rpx;
  285. display: flex;
  286. gap: 55rpx;
  287. flex-wrap: wrap;
  288. }
  289. }
  290. }
  291. </style>