index.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <template>
  2. <view class="page">
  3. <uni-section :title="$t('ledger.detail.section')" />
  4. <uni-list :border="false" style="margin-top: 10px">
  5. <uni-list-item v-for="item of list" :title="item.name" :right-text="item.value" />
  6. </uni-list>
  7. </view>
  8. </template>
  9. <script setup>
  10. import { onLoad } from '@dcloudio/uni-app'
  11. import { getCurrentInstance, ref } from "vue"
  12. import { getDeviceLedgerDetail } from "@/api/ledger"
  13. import { useDataDictStore } from "@/store/modules/dataDict";
  14. const { appContext } = getCurrentInstance()
  15. const t = appContext.config.globalProperties.$t
  16. const list = ref([])
  17. const mapToListItem = (info) => {
  18. const list = []
  19. list.push({ name: t('ledger.form.deviceCode'), value: info.deviceCode || '-' }) // 设备编号
  20. list.push({ name: t('ledger.form.deviceName'), value: info.deviceName || '-' }) // 设备名称
  21. list.push({ name: t('ledger.form.dept'), value: info.deptName || '-' }) // 所在部门
  22. list.push({ name: t('ledger.detail.assetType'), value: info.assetClassName || '-' }) // 类别
  23. list.push({ name: t('ledger.form.deviceStatus'), value: getStatusName(info.deviceStatus) || '-' }) // 状态
  24. list.push({ name: t('ledger.form.assetProperty'), value: getAssetPropertyName(info.assetProperty) || '-' }) // 资产性质
  25. list.push({ name: t('ledger.form.brand'), value: info.brandName || '-' }) // 品牌
  26. list.push({ name: t('ledger.form.model'), value: info.modelName || '-' }) // 规格型号
  27. list.push({ name: t('ledger.detail.user'), value: info.responsibleNames || '-' }) // 责任人
  28. return list
  29. }
  30. const getStatusName = (code) => {
  31. for (const item of deviceStatusList.value) {
  32. if (item.value === code) {
  33. return item.label
  34. }
  35. }
  36. }
  37. const getAssetPropertyName = (code) => {
  38. for (const item of assetPropertyList.value) {
  39. if (item.value === code) {
  40. return item.label
  41. }
  42. }
  43. }
  44. const { getDataDictList } = useDataDictStore()
  45. const deviceStatusList = ref([])
  46. const assetPropertyList = ref([])
  47. onLoad(async (options) => {
  48. assetPropertyList.value = getDataDictList('pms_asset_property') // 获取资产性质字典
  49. deviceStatusList.value = getDataDictList('pms_device_status') // 获取设备状态字典
  50. const id = options.id
  51. const info = (await getDeviceLedgerDetail(id)).data
  52. list.value = mapToListItem(info)
  53. })
  54. </script>
  55. <style scoped lang="scss">
  56. :deep(.uni-section) {
  57. background-color: transparent;
  58. .uni-section-header {
  59. padding: 0 0 0 10px;
  60. }
  61. .uni-section__content-title {
  62. font-size: 16px !important;
  63. color: #333333 !important;
  64. font-weight: 500;
  65. }
  66. }
  67. :deep(.uni-list--border-top) {
  68. display: none;
  69. }
  70. :deep(.uni-list--border-bottom) {
  71. display: none;
  72. }
  73. :deep(.uni-list-item__container) {
  74. padding: 12px 20px;
  75. }
  76. :deep(.uni-list--border) {
  77. margin: 0 20px;
  78. width: auto;
  79. height: 1px;
  80. background-image: linear-gradient(to right, #CACCCF 0%, #CACCCF 50%, transparent 50%);
  81. background-size: 10px 1px;
  82. background-repeat: repeat-x;
  83. border-color: transparent !important;
  84. }
  85. :deep(.uni-list-item__content-title) {
  86. font-size: 14px;
  87. color: #333333;
  88. font-weight: 500;
  89. }
  90. :deep(.uni-list-item__extra-text) {
  91. font-size: 14px;
  92. color: #333333;
  93. font-weight: 500;
  94. }
  95. </style>