Ver Fonte

关联材料项

shengxuefei há 4 anos atrás
pai
commit
d02f798747

+ 1 - 0
.gitignore

@@ -13,3 +13,4 @@
 /WebAPIBase.NetCore/WebAPIBase.NetCore.BusinessCore/bin
 /WebAPIBase.NetCore/WebAPIBase.NetCore.Enties/bin
 /WebAPIBase.NetCore/WebAPIBase.NetCore.Enties/obj
+/uni-app-front/unpackage

+ 11 - 0
uni-app-front/.hbuilderx/launch.json

@@ -0,0 +1,11 @@
+{ // launch.json 配置了启动调试时相关设置,configurations下节点名称可为 app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/
+  // launchtype项可配置值为local或remote, local代表前端连本地云函数,remote代表前端连云端云函数
+    "version": "0.0",
+    "configurations": [{
+            "type": "uniCloud",
+            "default": {
+                "launchtype": "remote"
+            }
+        }
+    ]
+}

+ 3 - 1
uni-app-front/common/api/MaterialInOut.js

@@ -169,4 +169,6 @@ import request from '@/common/axiosHelper.js'
 		   		method: 'get',
 		   		params:{materialOutCode:materialOutCode}
 		     });
-		   }
+		   }
+					  
+					  

+ 24 - 0
uni-app-front/common/api/SafeQualityCheckApi.js

@@ -42,4 +42,28 @@ import request from '@/common/axiosHelper.js'
  	method: 'get',
  	params:{type:type,searchvalue:searchvalue}
    })
+ }
+ /*质量检测表中材料检查关联的材料项列表*/
+ export function GetZRelationSafeQualityCheckMaterialDTOs(safeQualityCheckCode) {
+   return request({
+ 	url: '/SafeQualityCheck/GetZRelationSafeQualityCheckMaterialDTOs',
+ 	method: 'get',
+ 	params:{safeQualityCheckCode:safeQualityCheckCode}
+   })
+ } 
+ /*插入质量检测表中材料检查关联的材料项*/
+ export function InsertZRelationSafeQualityCheckMaterial(data) {
+   return request({
+ 	url: '/SafeQualityCheck/InsertZRelationSafeQualityCheckMaterial',
+ 	method: 'POST',
+ 	data:data
+   })
+ }
+ /*删除质量检测表中材料检查关联的材料项*/
+ export function DeleteZRelationSafeQualityCheckMaterial(id) {
+   return request({
+ 	url: '/SafeQualityCheck/DeleteZRelationSafeQualityCheckMaterial',
+ 	method: 'get',
+ 	params:{id:id}
+   })
  }

+ 11 - 1
uni-app-front/common/api/commonApi.js

@@ -114,4 +114,14 @@ export function GetUserDepartment(usercode) {
  	method: 'POST',
  	data:data
    })
- }
+ }
+ 
+ 
+ /* 查询所有材料 */
+  export function GetMaterialList(name) {
+    return request({
+  	url: '/Common/GetMaterialList',
+  	method: 'get',
+  	params:{name:name}
+    })
+  }

+ 18 - 0
uni-app-front/pages.json

@@ -465,6 +465,24 @@
             }
             
         }
+        ,{
+            "path" : "pages/template/GetRelationMaterialList/GetRelationMaterialList",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "关联材料",
+                "enablePullDownRefresh": false
+            }
+            
+        }
+        ,{
+            "path" : "pages/template/relationMaterialAdd/relationMaterialAdd",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "关联材料添加",
+                "enablePullDownRefresh": false
+            }
+            
+        }
     ],
 	"globalStyle": {
 		"navigationBarTextStyle": "white",

+ 1 - 1
uni-app-front/pages/template/GetDesignChanges/GetDesignChanges.vue

@@ -1,6 +1,6 @@
 <template>
 	<view>		
-		<view style="margin:10px 100px;position: fixed;z-index: 50;opacity:0.7;" v-show="isShow">
+		<view style="margin:10px 50px;position: fixed;z-index: 50;opacity:0.7;" v-show="isShow">
 			<button type="primary" style="border-radius: 5px;" class="mini-btn" size="mini" @click="modify">修改</button>
 			<button type="primary" style="border-radius: 5px;margin-left:15px;" class="mini-btn" size="mini" @click="workFlow" v-show="isWorkFlow">流程审核</button>
 		</view>

+ 154 - 0
uni-app-front/pages/template/GetRelationMaterialList/GetRelationMaterialList.vue

@@ -0,0 +1,154 @@
+<template>
+	<view>		 
+		<uni-list>
+			<uni-list-item>
+				<view slot="body" class="slot-box">
+					<view class="row">
+						<view class="column-left">当前检查项:</view>
+						<view class="column-right section-title">{{listData.entity!=null?listData.entity.projectName:""}}</view>
+					</view>
+					</view>
+			</uni-list-item>
+		</uni-list>
+		<uni-list>
+			<uni-list-item v-for="(item, index) in listData.list" :key="index"  >
+				<view slot="body" class="slot-box">
+					<view class="row">
+						<view class="column-left">编号:</view>
+						<view class="column-right section-title">{{item.id}}</view>
+					</view>
+					<view class="row">
+						<view class="column-left">材料名:</view>
+						<view class="column-right">{{item.materialName}}</view>
+					</view>
+					<view class="row">
+						<view class="column-left">单位:</view>
+						<view class="column-right">{{item.unit}}</view>
+					</view>
+					 
+					<view class="row">
+						<view class="column-left">操作:</view>
+						<view class="column-right"><a href="javascript:;" @click="deleteMaterial(item.id)"><i class="fa fa-times" aria-hidden="true"></i></a></view>
+					</view>
+				</view>
+			</uni-list-item>
+		</uni-list>
+		<view style="bottom: 15px;right:10px;position: fixed;z-index: 50;">
+			<router-link :to="'/pages/template/relationMaterialAdd/relationMaterialAdd?SafeQualityCheckCode=' + this.$util.getQuery('id')"   style="text-decoration: none;" title="材料添加">
+				<uni-icons type="plus-filled" size="80" color="#5678FE"></uni-icons>
+			</router-link>
+		</view>
+		<page-foot :isShow="true" :showIndex="2"></page-foot>
+		<uni-load-more :status="status" :icon-size="16" :content-text="contentText" />
+		 
+	</view>
+</template>
+
+<script>
+	import {
+		GetZRelationSafeQualityCheckMaterialDTOs,DeleteZRelationSafeQualityCheckMaterial
+	} from "@/common/api/SafeQualityCheckApi.js";
+	import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
+	
+
+	export default {
+		components: {
+			uniLoadMore
+		},
+		data() {
+			return {
+				listData: [],
+				last_id: '',
+				reload: false,
+				status: 'more',
+                
+				contentText: {
+					contentdown: '上拉加载更多',
+					contentrefresh: '加载中',
+					contentnomore: '没有更多'
+				}
+			};
+		},
+		onLoad() {
+			console.info("当前登录状态:" + this.$store.state.isLogin);
+			//console.info(this);
+			this.$util.persistLogin(this);
+		},
+		onPullDownRefresh() {
+			this.reload = true;
+			this.last_id = '';
+
+			this.getList();
+		},
+		onReachBottom() {
+			this.status = 'more';
+			this.getList();
+		},
+		created: function() {
+			this.getList();
+		},
+		methods: {
+
+			getList() {
+				let that = this;
+				 
+				let id = that.$util.getQuery("id");
+				
+				GetZRelationSafeQualityCheckMaterialDTOs(id).then((res) => {
+					console.info('GetZRelationSafeQualityCheckMaterialDTOs',res);
+					that.listData=res;
+					console.info(that.listData);
+				});
+			},
+			
+			// 删除材料
+           deleteMaterial:function(id){
+			   let that = this;
+			   uni.showModal({
+			   	title:'提示',
+				content:'确定要删除吗,删除后不能恢复!',
+				success: function (res) {
+				        if (res.confirm) {
+				            console.log('用户点击确定');
+							//删除操作
+							DeleteZRelationSafeQualityCheckMaterial(id).then((res)=>{
+								console.info('DeleteZRelationSafeQualityCheckMaterial',res);
+								if(res>0){
+									uni.showToast({
+										title:'删除成功',
+										duration:3000,
+										icon:'none'
+									});
+									let thisid = that.$util.getQuery("id");
+									//重新加载数据,以实现刷新
+									GetZRelationSafeQualityCheckMaterialDTOs(thisid).then((res) => {
+										console.info('GetZRelationSafeQualityCheckMaterialDTOs',res);
+										that.listData=res;
+										console.info(that.listData);
+									});
+								}
+							   else{
+								   uni.showToast({
+								   	title:'删除失败',
+								   	duration:3000,
+								   	icon:'none'
+								   });
+							   }
+							});
+				        } else if (res.cancel) {
+				            console.log('用户点击取消');
+				        }
+				    }
+			   })
+			  
+		   }
+		}
+	};
+</script>
+
+<style scoped lang="scss">
+	.uni-list-item{
+		border-bottom: $BgColorBlue;
+	} 
+	
+</style>

+ 25 - 3
uni-app-front/pages/template/GetSafeQualityCheckDTO/GetSafeQualityCheckDTO.vue

@@ -1,7 +1,8 @@
 <template>
 	<view>		
-		<view style="margin:10px 100px;position: fixed;z-index: 50;opacity:0.7;" v-show="isShow">
+		<view style="margin:10px 10px;" v-show="isShow">
 			<button type="primary" style="border-radius: 5px;" class="mini-btn" size="mini" @click="modify">修改</button>
+			<button type="primary" style="border-radius: 5px;" class="mini-btn" size="mini" @click="relationMaterial"  v-show="isMaterialShow">关联材料</button>
 			<button type="primary" style="border-radius: 5px;margin-left:15px;" class="mini-btn" size="mini" @click="workFlow" v-show="isWorkFlow">流程审核</button>
 		</view>
 		<uni-list>
@@ -53,6 +54,10 @@
 						<view class="column-left">检查结果:</view>
 						<view class="column-right">{{item.checkResult}}</view>
 					</view>
+					<view class="row">
+						<view class="column-left">关联材料:</view>
+						<view class="column-right">{{item.checkResult}}</view>
+					</view>
 					</view> 
 			</uni-list-item>
 		</uni-list>
@@ -71,6 +76,7 @@
 			return {
 				listData: {},
 				isShow:false,        //是否显示修改按钮
+				isMaterialShow:false,  //是否显示关联材料按钮
 				isWorkFlow:false,    //是否显示流程审核按钮
 				procedureName:""     //流程审批名
 			}
@@ -107,12 +113,19 @@
 				let that = this;
 				GetSafeQualityCheckDTO(id).then((res) => {
 					console.info('GetSafeQualityCheckDTO',res);
-					
+					let type=this.$util.getQuery("type")-0;
 					if(res.entity.status==0){
 						that.isShow=true;
 					}
 					else{
-						that.isShow=true;
+						that.isShow=false;
+					}
+					if(res.entity.status==0&&type==2)
+					{
+						that.isMaterialShow=true;
+					}
+					else{
+						that.isMaterialShow=false;
 					}
 					that.listData=res;
 					
@@ -145,6 +158,12 @@
 			 		url:url
 			 	});
 			 },
+			 relationMaterial:function(){
+				 let id = this.$util.getQuery("id");
+				 uni.navigateTo({
+				 	url: '/pages/template/GetRelationMaterialList/GetRelationMaterialList?id=' + id
+				 });
+			 }
 		}
 	}
 </script>
@@ -162,4 +181,7 @@
 	  background-color: #fff;
 	  padding: 5px 8px;
   }
+  .mini-btn{
+	  margin-left:15px;
+  }
 </style>

+ 2 - 2
uni-app-front/pages/template/SelectCheckProject/SelectCheckProject.vue

@@ -12,10 +12,10 @@
 							<checkbox :value="item.diCode" />
 						</view>
 						<!-- 自定义 body -->
-						<view slot="body" style="width: 20%;">
+						<view slot="body" style="width: 25%;">
 							{{item.dnCode=='10034'?'质量检查':item.dnCode=='10035'?'安全检查':'材料检查'}}
 						</view>	
-						<view slot="footer" style="width: 70%;">
+						<view slot="footer" style="width: 65%;">
 							{{item.diName}}
 						</view>					
 						</uni-list-item>

+ 155 - 0
uni-app-front/pages/template/relationMaterialAdd/relationMaterialAdd.vue

@@ -0,0 +1,155 @@
+<template>
+	<view>
+		<view>
+			<uni-search-bar :radius="100" @confirm="search" @input="input" @cancel="cancel"></uni-search-bar>
+		</view>
+		<uni-forms ref="form" @submit="submitForm">
+			<uni-list v-if="materials.length>0">
+				<checkbox-group @change="checkboxChange" >
+					<uni-list-item v-for="(item,index) in materials" :key="index">
+						<!-- 自定义 header -->
+						<view slot="header" class="slot-box">
+							<checkbox :value="item.materialCode" />
+						</view>
+						<!-- 自定义 body -->
+						<view slot="body" class="slot-box">
+							{{item.materialName}}
+						</view>
+						<!-- 自定义 footer-->
+						<view slot="footer" class="slot-box">
+							{{item.unit}}
+						</view>
+					</uni-list-item>
+				</checkbox-group>
+			</uni-list>
+			<uni-list v-else>
+				<checkbox-group @change="checkboxChange" >
+					<uni-list-item >						
+						<!-- 自定义 body -->
+						<view slot="body" class="slot-box">
+							没有材料
+						</view>
+						
+					</uni-list-item>
+				</checkbox-group>
+			</uni-list>
+			<view class="uni-btn-v uni-column">
+				<button type="primary" form-type="submit" style="border-radius: 15px;">关联材料添加</button>
+			</view>
+		</uni-forms>
+	</view>
+</template>
+
+<script>
+	import {GetMaterialList} from '@/common/api/commonApi.js';
+	import {
+		InsertZRelationSafeQualityCheckMaterial
+	} from "@/common/api/SafeQualityCheckApi.js";
+	export default {
+		data() {
+			return {
+				materials: [],
+				checkboxValues: [],
+				searchVal: ''
+			}
+		},
+		onLoad: function() {
+			//console.info('授权');
+			//console.info(this.$auth);
+			this.$util.persistLogin(this);
+		},
+		created: function() {
+			this.getMaterials();
+		},
+		methods: {
+			getMaterials: function() {
+				var that = this;
+				 
+				let searchVal=that.searchVal;
+				uni.showLoading({
+					title: "页面努力加载中,请稍候...",
+					mask: true
+				});
+				GetMaterialList(searchVal).then((res) => {
+					uni.hideLoading();
+					console.info('GetMaterialList',res);
+					//console.info(projectCode);
+					that.materials=[];
+					//return;
+					res.forEach(function(item, index, array) {
+						that.$set(that.materials, index, item);
+					});
+					 
+				});
+			},
+			checkboxChange: function(e) {
+				var items = this.materials,
+					values = e.detail.value;
+				this.checkboxValues = values.join(',');
+				console.info("values",values); 
+				console.info(this.checkboxValues);
+				for (var i = 0, lenI = items.length; i < lenI; ++i) {
+					const item = items[i]
+					if (values.includes(item.value)) {
+						this.$set(item, 'checked', true)
+					} else {
+						this.$set(item, 'checked', false)
+					}
+				}
+			},
+			submitForm(e) {
+				console.info('submitForm',this.checkboxValues);
+				let _this=this;
+				if(this.checkboxValues.length<=0){
+					uni.showToast({
+						title:'请选择材料',
+						icon:'none',
+						duration:3000
+					});
+					return;
+				}
+				//先记录值,下面this指向会不一样
+				let relationContractCodes = this.checkboxValues;
+				let SafeQualityCheckCode=_this.$util.getQuery("SafeQualityCheckCode");
+				let arr=relationContractCodes.split(',');
+				for (let i = 0; i < arr.length; i++) {
+					var zRelationSafeQualityCheckMaterial={safeQualityCheckCode:SafeQualityCheckCode,materialCode:arr[i]};
+					InsertZRelationSafeQualityCheckMaterial(zRelationSafeQualityCheckMaterial);
+				} 
+				 
+				//跳转
+				uni.navigateTo({
+					url:'../GetRelationMaterialList/GetRelationMaterialList?id='+SafeQualityCheckCode
+				});
+			},
+			search(res) { //回车搜索
+				this.searchvalue = res.value; //赋值
+				
+				this.getMaterials(); //调用搜索方法
+			},
+			input(res) {
+				this.searchVal = res.value
+			},
+			cancel(res) {
+				console.info('点击取消,输入值为:' + res.value);
+				
+			}
+		}
+	}
+</script>
+
+<style scoped>
+	.slot-box {
+		margin: 5px 5px;
+	}
+
+	.uni-btn-v {
+		position: fixed;
+		bottom: 0;
+		width: 100%;
+
+	}
+	uni-view{
+		font-size:15px;
+	}
+</style>