spare-detail.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. <template>
  2. <view>
  3. <u-toast ref="uToast" />
  4. <view class="d-flex px3 py2">
  5. <view class="top d-flex a-center bg-color-white flex1 one-ellipsis">
  6. <view class="img" style="cursor:pointer">
  7. <image
  8. :src="
  9. imgSrc
  10. ? imgSrc
  11. : $BaseTool.UserUtil.getFileUrl(infoData.qrCode)
  12. "
  13. mode="widthFix"
  14. ></image>
  15. </view>
  16. <view class="pl-3">
  17. <view class="f-size-36 text-color-3 one-ellipsis">{{
  18. infoData.name
  19. }}</view>
  20. <view
  21. class="d-flex f-size-28 f-weight-6 f-wrap"
  22. style="margin: 20rpx 0"
  23. >
  24. </view>
  25. <view class="d-flex">
  26. <text class="f-size-26 mr-3 state-r main-color-bg text-color-white">编码:{{ infoData.no }}</text>
  27. </view>
  28. </view>
  29. </view>
  30. </view>
  31. <view class="divider"></view>
  32. <!-- 基本信息 -->
  33. <view class="mt-3 px3">
  34. <view
  35. class="f-size-30 f-weight-bold py2 border-bottom"
  36. >基本信息</view
  37. >
  38. <view
  39. class="mx3 my2 p3 bg-color-white"
  40. style="border-radius: 16rpx; border: 1px solid #eee"
  41. >
  42. <equipment-line title="备件价格" :content="infoData.initialValue" />
  43. <equipment-line title="备件编号" :content="infoData.initNo" />
  44. <equipment-line title="备件类型" :content="infoData.typeName" />
  45. <equipment-line title="规格型号" :content="infoData.ggxh" />
  46. </view>
  47. </view>
  48. <view class="divider"></view>
  49. <view class="px3">
  50. <view
  51. class="f-size-30 f-weight-bold py2 border-bottom"
  52. >常用操作</view
  53. >
  54. <u-grid :col="3" :border="false">
  55. <u-grid-item @tap="handleAdd(1)">
  56. <view
  57. class="iconfont icon-ruku main-color-text"
  58. style="color: #0f6fb9;font-size: 56rpx"
  59. ></view>
  60. <view class="grid-text">入库</view>
  61. </u-grid-item>
  62. <u-grid-item @tap="handleStart()">
  63. <view class="iconfont icon-chuku main-color-text" style="color: #0f6fb9;font-size: 56rpx"></view>
  64. <view class="grid-text">出库</view>
  65. </u-grid-item>
  66. <u-grid-item v-if="infoData.status != 7" @tap="handleStop()">
  67. <view class="iconfont icon-stop1 main-color-text"></view>
  68. <view class="grid-text">盘点</view>
  69. </u-grid-item>
  70. </u-grid>
  71. </view>
  72. <view class="divider"></view>
  73. <view class="px3">
  74. <my-card
  75. title="备件图片"
  76. @handleLubrication="handleImg"
  77. ></my-card>
  78. <my-card
  79. icon="icon-tubiaozhizuomoban-135"
  80. title="备件仓库"
  81. @handleLubrication="handleSpareStore"
  82. ></my-card>
  83. </view>
  84. </view>
  85. </template>
  86. <script>
  87. import DictCache from '@/utils/dict';
  88. export default {
  89. data() {
  90. return {
  91. list: [
  92. {
  93. name: '维修记录'
  94. },
  95. {
  96. name: '运行记录'
  97. },
  98. {
  99. name: '巡检记录'
  100. }
  101. ],
  102. current: 0,
  103. detailId: '',
  104. infoData: {},
  105. statusMap: {},
  106. rlTypeMap: null,
  107. colorMap: null,
  108. imgSrc: '',
  109. gatherTask: {
  110. checkTask: 0,
  111. maintainTask: 0,
  112. lubricationTask: 0,
  113. lubricationTaskWeek: 0,
  114. lubricationTaskMonth: 0,
  115. oilTask: 0,
  116. repairTask: 0,
  117. repairCheckTask: 0
  118. }
  119. };
  120. },
  121. onLoad(options) {
  122. // 获取词典
  123. this.detailId = options.detailId;
  124. this.$Http.getDictData().then(response => {
  125. uni.setStorage({
  126. key: DictCache.BASE_DATA_CACHE,
  127. data: response.data,
  128. success: function () {}
  129. });
  130. this.statusMap = this.$DictCache.getLabelByValueMapByType(
  131. this.$DictCache.TYPE.SB_INFO_STATUS
  132. );
  133. this.rlTypeMap = this.$DictCache.getLabelByValueMapByType(
  134. this.$DictCache.TYPE.RANLIAO_TYPE
  135. );
  136. this.colorMap = this.$DictCache.getLabelByValueMapByType(
  137. this.$DictCache.TYPE.SB_COLOR
  138. );
  139. this.$Http
  140. .fetchSparePartInfo({
  141. id: this.detailId
  142. })
  143. .then((res) => {
  144. this.infoData = res.data;
  145. this.imgSrc = this.$BaseTool.UserUtil.getFileUrl(this.infoData.image)
  146. uni.setNavigationBarTitle({
  147. title: this.infoData.name
  148. });
  149. });
  150. });
  151. },
  152. onShow() {
  153. },
  154. methods: {
  155. // 图片
  156. handleImg() {
  157. uni.navigateTo({
  158. url:
  159. '/pages/spare/spare-img?detailId=' +
  160. this.detailId
  161. });
  162. },
  163. // 备件仓库
  164. handleSpareStore() {
  165. uni.navigateTo({
  166. url: '/pages/spare/spare-store?detailId=' + this.detailId + '&spareName=' + this.infoData.name + '&spareNo=' + this.infoData.no
  167. });
  168. },
  169. // 常用操作跳转
  170. handleAdd(index) {
  171. if (index === 1) {
  172. uni.navigateTo({
  173. url:
  174. '/pages/repair-add/repair-add?detailId=' +
  175. this.detailId
  176. });
  177. } else if (index === 2) {
  178. uni.navigateTo({
  179. url: '/pages/running/running-edit?sbId=' + this.detailId
  180. });
  181. } else if (index === 3) {
  182. uni.navigateTo({
  183. url:
  184. '/pages/inspection/inspection-edit?sbId=' +
  185. this.detailId
  186. });
  187. }
  188. },
  189. change(index) {
  190. this.current = index;
  191. },
  192. }
  193. };
  194. </script>
  195. <style lang="less">
  196. .iconfont {
  197. font-size: 50rpx;
  198. }
  199. .col2 view:first-child {
  200. // width: 130rpx;
  201. }
  202. .col2 view:last-child {
  203. flex: 1;
  204. }
  205. .top {
  206. .img {
  207. width: 168rpx;
  208. height: 168rpx;
  209. border-radius: 50%;
  210. image {
  211. width: 168rpx;
  212. height: 168rpx;
  213. border-radius: 50%;
  214. background-color: #eee;
  215. }
  216. }
  217. }
  218. .d-flex.mb-2 {
  219. align-items: center;
  220. }
  221. .state-r {
  222. padding: 8rpx 20rpx;
  223. border-radius: 30rpx;
  224. }
  225. .state-g {
  226. padding: 8rpx 20rpx;
  227. border-radius: 30rpx;
  228. background-color: #e7e8f2;
  229. color: #949dad;
  230. }
  231. </style>