material.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399
  1. <template>
  2. <view class="container">
  3. <uni-section title="原料" type="line" padding>
  4. <uni-grid :column="4" :highlight="true">
  5. <uni-grid-item v-for="(item, index) in categoryList" :index="index" :key="index" style="height:400px;">
  6. <view class="grid-item-box" style="background-color: #fff;text-align:center;margin:10px 0;"
  7. @click="inputDialogToggle(item)">
  8. <text class="text">{{item.name}}</text>
  9. <!--<cover-image class="img" src="@/static/images/rectangle.png"></cover-image>
  10. <view class="progress-box">
  11. <progress :percent="item.val" stroke-width="100" inverse="false" style="width:300px;"
  12. v-if="item.status===0" />
  13. <progress :percent="item.val" stroke-width="100" inverse="false" activeColor="#ff0000"
  14. v-if="item.status===1" style="width:300px;" />
  15. </view>-->
  16. <view class="progressContainer">
  17. <view class="progress" :style="{ height: item.val + '%' }" v-if="item.status===0">
  18. <view class="progress-view"></view>
  19. </view>
  20. <view class="progress" :style="{ height: item.val + '%', backgroundColor:'#ff0000'}"
  21. v-if="item.status===1">
  22. <view class="progress-view"></view>
  23. </view>
  24. <text class="errMsg" v-if="item.status===1">{{item.errMsg}}</text>
  25. <text class="tip">{{item.val}}ml</text>
  26. </view>
  27. <view class="num">
  28. <uni-badge class="uni-badge-left-margin" :text="item.id" type="primary"
  29. :customStyle="{background: '#00ffff', width: '60rpx',height:'60rpx',lineHeight:'60rpx',minWidth:'30rpx',fontSize:'40rpx'}" />
  30. </view>
  31. </view>
  32. </uni-grid-item>
  33. </uni-grid>
  34. </uni-section>
  35. <uni-section title="操作记录" type="line" padding>
  36. <uni-list>
  37. <uni-list-item title="时间"></uni-list-item>
  38. </uni-list>
  39. <uni-table border stripe emptyText="暂无更多数据">
  40. <!-- 表头行 -->
  41. <uni-tr>
  42. <uni-th align="center">料筒</uni-th>
  43. <uni-th align="center">剩余原料</uni-th>
  44. <uni-th align="center">余量</uni-th>
  45. <uni-th align="center">换料原料</uni-th>
  46. <uni-th align="center">换料规格</uni-th>
  47. <uni-th align="center">到期日期</uni-th>
  48. </uni-tr>
  49. <uni-tr v-for="(item, index) in records" :key="item.id">
  50. <uni-td align="center">{{item.id}}</uni-td>
  51. <uni-td align="center">{{item.name}}</uni-td>
  52. <uni-td align="center">{{item.surplus}}</uni-td>
  53. <uni-td align="center">{{item.rawMaterial}}</uni-td>
  54. <uni-td align="center">{{item.specs}}</uni-td>
  55. <uni-td align="center">{{item.date}}</uni-td>
  56. </uni-tr>
  57. </uni-table>
  58. <uni-table border stripe emptyText="暂无更多数据">
  59. <!-- 表头行 -->
  60. <uni-tr>
  61. <uni-th align="center"></uni-th>
  62. <uni-th align="center">原料</uni-th>
  63. <uni-th align="center">规格</uni-th>
  64. <uni-th align="center">到期日期</uni-th>
  65. </uni-tr>
  66. <uni-tr v-for="(item, index) in records2" :key="item.id">
  67. <uni-td align="center">{{item.status===0?'修正前':'修正后'}}</uni-td>
  68. <uni-td align="center">{{item.name}}</uni-td>
  69. <uni-td align="center">{{item.specs}}</uni-td>
  70. <uni-td align="center">{{item.date}}</uni-td>
  71. </uni-tr>
  72. </uni-table>
  73. <uni-load-more status="more"></uni-load-more>
  74. </uni-section>
  75. <view class="example-body box" v-show="popShow">
  76. <uni-popup ref="inputDialog" type="dialog">
  77. <view class="popup">
  78. <uni-row class="uni-row">
  79. <uni-col :span="12">
  80. <view class="demo-uni-col dark">料筒</view>
  81. </uni-col>
  82. <uni-col :span="12">
  83. <view class="uni-col light">{{material.id}}</view>
  84. </uni-col>
  85. </uni-row>
  86. <uni-row class="uni-row" >
  87. <uni-col :span="12">
  88. <view class="uni-col dark">料筒</view>
  89. </uni-col>
  90. <uni-col :span="12">
  91. <view class="uni-col light">{{material.id}}</view>
  92. </uni-col>
  93. </uni-row>
  94. <uni-row class="uni-row">
  95. <uni-col :span="12">
  96. <view class="uni-col dark">产品</view>
  97. </uni-col>
  98. <uni-col :span="12">
  99. <view class="uni-col light">{{material.name}}</view>
  100. </uni-col>
  101. </uni-row>
  102. <uni-row class="uni-row">
  103. <uni-col :span="12">
  104. <view class="uni-col dark">原料剩余</view>
  105. </uni-col>
  106. <uni-col :span="12">
  107. <view class="uni-col light">{{material.surplus}}</view>
  108. </uni-col>
  109. </uni-row>
  110. <uni-row class="uni-row">
  111. <uni-col :span="12">
  112. <view class="uni-col dark">过期状态</view>
  113. </uni-col>
  114. <uni-col :span="12">
  115. <view class="uni-col light">{{material.status===0?'未过期':'过期'}}</view>
  116. </uni-col>
  117. </uni-row>
  118. <uni-row class="uni-row">
  119. <uni-col :span="12">
  120. <view class="uni-col dark">到期日期</view>
  121. </uni-col>
  122. <uni-col :span="12">
  123. <view class="uni-col light">{{material.date}}</view>
  124. </uni-col>
  125. </uni-row>
  126. <uni-row class="uni-row">
  127. <uni-col :span="12">
  128. <button @click="editDialog(material)" type="primary" size="mini">修正</button>
  129. </uni-col>
  130. <uni-col :span="12">
  131. <button @click="dialogClose" type="primary" size="mini">关闭</button>
  132. </uni-col>
  133. </uni-row>
  134. </view>
  135. </uni-popup>
  136. </view>
  137. <view class="">
  138. <MaterialDetail ref="edit" :dialog-visible="editShow" @close="editClose" ></MaterialDetail>
  139. </view>
  140. </view>
  141. </template>
  142. <script>
  143. import MaterialDetail from "@/pages/material/materialDetail.vue";
  144. export default {
  145. data() {
  146. return {
  147. index: 0,
  148. index2: 0,
  149. array: [1, 2, 3, 4, 5, 6, 7, 8],
  150. specs: [5, 10, 20],
  151. popShow: false,
  152. editShow: false,
  153. materials: ['燕麦', '魔芋粉', '牛肉粉', '红薯粉', '蜂蜜'],
  154. material: {
  155. equId: '',
  156. barrelCode:'',
  157. name: '',
  158. surplus: '',
  159. specs: '',
  160. date: '',
  161. status: ''
  162. },
  163. records: [{
  164. id: 1,
  165. name: '燕麦',
  166. rawMaterial: '燕麦',
  167. surplus: '2',
  168. specs: '10',
  169. date: '2021-11-14 12:13'
  170. }],
  171. records2: [{
  172. id: 1,
  173. name: '燕麦',
  174. surplus: '2',
  175. specs: '10',
  176. date: '2021-11-14 12:13',
  177. status: 0,
  178. }, {
  179. id: 2,
  180. name: '燕麦',
  181. surplus: '2',
  182. specs: '10',
  183. date: '2021-11-14 12:13',
  184. status: 1,
  185. }],
  186. categoryList: [{
  187. id: 1,
  188. name: "燕麦",
  189. val: 40,
  190. status: 1,
  191. errMsg: '原料不足',
  192. }, {
  193. id: 2,
  194. name: "魔芋粉",
  195. val: 60,
  196. status: 1,
  197. errMsg: '即将过期',
  198. }, {
  199. id: 3,
  200. name: "红薯粉",
  201. val: 80,
  202. status: 0,
  203. errMsg: '',
  204. }, {
  205. id: 4,
  206. name: "牛肉粉",
  207. val: 65,
  208. status: 0,
  209. errMsg: '',
  210. }, {
  211. id: 5,
  212. name: "蜂蜜",
  213. val: 40,
  214. status: 0,
  215. errMsg: '',
  216. }, {
  217. id: 6,
  218. name: "安赛蜜",
  219. val: 60,
  220. status: 0,
  221. errMsg: '',
  222. }, {
  223. id: 7,
  224. name: "牛奶",
  225. val: 80,
  226. status: 0,
  227. errMsg: '',
  228. }, {
  229. id: 8,
  230. name: "橙汁",
  231. val: 65,
  232. status: 0,
  233. errMsg: '',
  234. }],
  235. }
  236. },
  237. components: {
  238. MaterialDetail
  239. },
  240. methods: {
  241. inputDialogToggle(row) {
  242. this.popShow = true
  243. this.$refs.inputDialog.open()
  244. //this.$refs.detail.setMaterial(row);
  245. this.material = row;
  246. },
  247. dialogClose() {
  248. console.log('点击关闭')
  249. this.popShow = false
  250. this.$refs.inputDialog.close()
  251. },
  252. editDialog(row) {
  253. this.dialogClose()
  254. this.editShow = true
  255. console.log(row)
  256. this.$refs.edit.setMaterial(row);
  257. },
  258. editClose(){
  259. this.editShow = false
  260. },
  261. getMaterialData() {
  262. let that = this;
  263. util.request(api.MaterialList, {
  264. equId: this.$route.query.id
  265. }, 'GET', 'application/json').then(function(res) {
  266. if (res.code === 0) {
  267. that.records = res.data;
  268. }
  269. });
  270. },
  271. onLoad: function() {
  272. this.getMaterialData();
  273. }
  274. }
  275. }
  276. </script>
  277. <style style="scss">
  278. .grid-item-box .text {
  279. padding: 20rpx 0;
  280. height: 30rpx;
  281. line-height: 30rpx;
  282. font-weight: bold;
  283. width: inherit;
  284. }
  285. .grid-item-box .num {
  286. position: relative;
  287. margin: 0 auto;
  288. z-index: 999;
  289. }
  290. .grid-item-box .tip {
  291. position: absolute;
  292. bottom: 20rpx;
  293. left: 30%;
  294. margin: 0 auto;
  295. color: #fff;
  296. z-index: 999;
  297. text-align: center;
  298. }
  299. .grid-item-box .errMsg {
  300. position: absolute;
  301. left: 30%;
  302. top: 120rpx;
  303. font-size: 36rpx;
  304. width: 80rpx;
  305. color: #ff0000;
  306. z-index: 9999;
  307. margin: 0 auto;
  308. }
  309. .fb-type {
  310. height: 104rpx;
  311. width: 80%;
  312. margin-left: 20%;
  313. background: #fff;
  314. margin-bottom: 20rpx;
  315. display: flex;
  316. flex-direction: row;
  317. align-items: center;
  318. padding-left: 30rpx;
  319. padding-right: 30rpx;
  320. }
  321. .fb-type .type-label {
  322. height: 36rpx;
  323. flex: 1;
  324. color: #333;
  325. font-size: 28rpx;
  326. }
  327. .fb-type .type-icon {
  328. height: 36rpx;
  329. width: 36rpx;
  330. }
  331. .popup-content {
  332. align-items: center;
  333. justify-content: center;
  334. padding: 15px;
  335. height: 50px;
  336. background-color: #fff;
  337. }
  338. .popup {
  339. display: block;
  340. padding: 5rpx 10rpx 0;
  341. overflow: hidden;
  342. background-color: #fff;
  343. }
  344. .uni-row {
  345. margin-bottom: 10px;
  346. display: block;
  347. }
  348. .uni-col {
  349. height: 36px;
  350. border-radius: 5px;
  351. text-align: center;
  352. }
  353. </style>
  354. <style scoped>
  355. .progressContainer {
  356. position: relative;
  357. width: 160rpx;
  358. height: 600rpx;
  359. background-color: #ddd;
  360. overflow: hidden;
  361. margin: 20rpx auto;
  362. }
  363. .progress {
  364. position: absolute;
  365. width: inherit;
  366. bottom: 0;
  367. background-color: #007aff;
  368. }
  369. .progress-view {
  370. width: inherit;
  371. height: inherit;
  372. position: absolute;
  373. top: 0;
  374. }
  375. /deep/ .uni-popup .uni-popup__wrapper {
  376. width: 600rpx;
  377. min-width: 400rpx;
  378. }
  379. </style>