瀏覽代碼

1、实现入库单编辑页面初始化时获取主表和子表数据接口
2、实现入库单编辑页面初始化时获取入库类型名接口,材料合同及供应商接口。
3、实现入库单编辑页面初始化时显示已经添加的材料接口
4、实现入库单编辑页面布局,及初始化时各项的正常显示

shengxuefei 4 年之前
父節點
當前提交
39a3ff24f5

+ 3 - 0
.gitignore

@@ -0,0 +1,3 @@
+/WebAPIBase.NetCore/.vs
+/WebAPIBase.NetCore/WebAPIBase.NetCore/obj
+/WebAPIBase.NetCore/WebAPIBase.NetCore/bin

+ 54 - 0
WebAPIBase.NetCore/Utils/CustomErrorMiddleware.cs

@@ -0,0 +1,54 @@
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.AspNetCore.Http;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using NLog;
+using NLog.Web.AspNetCore;
+
+namespace WebAPIBase.Utils
+{
+    public class CustomErrorMiddleware : ICustomErrorMiddleware
+    {
+        private readonly RequestDelegate next;
+        private IHostingEnvironment environment;
+
+        //Nlog构造方法注入
+        private readonly Microsoft.Extensions.Logging.ILogger<CustomErrorMiddleware> _logger;
+        public CustomErrorMiddleware(RequestDelegate next, IHostingEnvironment environment, Microsoft.Extensions.Logging.ILogger<CustomErrorMiddleware> logger)
+        {
+            _logger = logger;
+            this.next = next;
+            this.environment = environment;
+        }
+
+        public async Task Invoke(HttpContext context)
+        {
+            try
+            {
+                await next.Invoke(context);
+                var features = context.Features;
+            }
+            catch (Exception e)
+            {
+                await HandleException(context, e);
+            }
+        }
+
+        private async Task HandleException(HttpContext context, Exception ex)
+        {
+
+            //_logger.Log();
+
+            await context.Response.WriteAsync(ex.Message + "\r\n" + ex.StackTrace);
+        }
+
+        public void LogError(Exception ex)
+        {
+
+            // _logger.Log();
+        }
+    }
+}

+ 13 - 0
WebAPIBase.NetCore/Utils/ICustomErrorMiddleware.cs

@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WebAPIBase.Utils
+{
+    public interface ICustomErrorMiddleware
+    {
+        void LogError(Exception ex);
+    }
+}

+ 113 - 0
WebAPIBase.NetCore/WebAPIBase.NetCore.Enties/DTO/MaterialDTO.cs

@@ -0,0 +1,113 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Sugar.Enties
+{
+    public class MaterialDTO
+    {
+        /// <summary>
+        /// Desc:
+        /// Default:
+        /// Nullable:False
+        /// </summary> 
+        public string MaterialCode { get; set; }
+
+        /// <summary>
+        /// Desc:
+        /// Default:
+        /// Nullable:True
+        /// </summary>           
+        public string MaterialName { get; set; }
+
+        /// <summary>
+        /// Desc:
+        /// Default:
+        /// Nullable:True
+        /// </summary>           
+        public string GroupCode { get; set; }
+
+        /// <summary>
+        /// Desc:
+        /// Default:
+        /// Nullable:True
+        /// </summary>           
+        public string Spec { get; set; }
+
+        /// <summary>
+        /// Desc:
+        /// Default:
+        /// Nullable:True
+        /// </summary>           
+        public string Unit { get; set; }
+
+        /// <summary>
+        /// Desc:
+        /// Default:
+        /// Nullable:True
+        /// </summary>           
+        public decimal? StandardPrice { get; set; }
+
+        /// <summary>
+        /// Desc:
+        /// Default:
+        /// Nullable:True
+        /// </summary>           
+        public string InputPerson { get; set; }
+
+        /// <summary>
+        /// Desc:
+        /// Default:
+        /// Nullable:True
+        /// </summary>           
+        public DateTime? InputDate { get; set; }
+
+        /// <summary>
+        /// Desc:
+        /// Default:
+        /// Nullable:True
+        /// </summary>           
+        public string Remark { get; set; }
+
+        /// <summary>
+        /// Desc:
+        /// Default:
+        /// Nullable:True
+        /// </summary>           
+        public string ApplicationArea { get; set; }
+
+        /// <summary>
+        /// Desc:
+        /// Default:0
+        /// Nullable:True
+        /// </summary>           
+        public int? PurchaseType { get; set; }
+
+        /// <summary>
+        /// Desc:
+        /// Default:
+        /// Nullable:True
+        /// </summary>           
+        public string Grade { get; set; }
+
+        /// <summary>
+        /// Desc:
+        /// Default:
+        /// Nullable:True
+        /// </summary>           
+        public string Appearance { get; set; }
+
+        /// <summary>
+        /// Desc:
+        /// Default:
+        /// Nullable:True
+        /// </summary>           
+        public string RepairDesc { get; set; }
+
+        public decimal InQty { get; set; }
+        public decimal NoQty { get; set; }
+
+    }
+}

+ 26 - 0
WebAPIBase.NetCore/WebAPIBase.NetCore.Enties/enum/ContractCheckStatus.cs

@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Sugar.Enties
+{
+    /// <summary>
+    /// 合同Contract表状态
+    /// </summary>
+    public enum ContractCheckStatus
+    {
+        //状态:0=已审;1=申请;2=已结;3=作废;4=变更;6=历史;7=审核流程中
+        已审 = 0,
+        申请 = 1,
+        已结 = 2,
+        作废 = 3,
+        变更 = 4,
+        历史 = 6,
+        审核流程中 = 7
+
+
+
+    }
+}

+ 18 - 0
WebAPIBase.NetCore/WebAPIBase.NetCore.Enties/enum/ContractType.cs

@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Sugar.Enties
+{
+    /// <summary>
+    /// 合同类型
+    /// </summary>
+    public enum ContractType1
+    {
+        材料合同,
+        工程合同,
+        其他合同
+    }
+}

+ 55 - 0
uni-app-front/common/api/MaterialInOut.js

@@ -0,0 +1,55 @@
+import request from '@/common/axiosHelper.js'
+
+/* 根据项目代码和合同编码获取合同中包含的资料 */
+ export function GetMaterials(projectCode, contractCode,searchValue) {
+   return request({
+ 	url: '/MaterialInOut/GetMaterials',
+ 	method: 'get',
+ 	params:{projectCode:projectCode,contractCode:contractCode,searchValue:searchValue}
+   })
+ }
+ 
+ /* 插入入库单主表和子表 */
+  export function InsertMaterialIn(data) {
+    return request({
+  	url: '/MaterialInOut/InsertMaterialIn',
+  	method: 'POST',
+  	data:data
+    })
+  }
+  
+  /* 更新入库单主表和子表 */
+   export function UpdateMaterialIn(data) {
+     return request({
+   	url: '/MaterialInOut/UpdateMaterialIn',
+   	method: 'POST',
+   	data:data
+     })
+   }
+  
+  /* 获取编辑出入库单的主表和子表数据 */
+   export function GetMaterialInByMaterialInCode(materialInCode) {
+     return request({
+   	url: '/MaterialInOut/GetMaterialInByMaterialInCode',
+   	method: 'get',
+   	params:{materialInCode:materialInCode}
+     })
+   }
+   
+   /* 获取编辑出入库单的主表和子表数据 */
+    export function getContractAndSupplier(contractCode) {
+      return request({
+    	url: '/MaterialInOut/GetContractAndSupplier',
+    	method: 'get',
+    	params:{contractCode:contractCode}
+      })
+    }
+	
+	/* 获取编辑出入库单的主表和子表数据 */
+	 export function getGroupName(groupCode) {
+	   return request({
+	 	url: '/MaterialInOut/GetGroupName',
+	 	method: 'get',
+	 	params:{groupCode:groupCode}
+	   })
+	 }

+ 86 - 0
uni-app-front/components/t-table/t-table.vue

@@ -0,0 +1,86 @@
+<template>
+	<view class="t-table" :style="{ 'border-width': border + 'px', 'border-color': borderColor }">
+		<slot />
+	</view>
+</template>
+
+<script>
+	export default {
+		props: {
+			border: {
+				type: String,
+				default: '1'
+			},
+			borderColor: {
+				type: String,
+				default: '#d0dee5'
+			},
+			isCheck: {
+				type: Boolean,
+				default: false
+			}
+		},
+		provide() {
+			return {
+				table: this
+			};
+		},
+		data() {
+			return {};
+		},
+		created() {
+			this.childrens = [];
+			this.index = 0;
+		},
+		methods: {
+			fire(e, index, len) {
+				let childrens = this.childrens;
+				console.log(childrens);
+				// 全选
+				if (index === 0) {
+					childrens.map((vm, index) => {
+						vm.checkboxData.checked = e;
+						return vm;
+					});
+				} else {
+					let isAll = childrens.find((n, ids) => ids !== 0 && !n.checkboxData.checked);
+					childrens[0].checkboxData.checked = isAll ? false : true;
+				}
+
+				let fireArr = [];
+				for (let i = 0; i < childrens.length; i++) {
+					if (childrens[i].checkboxData.checked && i !== 0) {
+						fireArr.push(childrens[i].checkboxData.value - 1);
+					}
+				}
+				this.$emit('change', {
+					detail: fireArr
+				});
+			}
+		}
+	};
+</script>
+
+<style scoped>
+	.t-table {
+		width: 100%;
+		border: 1px #d0dee5 solid;
+		border-left: none;
+		border-top: none;
+		box-sizing: border-box;
+	}
+
+	.t-table>>>t-tr {
+		display: flex;
+	}
+
+	.t-table>>>t-tr:nth-child(2n) {
+		background: #f5f5f5;
+	}
+
+	/* #ifdef H5 */
+	.t-table>>>.t-tr:nth-child(2n) {
+		background: #f5f5f5;
+	}
+	/* #endif */
+</style>

+ 71 - 0
uni-app-front/components/t-table/t-td.vue

@@ -0,0 +1,71 @@
+<template>
+	<view class="t-td" :style="{ 'border-width': thBorder + 'px','border-color':borderColor ,'font-size':fontSize+'px' ,'color':color,'justify-content':tdAlignCpd}">
+		<slot></slot>
+	</view>
+</template>
+
+<script>
+	export default {
+		props: {
+			align: String
+		},
+		data() {
+			return {
+				thBorder: '1',
+				borderColor: '#d0dee5',
+				fontSize: '14',
+				color: '#555c60',
+				tdAlign: 'center'
+			};
+		},
+		inject: ['table', 'tr'],
+
+		created() {
+			this.thBorder = this.table.border;
+			this.borderColor = this.table.borderColor;
+			this.fontSize = this.tr.fontSize;
+			this.color = this.tr.color;
+			if (this.align) {
+				this.tdAlign = this.align;
+			} else {
+				this.tdAlign = this.tr.align
+			}
+		},
+		computed: {
+			tdAlignCpd() {
+				let nameAlign = '';
+				switch (this.tdAlign) {
+					case 'left':
+						nameAlign = 'flex-start'
+						break;
+					case 'center':
+						nameAlign = 'center'
+						break;
+					case 'right':
+						nameAlign = 'flex-end'
+						break;
+					default:
+						nameAlign = 'center'
+						break;
+				}
+				return nameAlign
+			}
+		}
+	};
+</script>
+
+<style>
+	.t-td {
+		flex: 1;
+		display: flex;
+		align-items: center;
+		width: 100%;
+		padding: 14upx;
+		border-top: 1px #d0dee5 solid;
+		border-left: 1px #d0dee5 solid;
+		text-align: center;
+		color: #555c60;
+		font-size: 28upx;
+
+	}
+</style>

+ 71 - 0
uni-app-front/components/t-table/t-th.vue

@@ -0,0 +1,71 @@
+<template>
+	<view class="t-th" :style="{ 'border-width': thBorder + 'px' ,'border-color':borderColor,'font-size':fontSize+'px' ,'color':color,'justify-content':thAlignCpd}">
+		<slot></slot>
+	</view>
+</template>
+
+<script>
+	export default {
+		props: {
+			align: String,
+		},
+		data() {
+			return {
+				thBorder: '1',
+				borderColor: '#d0dee5',
+				fontSize: '15',
+				color: '#3b4246',
+				thAlign: 'center'
+			};
+		},
+		inject: ['table', 'tr'],
+
+		created() {
+			this.thBorder = this.table.border;
+			this.borderColor = this.table.borderColor;
+			this.fontSize = this.tr.fontSize;
+			this.color = this.tr.color;
+			if (this.align) {
+				this.thAlign = this.align;
+			} else {
+				this.thAlign = this.tr.align
+			}
+		},
+
+		computed: {
+			thAlignCpd() {
+				let nameAlign = '';
+				switch (this.thAlign) {
+					case 'left':
+						nameAlign = 'flex-start'
+						break;
+					case 'center':
+						nameAlign = 'center'
+						break;
+					case 'right':
+						nameAlign = 'flex-end'
+						break;
+					default:
+						nameAlign = 'center'
+						break;
+				}
+				return nameAlign
+			}
+		}
+	};
+</script>
+
+<style>
+	.t-th {
+		flex: 1;
+		display: flex;
+		align-items: center;
+		font-size: 30upx;
+		font-weight: bold;
+		text-align: center;
+		color: #3b4246;
+		border-left: 1px #d0dee5 solid;
+		border-top: 1px #d0dee5 solid;
+		padding: 15upx;
+	}
+</style>

+ 81 - 0
uni-app-front/components/t-table/t-tr.vue

@@ -0,0 +1,81 @@
+<template>
+	<view class="t-tr">
+		<view v-if="isCheck" class="t-check-box" :style="{ 'border-width': thBorder + 'px' ,'border-color':borderColor}">
+			<checkbox-group @change="checkboxChange">
+				<checkbox :value="checkboxData.value + ''" :checked="checkboxData.checked" />
+			</checkbox-group>
+		</view>
+		<slot></slot>
+	</view>
+</template>
+
+<script>
+	export default {
+		props: {
+			fontSize: String,
+			color: String,
+			align: String
+		},
+		inject: ['table'],
+		provide() {
+			return {
+				tr: this
+			};
+		},
+		data() {
+			return {
+				isCheck: false,
+				checkboxData: {
+					value: 0,
+					checked: false
+				},
+				checked: false,
+				thBorder: '1',
+				borderColor: '#d0dee5'
+			};
+		},
+		created() {
+			this.thBorder = this.table.border;
+			this.borderColor = this.table.borderColor;
+			this.table.childrens.push(this);
+			this.checkboxData.value = this.table.index++;
+			this.isCheck = this.table.isCheck;
+
+		},
+		methods: {
+			checkboxChange(e) {
+				this.checkboxData.checked = !this.checkboxData.checked;
+				this.table.childrens[this.checkboxData.value] = this;
+				this.table.fire(e.detail.value[0] ? true : false, this.checkboxData.value, this.table.index);
+			}
+		}
+	};
+</script>
+
+<style>
+	.t-tr {
+		width: 100%;
+		display: flex;
+	}
+
+	.t-tr t-th,
+	.t-tr t-td {
+		display: flex;
+		flex: 1;
+	}
+
+	.t-tr .t-check-box {
+		flex-shrink: 0;
+		display: flex;
+		justify-content: center;
+		align-items: center;
+		width: 80upx;
+		color: #3b4246;
+		border-left: 1px #d0dee5 solid;
+		border-top: 1px #d0dee5 solid;
+	}
+
+	.t-tr .t-check-box checkbox {
+		transform: scale(0.8);
+	}
+</style>

+ 746 - 0
uni-app-front/pages/template/MaterialInEdit/MaterialInEdit.vue

@@ -0,0 +1,746 @@
+<template>
+	<view>
+		<uni-forms ref="form" labelPosition="left" labelAlign="left" @submit="submitForm">
+			<view class="uni-form-item uni-column">
+				<view class="title"><text class="uni-form-item__title">入库类型</text></view>
+				<view class="uni-input-wrapper ">
+					<input class="uni-input-small" disabled=true v-model="intypeName" />
+					<a href='javascript:;' @click='getType' class="uni-icon"><i class="fa fa-search" aria-hidden="true"></i></a>
+				</view>
+			</view>
+			<view class="uni-form-item uni-column">
+				<view class="title"><text class="uni-form-item__title">入库日期</text></view>
+				<view class="uni-input-wrapper" style="justify-content: left;">
+					<picker mode="date" :value="date" :start="startDate" :end="endDate" @change="bindDateChange" v-model="inDate"
+					 name="requisitionDate" style="width: 100%;">
+						<view class="uni-input">{{date}}</view>
+					</picker>
+				</view>
+			</view>
+			<view class="uni-form-item uni-column">
+				<view class="title"><text class="uni-form-item__title">材料合同</text></view>
+				<view class="uni-input-wrapper" >
+					 <input class="uni-input-small" disabled=true v-model="contractName" />
+					 <a href='javascript:;' @click='getContract(projectCode)' class="uni-icon"><i class="fa fa-search" aria-hidden="true"></i></a>
+				</view>
+			</view>
+
+
+			<view class="uni-form-item uni-column">
+				<view class="title"><text class="uni-form-item__title">供应单位</text></view>
+				<view class="uni-textarea">
+						<input class="uni-input-small" disabled=true v-model="supplierName" />
+					
+				</view>
+			</view>
+
+
+			<view class="uni-form-item uni-column">
+				<view class="title" style="background-color: #efefef;"><text class="uni-form-item__title">附件</text></view>
+				<view class="content">
+					<g-upload ref='gUpload' :mode="imgList" @chooseFile='chooseFile' @imgDelete='imgDelete' :control='control'
+					 :columnNum="columnNum" :maxCount="maxCount"></g-upload>
+				</view>
+			</view>
+
+			<uni-section title="入库明细" type="line">
+				<button type="default" @click="openWindow"  size="mini">添加材料</button>
+			</uni-section>
+			<view class="uni-form-item uni-column">
+				<t-table border="2" border-color="#999999"   >
+					<t-tr font-size="14" color="#999999" align="left">
+						<t-th align="left">名称</t-th>
+						<t-th align="left">入库数量</t-th>
+						<t-th align="left">不合格数量</t-th>
+						<t-th align="center" style="width: 50px !important;">操作</t-th>
+					</t-tr>
+					<t-tr font-size="12" color="#999999" align="right" v-for="(item,index) in materials" :key="index">
+						<t-td align="left">{{ item.materialName }}</t-td>
+						<t-td align="left"><input class="uni-input-small" type="digit"  v-model="item.inQty" style="width:50px;"/></t-td>
+						<t-td align="left"><input class="uni-input-small" type="digit"  v-model="item.noQty"  style="width:50px;"/></t-td>
+						<t-td align="center"  style="width: 50px !important;"><i class="fa fa-window-close" aria-hidden="true"   @click="delRow(index)" style="font-size:20px;cursor: pointer;color: #999;margin-left:15px;" title="删除"></i></t-td>
+					</t-tr>
+				</t-table>
+			</view>
+
+			<view style="margin-bottom: 120px;">
+
+			</view>
+			<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 {
+		getSupplierNameAndType
+	} from "@/common/api/commonApi.js";
+	import {
+		Decimal
+	} from 'decimal.js'; //decimal计算
+	import {GetMaterials,UpdateMaterialIn,GetMaterialInByMaterialInCode,getContractAndSupplier,getGroupName} from '@/common/api/MaterialInOut.js';
+	import tTable from '@/components/t-table/t-table.vue';
+	import tTh from '@/components/t-table/t-th.vue';
+	import tTr from '@/components/t-table/t-tr.vue';
+	import tTd from '@/components/t-table/t-td.vue';
+	
+	var sourceType = [
+		['camera'],
+		['album'],
+		['camera', 'album']
+	]
+	var sizeType = [
+		['compressed'],
+		['original'],
+		['compressed', 'original']
+	]
+
+	export default {
+		components: {
+		           tTable,
+		           tTh,
+		           tTr,
+		           tTd
+		       },
+		data() {			
+			return {
+				intypeCode: '',
+				intypeName:'',
+				inDate: this.$util.getDate({
+					format: true
+				}),
+				 contractName:'',
+				 contractCode:'',
+				 supplierName:'',
+				
+				 contract:{},
+				userCode: this.$util.getState(this,"userCode"), //用户编号
+				
+				projectCode:this.$util.getState(this,"projectCode"),
+				 
+
+				contractList: [],   //合同
+				materials:[],       //材料
+				title: 'choose/previewImage',
+				imageList: [],
+				sourceTypeIndex: 2,
+				sourceType: ['拍照', '相册', '拍照或相册'],
+				sizeTypeIndex: 2,
+				sizeType: ['压缩', '原图', '压缩或原图'],
+				countIndex: 5,
+				count: [1, 2, 3, 4, 5],
+				title1: 'picker',
+				array: [],
+				index: 0,
+				date: this.$util.getDate({
+					format: true
+				}),
+				startDate: this.$util.getDate('start'),
+				endDate: this.$util.getDate('end'),
+
+				control: true,
+				columnNum: 3,
+				imgList: [],
+				urlList: [],
+				maxCount: 5
+
+			}
+		},
+		onLoad() {
+			//console.info(page.path);
+			console.info(uni.getStorageSync('storage_state'));
+			//console.info(this);
+			this.$util.persistLogin(this);
+			//console.info(this.$store.state.user);
+
+		},
+		onUnload() {
+			this.imageList = [],
+				this.sourceTypeIndex = 2,
+				this.sourceType = ['拍照', '相册', '拍照或相册'],
+				this.sizeTypeIndex = 2,
+				this.sizeType = ['压缩', '原图', '压缩或原图'],
+				this.countIndex = 5;
+		},
+		created: function() {
+		 console.info('created');	
+		 //console.info(this.intypeName);
+		 this.GetMaterialInByCode();
+        
+
+		},
+		mounted:function(){
+			console.info('mounted');
+			//console.info('intype',this.intypeCode);
+			
+		},
+		updated: function() {
+           console.info('updated');
+			console.info('contract',this.contract);
+			console.info('date',this.date);
+			console.info('indate',this.inDate);
+			if(this.date){
+				this.inDate=this.date;
+			}
+			if(this.contract){
+				if(this.contract.length>0){
+					this.getSupplierName(this.contract[0].supplierCode,this.contract[0].supplierTypeCode);
+				}
+				
+			}
+						
+		},
+		methods: {
+			 
+			/**
+			 * 手动提交
+			 * @param {Object} form
+			 */
+			submitForm(e) {
+				console.info('submitForm');
+				let _this = this;
+                if(this.intypeCode==""){
+					uni.showToast({
+						title:'请选择入库类型',
+						duration:3000,
+						icon:'none'
+					});
+					return;
+				}
+                if(this.inDate==""){
+                	uni.showToast({
+                		title:'请选择入库日期',
+                		duration:3000,
+                		icon:'none'
+                	});
+                	return;
+                }
+				if(this.contractCode==""){
+					uni.showToast({
+						title:'请选择材料合同',
+						duration:3000,
+						icon:'none'
+					});
+					return;
+				}
+				if(!this.userCode){
+					uni.showToast({
+						title:'用户登录已失效,请重新登录',
+						duration:3000,
+						icon:'none'
+					});
+					return;
+				}
+				if(!this.contract){
+					uni.showToast({
+						title:'请重新选择材料合同',
+						duration:3000,
+						icon:'none'
+					});
+					return;
+				}
+				var materialIn = {
+					materialInCode:_this.$util.getQuery("id"),
+					materialInID:_this.$util.getQuery("id"),
+					projectCode: this.$store.state.projectCode,
+					groupCode: this.intypeCode,
+					inDate:this.inDate,
+					inPerson: this.userCode,
+					inputPerson: this.userCode,
+					contractCode: this.contractCode,
+					supplierCode: this.contract[0].supplierCode,
+					supplierTypeCode: this.contract[0].supplierTypeCode,
+					supplierTypeId: this.contract[0].supplierTypeId
+				};
+                console.info('materials',this.materials);
+				var list1 = this.materials;
+                console.info('list1',list1);
+				let list = [];
+				let isLessThan=true;
+				list1.forEach(function(item, index, array) {
+					if(item.inQty<=0){
+						console.info('入库数量不能小于0');
+						isLessThan=false;
+						return;
+					}
+					list.push({
+						materialCode: item.materialCode,
+						unit: item.unit,
+						inQty: new Decimal(item.inQty).toFixed(2) - 0,
+						inPrice: new Decimal(item.standardPrice).toFixed(2) - 0,						
+						noPassQty:new Decimal(item.noQty).toFixed(2) - 0,
+					});
+					//list.push({requisitionCode:'',contractCode:item.contractCode,estimateCash: 220});
+				});
+				if(!isLessThan){
+					uni.showToast({
+						title:'入库数量不能小于0',
+						duration:3000,
+						icon:'none'
+					});
+					return;
+				}
+				console.info("【list】",list);				 
+				if (list.length <= 0) {
+					uni.showToast({
+						title: "请添加材料",
+						icon: "none",
+						duration: 3000
+					});
+					return;
+				}
+				//return;
+				var data = {
+					materialIn: materialIn,
+					mDetailList: list
+				};
+				console.info('data',data);
+				//return;
+				
+				//var strList=JSON.stringify(list);
+				//var strData=JSON.stringify(data);
+				UpdateMaterialIn(data).then((res) => {
+					console.info("提交应答返回值",res);
+					
+					if (res) {
+						//上传图片
+						//_this.uploadFileToServe(res);
+
+						uni.navigateTo({
+							url: '/pages/template/GetMaterialIns/GetMaterialIns'
+						})
+					} else {
+						uni.showToast({
+							title: '修改失败,重新操作',
+							icon: 'none',
+							duration: 3000
+						})
+					}
+
+				});
+			},
+			bindPickerChange: function(e) {
+				//console.log('picker发送选择改变,携带值为:' + e.detail.value);
+				//console.info(e.detail);
+				this.index = e.detail.value;
+				this.changeType = this.array[this.index];
+				console.info(this.changeType);
+			},
+			bindDateChange: function(e) {
+				this.date = e.detail.value;
+				this.requisitionDate = this.date;
+				console.info(this.date);
+			},
+
+			GetDropDown: function() {
+				let that = this;
+				GetQianzhengDropDown().then((res) => {
+					console.info(res);
+					res.forEach(function(item, index, array) {
+						that.$set(that.array, index, item);
+					});
+					that.changeType = that.array[0];
+				});
+			},
+			
+			openWindow: function() {
+				let _this = this;
+				//console.info('监听事件外部this');
+				//console.info(this);
+				_this.saveTemp(_this);
+				if(_this.contractCode==undefined||_this.contractCode==''){
+					uni.showToast({
+						title:'请选择材料合同',
+						icon:'none',
+						duration:3000
+					});
+					return;
+				}
+
+				//创建名字为fire的监听器,监听子页面传值事件
+				uni.$on('materials', function(data) {
+					console.info("监听materials子页面的传值",data);					
+					//从子页面返回父页面,原来表单已经填写的值会丢失,因此需要重新赋值
+					_this.getTemp(_this);
+					_this.materials = [];
+					data.forEach(function(item, index, array) {
+						//console.info("foreach");				
+						_this.$set(_this.materials, index, item);
+					});
+
+					//接收一次监听,一旦监听到回传值,则清除监听事件,若不清除,会占用资源
+					uni.$off("materials");
+					console.info("监听materials子页面的传值结束");
+				});
+				//打开子页面
+				uni.navigateTo({
+					url: "/pages/template/selectmaterials/selectmaterials?contractCode="+_this.contractCode
+				})
+			},
+			delRow: function(index) {
+				console.info("删除");
+				console.info(this.materials[index]);
+				this.materials.splice(index, 1);
+			},
+			/*
+			上传后返回的值:
+			list:上传后图片数组
+			v:返回当前上传图片的临时路径
+			*/
+			chooseFile(list, v) {
+				console.log("上传图片_list:", list)
+				console.log("上传图片_v:", v);
+				this.urlList = list;
+				console.info("urlList", this.urlList);
+
+			},
+
+
+			/*
+			删除图片:
+			list:删除返回删除后剩余的图片数组
+			eq:返回删除的数组
+			*/
+			imgDelete(list, eq) {
+				console.log("删除图片_list:", list);
+				console.log("删除图片_eq:", eq);
+				this.urlList = list;
+				console.info("urlList", this.urlList);
+			},
+			/*
+			执行上传服务:
+			urlList:要上传的图片:数组类型
+			*/
+			uploadFileToServe(masterCode) {
+				let _this = this;
+				var urlList = _this.urlList;
+				if (!urlList || urlList.length <= 0) {
+					return;
+				};
+				//console.info(urlList);
+
+
+				//return;
+				for (let i = 0; i < urlList.length; i++) {
+
+					uni.uploadFile({
+						url: '/api/Requisition/UploadImage',
+						filePath: urlList[i],
+						name: 'file',
+						formData: {
+							createPerson: _this.$store.state.user.userCode,
+							masterCode: masterCode
+						},
+						headers: {
+							'Content-Type': 'multipart/form-data; boundary = ' + new Date().getTime()
+							//这里要把content-type设置为multipard/form-data,同时还要设置boundary
+						},
+						success: (uploadFileRes) => {
+							console.log("图片上传:", uploadFileRes.data);
+						}
+					});
+				}
+			},
+			/*
+			获取入库类型
+			*/
+			getType() {
+				let _this = this;
+				console.info('gettype',_this);
+				_this.saveTemp(_this);
+				//创建名字为fire的监听器,监听子页面传值事件
+				uni.$on('intype', function(data) {
+					console.info("监听intype子页面的传值", data);
+					console.info('监听',_this);
+                     _this.getTemp(_this);
+					 _this.intypeCode=data[0].id;
+					 _this.intypeName=data[0].name;
+					 _this.$nextTick(function(){
+					 	//更新dom
+					 });
+					 console.info(data[0].id,data[0].name);
+					 console.info(_this.intypeCode,_this.intypeName);
+					//接收一次监听,一旦监听到回传值,则清除监听事件,若不清除,会占用资源
+					uni.$off("intype");
+				});
+				uni.navigateTo({
+					url: '/pages/tree/tree?classCode=1503'
+				});
+			},
+			/*获取材料合同*/
+			getContract(projectCode){
+				console.info('getContract',projectCode);
+				let _this = this;
+				_this.saveTemp(_this);   //表单存入缓存
+				//创建名字为fire的监听器,监听子页面传值事件
+				uni.$on('contract', function(data) {
+					console.info("监听contract子页面的传值", data);
+				    _this.getTemp(_this);      //自缓存中取出表单数据,重新赋值
+					_this.contractCode=data[0].contractCode;
+					_this.contractName=data[0].contractName;
+					_this.contract=data;
+					console.info('_this.contract',_this.contract);
+					//接收一次监听,一旦监听到回传值,则清除监听事件,若不清除,会占用资源
+					uni.$off("contract");
+				});
+				uni.navigateTo({
+					url: '/pages/template/SelectContract/SelectContract?projectCode='+projectCode
+				});
+			},
+			/* 获取供应商名称 */
+			getSupplierName(supplierCode, supplierTypeCode){
+				console.info('getSupplierName');
+				console.info('supplierCode',supplierCode);
+				console.info('supplierTypeCode',supplierTypeCode);
+				let that=this;
+				if(supplierCode&&supplierTypeCode){
+					getSupplierNameAndType(supplierCode, supplierTypeCode).then(res=>{
+						console.info('getSupplierNameAndType',res);
+						that.supplierName=res;
+					});
+				}
+				
+			},
+			saveTemp(_this){  //临时存
+				uni.setStorage({
+					key:'intypeName',
+					data:_this.intypeName
+				});
+				uni.setStorage({
+					key:'intypeCode',
+					data:_this.intypeCode
+				});
+				uni.setStorage({
+					key:'inDate',
+					data:_this.inDate
+				});
+				uni.setStorage({
+					key:'contractCode',
+					data:_this.contractCode
+				});
+				uni.setStorage({
+					key:'contractName',
+					data:_this.contractName
+				});
+				uni.setStorage({
+					key:'supplierCode',
+					data:_this.supplierCode
+				});
+				uni.setStorage({
+					key:'supplierName',
+					data:_this.supplierName
+				});
+				uni.setStorage({
+					key:'contract',
+					data:_this.contract
+				});
+				uni.setStorage({
+					key:'usercode',
+					data:_this.usercode
+				});
+				uni.setStorage({
+					key:'imageList',
+					data:_this.imageList
+				});
+			},
+			getTemp(_this){   //获取缓存,重新给表单赋值
+				_this.intypeCode=uni.getStorageSync('intypeCode');
+				_this.intypeName=uni.getStorageSync('intypeName');
+				_this.inDate=uni.getStorageSync('inDate');
+				_this.contractCode=uni.getStorageSync('contractCode');
+				_this.contractName=uni.getStorageSync('contractName');
+				_this.supplierCode=uni.getStorageSync('supplierCode');
+				_this.supplierName=uni.getStorageSync('supplierName');
+				_this.supplierCode=uni.getStorageSync('supplierCode');
+				_this.usercode=uni.getStorageSync('usercode');
+				_this.contract=uni.getStorageSync('contract');
+			},
+			GetMaterialInByCode(){
+				let _this=this;
+				let id=this.$util.getQuery("id");
+				GetMaterialInByMaterialInCode(id).then(res=>{
+					console.info('GetMaterialInByMaterialInCode',res);
+					let mainEntity=res.mainEntity;
+					let subList=res.subList;
+					console.info('projectCode',_this.projectCode);
+					if(mainEntity.projectCode!=_this.projectCode){
+						uni.showModal({
+						    title: '提示',
+						    content: '非本人,无编辑权限',
+						    success: function (res) {
+						        if (res.confirm||res.cancel) {
+						            uni.navigateTo({
+						            	url:'../GetMaterialIns/GetMaterialIns'
+						            })
+						        }  
+						    }
+						});
+					}
+					//初始化赋值
+					_this.intypeCode=mainEntity.groupCode;
+					_this.date=mainEntity.inDate.substring(0,10);
+					_this.contractCode=mainEntity.contractCode;
+					
+					 getContractAndSupplier(mainEntity.contractCode).then(res=>{
+					 	console.info('getContractAndSupplier',res);
+					 	_this.contractCode=res[0].contractCode;
+					 	_this.contractName=res[0].contractName; 
+						console.info('res.contractName',res[0].contractName);
+					 	console.info('_this.contractName',_this.contractName);
+					 	_this.contract=res;
+					 });
+					 getGroupName(mainEntity.groupCode).then(res=>{
+					 	console.info('getGroupName',res);
+					 	_this.intypeName=res;
+					 });
+					 
+					
+					subList.forEach(function(item, index, array) {
+						//console.info("foreach");				
+						_this.$set(_this.materials, index, item);
+					});
+				});
+			},
+			 
+		}
+	}
+</script>
+
+<style scoped>
+	/* 头条小程序组件内不能引入字体 */
+	/* #ifdef MP-TOUTIAO */
+	@font-face {
+		font-family: uniicons;
+		font-weight: normal;
+		font-style: normal;
+		src: url("~@/static/uni.ttf") format("truetype");
+	}
+
+	/* #endif */
+
+	page {
+		display: flex;
+		flex-direction: column;
+		box-sizing: border-box;
+		background-color: #efeff4;
+		min-height: 100%;
+		height: auto;
+	}
+
+	view {
+		font-size: 14px;
+		line-height: inherit;
+	}
+
+	.uni-form-item__title {
+		font-size: 16px;
+		line-height: 24px;
+
+	}
+
+	.uni-input-wrapper {
+		/* #ifndef APP-NVUE */
+		display: flex;
+		/* #endif */
+		padding: 8px 13px;
+		flex-direction: row;
+		flex-wrap: nowrap;
+		background-color: #FFFFFF;
+	}
+
+	.title {
+		background-color: #efefef;
+		padding: 5px 20px;
+	}
+
+	.uni-input {
+		height: 28px;
+		line-height: 28px;
+		font-size: 15px;
+		padding: 5px;
+		flex: 1;
+		background-color: #FFFFFF;
+	}
+
+	.uni-input-small {
+		height: 28px;
+		line-height: 28px;
+		font-size: 15px;
+		padding: 5px;
+		flex: 1;
+		width: 270px;
+		background-color: #FFFFFF;
+	}
+
+	.uni-icon {
+		height: 28px;
+		line-height: 28px;
+		font-size: 20px;
+		padding-right: 15px;
+		color: #5555ff;
+		width: 50px;
+	}
+
+	.uni-eye-active {
+		color: #007AFF;
+	}
+
+	.uni-btn-v {
+		position: fixed;
+		bottom: 0;
+		width: 100%;
+
+	}
+
+	.header-slot-box {
+		font-size: 15px;
+		margin: 5px 5px;
+		width: 20%;
+		justify-content: center;
+	}
+
+	.body-slot-box {
+		font-size: 15px;
+		margin: 5px 5px;
+		width: 40%;
+		justify-content: center;
+	}
+
+	.footer-slot-box {
+		font-size: 15px;
+		margin: 5px 5px;
+		width: 40%;
+		justify-content: center;
+	}
+
+	.uni-textarea textarea {
+		font-size: 15px;
+	}
+
+	.content {
+		padding: 40rpx;
+		background-color: #fff;
+	}
+
+	/* 上传控件 */
+	.uploadControl {
+		border: 1rpx solid #eee;
+		border-radius: 10rpx;
+		width: 130rpx;
+		display: block;
+		height: 130rpx;
+		text-align: center;
+		line-height: 130rpx;
+		font-size: 30rpx;
+		color: #888;
+		background-color: #eeeeee;
+	}
+
+	.bg1 {
+		background-color: #EFEFEF;
+	}
+</style>

+ 159 - 0
uni-app-front/pages/template/SelectContract/SelectContract.vue

@@ -0,0 +1,159 @@
+<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>
+				<radio-group @change="radioChange">
+					<uni-list-item v-for="(item,index) in contractList" :key="index">
+						<!-- 自定义 header -->
+						<view slot="header" class="slot-box-header">
+							<radio :value="item.contractCode" />
+						</view>
+						<!-- 自定义 body -->
+						<view slot="body" class="slot-box-body">
+							{{item.contractID}}
+						</view>
+						<!-- 自定义 footer-->
+						<view slot="footer" class="slot-box-footer">
+							{{item.contractName}}
+						</view>
+					</uni-list-item>
+				</radio-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 {
+		GetContracts
+	} from "@/common/api/commonApi.js";
+	export default {
+		data() {
+			return {
+				contractList: [],
+				radioValue: [],
+				searchVal: ''
+			}
+		},
+		onLoad: function() {
+			//console.info('授权');
+			//console.info(this.$auth);
+			this.$util.persistLogin(this);
+		},
+		created: function() {
+
+			this.getcontractList();
+		},
+		methods: {
+			getcontractList: function() {
+				var that = this;
+				let projectcode = this.$store.state.projectCode;
+				let searchValue = this.searchVal;
+				uni.showLoading({
+					title: "页面努力加载中,请稍候...",
+					mask: true
+				});
+				GetContracts(projectcode, searchValue).then((res) => {
+					uni.hideLoading();
+					console.info('GetContracts', res);
+					//console.info(projectCode);
+					//console.info(res);
+					//return;
+					res.forEach(function(item, index, array) {
+						that.$set(that.contractList, index, item);
+					});
+					//console.info(that.contractList);
+				});
+			},
+			radioChange: function(evt) {
+				//console.info(evt);
+				//console.info(evt.target.value);
+				//console.info('contractList',this.contractList);
+				for (let i = 0; i < this.contractList.length; i++) {
+					if (this.contractList[i].contractCode === evt.target.value) {
+						console.info(evt.target.value);
+						this.current = i;
+						this.radioValue = this.contractList[i];
+						console.info('this.radioValue', this.radioValue);
+						break;
+					}
+				}
+			},
+			submitForm(e) {
+				console.info('submitForm',this.radioValue);
+				//先记录值,下面this指向会不一样
+				let relationContractCodes = this.radioValue;
+				if (relationContractCodes.length<=0) {
+					uni.showToast({
+						title: '请选择合同',
+						duration: 3000,
+						icon: 'none'
+					})
+					return;
+				}
+				
+				let selectChecked = [];
+				selectChecked.push({
+						contractCode: relationContractCodes.contractCode,
+						contractID: relationContractCodes.contractID,
+						contractName: relationContractCodes.contractName,
+						supplierCode:relationContractCodes.supplierCode,
+						supplierTypeCode:relationContractCodes.supplierTypeCode,
+						supplierTypeId:relationContractCodes.supplierTypeId
+					});
+				console.info('selectChecked',selectChecked);
+				//return;
+			//将数据发射到父级监听事件中
+			uni.$emit('contract', selectChecked);
+			//关闭当前窗口
+			uni.navigateBack();
+		},
+		search(res) { //回车搜索
+			this.searchvalue = res.value; //赋值
+			this.contractList = [];
+			this.getcontractList(); //调用搜索方法
+		},
+		input(res) {
+			this.searchVal = res.value
+		},
+		cancel(res) {
+			console.info('点击取消,输入值为:' + res.value);
+
+		}
+	}
+	}
+</script>
+
+<style scoped>
+	.slot-box-header {
+		margin: 5px 5px;
+		width: 40px;
+	}
+
+	.slot-box-body {
+		margin: 5px 5px;
+		width: 180px;
+	}
+
+	.slot-box-footer {
+		margin: 5px 5px;
+		width: 180px;
+	}
+
+	.uni-btn-v {
+		position: fixed;
+		bottom: 0;
+		width: 100%;
+
+	}
+
+	uni-view {
+		font-size: 15px;
+	}
+</style>

+ 159 - 0
uni-app-front/pages/template/selectmaterials/selectmaterials.vue

@@ -0,0 +1,159 @@
+<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.standardPrice}} 元
+						</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 {GetMaterials} from '@/common/api/MaterialInOut.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;
+				var projectCode = this.$store.state.projectCode;
+				let contractCode = this.$util.getQuery("contractCode");
+				let searchVal=that.searchVal;
+				uni.showLoading({
+					title: "页面努力加载中,请稍候...",
+					mask: true
+				});
+				GetMaterials(projectCode, contractCode,searchVal).then((res) => {
+					uni.hideLoading();
+					console.info('GetMaterials',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);
+				if(this.checkboxValues.length<=0){
+					uni.showToast({
+						title:'请选择材料',
+						icon:'none',
+						duration:3000
+					});
+					return;
+				}
+				//先记录值,下面this指向会不一样
+				let relationContractCodes = this.checkboxValues;
+				let arr=relationContractCodes.split(',');
+				let selectChecked=[];
+				this.materials.forEach(function(item,index,array){
+					arr.forEach(function(item1,index1,array1){
+						if(item.materialCode==item1){
+							item.inQty=0.00;
+							item.noQty=0.00;
+							selectChecked.push(item);
+							
+						}
+					});
+				});
+				console.info('submitForm selectChecked',this.selectChecked);
+				//将数据发射到父级监听事件中
+				uni.$emit('materials', selectChecked);
+				//关闭当前窗口
+				uni.navigateBack({});
+			},
+			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>