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

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