index.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. <template>
  2. <view>
  3. <uni-nav-bar
  4. fixed="true"
  5. statusBar="true"
  6. left-icon="back"
  7. title="设备台账"
  8. @clickLeft="back"
  9. rightText="待处理"
  10. @clickRight="toProcessed"
  11. :rightNum="num"
  12. >
  13. </uni-nav-bar>
  14. <view class="main">
  15. <view class="title">
  16. <view class="">{{ info.assetName }}</view>
  17. <view class="sub">{{ info.assetCode }}</view>
  18. </view>
  19. <view class="img-box">
  20. <image
  21. mode="widthFix"
  22. class="main-img"
  23. :src="apiUrl + info.imageUrl.accessUrl"
  24. v-if="info.imageUrl"
  25. ></image>
  26. <image
  27. mode="widthFix"
  28. class="main-img"
  29. src="./upload-placeholder.svg"
  30. v-else
  31. ></image>
  32. </view>
  33. <view class="main-list">
  34. <view
  35. class="list-item"
  36. v-for="(item, index) in jumpList"
  37. :key="index"
  38. @click="toJump(item)"
  39. >
  40. <image
  41. class="item-img"
  42. :src="`../../static/ledger/icon${index + 1}.png`"
  43. ></image>
  44. <view class="item-name">{{ item.name }}</view>
  45. </view>
  46. </view>
  47. </view>
  48. <Assign
  49. ref="assignRef"
  50. @total="handlNum"
  51. :qrContent="qrContent"
  52. :list="AssignList"
  53. />
  54. </view>
  55. </template>
  56. <script>
  57. import Assign from '@/pages/equipment_ledger/components/Assign.vue'
  58. import { get, postJ } from '@/utils/api.js'
  59. export default {
  60. components: {
  61. Assign
  62. },
  63. data () {
  64. return {
  65. jumpList: [
  66. {
  67. id: 0,
  68. name: '基本信息',
  69. url: '/pages/equipment_ledger/basic_info/basic_info?info='
  70. },
  71. {
  72. id: 1,
  73. name: '关联模具',
  74. url: '/pages/equipment_ledger/correlation_model/correlation_model?info='
  75. },
  76. {
  77. id: 2,
  78. name: '巡点检记录',
  79. url: '/pages/equipment_ledger/patrol_record/patrol_record?info='
  80. },
  81. {
  82. id: 3,
  83. name: '保养记录',
  84. url: '/pages/equipment_ledger/patrol_record/patrol_record?info='
  85. },
  86. {
  87. id: 4,
  88. name: '维修记录',
  89. url: '/pages/equipment_ledger/patrol_record/patrol_record?info='
  90. },
  91. {
  92. id: 5,
  93. name: '故障记录',
  94. url: '/pages/equipment_ledger/malfunction/malfunction?info='
  95. },
  96. {
  97. id: 6,
  98. name: '盘点记录',
  99. url: '/pages/equipment_ledger/check/check?info='
  100. },
  101. // { id: 7, name: '设备运行记录' },
  102. {
  103. id: 8,
  104. name: '物联数据',
  105. url: '/pages/equipment_ledger/lot_data/lot_data?info='
  106. }
  107. ],
  108. info: '',
  109. num: '0',
  110. qrContent: '',
  111. // 待处理工单
  112. AssignList: []
  113. }
  114. },
  115. async onLoad (option) {
  116. console.log('option', option)
  117. this.qrContent = option.qrContent
  118. this.info = JSON.parse(decodeURIComponent(option.info))
  119. console.log(this.info)
  120. },
  121. onShow () {
  122. if (this.info) {
  123. this.getAssign()
  124. }
  125. },
  126. computed: {},
  127. methods: {
  128. toProcessed () {
  129. this.$refs.assignRef.open(this.info.assetCode)
  130. console.log('点击待处理')
  131. },
  132. toJump (item) {
  133. if (item.url) {
  134. uni.navigateTo({
  135. url:
  136. item.url +
  137. encodeURIComponent(JSON.stringify(this.info)) +
  138. '&pageTitle=' +
  139. item.name
  140. })
  141. }
  142. },
  143. assignSuccess () {
  144. // this.back()
  145. },
  146. handlNum (num) {
  147. this.num = String(num)
  148. },
  149. // 获取待处理数量
  150. getAssign () {
  151. let par = {
  152. equiCode: this.info.assetCode,
  153. orderTypeList: [1, 2, 3]
  154. }
  155. let _par = this.URLSearchParams(par)
  156. postJ(
  157. this.apiUrl + '/workOrder/getEquiAndWorkOrder?' + _par,
  158. par,
  159. true
  160. ).then(res => {
  161. if (res?.success) {
  162. this.AssignList = res.data
  163. this.num = String(res.data.length)
  164. if (res.data.length > 0) {
  165. this.$refs.assignRef.open()
  166. }
  167. }
  168. })
  169. },
  170. // 设置barType
  171. setBarType (val) {
  172. let index = val.indexOf('@_@')
  173. let result = 0
  174. if (index !== -1) {
  175. let item = val.substr(index + 3, 1)
  176. if (item) {
  177. result = Number(item)
  178. }
  179. }
  180. return result
  181. }
  182. }
  183. }
  184. </script>
  185. <style scoped lang="scss">
  186. .main {
  187. .title {
  188. padding-top: 20rpx;
  189. text-align: center;
  190. font-weight: bold;
  191. .sub {
  192. font-weight: normal;
  193. font-size: $uni-font-size-ssm;
  194. color: $uni-color-subtitle;
  195. }
  196. }
  197. .img-box {
  198. }
  199. .main-img {
  200. display: block;
  201. margin: 40rpx auto;
  202. width: 500rpx;
  203. }
  204. .main-list {
  205. width: 100%;
  206. margin: 0 auto;
  207. display: flex;
  208. flex-wrap: wrap;
  209. justify-content: flex-start;
  210. .list-item {
  211. border: 1rpx solid #47975a;
  212. border-radius: 14rpx;
  213. width: 205rpx;
  214. height: 160rpx;
  215. margin: 0 20rpx 30rpx;
  216. .item-img {
  217. display: block;
  218. margin: 15rpx auto;
  219. width: 80rpx;
  220. height: 80rpx;
  221. }
  222. .item-name {
  223. width: 100%;
  224. color: #47975a;
  225. font-size: 28rpx;
  226. text-align: center;
  227. }
  228. }
  229. }
  230. }
  231. </style>