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

370 lines
9.0 KiB

  1. <template>
  2. <view class="maintain-container">
  3. <!-- 顶部选择器区域 -->
  4. <view class="selector-section">
  5. <!-- 紧急程度选择器 -->
  6. <view class="selector-item" @click="openUrgencyPicker">
  7. <text class="selector-label" :class="{ active: urgency }">{{ urgency.label || '紧急状态' }}</text>
  8. <uv-icon name="arrow-down-fill" size="14" :color="urgency ? '#C70019' : '#000'"></uv-icon>
  9. </view>
  10. <!-- 维修状态选择器 -->
  11. <view class="selector-item" @click="openStatusPicker">
  12. <text class="selector-label" :class="{ active: status }">{{ status.label || '维修状态' }}</text>
  13. <uv-icon name="arrow-down-fill" size="14" :color="status ? '#C70019' : '#000'"></uv-icon>
  14. </view>
  15. </view>
  16. <!-- 产品列表 -->
  17. <view class="product-list">
  18. <view class="product-item" v-for="(item, index) in list" :key="index" @click="navigateToDetail(item)">
  19. <!-- 产品ID和状态标签 -->
  20. <view class="item-header">
  21. <view >
  22. <text class="item-id">{{ item.id }}</text>
  23. <img src="@/static/copy.png" alt="复制图标" class="item-icon">
  24. </view>
  25. <view class="status-tag" :class="[getStatusClass(item.status)]">
  26. <text class="status-text">{{ item.status_dictText }}</text>
  27. </view>
  28. </view>
  29. <!-- 中间那条下划线 -->
  30. <view class="item-border" />
  31. <!-- 产品标题 -->
  32. <view class="item-title">
  33. <text class="title-text">{{ item.showpieceId_dictText }}</text>
  34. </view>
  35. <!-- 产品详情 -->
  36. <view class="item-details">
  37. <view class="detail-row">
  38. <view class="detail-item">
  39. <text class="detail-label">展品编号</text>
  40. <text class="detail-value">{{ item.showpieceId }}</text>
  41. </view>
  42. <view class="detail-item">
  43. <text class="detail-label">紧急程度</text>
  44. <text class="detail-value">{{ item.urgency_dictText }}</text>
  45. </view>
  46. </view>
  47. <view class="detail-row">
  48. <view class="detail-item">
  49. <text class="detail-label">展品位置</text>
  50. <text class="detail-value">{{ item.position }}</text>
  51. </view>
  52. </view>
  53. <view class="detail-row">
  54. <view class="detail-item">
  55. <text class="detail-label">报修人</text>
  56. <text class="detail-value">{{ item.reporterName }}</text>
  57. </view>
  58. <view class="detail-item">
  59. <text class="detail-label">报修日期</text>
  60. <text class="detail-value">{{ item.firstDate }}</text>
  61. </view>
  62. </view>
  63. <view class="detail-row">
  64. <view class="detail-item full-width">
  65. <text class="detail-label">故障描述</text>
  66. <text class="detail-value">{{ item.malfunctionDesc }}</text>
  67. </view>
  68. </view>
  69. </view>
  70. <!-- 操作按钮 -->
  71. <view class="item-actions">
  72. <button class="item-actions-button">立即维修</button>
  73. </view>
  74. </view>
  75. <!-- 空状态 -->
  76. </view>
  77. <uv-empty v-if="!list.length" icon="/static/暂无搜索结果.png" />
  78. <!-- 紧急程度选择器 -->
  79. <uv-picker
  80. ref="urgencyPicker"
  81. v-model="urgencyShow"
  82. :columns="urgencyColumns"
  83. keyName="label"
  84. mode="selector"
  85. @confirm="onUrgencyConfirm"
  86. confirmColor="#C70019"
  87. ></uv-picker>
  88. <!-- 维修状态选择器 -->
  89. <uv-picker
  90. ref="statusPicker"
  91. v-model="statusShow"
  92. :columns="statusColumns"
  93. keyName="label"
  94. mode="selector"
  95. @confirm="onStatusConfirm"
  96. confirmColor="#C70019"
  97. ></uv-picker>
  98. </view>
  99. </template>
  100. <script>
  101. import ListMixin from '@/mixins/list'
  102. export default {
  103. mixins: [ListMixin],
  104. data() {
  105. return {
  106. urgency: null,
  107. status: null,
  108. urgencyShow: false,
  109. statusShow: false,
  110. mixinListApi: 'exhibit.queryMalfunctionList',
  111. urgencyColumns: [
  112. [
  113. {
  114. label: '全部',
  115. value: ''
  116. },
  117. {
  118. label: '一般',
  119. value: '0'
  120. },
  121. {
  122. label: '紧急',
  123. value: '1'
  124. },
  125. ]
  126. ],
  127. statusColumns: [
  128. [
  129. {
  130. label: '全部',
  131. value: ''
  132. },
  133. {
  134. label: '故障中',
  135. value: '0'
  136. },
  137. {
  138. label: '维修中',
  139. value: '1'
  140. },
  141. {
  142. label: '已解决',
  143. value: '2'
  144. }
  145. ]
  146. ],
  147. }
  148. },
  149. methods: {
  150. mixinSetParams(){
  151. return {
  152. urgency: this.urgency?.value || '',
  153. status: this.status?.value || ''
  154. }
  155. },
  156. navigateToDetail(item) {
  157. uni.navigateTo({
  158. url: '/subPages/repair/maintainSubmit?id=' + item.id
  159. })
  160. },
  161. openUrgencyPicker() {
  162. this.$refs.urgencyPicker.open()
  163. },
  164. openStatusPicker() {
  165. this.$refs.statusPicker.open()
  166. },
  167. onUrgencyConfirm(e) {
  168. this.urgency = e.value[0]
  169. console.log('选择紧急程度:', e)
  170. this.initPage()
  171. this.getList(true)
  172. // TODO: 根据紧急程度筛选
  173. },
  174. onStatusConfirm(e) {
  175. this.status = e.value[0]
  176. console.log('选择维修状态:', e)
  177. this.initPage()
  178. this.getList(true)
  179. // TODO: 根据状态筛选
  180. },
  181. getStatusClass(status) {
  182. switch(status) {
  183. case '维修中':
  184. return 'status-repairing'
  185. case '故障中':
  186. return 'status-fault'
  187. case '已解决':
  188. return 'status-resolved'
  189. default:
  190. return ''
  191. }
  192. },
  193. handleRepair(item) {
  194. console.log('立即维修:', item)
  195. // TODO: 处理维修逻辑
  196. }
  197. }
  198. }
  199. </script>
  200. <style lang="scss" scoped>
  201. .maintain-container {
  202. background-color: #fff;
  203. min-height: 100vh;
  204. }
  205. .selector-section {
  206. display: flex;
  207. padding: 34rpx 41rpx;
  208. // background-color: #fff;
  209. gap: 58rpx;
  210. .selector-item {
  211. display: flex;
  212. align-items: center;
  213. gap: 9rpx;
  214. cursor: pointer;
  215. .selector-label {
  216. font-size: 28rpx;
  217. color: #000;
  218. &.active {
  219. color: $primary-color;
  220. }
  221. }
  222. }
  223. }
  224. .product-list {
  225. padding: 20rpx 32rpx;
  226. .product-item {
  227. background-color: #fff;
  228. border-radius: 15rpx;
  229. padding: 30rpx 30rpx 20rpx;
  230. margin-bottom: 24rpx;
  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: space-between;
  236. margin-bottom: 13.5rpx;
  237. .item-icon {
  238. width: 25.5rpx;
  239. height: 25.5rpx;
  240. }
  241. .item-id {
  242. font-size: 28rpx;
  243. margin-right: 20rpx;
  244. color: $secondary-text-color;
  245. }
  246. .status-tag {
  247. border-radius: 15rpx;
  248. width: 135rpx;
  249. height: 57rpx;
  250. display: flex;
  251. align-items: center;
  252. justify-content: center;
  253. .status-text {
  254. font-size: 28rpx;
  255. }
  256. &.status-repairing {
  257. background-color: #ffffca;
  258. color: #CE7C62;
  259. }
  260. &.status-fault {
  261. background-color: #fccec7;
  262. color: #b82222;
  263. }
  264. &.status-resolved {
  265. background-color: #cfffca;
  266. color: #528828;
  267. }
  268. }
  269. }
  270. .item-border {
  271. border-bottom: 1rpx solid $secondary-text-color;
  272. // background-color: #E5E5E5;
  273. margin-bottom: 26.5rpx;
  274. opacity: 0.22;
  275. }
  276. .item-title {
  277. margin-bottom: 37rpx;
  278. .title-text {
  279. font-size: 30rpx;
  280. color: $primary-text-color;
  281. font-weight: bold;
  282. }
  283. }
  284. .item-details {
  285. margin-bottom: 52rpx;
  286. .detail-row {
  287. display: flex;
  288. margin-bottom: 25rpx;
  289. &:last-child {
  290. margin-bottom: 0;
  291. }
  292. .detail-item {
  293. flex: 1;
  294. display: flex;
  295. align-items: flex-start;
  296. margin-right: 35rpx;
  297. &.full-width {
  298. flex: 1 1 100%;
  299. margin-right: 0;
  300. }
  301. &:last-child {
  302. margin-right: 0;
  303. margin-bottom: 0;
  304. }
  305. .detail-label {
  306. font-size: 22rpx;
  307. color: $secondary-text-color;
  308. margin-right: 19rpx;
  309. flex-shrink: 0;
  310. min-width: 95rpx;
  311. }
  312. .detail-value {
  313. font-size: 22rpx;
  314. color: $primary-text-color;
  315. flex: 1;
  316. }
  317. }
  318. }
  319. }
  320. .item-actions {
  321. display: flex;
  322. justify-content: center;
  323. .item-actions-button {
  324. width: 378rpx;
  325. height: 78rpx;
  326. background-color: $primary-color;
  327. color: #fff;
  328. font-size: 28rpx;
  329. border-radius: 39rpx;
  330. }
  331. }
  332. }
  333. }
  334. </style>