detail.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. <template>
  2. <view class="container">
  3. <view class="mx3 my2 p3 bg-color-white" style="border-radius: 16rpx">
  4. <view class="f-size-32 f-weight-6 py2 mb-2 title">基本信息</view>
  5. <detail-list-item title="设备名称">{{ model.sbName }}</detail-list-item>
  6. <detail-list-item title="设备编号">{{ model.sbNo }}</detail-list-item>
  7. <detail-list-item title="日期">{{ model.fillDate }}</detail-list-item>
  8. <template v-for="natureDict in natureList" >
  9. <view
  10. v-show="natureDict.show"
  11. :key="natureDict.id"
  12. class="f-size-32 f-weight-6 py2 mb-2 title">{{ natureDict.label }}</view>
  13. <view v-show="natureDict.show" v-for="fillInfo in fillInfoList" v-if="fillInfo.nature === natureDict.value">
  14. <view :key="fillInfo.infoId" v-if="fillInfo.type === fillInfoTypeMap.FILL_INFO_TYPE_PROJECT_QUANTITY">
  15. <detail-list-item
  16. title="作业名称"
  17. >
  18. {{ getProjectQuantityValue(fillInfo) }}
  19. </detail-list-item>
  20. <detail-list-item
  21. title="作业位置">
  22. {{ getProjectQuantityValueValue(fillInfo) }}
  23. </detail-list-item>
  24. <detail-list-item
  25. title="完成量">
  26. {{ getProjectQuantityNumberValue(fillInfo) }}
  27. </detail-list-item>
  28. <detail-list-item
  29. title="作业备注">
  30. {{ fillInfo.remark }}
  31. </detail-list-item>
  32. </view>
  33. <view :key="fillInfo.infoId+1" v-else-if="fillInfo.type === fillInfoTypeMap.FILL_INFO_TYPE_DATE_TIME">
  34. <detail-list-item title="运行开始时间">
  35. {{ fillInfo.startTime }}
  36. </detail-list-item>
  37. <detail-list-item title="运行结束时间">
  38. {{ fillInfo.endTime }}
  39. </detail-list-item>
  40. <detail-list-item title="未工作小时">
  41. {{ fillInfo.resultEliminate }}小时
  42. </detail-list-item>
  43. </view>
  44. <detail-list-item
  45. :title="fillInfo.name"
  46. v-else
  47. :key="fillInfo.infoId" >
  48. {{ getFillValue(fillInfo) }}
  49. </detail-list-item>
  50. </view>
  51. </template>
  52. </view>
  53. <u-modal
  54. v-model="modelShow"
  55. :content="content"
  56. :show-cancel-button="true"
  57. @confirm="handleDelete"
  58. ></u-modal>
  59. <!-- <view class="p-fixed d-flex j-around a-center footer">
  60. <view class="common" @tap="handleDelTip">删除</view>
  61. <view class="common" @tap="handleUpdate">修改</view>
  62. </view> -->
  63. </view>
  64. </template>
  65. <script>
  66. import DetailListItem from '@/components/detail-list/DescriptionList'
  67. export default {
  68. components: { DetailListItem },
  69. props: {
  70. useType: {
  71. type: Number,
  72. default: 1
  73. },
  74. projectQuantityList: {
  75. type: Array,
  76. default: () => []
  77. },
  78. fillInfoList: {
  79. type: Array,
  80. default: () => []
  81. },
  82. model: {
  83. type: Object,
  84. default: () => {}
  85. }
  86. },
  87. data() {
  88. return {
  89. modelShow: false,
  90. projectQuantityUnitMap: {},
  91. content: '',
  92. natureList: [],
  93. fillInfoTypeMap: {},
  94. selectOptionMap: {},
  95. radioGroupMap: {}
  96. };
  97. },
  98. watch: {
  99. fillInfoList (fillInfoListValue) {
  100. this.natureShowMap = {}
  101. fillInfoListValue.forEach(fillInfo => {
  102. this.natureShowMap[fillInfo.nature] = true
  103. })
  104. const natureList = this.$DictCache.getChildrenList(this.$DictCache.TYPE.FILL_INFO_NATURE)
  105. natureList.forEach(natureItem => {
  106. if (this.natureShowMap[natureItem.value]) {
  107. natureItem.show = true
  108. } else {
  109. natureItem.show = false
  110. }
  111. })
  112. this.natureList = natureList
  113. this.fillInfoList = fillInfoListValue
  114. }
  115. },
  116. created () {
  117. this.projectQuantityUnitMap = this.$DictCache.getLabelByValueMapByType(this.$DictCache.TYPE.FILL_PROJECT_QUANTITY_UNIT)
  118. this.fillInfoTypeMap = this.$DictCache.VALUE.FILL_INFO_TYPE
  119. },
  120. methods: {
  121. getProjectQuantityValue (fillInfo) {
  122. const selectList = this.projectQuantityList.filter((item) => { return item.id === fillInfo.resultDesc })
  123. if (selectList && selectList.length > 0) {
  124. return selectList[0].name
  125. }
  126. return ''
  127. },
  128. getProjectQuantityValueValue (fillInfo) {
  129. const selectList = this.projectQuantityList.filter((item) => { return item.id === fillInfo.resultDesc })
  130. let result = this.$BaseTool.Amount.formatter(fillInfo.resultStart) + '~' + this.$BaseTool.Amount.formatter(fillInfo.resultEnd)
  131. if (selectList && selectList.length > 0) {
  132. result = result + this.projectQuantityUnitMap[selectList[0].siteUnit]
  133. }
  134. return result
  135. },
  136. getProjectQuantityNumberValue (fillInfo) {
  137. const selectList = this.projectQuantityList.filter((item) => { return item.id === fillInfo.resultDesc })
  138. let result = fillInfo.resultNumber
  139. if (selectList && selectList.length > 0) {
  140. result = result + this.projectQuantityUnitMap[selectList[0].unit]
  141. }
  142. return result
  143. },
  144. getFillValue(fillInfo) {
  145. if (fillInfo.type === this.$DictCache.VALUE.FILL_INFO_TYPE.FILL_INFO_TYPE_XIA_LA) {
  146. return this.getSelectLabel(fillInfo)
  147. } else if (fillInfo.type === this.$DictCache.VALUE.FILL_INFO_TYPE.FILL_INFO_TYPE_DAN_XUAN) {
  148. return this.getRadioGroupLabel(fillInfo)
  149. } else if (fillInfo.type === this.$DictCache.VALUE.FILL_INFO_TYPE.FILL_INFO_TYPE_FAN_WEI) {
  150. let result = this.$BaseTool.Amount.formatter(fillInfo.resultStart) + '~' + this.$BaseTool.Amount.formatter(fillInfo.resultEnd) +
  151. '(' + this.$BaseTool.Amount.formatter(fillInfo.resultEliminate) + ')'
  152. if (fillInfo.codeValue === this.$DictCache.VALUE.FILL_INFO_CODE_VALUE.FILL_INFO_CODE_VALUE_GLS) {
  153. result = result + 'KM'
  154. } else if (fillInfo.codeValue === this.$DictCache.VALUE.FILL_INFO_CODE_VALUE.FILL_INFO_CODE_VALUE_SJS) {
  155. result = result + '小时'
  156. }
  157. return result
  158. } else {
  159. return fillInfo.resultDesc
  160. }
  161. },
  162. getSelectLabel (fillInfo) {
  163. const options = this.getSelectOptions(fillInfo)
  164. return options[fillInfo.resultValue]
  165. },
  166. getSelectOptions (fillInfo) {
  167. if (this.$BaseTool.Object.isBlank(this.selectOptionMap[fillInfo.dictType])) {
  168. this.selectOptionMap[fillInfo.dictType] = this.$DictCache.getLabelByValueMapByType(fillInfo.dictType)
  169. }
  170. return this.selectOptionMap[fillInfo.dictType]
  171. },
  172. getRadioGroup (fillInfo) {
  173. if (this.$BaseTool.Object.isBlank(this.radioGroupMap[fillInfo.dictType])) {
  174. this.radioGroupMap[fillInfo.dictType] = this.$DictCache.getLabelByValueMapByType(fillInfo.dictType)
  175. }
  176. return this.radioGroupMap[fillInfo.dictType]
  177. },
  178. getRadioGroupLabel (fillInfo) {
  179. const options = this.getRadioGroup(fillInfo)
  180. return options[fillInfo.resultValue]
  181. },
  182. // 删除提示
  183. handleDelTip() {
  184. this.modelShow = true;
  185. this.content = '您确定删除吗?';
  186. },
  187. // 删除
  188. handleDelete() {},
  189. // 修改
  190. handleUpdate() {
  191. uni.navigateTo({
  192. url: '../running-update/running-update'
  193. });
  194. }
  195. }
  196. };
  197. </script>
  198. <style scoped lang="less">
  199. page {
  200. background-color: #f4f4f4;
  201. }
  202. .container {
  203. padding-bottom: 100rpx;
  204. .title {
  205. border-bottom: 1rpx solid #f4f4f4;
  206. color: #0082ff;
  207. }
  208. .p-fixed {
  209. border-top: 1rpx solid #f4f4f4;
  210. height: 100rpx;
  211. .common {
  212. padding: 15rpx 100rpx;
  213. border-radius: 30rpx;
  214. background-color: #0082ff;
  215. color: #fff;
  216. &:last-of-type {
  217. background-color: #fff;
  218. border: 1rpx solid #0082ff;
  219. color: #0082ff;
  220. }
  221. }
  222. }
  223. .footer {
  224. bottom: 0;
  225. left: 0;
  226. right: 0;
  227. background-color: #fff;
  228. }
  229. }
  230. </style>