瀏覽代碼

宝霆运维端代码更新

oyq28 2 年之前
父節點
當前提交
a2c2354b73

File diff suppressed because it is too large
+ 0 - 0
imcs-bt-admin/imcs-bt-admin/imcs/index.html


+ 55 - 8
imcs-bt-be/imcs-authority-server/src/main/java/com/github/zuihou/api/OpsAppApi.java

@@ -1,17 +1,27 @@
 package com.github.zuihou.api;
 
 import cn.hutool.core.bean.BeanUtil;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.zuihou.base.R;
 import com.github.zuihou.base.request.PageParams;
 import com.github.zuihou.business.barrel.entity.EquBarrel;
 import com.github.zuihou.business.barrel.service.EquBarrelService;
+import com.github.zuihou.business.material.entity.Material;
+import com.github.zuihou.business.material.service.MaterialService;
 import com.github.zuihou.business.order.entity.Order;
 import com.github.zuihou.business.order.service.OrderService;
+import com.github.zuihou.business.productionresource.dto.EquGoodsDto;
 import com.github.zuihou.business.productionresource.dto.ReloadMtrDto;
+import com.github.zuihou.business.productionresource.entity.EquAndGoods;
 import com.github.zuihou.business.productionresource.entity.ProductionResource;
+import com.github.zuihou.business.productionresource.service.EquAndGoodsService;
 import com.github.zuihou.business.productionresource.service.ProductionTenantResourceService;
+import com.github.zuihou.business.record.entity.EquRecord;
+import com.github.zuihou.business.record.service.EquRecordService;
+import com.github.zuihou.business.record.service.impl.EquRecordServiceImpl;
 import com.github.zuihou.business.util.CommonUtil;
 import com.github.zuihou.common.util.DateUtil;
 import com.github.zuihou.context.BaseContextHandler;
@@ -43,6 +53,10 @@ public class OpsAppApi {
     private OrderService orderService;
     @Autowired
     private EquBarrelService equBarrelService;
+    @Autowired
+    private EquRecordService equRecordService;
+    @Autowired
+    private MaterialService materialService;
 
     /**
      * 设备列表接口
@@ -191,14 +205,40 @@ public class OpsAppApi {
      * @return
      */
     @GetMapping("/barrelList")
-    public R<List<EquBarrel>> barrelList(@RequestParam("equId") Long equId) {
+    public R<IPage<EquBarrel>> barrelList(@RequestParam("equId") Long equId) {
         BaseContextHandler.setTenant("0000");
         QueryWrap<EquBarrel> equBarrelQueryWrap = new QueryWrap<>();
         equBarrelQueryWrap.eq("equ_id",equId);
-        List<EquBarrel> list = equBarrelService.list(equBarrelQueryWrap);
+        Page<EquBarrel> page = new Page<>(1L,10);
+        //List<EquBarrel> list = equBarrelService.list(equBarrelQueryWrap);
+        IPage<EquBarrel> list = equBarrelService.pageList(page, equBarrelQueryWrap);
+        return R.success(list);
+    }
+
+
+    @PostMapping("/recordList")
+    public  R<IPage<EquRecord>> recordList(@RequestBody PageParams<EquRecord> params){
+        BaseContextHandler.setTenant("0000");
+        IPage<EquRecord> page = params.buildPage();
+        LbqWrapper<EquRecord> recordQueryWrap = Wraps.lbQ();
+        EquRecord equRecord = BeanUtil.toBean(params, EquRecord.class);
+        recordQueryWrap.eq(EquRecord::getEquId, equRecord.getEquId()).orderByDesc(EquRecord::getCreateTime);
+        IPage<EquRecord> list = equRecordService.pageList(page, recordQueryWrap);
+        return R.success(list);
+    }
+
+    @GetMapping("/equMaterialList")
+    public  R<List<Material>> equMaterialList(@RequestParam("mtType") String mtType){
+        BaseContextHandler.setTenant("0000");
+        LbqWrapper<Material> materialQueryWrap = Wraps.lbQ();
+        materialQueryWrap.eq(Material::getMtType, mtType);
+        //Page<EquGoodsDto> page = new Page<>(1L,100);
+        //goodsQueryWrap.eq(EquGoodsDto::getEquId, equId).orderByDesc(EquGoodsDto::getGoodsId);
+        List<Material> list = materialService.list(materialQueryWrap);
         return R.success(list);
     }
 
+
     /**
      * 订单统计数据
      *
@@ -226,12 +266,17 @@ public class OpsAppApi {
      *
      * @return
      */
-    @PostMapping("/reloadMtr")
-    public R<List<EquBarrel>> reloadMtr(@RequestBody ReloadMtrDto reloadMtrDto) {
-//        QueryWrap<EquBarrel> equBarrelQueryWrap = new QueryWrap<>();
-//        equBarrelQueryWrap.eq("equ_id",equId);
-//        List<EquBarrel> list = equBarrelService.list(equBarrelQueryWrap);
-        return R.success(null);
+    @PostMapping("/recordSave")
+    public R<Boolean> recordSave(@RequestBody EquRecord equRecord) {
+        BaseContextHandler.setTenant("0000");
+        LambdaUpdateWrapper<EquBarrel> updateWrapper = new LambdaUpdateWrapper();
+        updateWrapper.set(EquBarrel::getMtrId, equRecord.getReplaceMaterial()).set(EquBarrel::getMtrName, equRecord.getMtName()).set(EquBarrel::getMtrResidue, equRecord.getSpecs())
+                .set(EquBarrel::getExprTime, equRecord.getDate()).eq(EquBarrel::getId, equRecord.getMaterialId());
+        Boolean bool = equBarrelService.update(null, updateWrapper);
+        if(bool){
+            bool = equRecordService.save(equRecord);
+        }
+        return R.success(bool);
     }
 
 
@@ -242,6 +287,8 @@ public class OpsAppApi {
 
 
 
+
+
 //    操作记录接口
 
 

+ 8 - 0
imcs-bt-be/imcs-business-biz/src/main/java/com/github/zuihou/business/barrel/dao/EquBarrelMapper.java

@@ -1,8 +1,15 @@
 package com.github.zuihou.business.barrel.dao;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Constants;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.zuihou.base.mapper.SuperMapper;
 import com.github.zuihou.business.barrel.entity.EquBarrel;
 
+import com.github.zuihou.business.productionresource.entity.ProductionResource;
+import com.github.zuihou.database.mybatis.auth.DataScope;
+import com.github.zuihou.database.mybatis.conditions.query.QueryWrap;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 
 /**
@@ -17,4 +24,5 @@ import org.springframework.stereotype.Repository;
 @Repository
 public interface EquBarrelMapper extends SuperMapper<EquBarrel> {
 
+    IPage<EquBarrel> pageList(Page<EquBarrel> page, @Param(Constants.WRAPPER) QueryWrap<EquBarrel> equBarrelQueryWrap);
 }

+ 7 - 0
imcs-bt-be/imcs-business-biz/src/main/java/com/github/zuihou/business/barrel/service/EquBarrelService.java

@@ -1,7 +1,11 @@
 package com.github.zuihou.business.barrel.service;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.zuihou.base.service.SuperService;
 import com.github.zuihou.business.barrel.entity.EquBarrel;
+import com.github.zuihou.business.productionresource.entity.ProductionResource;
+import com.github.zuihou.database.mybatis.conditions.query.QueryWrap;
 
 /**
  * <p>
@@ -15,4 +19,7 @@ import com.github.zuihou.business.barrel.entity.EquBarrel;
 public interface EquBarrelService extends SuperService<EquBarrel> {
 
     void updateBarrel(String speId,String equId);
+
+    IPage<EquBarrel> pageList(Page<EquBarrel> page, QueryWrap<EquBarrel> equBarrelQueryWrap);
+
 }

+ 6 - 0
imcs-bt-be/imcs-business-biz/src/main/java/com/github/zuihou/business/barrel/service/impl/EquBarrelServiceImpl.java

@@ -2,6 +2,8 @@ package com.github.zuihou.business.barrel.service.impl;
 
 
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.zuihou.base.service.SuperServiceImpl;
 import com.github.zuihou.business.barrel.dao.EquBarrelMapper;
 import com.github.zuihou.business.barrel.entity.EquBarrel;
@@ -83,5 +85,9 @@ public class EquBarrelServiceImpl extends SuperServiceImpl<EquBarrelMapper, EquB
 
     }
 
+    @Override
+    public IPage<EquBarrel> pageList(Page<EquBarrel> page, QueryWrap<EquBarrel> equBarrelQueryWrap) {
+        return baseMapper.pageList(page, equBarrelQueryWrap);
+    }
 
 }

+ 6 - 0
imcs-bt-be/imcs-business-biz/src/main/java/com/github/zuihou/business/productionresource/dao/EquAndGoodsMapper.java

@@ -1,8 +1,14 @@
 package com.github.zuihou.business.productionresource.dao;
 
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Constants;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.zuihou.base.mapper.SuperMapper;
 import com.github.zuihou.business.productionresource.entity.EquAndGoods;
+import com.github.zuihou.database.mybatis.auth.DataScope;
+import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 
 /**

+ 3 - 0
imcs-bt-be/imcs-business-biz/src/main/java/com/github/zuihou/business/productionresource/service/EquAndGoodsService.java

@@ -1,8 +1,11 @@
 package com.github.zuihou.business.productionresource.service;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.zuihou.base.service.SuperService;
 import com.github.zuihou.business.productionresource.entity.EquAndGoods;
 import com.github.zuihou.business.productionresource.entity.ProductionResource;
+import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
 
 /**
  * <p>

+ 4 - 0
imcs-bt-be/imcs-business-biz/src/main/java/com/github/zuihou/business/productionresource/service/impl/EquAndGoodsServiceImpl.java

@@ -1,9 +1,13 @@
 package com.github.zuihou.business.productionresource.service.impl;
 
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.zuihou.base.service.SuperServiceImpl;
 import com.github.zuihou.business.productionresource.entity.EquAndGoods;
 import com.github.zuihou.business.productionresource.service.EquAndGoodsService;
+import com.github.zuihou.database.mybatis.auth.DataScope;
+import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 import com.github.zuihou.business.productionresource.dao.EquAndGoodsMapper;

+ 12 - 1
imcs-bt-be/imcs-business-biz/src/main/resources/mapper_business/base/barrel/EquBarrelMapper.xml

@@ -18,13 +18,24 @@
         <result column="residue_warn" jdbcType="DECIMAL" property="residueWarn"/>
         <result column="expr_time" jdbcType="TIMESTAMP" property="exprTime"/>
         <result column="expr_Status" jdbcType="VARCHAR" property="exprStatus"/>
+        <result column="barrel_code" jdbcType="VARCHAR" property="barrelCode"/>
         <result column="barrel_weight" jdbcType="BIGINT" property="barrelWeight"/>
     </resultMap>
 
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
-        id,create_time,create_user,update_time,update_user,
+        id,create_time,create_user,update_time,update_user,barrel_code,
         equ_id, mtr_id, mtr_name, mtr_type, mtr_unit, mtr_residue, residue_warn, expr_time, expr_Status, barrel_weight
     </sql>
 
+    <select id="pageList" resultMap="BaseResultMap" parameterType="String">
+        select
+        <include refid="Base_Column_List"/>
+        from (
+            select b.*, p.name as equName from bt_equ_barrel b left join bt_material m on b.mtr_id = m.id
+            left join imcs_tenant_productionresource p on b.equ_id = p.id
+
+        ) f ${ew.customSqlSegment}
+    </select>
+
 </mapper>

+ 2 - 2
imcs-bt-fe/imcs-bt-fe/uni-mall/pages/device/deviceDetail.vue

@@ -44,7 +44,7 @@
 			</view>
 		</view>
 		<view class="a-section material">
-			<navigator :url="'../material/material?id='+device.id">
+			<navigator :url="'../material/material?equId='+device.id">
 				<view class="h">
 					<view class="l">料筒物料</view>
 					<view class="r">
@@ -54,7 +54,7 @@
 			</navigator>
 		</view>
 		<view class="a-section material">
-			<navigator :url="'../ucenter/order/order?id='+device.id">
+			<navigator :url="'../ucenter/order/order?equId='+device.id">
 				<text class="title">设备订单</text>
 			</navigator>
 		</view>

+ 313 - 76
imcs-bt-fe/imcs-bt-fe/uni-mall/pages/material/material.vue

@@ -1,32 +1,27 @@
 <template>
-	<view class="container">		
+	<view class="container">
 		<uni-section title="原料" type="line" padding>
 			<uni-grid :column="4" :highlight="true">
 				<uni-grid-item v-for="(item, index) in categoryList" :index="index" :key="index" style="height:400px;">
 					<view class="grid-item-box" style="background-color: #fff;text-align:center;margin:10px 0;"
 						@click="inputDialogToggle(item)">
-						<text class="text">{{item.name}}</text>
-						<!--<cover-image class="img" src="@/static/images/rectangle.png"></cover-image>
-						<view class="progress-box">
-							<progress :percent="item.val" stroke-width="100" inverse="false" style="width:300px;"
-								v-if="item.status===0" />
-							<progress :percent="item.val" stroke-width="100" inverse="false" activeColor="#ff0000"
-								v-if="item.status===1" style="width:300px;" />
-						</view>-->
+						<text class="text">{{item.mtrName||'空'}}</text>
 						<view class="progressContainer">
-							<view class="progress" :style="{ height: item.val + '%' }" v-if="item.status===0">
+							<view class="progress" :style="{ height: Math.round(item.mtrResidue) + '%' }"
+								v-if="item.exprStatus==='0'">
 								<view class="progress-view"></view>
 							</view>
-							<view class="progress" :style="{ height: item.val + '%', backgroundColor:'#ff0000'}"
-								v-if="item.status===1">
+							<view class="progress"
+								:style="{ height: Math.round(item.mtrResidue) + '%', backgroundColor:'#ff0000'}" v-else>
 								<view class="progress-view"></view>
 							</view>
-							<text class="errMsg" v-if="item.status===1">{{item.errMsg}}</text>
-							<text class="tip">{{item.val}}ml</text>
-						</view>						
+							<text class="errMsg" v-if="item.exprStatus==='1'">即将到期</text>
+							<text class="errMsg" v-if="item.mtrResidue <= item.residueWarn">原料不足</text>
+							<text class="tip">{{item.mtrResidue || '0'}}ml</text>
+						</view>
 
 						<view class="num">
-							<uni-badge class="uni-badge-left-margin" :text="item.id" type="primary"
+							<uni-badge class="uni-badge-left-margin" :text="item.barrelCode" type="primary"
 								:customStyle="{background: '#00ffff', width: '60rpx',height:'60rpx',lineHeight:'60rpx',minWidth:'30rpx',fontSize:'40rpx'}" />
 						</view>
 					</view>
@@ -35,7 +30,7 @@
 		</uni-section>
 		<uni-section title="操作记录" type="line" padding>
 			<uni-list>
-				<uni-list-item title="时间"></uni-list-item>				
+				<uni-list-item title="时间"></uni-list-item>
 			</uni-list>
 			<uni-table border stripe emptyText="暂无更多数据">
 				<!-- 表头行 -->
@@ -48,16 +43,16 @@
 					<uni-th align="center">到期日期</uni-th>
 				</uni-tr>
 				<uni-tr v-for="(item, index) in records" :key="item.id">
-					<uni-td align="center">{{item.id}}</uni-td>
-					<uni-td align="center">{{item.name}}</uni-td>
+					<uni-td align="center">{{item.barrelCode}}</uni-td>
+					<uni-td align="center">{{item.mtName}}</uni-td>
 					<uni-td align="center">{{item.surplus}}</uni-td>
-					<uni-td align="center">{{item.rawMaterial}}</uni-td>
+					<uni-td align="center">{{item.mtrName}}</uni-td>
 					<uni-td align="center">{{item.specs}}</uni-td>
 					<uni-td align="center">{{item.date}}</uni-td>
 				</uni-tr>
 			</uni-table>
 
-			<uni-table border stripe emptyText="暂无更多数据">
+			<uni-table border stripe emptyText="暂无更多数据" v-show="false">
 				<!-- 表头行 -->
 				<uni-tr>
 					<uni-th align="center"></uni-th>
@@ -76,7 +71,7 @@
 			<uni-load-more status="more"></uni-load-more>
 		</uni-section>
 
-		<view class="example-body box" v-show="popShow">
+		<view class="inputBox" v-show="popShow" style="min-width:800rpx;">
 			<uni-popup ref="inputDialog" type="dialog">
 				<view class="popup">
 					<uni-row class="uni-row">
@@ -84,15 +79,7 @@
 							<view class="demo-uni-col dark">料筒</view>
 						</uni-col>
 						<uni-col :span="12">
-							<view class="uni-col light">{{material.id}}</view>
-						</uni-col>
-					</uni-row>
-					<uni-row class="uni-row" >
-						<uni-col :span="12">
-							<view class="uni-col dark">料筒</view>
-						</uni-col>
-						<uni-col :span="12">
-							<view class="uni-col light">{{material.id}}</view>
+							<view class="uni-col light">{{material.barrelCode}}</view>
 						</uni-col>
 					</uni-row>
 					<uni-row class="uni-row">
@@ -100,15 +87,16 @@
 							<view class="uni-col dark">产品</view>
 						</uni-col>
 						<uni-col :span="12">
-							<view class="uni-col light">{{material.name}}</view>
+							<view class="uni-col light">{{material.mtrName || '空'}}</view>
 						</uni-col>
-					</uni-row>					
+					</uni-row>
 					<uni-row class="uni-row">
 						<uni-col :span="12">
 							<view class="uni-col dark">原料剩余</view>
 						</uni-col>
 						<uni-col :span="12">
-							<view class="uni-col light">{{material.surplus}}</view>
+							<view class="uni-col light">{{material.mtrResidue || '0'}}ml
+								({{material.mtrResidue > material.residueWarn?'原料充足':'原料不足' }})</view>
 						</uni-col>
 					</uni-row>
 					<uni-row class="uni-row">
@@ -116,7 +104,7 @@
 							<view class="uni-col dark">过期状态</view>
 						</uni-col>
 						<uni-col :span="12">
-							<view class="uni-col light">{{material.status===0?'未过期':'过期'}}</view>
+							<view class="uni-col light">{{material.exprStatus==='0'?'正常':'过期'}}</view>
 						</uni-col>
 					</uni-row>
 					<uni-row class="uni-row">
@@ -124,48 +112,106 @@
 							<view class="uni-col dark">到期日期</view>
 						</uni-col>
 						<uni-col :span="12">
-							<view class="uni-col light">{{material.date}}</view>
+							<view class="uni-col light">{{material.exprTime||'空'}}</view>
 						</uni-col>
 					</uni-row>
 					<uni-row class="uni-row">
 						<uni-col :span="12">
-							<button @click="editDialog(material)" type="primary" size="mini">修正</button>
+							<button @click="editDialog(material)" type="primary" size="mini">换料</button>
 						</uni-col>
 						<uni-col :span="12">
 							<button @click="dialogClose" type="primary" size="mini">关闭</button>
 						</uni-col>
 					</uni-row>
-				</view>	
-			</uni-popup>			
+				</view>
+			</uni-popup>
 		</view>
-	
-	    <view class="">	
-			<MaterialDetail ref="edit" :dialog-visible="editShow" @close="editClose" ></MaterialDetail>
+
+		<view class="editBox" v-show="editShow">
+			<!--<MaterialDetail ref="edit" :dialog-visible="editShow" @close="editClose" ></MaterialDetail>-->
+			<uni-popup ref="editDialog" type="dialog">
+				<view class="popup">
+					<uni-forms class="uni-forms" :modelValue="form">
+						<uni-forms-item class="form-item" label="料筒" name="barrelCode">
+							<!--<text>{{this.form.barrelCode||'空'}}</text>-->
+							<text>{{this.form.barrelCode}}</text>
+						</uni-forms-item>
+						<uni-forms-item class="form-item" label="到期日期" name="date">
+							<uni-datetime-picker v-model="form.date" />
+						</uni-forms-item>
+						<uni-forms-item class="form-item" label="剩余原料" name="currentMaterial">
+							<text>{{this.form.mtName||'空'}}</text>
+						</uni-forms-item>
+						<uni-forms-item class="form-item" label="余量" name="surplus">
+							<uni-number-box :min="0" :max="100" v-model="form.surplus" :disabled="true">
+							</uni-number-box>
+						</uni-forms-item>
+						<uni-forms-item class="form-item" label="换料原料" name="replaceMaterial">
+							<!--<uni-data-select @change="bindPickerChange" v-model="index" collection="equMaterials" field="id as value, mtName as text" v-if="editShow"></uni-data-select>-->
+							<picker @change="bindPickerChange" v-model="index2" :range="equMaterials" range-key="mtName"
+								v-if="equMaterials.length>0">
+								<view class="picker">
+									<view class="fb-type">
+										<view class="type-label">{{this.equMaterials[this.index2].mtName}}</view>
+										<image class="type-icon"
+											src="http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/pickerArrow-a8b918f05f.png">
+										</image>
+									</view>
+								</view>
+							</picker>
+						</uni-forms-item>
+						<uni-forms-item class="form-item" label="换料规格" name="specs">
+							<uni-number-box :min="0" :max="100" v-model="form.specs"></uni-number-box>
+						</uni-forms-item>
+					</uni-forms>
+					<uni-row class="uni-row" style="margin-top: 200rpx">
+						<uni-col :span="12">
+							<button @click="update" type="primary" size="mini">确定</button>
+						</uni-col>
+						<uni-col :span="12">
+							<button @click="editClose" type="primary" size="mini">关闭</button>
+						</uni-col>
+					</uni-row>
+				</view>
+			</uni-popup>
 		</view>
 	</view>
 </template>
 
 <script>
-	import MaterialDetail from "@/pages/material/materialDetail.vue";
+	const util = require("@/utils/util.js");
+	const api = require('@/utils/api.js');
+	//import MaterialDetail from "@/pages/material/materialDetail.vue";
 	export default {
 		data() {
 			return {
 				index: 0,
 				index2: 0,
-				array: [1, 2, 3, 4, 5, 6, 7, 8],
+				array: [1, 2, 3, 4, 5, 6, 7, 8, 9],
 				specs: [5, 10, 20],
 				popShow: false,
 				editShow: false,
 				materials: ['燕麦', '魔芋粉', '牛肉粉', '红薯粉', '蜂蜜'],
 				material: {
 					equId: '',
-					barrelCode:'',
-					name: '',
+					barrelCode: '',
+					mtrName: '',
 					surplus: '',
 					specs: '',
 					date: '',
 					status: ''
 				},
+				form: {
+					materialId: '',
+					equId: '',
+					barrelCode: '',
+					currentMaterial: '',
+					mtName: '',
+					replaceMaterial: '',
+					surplus: '',
+					specs: '',
+					date: ''
+				},
 				records: [{
 					id: 1,
 					name: '燕麦',
@@ -189,94 +235,241 @@
 					date: '2021-11-14 12:13',
 					status: 1,
 				}],
+				rangeIds: [{
+						value: 1,
+						text: "1"
+					},
+					{
+						value: 2,
+						text: "2"
+					},
+					{
+						value: 3,
+						text: "3"
+					}
+				],
+				equMaterials: [],
+				allEquMaterials: [],
+				queryParams: util.initQueryParams(),
+				totalPages: 1,
+				rangeSurplus: [{
+						value: 1,
+						text: "5"
+					},
+					{
+						value: 2,
+						text: "10"
+					},
+					{
+						value: 3,
+						text: "20"
+					}
+				],
+				rangeSpecs: [{
+						value: 1,
+						text: "5"
+					},
+					{
+						value: 2,
+						text: "10"
+					},
+					{
+						value: 3,
+						text: "20"
+					}
+				],
+				rangeDates: [{
+						value: "2021-11-14",
+						text: "2021-11-14"
+					},
+					{
+						value: "2021-12-24",
+						text: "2021-12-24"
+					},
+					{
+						value: "2022-08-01",
+						text: "2022-08-01"
+					}
+				],
 				categoryList: [{
 					id: 1,
-					name: "燕麦",
-					val: 40,
+					barrleCode: 1,
+					mtrName: "燕麦",
+					mtrResidue: 40,
 					status: 1,
+					exprStatus: '0',
 					errMsg: '原料不足',
 				}, {
 					id: 2,
-					name: "魔芋粉",
-					val: 60,
+					barrleCode: 2,
+					mtrName: "魔芋粉",
+					mtrResidue: 60,
 					status: 1,
+					exprStatus: '0',
 					errMsg: '即将过期',
 				}, {
 					id: 3,
-					name: "红薯粉",
-					val: 80,
+					barrleCode: 3,
+					mtrName: "红薯粉",
+					mtrResidue: 80,
+					exprStatus: '1',
 					status: 0,
 					errMsg: '',
 				}, {
 					id: 4,
-					name: "牛肉粉",
-					val: 65,
+					barrleCode: 4,
+					mtrName: "牛肉粉",
+					mtrResidue: 65,
+					exprStatus: '0',
 					status: 0,
 					errMsg: '',
 				}, {
 					id: 5,
-					name: "蜂蜜",
-					val: 40,
+					barrleCode: 5,
+					mtrName: "蜂蜜",
+					mtrResidue: 40,
+					exprStatus: '1',
 					status: 0,
 					errMsg: '',
 				}, {
 					id: 6,
-					name: "安赛蜜",
-					val: 60,
+					barrleCode: 6,
+					mtrName: "安赛蜜",
+					mtrResidue: 60,
 					status: 0,
+					exprStatus: '0',
 					errMsg: '',
 				}, {
 					id: 7,
-					name: "牛奶",
-					val: 80,
+					barrleCode: 7,
+					mtrName: "牛奶",
+					mtrResidue: 80,
 					status: 0,
+					exprStatus: '1',
 					errMsg: '',
 				}, {
 					id: 8,
-					name: "橙汁",
-					val: 65,
+					barrleCode: 8,
+					mtrName: "橙汁",
+					mtrResidue: 65,
+					exprStatus: '0',
 					status: 0,
 					errMsg: '',
 				}],
 			}
 		},
 		components: {
-			MaterialDetail
+			//MaterialDetail
 		},
 		methods: {
 			inputDialogToggle(row) {
+				//if (row.mtrResidue) {
 				this.popShow = true
 				this.$refs.inputDialog.open()
 				//this.$refs.detail.setMaterial(row);
 				this.material = row;
+				//}
 			},
 			dialogClose() {
-				console.log('点击关闭')
 				this.popShow = false
 				this.$refs.inputDialog.close()
 			},
 			editDialog(row) {
 				this.dialogClose()
 				this.editShow = true
-				console.log(row)
-				this.$refs.edit.setMaterial(row);
+				this.form = {
+					'materialId': row.id,
+					'currentMaterial': row.mtrId,
+					'mtName': row.mtrName,
+					'surplus': row.mtrResidue,
+					'date': row.exprTime,
+					'barrelCode': row.barrelCode,
+					'equId': row.equId
+				}
+				this.$refs.editDialog.open()
+				//this.$refs.edit.setMaterial(row);						 
+				if (row.mtrType == null || row.mtrType == "") {
+					this.equMaterials = this.allEquMaterials
+				} else {
+					this.equMaterials = this.allEquMaterials.filter(item => {
+						return item.mtType == row.mtrType;
+					});
+				}				
+				//console.log(this.form)
 			},
-			editClose(){
+			editClose() {
 				this.editShow = false
+				this.equMaterials = this.allEquMaterials
 			},
 			getMaterialData() {
 				let that = this;
 				util.request(api.MaterialList, {
-					equId: this.$route.query.id
+					equId: this.$route.query.equId
+				}, 'GET', 'application/json').then(function(res) {
+					if (res.code === 0) {
+						that.categoryList = res.data.records;
+					}
+				});
+			},
+			getRecordList() {
+				let that = this;
+				that.queryParams.model.equId = this.$route.query.equId
+				util.request(api.RecordList, that.queryParams, 'Post', 'application/json').then(function(res) {
+					if (res.code === 0) {
+						that.records = res.data.records
+						that.totalPages = res.data.pages
+					}
+				});
+			},
+			bindPickerChange: function(e) {
+				this.index2 = e.detail.value
+				this.form.replaceMaterial = this.equMaterials[this.index2].id
+			},
+			getEquMaterialData: function() {
+				let that = this;
+				util.request(api.EquMaterialList, {
+					mtType: ''
 				}, 'GET', 'application/json').then(function(res) {
 					if (res.code === 0) {
-						that.records = res.data;
+						that.allEquMaterials = res.data;
 					}
 				});
 			},
+			update() {
+				let that = this;
+				util.request(api.RecordAdd, this.form, "POST", "application/json").then(function(res) {
+					if (res.code === 0) {
+						uni.showToast({
+							title: "操作结果",
+							icon: 'success',
+							duration: 1000,
+							complete: function() {
+								setTimeout(function() {
+									that.editClose()
+									uni.switchTab({
+										url: '/pages/material/material',
+									});
+								}, 2000)
+							}
+						});
+					} else {
+						util.toast(res.data);
+					}
+				});
+			},
+			onReachBottom: function() {
+				if (this.totalPages > this.queryParams.current) {
+					this.queryParams.current = this.queryParams.current + 1
+				} else {
+					return false;
+				}
+				this.getRecordList()
+			},
 			onLoad: function() {
 				this.getMaterialData();
-			} 
+				this.getEquMaterialData();
+				this.getRecordList();
+			}
 		}
 	}
 </script>
@@ -291,7 +484,7 @@
 	}
 
 	.grid-item-box .num {
-		position: relative;	
+		position: relative;
 		margin: 0 auto;
 		z-index: 999;
 	}
@@ -319,7 +512,7 @@
 
 	.fb-type {
 		height: 104rpx;
-		width: 80%;
+		width: 75%;
 		margin-left: 20%;
 		background: #fff;
 		margin-bottom: 20rpx;
@@ -356,9 +549,10 @@
 		overflow: hidden;
 		background-color: #fff;
 	}
+
 	.uni-row {
 		margin-bottom: 10px;
-		display: block;		
+		display: block;
 	}
 
 	.uni-col {
@@ -366,6 +560,37 @@
 		border-radius: 5px;
 		text-align: center;
 	}
+
+	.fb-type {
+		height: 84rpx;
+		width: 60%;
+		margin-left: 40%;
+		background: #fff;
+		margin-bottom: 20rpx;
+		display: flex;
+		flex-direction: row;
+		align-items: center;
+		padding-left: 30rpx;
+		padding-right: 30rpx;
+	}
+
+	.fb-type .type-label {
+		height: 36rpx;
+		flex: 1;
+		color: #333;
+		font-size: 28rpx;
+	}
+
+	.fb-type .type-icon {
+		height: 36rpx;
+		width: 36rpx;
+	}
+
+	.form-item {
+		display: flex;
+		align-items: center;
+		text-align: center;
+	}
 </style>
 
 <style scoped>
@@ -392,8 +617,20 @@
 		top: 0;
 	}
 
-	/deep/ .uni-popup .uni-popup__wrapper {
-		width: 600rpx;
-		min-width: 400rpx;
+	/deep/ .uni-forms .uni-forms-item__label {
+		width: 180rpx;
+		padding: 0;
+	}
+
+	/deep/ .uni-popup .uni-popup__wrapper .popup {
+		min-width: 800rpx;
+	}
+
+	/deep/ .editBox .uni-popup .uni-popup__wrapper .popup {
+		min-height: 1200rpx;
+	}
+
+	/deep/ .editBox .uni-numbox {
+		margin-left: 35%;
 	}
 </style>

+ 0 - 3
imcs-bt-fe/imcs-bt-fe/uni-mall/pages/material/materialDetail.vue

@@ -2,9 +2,6 @@
 	<view class="container">
 		<uni-popup ref="editDialog" type="dialog">
 			<view class="popup">
-				<uni-card :is-shadow="false" is-full>
-					<text class="uni-h6">修正原料</text>
-				</uni-card>
 				<uni-forms class="form" :modelValue="material">
 					<uni-forms-item label="料筒" name="id">
 						<uni-data-select v-model="material.id" :localdata="rangeIds"></uni-data-select>

+ 5 - 2
imcs-bt-fe/imcs-bt-fe/uni-mall/utils/api.js

@@ -13,7 +13,7 @@ module.exports = {
 	AuthLoginByWeixin: 'auth/login_by_weixin', //微信登录
 
 	GoodsCount: 'goods/count', //统计商品总数
-	GoodsList: 'goods/list', //获得商品列表
+	GoodsList: 'goodsList', //获得商品列表
 	GoodsCategory: 'goods/category', //获得分类数据
 	GoodsDetail: 'goods/detail', //获得商品的详情
 	GoodsHot: 'goods/hot', //人气推荐
@@ -70,6 +70,7 @@ module.exports = {
 	MaterialList: 'barrelList',
 	MaterialDetail: 'material/detail',
 	MaterialUpdate: 'material/update',
+	EquMaterialList: 'equMaterialList',  //设备原料
 
 	FootprintList: 'footprint/list', //足迹列表
 	FootprintDelete: 'footprint/delete', //删除足迹
@@ -82,7 +83,9 @@ module.exports = {
 	CouponList: 'coupon/list', // 优惠券列表
 	GoodsCouponList: 'coupon/listByGoods', // 商品优惠券列表
 	OrderQuery: 'pay/query', //微信查询订单状态
-
+	
+	RecordList: 'recordList',
+	RecordAdd: 'recordSave',
 	HelpTypeList: 'helpissue/typeList', //查看帮助类型列表
 	HelpIssueList: 'helpissue/issueList', //查看问题列表
 };

Some files were not shown because too many files changed in this diff