Просмотр исходного кода

1.修复所以树形页面刚加载渲染报错问题
2.商品管理问题修复、表单填写优化

hcf 1 год назад
Родитель
Сommit
bb766b4960

+ 1 - 0
.gitignore

@@ -22,3 +22,4 @@ pnpm-debug.log*
 *.sln
 *.sw?
 vue.config.js
+/package-lock.json

+ 23 - 29
src/views/audit/agencyGoods/index.vue

@@ -256,18 +256,6 @@
 			this.timer = setInterval(() => {
 				this.getDataList()
 			}, 300)
-			this.getTreeList();
-		}
-		getTreeList(){
-			api.treeList('maindataMaterialOrganizationCategory').then((res : any) => {
-				console.log(res);
-				var data:any = [{
-					id: 0,
-					name: '机构商品分类',
-					children: res.data
-				}];
-				(this as any).$refs.sideTree.setData(data);
-			})
 		}
 		//点击树获取数据
 		onChangeTree(e : any) {
@@ -304,7 +292,6 @@
 						if (res.code === 200) {
 							this.$message.success(this.popTitle + '成功!');
 							// (this as any).$refs.sideTree.request();
-							this.getTreeList()
 							this.dialogFormVisible = false;
 							this.getDataList();
 						} else this.$message.error(res.msg);
@@ -321,7 +308,6 @@
 						if (res.code === 200) {
 							this.$message.success(this.popTitle + '成功!');
 							// (this as any).$refs.sideTree.request();
-							this.getTreeList()
 							this.dialogFormVisible = false;
 							this.getDataList();
 						} else this.$message.error(res.msg);
@@ -346,17 +332,29 @@
 		}
 		getPageList(query : any) {
 			let loading = this.$loading({ target: '.main-container' });
-			api.pageList(query, 'maindataMaterialOrganizationCategory').then((res : any) => {
-				loading.close();
-				if (res.code === 200) {
-					(this.$refs.moduleView as any).setTableValue(res.data.records);
-					let page = {
-						pageNo: res.data.current, //当前页
-						pageSize: res.data.size, //每页条数
-						total: res.data.total //总条数
-					};
-					(this.$refs.moduleView as any).setPage(page);
-				} else this.$message.error(res.msg);
+			api.treeList('maindataMaterialOrganizationCategory').then((treeRes : any) => {
+				if(treeRes.code==200){
+					api.pageList(query, 'maindataMaterialOrganizationCategory').then((res : any) => {
+						if (res.code === 200) {
+							
+							var data:any = [{
+								id: 0,
+								name: '机构商品分类',
+								children: treeRes.data
+							}];
+							(this as any).$refs.sideTree.setData(data);
+							
+							(this.$refs.moduleView as any).setTableValue(res.data.records);
+							let page = {
+								pageNo: res.data.current, //当前页
+								pageSize: res.data.size, //每页条数
+								total: res.data.total //总条数
+							};
+							(this.$refs.moduleView as any).setPage(page);
+							loading.close();
+						} else this.$message.error(res.msg);
+					}).catch(() => loading.close());
+				}
 			}).catch(() => loading.close());
 		}
 		// 工具栏方法
@@ -368,7 +366,6 @@
 			this.popTitle = '新增'
 			this.dialogFormVisible = true;
 			this.radio = 0
-			this.getTreeList();
 			setTimeout(() => {
 				if(this.parentId!=0){
 					var data = {
@@ -394,7 +391,6 @@
 			console.log('打开编辑 ==> ', e);
 			this.popTitle = '编辑';
 			let loading = this.$loading({ target: '.main-container' });
-			this.getTreeList();
 			api.single({ id: e.id }, 'maindataMaterialOrganizationCategory').then((res : any) => {
 				if (res.code === 200) {
 					let data = res.data;
@@ -428,7 +424,6 @@
 				api.delCategoryId({ id: item.id }, 'maindataMaterialOrganizationCategory').then((res : any) => {
 					if (res.code === 200) {
 						// (this as any).$refs.sideTree.request();
-						this.getTreeList()
 						this.getDataList();
 						this.$message.success('删除成功');
 					} else this.$message.error(res.msg);
@@ -439,7 +434,6 @@
 		onRefresh() {
 			(this as any).$refs.moduleView.clearSearch();
 			// (this as any).$refs.sideTree.request();
-			this.getTreeList()
 			this.parentIds = '';
 			this.getDataList();
 		}

+ 27 - 31
src/views/audit/distributor/index.vue

@@ -372,18 +372,6 @@
 			this.timer = setInterval(() => {
 				this.getDataList()
 			}, 300)
-			this.getTreeList();
-		}
-		getTreeList(){
-			api.treeList('maindataOrganizationCategory').then((res : any) => {
-				console.log(res);
-				var data:any = [{
-					id: 0,
-					name: '机构分类',
-					children: res.data
-				}];
-				(this as any).$refs.sideTree.setData(data);
-			})
 		}
 		//点击树获取数据
 		onChangeTree(e : any) {
@@ -434,7 +422,6 @@
 						if (res.code === 200) {
 							this.$message.success('保存成功');
 							// (this as any).$refs.sideTree.request();
-							this.getTreeList();
 							this.isShow = 'home'; // 展示类型
 							this.dialogFormVisible = false;
 							this.getDataList();
@@ -446,7 +433,6 @@
 						if (res.code === 200) {
 							this.$message.success('编辑成功');
 							// (this as any).$refs.sideTree.request();
-							this.getTreeList();
 							this.isShow = 'home'; // 展示类型
 							this.dialogFormVisible = false;
 							this.getDataList();
@@ -473,21 +459,33 @@
 		}
 		getPageList(query : any) {
 			let loading = this.$loading({ target: '.main-container' });
-			api.pageList(query, 'maindataMaterialDistributor').then((res : any) => {
-				loading.close();
-				if (res.code === 200) {
-					res.data.records.map((v : any) => {
-						if (v.financeType === 'kingdee') v.financeType2 = '金蝶K3';
-						if (v.financeType === 'yonbip') v.financeType2 = '用友U8';
-					});
-					(this.$refs.moduleView as any).setTableValue(res.data.records);
-					let page = {
-						pageNo: res.data.current, //当前页
-						pageSize: res.data.size, //每页条数
-						total: res.data.total //总条数
-					};
-					(this.$refs.moduleView as any).setPage(page);
-				} else this.$message.error(res.msg);
+			api.treeList('maindataOrganizationCategory').then((treeRes : any) => {
+				if(treeRes.code==200){
+					api.pageList(query, 'maindataMaterialDistributor').then((res : any) => {
+						loading.close();
+						if (res.code === 200) {
+							
+							var data:any = [{
+								id: 0,
+								name: '机构分类',
+								children: treeRes.data
+							}];
+							(this as any).$refs.sideTree.setData(data);
+							
+							res.data.records.map((v : any) => {
+								if (v.financeType === 'kingdee') v.financeType2 = '金蝶K3';
+								if (v.financeType === 'yonbip') v.financeType2 = '用友U8';
+							});
+							(this.$refs.moduleView as any).setTableValue(res.data.records);
+							let page = {
+								pageNo: res.data.current, //当前页
+								pageSize: res.data.size, //每页条数
+								total: res.data.total //总条数
+							};
+							(this.$refs.moduleView as any).setPage(page);
+						} else this.$message.error(res.msg);
+					}).catch(() => loading.close());
+				}
 			}).catch(() => loading.close());
 		}
 		// 工具栏方法
@@ -531,7 +529,6 @@
 					loading.close();
 					if (res.code === 200) {
 						// (this as any).$refs.sideTree.request();
-						this.getTreeList();
 						this.getDataList();
 						this.$message.success('删除成功');
 					} else this.$message.error(res.msg);
@@ -542,7 +539,6 @@
 		onRefresh() {
 			(this as any).$refs.moduleView.clearSearch();
 			// (this as any).$refs.sideTree.request();
-			this.getTreeList();
 			this.categoryIds = '';
 			this.getDataList();
 		}

+ 27 - 31
src/views/audit/manufacturer/index.vue

@@ -376,18 +376,6 @@
 			this.timer = setInterval(() => {
 				this.getDataList()
 			}, 300)
-			this.getTreeList();
-		}
-		getTreeList(){
-			api.treeList('maindataOrganizationCategory').then((res : any) => {
-				console.log(res);
-				var data:any = [{
-					id: 0,
-					name: '机构分类',
-					children: res.data
-				}];
-				(this as any).$refs.sideTree.setData(data);
-			})
 		}
 		//点击树获取数据
 		onChangeTree(e : any) {
@@ -441,7 +429,6 @@
 						if (res.code === 200) {
 							this.$message.success('保存成功');
 							// (this as any).$refs.sideTree.request();
-							this.getTreeList();
 							this.isShow = 'home'; // 展示类型
 							this.getDataList();
 						} else this.$message.error(res.msg);
@@ -452,7 +439,6 @@
 						if (res.code === 200) {
 							this.$message.success('编辑成功');
 							// (this as any).$refs.sideTree.request();
-							this.getTreeList();
 							this.isShow = 'home'; // 展示类型
 							this.getDataList();
 						} else this.$message.error(res.msg);
@@ -478,21 +464,33 @@
 		}
 		getPageList(query : any) {
 			let loading = this.$loading({ target: '.main-container' });
-			api.pageList(query, 'maindataMaterialManufacturer').then((res : any) => {
-				loading.close();
-				if (res.code === 200) {
-					res.data.records.map((v : any) => {
-						if (v.financeType === 'kingdee') v.financeType2 = '金蝶K3';
-						if (v.financeType === 'yonbip') v.financeType2 = '用友U8';
-					});
-					(this.$refs.moduleView as any).setTableValue(res.data.records);
-					let page = {
-						pageNo: res.data.current, //当前页
-						pageSize: res.data.size, //每页条数
-						total: res.data.total //总条数
-					};
-					(this.$refs.moduleView as any).setPage(page);
-				} else this.$message.error(res.msg);
+			api.treeList('maindataOrganizationCategory').then((treeRes : any) => {
+				if(treeRes.code==200){
+					api.pageList(query, 'maindataMaterialManufacturer').then((res : any) => {
+						loading.close();
+						if (res.code === 200) {
+							
+							var data:any = [{
+								id: 0,
+								name: '机构分类',
+								children: treeRes.data
+							}];
+							(this as any).$refs.sideTree.setData(data);
+							
+							res.data.records.map((v : any) => {
+								if (v.financeType === 'kingdee') v.financeType2 = '金蝶K3';
+								if (v.financeType === 'yonbip') v.financeType2 = '用友U8';
+							});
+							(this.$refs.moduleView as any).setTableValue(res.data.records);
+							let page = {
+								pageNo: res.data.current, //当前页
+								pageSize: res.data.size, //每页条数
+								total: res.data.total //总条数
+							};
+							(this.$refs.moduleView as any).setPage(page);
+						} else this.$message.error(res.msg);
+					}).catch(() => loading.close());
+				}
 			}).catch(() => loading.close());
 		}
 		// 工具栏方法
@@ -536,7 +534,6 @@
 					loading.close();
 					if (res.code === 200) {
 						// (this as any).$refs.sideTree.request();
-						this.getTreeList();
 						this.getDataList();
 						this.$message.success('删除成功');
 					} else this.$message.error(res.msg);
@@ -547,7 +544,6 @@
 		onRefresh() {
 			(this as any).$refs.moduleView.clearSearch();
 			// (this as any).$refs.sideTree.request();
-			this.getTreeList();
 			this.categoryIds = '';
 			this.getDataList();
 		}

+ 21 - 29
src/views/audit/productClassification/index.vue

@@ -249,18 +249,6 @@
 			this.timer = setInterval(() => {
 				this.getDataList()
 			}, 500)
-			this.getTreeList();
-		}
-		getTreeList(){
-			api.treeList('maindataMaterialCategory').then((res : any) => {
-				console.log(res);
-				var data:any = [{
-					id: 0,
-					name: '物料分类',
-					children: res.data
-				}];
-				(this as any).$refs.sideTree.setData(data);
-			})
 		}
 		//点击树获取数据
 		onChangeTree(e : any) {
@@ -301,7 +289,6 @@
 						if (res.code === 200) {
 							this.$message.success(this.popTitle + '成功!');
 							// (this as any).$refs.sideTree.request();
-							this.getTreeList();
 							this.getDataList();
 						} else this.$message.error(res.msg);
 					}).catch(() => {});
@@ -317,7 +304,6 @@
 						if (res.code === 200) {
 							this.$message.success(this.popTitle + '成功!');
 							// (this as any).$refs.sideTree.request();
-							this.getTreeList();
 							this.getDataList();
 						} else this.$message.error(res.msg);
 					}).catch(() => {});
@@ -341,17 +327,27 @@
 		}
 		getPageList(query : any) {
 			let loading = this.$loading({ target: '.main-container' });
-			api.pageList(query, 'maindataMaterialCategory').then((res : any) => {
-				loading.close();
-				if (res.code === 200) {
-					(this.$refs.moduleView as any).setTableValue(res.data.records);
-					let page = {
-						pageNo: res.data.current, //当前页
-						pageSize: res.data.size, //每页条数
-						total: res.data.total //总条数
-					};
-					(this.$refs.moduleView as any).setPage(page);
-				} else this.$message.error(res.msg);
+			api.treeList('maindataMaterialCategory').then((treeRes : any) => {
+				if(treeRes.code==200){
+					api.pageList(query, 'maindataMaterialCategory').then((res : any) => {
+						var data:any = [{
+							id: 0,
+							name: '物料分类',
+							children: treeRes.data
+						}];
+						(this as any).$refs.sideTree.setData(data);
+						if (res.code === 200) {							
+							(this.$refs.moduleView as any).setTableValue(res.data.records);
+							let page = {
+								pageNo: res.data.current, //当前页
+								pageSize: res.data.size, //每页条数
+								total: res.data.total //总条数
+							};
+							(this.$refs.moduleView as any).setPage(page);
+							loading.close();
+						} else this.$message.error(res.msg);
+					}).catch(() => loading.close());
+				}
 			}).catch(() => loading.close());
 		}
 		// 工具栏方法
@@ -363,7 +359,6 @@
 			this.popTitle = '新增'
 			this.dialogFormVisible = true;
 			this.radio = 0
-			this.getTreeList();
 			setTimeout(() => {
 				if(this.parentId!=0){
 					var data = {
@@ -389,7 +384,6 @@
 			console.log('打开编辑 ==> ', e);
 			this.popTitle = '编辑'
 			let loading = this.$loading({ target: '.main-container' });
-			this.getTreeList();
 			api.single({ id: e.id }, 'maindataMaterialCategory').then((res : any) => {
 				if (res.code === 200) {
 					let data = res.data;
@@ -422,7 +416,6 @@
 				api.delCategoryId({ id: item.id }, 'maindataMaterialCategory').then((res : any) => {
 					if (res.code === 200) {
 						// (this as any).$refs.sideTree.request();
-						this.getTreeList();
 						this.getDataList();
 						this.$message.success('删除成功');
 					} else this.$message.error(res.msg);
@@ -433,7 +426,6 @@
 		onRefresh() {
 			(this as any).$refs.moduleView.clearSearch();
 			// (this as any).$refs.sideTree.request();
-			this.getTreeList();
 			this.parentIds = '';
 			this.getDataList();
 		}

+ 182 - 0
src/views/audit/productManagement/components/productModal.vue

@@ -0,0 +1,182 @@
+<template>
+	<vxe-modal v-model="value" id="productDialogModal" :width="width?width+'px':'90%'" @show="show"
+		:height="height?height+'px':'90%'" show-zoom resize transfer show-footer
+		@confirm="confirm" :loading="loading">
+		<template #title>
+			<span>选择商品</span>
+		</template>
+		<template #default>
+			<module-view :propConfig="config" ref="view" @pagination="getList" @search="getList" @resert="getList"
+				@clickHandle="clickHandle" />
+		</template>
+	</vxe-modal>
+</template>
+
+<script lang="ts">
+	import { Component, Prop, Vue, Watch } from "vue-property-decorator";
+	@Component
+	export default class ProductModal extends Vue {
+		value = false
+		time : any;
+		timeNum = 0;
+		loading = false;
+		data : Array<any> = []
+
+		@Prop()
+		width ?: number
+
+		@Prop()
+		height ?: number
+
+		@Prop()
+		mulit ?: boolean
+
+		config : any = {
+			search: {
+				attr: {
+					size: 'mini'
+				},
+				columns: [
+					[{
+						span: 6,
+						label: '标题',
+						prop: 'skuTitle',
+						component: 'by-input',
+						compConfig: {
+							attr: {
+								clearable: true,
+								placeholder: '请输入名称'
+							}
+						}
+					}]
+				]
+			},
+			tool: {
+				tools: {
+					search: true,
+					refresh: true
+				}
+			},
+			table: {
+				attr: {
+					size: 'mini',
+					seq: true,
+					align: 'left',
+					checkbox:true,
+					triggerRowCheck: 'row',
+					calculateH:'100%'
+				},
+				columns:
+					[
+						{
+							title: '标题',
+							field: 'skuTitle',
+							width: 250
+						},
+						{
+							title: '副标题',
+							field: 'skuSubtitle',
+							width: 250
+						},
+						{
+							width: 250,
+							title: '财务编号',
+							field: 'financialCode',
+						},
+						{
+							title: '规格',
+							field: 'materialSpec',
+							width: 250
+						},
+						{
+							title: '单位',
+							field: 'unit',
+							width: 250
+						},
+						{
+							title: '单价',
+							field: 'price',
+							width: 250
+						},
+					]
+			},
+		}
+		brandData : Array<any> = []
+
+		getBrandData() {
+			return this.brandData;
+		}
+
+		clickHandle(n : string) {
+			if (n == 'onRefresh') {
+				this.getList()
+			}
+		}
+
+		setShow(v : boolean) {
+			this.value = v;
+		}
+
+		mounted() { }
+
+		//确定
+		confirm() {
+			let data : Array<any> = this.getSelectdata();
+			this.$emit('confirm', data);
+			this.value = false;
+		}
+		//获取已选中表格数据
+		getSelectdata() {
+			let data : Array<any> = [];
+			if (this.$refs.view) {
+				data = (this.$refs.view as any).getSelectData()
+			}
+			return data;
+		}
+		//显示弹窗
+		show() {
+			if (this.data.length == 0) {
+				this.time = setInterval(() => {
+					this.getList()
+				}, 500)
+			}
+			if (this.$refs.view) {
+				(this.$refs.view as any).clearCheckboxRow();
+			}
+		}
+		getList() {
+			if (!this.$refs.view) {
+				if (this.timeNum > 5) {
+					clearInterval(this.time)
+				}
+				this.timeNum++;
+				return
+			}
+			clearInterval(this.time)
+			let query : any = (this.$refs.view as any).getQuery();
+			query.isLikeSearch = '1';
+			query.ismakeup = 1;
+			this.loading = true;
+			(this as any).$request({
+				url: '/maindata/maindataMaterialSku/page',
+				method: 'get',
+				params: query
+			}).then((res : any) => {
+				this.loading = false
+				if (res.data.records) {
+					(this.$refs.view as any).setTableValue(res.data.records);
+					this.data = res.data.records;
+					let page = {
+						pageNo: res.data.current, //当前页
+						pageSize: res.data.size, //每页条数
+						total: res.data.total //总条数
+					};
+					(this.$refs.view as any).setPage(page)
+				}
+			}).catch(() => {});
+		}
+	}
+</script>
+<style lang="scss" scoped>
+
+</style>

+ 154 - 82
src/views/audit/productManagement/index.vue

@@ -40,7 +40,7 @@
 					</template>
 					<template v-slot:makeupTable>
 						<div v-if="ismakeup===0">
-							<by-table :propConfig="makeupTable" ref="makeupTable"></by-table>
+							<by-table :propConfig="makeupTable" ref="makeupTable" @onChangeRow="getMakeupTableValue"></by-table>
 						</div>
 					</template>
 					<template v-slot:issued>
@@ -49,7 +49,7 @@
 					</template>
 					<template v-slot:materialSpec>
 						<el-radio v-model="materialSpec" :label="0" @input="changeSingle">单规格</el-radio>
-						<el-radio v-model="materialSpec" :label="1" @input="changeSingle">多规格</el-radio>
+						<el-radio v-model="materialSpec" :label="1" @input="changeSingle" :disabled="ismakeup==0">多规格</el-radio>
 					</template>
 					<template v-slot:attributeName>
 						<div v-if="isSingle" key="item4">
@@ -113,7 +113,7 @@
 		<!-- 选择物料 -->
 		<productModal ref="product" :mulit="true" @confirm="confirmProduct" />
 		
-		<vxe-modal v-model="vxeValue" width="48%" height="88%" show-zoom resize transfer show-footer>
+		<vxe-modal v-model="vxeValue" width="48%" height="88%" show-zoom resize transfer show-footer mask-closable :loading="tableloading">
 			<template #title>
 				<span>关联金蝶财务系统物料</span>
 			</template>
@@ -139,7 +139,6 @@
 				<el-table
 				    ref="multipleTable" 
 				    :data="newtableData"
-					v-loading="tableloading"
 					stripe
 					border
 				    style="width: 100%"
@@ -197,7 +196,7 @@
 	import api from '@/api/currency'
 	import other from '@/api/other'
 	import ForTab from "@/components/ForTab/index.vue";
-	import productModal from "../orderTask/components/productModal.vue";
+	import productModal from "./components/productModal.vue";
 	import brandType from "./components/brandType.vue";
 	// import selectKin from "./components/selectKin.vue";
 	@Component({ components: { ForTab, productModal, brandType } })
@@ -589,7 +588,6 @@
 							size: 'mini',
 							placeholder: ' ',
 							type: "number",
-							defaultValue:'0',
 							min: 0,
 						},
 					}
@@ -604,7 +602,6 @@
 							size: 'mini',
 							placeholder: ' ',
 							type: "number",
-							defaultValue:0,
 							min: 0,
 						},
 					}
@@ -619,7 +616,6 @@
 							size: 'mini',
 							placeholder: ' ',
 							type: "number",
-							defaultValue:0,
 							min: 0,
 						},
 					}
@@ -634,7 +630,6 @@
 							size: 'mini',
 							placeholder: ' ',
 							type: "number",
-							defaultValue:0,
 							min: 0,
 						},
 					}
@@ -723,6 +718,9 @@
 					name: [{
 						required: true, message: '请输入名称', trigger: 'blur'
 					}],
+					// materialCode: [{
+					// 	required: true, message: '请输入物料编码', trigger: 'blur'
+					// }],
 					basePrice: [{
 						required: true, message: '请输入基本售价', trigger: 'blur'
 					}],
@@ -1086,7 +1084,7 @@
 			},
 		}
 		
-		tableloading = false
+		tableloading: boolean = true
 		tableRadio: any = {}
 		tableData: any = []
 		newtableData: any = []
@@ -1095,6 +1093,8 @@
 		tablePageSize: any = 10
 		tablePageNum: any = 1
 		
+		productDataList: any = []
+		
 		mounted() {
 			this.getAttribute()
 			this.timer = setInterval(() => {
@@ -1111,28 +1111,16 @@
 			this.tableSearchForm.stime = '2020-01-01';
 			this.tableSearchForm.etime = y+'-'+m+'-'+d;
 			this.etime = y+'-'+m+'-'+d;
-			this.getFinancialCode()
-			this.getTreeList();
-		}
-		getTreeList(){
-			api.treeList('maindataMaterialCategory').then((res : any) => {
-				console.log(res);
-				var data:any = [{
-					id: 0,
-					name: '物料分类',
-					children: res.data
-				}];
-				(this as any).$refs.sideTree.setData(data);
-			})
+			// this.getFinancialCode()
 		}
 		// 确定商品新增
 		confirmProduct(e : any) {
-			console.log(e);
 			this.$nextTick(() => {
 				let nowData = (this.$refs.makeupTable as any).getValue();
 				let names = '';
 				if (e.length > 0) {
 					for (const item of e) {
+						this.productDataList.push(item)
 						let t = true;
 						for (const t_item of nowData) {
 							if (item.id == t_item.materialSkuId) {
@@ -1167,9 +1155,11 @@
 		//点击树获取数据
 		onChangeTree(e : any) {
 			this.categoryIds = e.id;
+			var ids:any = e.id;
+			if(e.id[0]==0) ids = 0;
 			let loading = this.$loading({ target: '.main-container' });
 			api.byCategoryPage({
-				categoryId: e.id,
+				categoryId: ids,
 				pageSize: 20,
 				pageNo: 1,
 			}, 'maindataMaterialCategory').then((res : any) => {
@@ -1222,9 +1212,9 @@
 						// if (parseInt(v.height) <= 0) return this.$message.warning('物料属性高度不能小于1');
 						if (!v.skuTitle) return this.$message.warning('物料标题必填');
 						if (!v.skuCode) return this.$message.warning('物料编码必填');
-						if(v.weight&&v.weight!=0){
-							v.weight = v.weight/1000
-						}
+						// if(v.weight&&v.weight!=0){
+						// 	v.weight = v.weight/1000
+						// }
 					};
 					data = { maindataMaterialReceiveParam: query, maindataMaterialSkus: this.tableList }
 					let newArray : any = []
@@ -1266,12 +1256,13 @@
 						// if (parseInt(v.width) <= 0) return this.$message.warning('物料宽不能小于1');
 						// if (!v.height) return this.$message.warning('物料高必填');
 						// if (parseInt(v.height) <= 0) return this.$message.warning('物料高不能小于1');
-						if (!v.skuTitle) return this.$message.warning('物料标题必填');
-						if (!v.skuCode) return this.$message.warning('物料编码必填');
+						if (!v.skuTitle) return this.$message.warning('物料属性的标题必填');
+						if (!v.skuCode) return this.$message.warning('物料属性的物料编码必填');
 						
-						if(v.weight&&v.weight!=0){
-							v.weight = v.weight/1000
-						}
+						// if(v.weight&&v.weight!=0){
+						// 	v.weight = v.weight/1000
+						// }
+						v.ismakeup = 1
 					};
 					data.maindataMaterialSkus[0].isDeleted = 0;
 					data.maindataMaterialReceiveParam.attributeList = ""
@@ -1295,7 +1286,6 @@
 						if (res.code === 200) {
 							this.isShow = 'home';
 							// (this as any).$refs.sideTree.request();
-							this.getTreeList();
 							this.getDataList();
 							this.$message.success('保存成功');
 						}
@@ -1306,7 +1296,6 @@
 						if (res.code === 200) {
 							this.isShow = 'home';
 							// (this as any).$refs.sideTree.request();
-							this.getTreeList();
 							this.getDataList();
 							this.$message.success('保存成功');
 						}
@@ -1398,10 +1387,13 @@
 									this.towTable = '' // 表格数据
 									this.attributeList = []; // 属性规格
 									this.$nextTick(() => {
-										console.log(info.data);
+										// console.log(info.data);
 										info.data.map((v : any, i : any) => {
-											if(v.weight!='0.00'&&v.weight!=0&&v.weight!='0'){
-												v.weight = parseFloat(v.weight)*1000
+											// if(v.volume&&v.weight!='0.00'&&v.weight!=0&&v.weight!='0'){
+											// 	v.weight = parseFloat(v.weight)*1000
+											// }
+											if(v.volume&&v.volume!='0.00'&&v.volume!=0&&v.volume!='0'){
+												v.volume = parseFloat(v.volume).toFixed(2)
 											}
 										});
 										(this as any).$refs.singeTable.setValue(info.data);
@@ -1414,8 +1406,11 @@
 									info.data.map((v : any, i : any) => {
 										v = Object.assign(v, skuRuleList[i])
 										v.dataIndex = i
-										if(v.weight!='0.00'&&v.weight!=0&&v.weight!='0'){
-											v.weight = parseFloat(v.weight)*1000
+										// if(v.volume&&v.weight!='0.00'&&v.weight!=0&&v.weight!='0'){
+										// 	v.weight = parseFloat(v.weight)*1000
+										// }
+										if(v.volume&&v.volume!='0.00'&&v.volume!=0&&v.volume!='0'){
+											v.volume = parseFloat(v.volume).toFixed(2)
 										}
 									});
 									newColumns.map((v : any) => {
@@ -1659,6 +1654,11 @@
 		// 打开关联金蝶财务系统物料选择
 		openVxeData(){
 			this.vxeValue = true;
+			if(this.tableData.length==0){
+				setTimeout(()=>{
+					this.getFinancialCode();
+				},0)
+			}
 		}
 		// 获取关联金蝶财务系统物料列表
 		getFinancialCode(){
@@ -1703,17 +1703,17 @@
 				val = [{
 					skuTitle: this.tableRadio.fname,
 					skuSubtitle: this.tableRadio.fname,
-					skuCode: '',
+					// skuCode: '',
 					financialCode: this.tableRadio.fnumber,
-					price: '0',
+					// price: '0',
 					unit: this.tableRadio.fbaseUnitName,
 					unitCode: this.tableRadio.fbaseUnitCode,
-					shelfLife: '0',
-					weight: '0',
-					length: '0',
-					width: '0',
-					height: '0',
-					volume: '0',
+					// shelfLife: '0',
+					// weight: '0',
+					// length: '0',
+					// width: '0',
+					// height: '0',
+					// volume: '0',
 				}];
 			}else{
 				val[0].skuTitle = this.tableRadio.fname;
@@ -1722,7 +1722,6 @@
 				val[0].unit = this.tableRadio.fbaseUnitName;
 				val[0].unitCode = this.tableRadio.fbaseUnitCode;
 			}
-			console.log(222,val);
 			(this as any).$refs.singeTable.setValue(val);
 			(this as any).$refs.form.setValue(val2);
 			this.vxeValue = false;
@@ -1808,6 +1807,54 @@
 				e.volume = (e.length * e.width * e.height).toFixed(2);
 			}
 		}
+		// 监听组合商品表格数据
+		getMakeupTableValue(e : any) {
+			// console.log('监听表格 ==> ', e);
+			// console.log(this.productDataList)
+			this.volumeCount()
+		}
+		volumeCount(){
+			let nowData:any = (this.$refs.makeupTable as any).getValue();
+			var data:any = {
+				weight: 0,
+				length: 0,
+				width: 0,
+				height: 0
+			}
+			for (let i in this.productDataList) {
+				for (let j in nowData) {
+					if(this.productDataList[i].id==nowData[j].materialSkuId){
+						var number:any = 1;
+						if(nowData[j].number){
+							var number:any = parseFloat(nowData[j].number).toFixed(2);
+						}
+						if(this.productDataList[i].weight){
+							var weight:any = parseFloat(this.productDataList[i].weight).toFixed(2);
+							data.weight += weight*number;
+						}
+						if(this.productDataList[i].length){
+							var length:any = parseFloat(this.productDataList[i].length).toFixed(2);
+							data.length += length*number;
+						}
+						if(this.productDataList[i].width){
+							var width:any = parseFloat(this.productDataList[i].width).toFixed(2);
+							data.width += width*number;
+						}
+						if(this.productDataList[i].height){
+							var height:any = parseFloat(this.productDataList[i].height).toFixed(2);
+							data.height += height*number;
+						}
+					}
+				}
+			}
+			var val = (this as any).$refs.singeTable.getValue();
+			val[0].weight = data.weight;
+			val[0].length = data.length;
+			val[0].width = data.width;
+			val[0].height = data.height;
+			(this as any).$refs.singeTable.setValue(val);
+		}
+		
 		// 排序生成
 		forFun(data : any, i : number, v ?: any) {
 			if (data.list) {
@@ -1888,7 +1935,7 @@
 				type: 'warning',
 				center: true
 			}).then(() => {
-				console.log(this.tableList);
+				// console.log(this.tableList);
 				(this as any).tableList.map((v : any) => {
 					if (v.dataIndex === item.dataIndex) v.isDeleted = 1;
 				})
@@ -1925,18 +1972,30 @@
 		}
 		getPageList(query : any) {
 			let loading = this.$loading({ target: '.main-container' });
-			api.pageList(query, 'maindataMaterial').then((res : any) => {
-				if (res.code === 200) {
-					(this.$refs.moduleView as any).setTableValue(res.data.records);
-					let page = {
-						pageNo: res.data.current, //当前页
-						pageSize: res.data.size, //每页条数
-						total: res.data.total //总条数
-					};
-					(this.$refs.moduleView as any).setPage(page);
-					loading.close();
-				} else this.$message.error(res.msg);
-			})
+			api.treeList('maindataMaterialCategory').then((treeRes : any) => {
+				if(treeRes.code==200){
+					api.pageList(query, 'maindataMaterial').then((res : any) => {
+						if (res.code === 200) {
+							
+							var data:any = [{
+								id: 0,
+								name: '物料分类',
+								children: treeRes.data
+							}];
+							(this as any).$refs.sideTree.setData(data);
+							
+							(this.$refs.moduleView as any).setTableValue(res.data.records);
+							let page = {
+								pageNo: res.data.current, //当前页
+								pageSize: res.data.size, //每页条数
+								total: res.data.total //总条数
+							};
+							(this.$refs.moduleView as any).setPage(page);
+							loading.close();
+						} else this.$message.error(res.msg);
+					}).catch(() => loading.close());
+				}
+			}).catch(() => loading.close());
 		}
 		// 工具栏方法
 		clickHandle(e : any) {
@@ -1957,27 +2016,44 @@
 				cancelButtonText: '取消',
 				type: 'warning',
 				center: true
-			}).then(() => {
+			}).then((res) => {
+				console.log(res)
 				let data = (this.$refs.makeupTable as any).getValue();// 获取表格数据
-				let i = -1;
-				let j = -1;
-				for (const v of data) {
-					i++;
-					if (v.id == item.id) {
-						break
-					}
-				};
-				for (const v of this.makeupList) {
-					j++;
-					if (v.id == item.id && item.isDeleted === 0) {
-						break
+				// let i = -1;
+				// let j = -1;
+				// for (const v of data) {
+				// 	i++;
+				// 	if (v.id == item.id) {
+				// 		break
+				// 	}
+				// };
+				// for (const v of this.makeupList) {
+				// 	j++;
+				// 	if (v.id == item.id && item.isDeleted === 0) {
+				// 		break
+				// 	}
+				// };
+				// this.makeupList[j].isDeleted = 1;
+				// data.splice(i, 1);
+				// this.productDataList.splice(i, 1);
+				for (var i = 0; i < data.length; i++) {
+					if(data[i].materialSkuId == item.materialSkuId){
+						if(item.isDeleted == 0){
+							this.makeupList[i].isDeleted = 1;
+						}
+						data.splice(i, 1);
+						this.productDataList.splice(i, 1)
 					}
 				};
-				this.makeupList[j].isDeleted = 1;
-				data.splice(i, 1);
 				(this.$refs.makeupTable as any).setValue(data);// 设置表格数据
 				this.$message.success('删除成功');
-			}).catch(() => this.$message.info('已取消删除'));
+				// setTimeout(()=> {
+				// 	this.volumeCount()
+				// }, 10);
+			}).catch((err) => {
+				this.$message.info('已取消删除');
+				console.log(err)
+			});
 		}
 		// 内页删除
 		pageDelete(item : any) {
@@ -1992,7 +2068,6 @@
 						this.$message.success('删除成功');
 						this.isShow = 'home';
 						// (this as any).$refs.sideTree.request();
-						this.getTreeList();
 						this.getDataList();
 					} else this.$message.error(res.msg);
 				}).catch(() => {});
@@ -2017,7 +2092,6 @@
 				other.deleteSpuAndSku({ ids: ids }, 'maindataMaterial').then((res : any) => {
 					if (res.code === 200) {
 						// (this as any).$refs.sideTree.request();
-						this.getTreeList();
 						this.getDataList();
 						this.$message.success('删除成功');
 					} else this.$message.error(res.msg);
@@ -2035,7 +2109,6 @@
 				other.deleteSpuAndSku({ ids: item.id }, 'maindataMaterial').then((res : any) => {
 					if (res.code === 200) {
 						// (this as any).$refs.sideTree.request();
-						this.getTreeList();
 						this.getDataList();
 						this.$message.success('删除成功');
 					} else this.$message.error(res.msg);
@@ -2046,7 +2119,6 @@
 		onRefresh() {
 			(this as any).$refs.moduleView.clearSearch();
 			// (this as any).$refs.sideTree.request();
-			this.getTreeList();
 			this.categoryIds = '';
 			this.getDataList();
 		}

+ 27 - 28
src/views/audit/supplier/index.vue

@@ -370,18 +370,6 @@
 			this.timer = setInterval(() => {
 				this.getDataList()
 			}, 300)
-			this.getTreeList();
-		}
-		getTreeList(){
-			api.treeList('maindataOrganizationCategory').then((res : any) => {
-				console.log(res);
-				var data:any = [{
-					id: 0,
-					name: '机构分类',
-					children: res.data
-				}];
-				(this as any).$refs.sideTree.setData(data);
-			})
 		}
 		//点击树获取数据
 		onChangeTree(e : any) {
@@ -469,21 +457,33 @@
 		}
 		getPageList(query : any) {
 			let loading = this.$loading({ target: '.main-container' });
-			api.pageList(query, 'maindataMaterialSupplier').then((res : any) => {
-				loading.close();
-				if (res.code === 200) {
-					res.data.records.map((v : any) => {
-						if (v.financeType === 'kingdee') v.financeType2 = '金蝶K3';
-						if (v.financeType === 'yonbip') v.financeType2 = '用友U8';
-					});
-					(this.$refs.moduleView as any).setTableValue(res.data.records);
-					let page = {
-						pageNo: res.data.current, //当前页
-						pageSize: res.data.size, //每页条数
-						total: res.data.total //总条数
-					};
-					(this.$refs.moduleView as any).setPage(page);
-				} else this.$message.error(res.msg);
+			api.treeList('maindataOrganizationCategory').then((treeRes : any) => {
+				if(treeRes.code==200){
+					api.pageList(query, 'maindataMaterialSupplier').then((res : any) => {
+						loading.close();
+						if (res.code === 200) {
+							
+							var data:any = [{
+								id: 0,
+								name: '机构分类',
+								children: treeRes.data
+							}];
+							(this as any).$refs.sideTree.setData(data);
+							
+							res.data.records.map((v : any) => {
+								if (v.financeType === 'kingdee') v.financeType2 = '金蝶K3';
+								if (v.financeType === 'yonbip') v.financeType2 = '用友U8';
+							});
+							(this.$refs.moduleView as any).setTableValue(res.data.records);
+							let page = {
+								pageNo: res.data.current, //当前页
+								pageSize: res.data.size, //每页条数
+								total: res.data.total //总条数
+							};
+							(this.$refs.moduleView as any).setPage(page);
+						} else this.$message.error(res.msg);
+					}).catch(() => loading.close());
+				}
 			}).catch(() => loading.close());
 		}
 		// 工具栏方法
@@ -537,7 +537,6 @@
 		onRefresh() {
 			(this as any).$refs.moduleView.clearSearch();
 			// (this as any).$refs.sideTree.request();
-			this.getTreeList();
 			this.categoryIds = '';
 			this.getDataList();
 		}

+ 23 - 11
src/views/audit/virtually/index.vue

@@ -338,17 +338,29 @@
 		}
 		getPageList(query : any) {
 			let loading = this.$loading({ target: '.main-container' });
-			api.pageList(query, 'maindataMaterialVmcategory').then((res : any) => {
-				loading.close();
-				if (res.code === 200) {
-					(this.$refs.moduleView as any).setTableValue(res.data.records);
-					let page = {
-						pageNo: res.data.current, //当前页
-						pageSize: res.data.size, //每页条数
-						total: res.data.total //总条数
-					};
-					(this.$refs.moduleView as any).setPage(page);
-				} else this.$message.error(res.msg);
+			api.treeList('maindataMaterialVmcategory').then((treeRes : any) => {
+				if(treeRes.code==200){
+					api.pageList(query, 'maindataMaterialVmcategory').then((res : any) => {
+						if (res.code === 200) {
+							
+							var data:any = [{
+								id: 0,
+								name: '虚拟分类',
+								children: treeRes.data
+							}];
+							(this as any).$refs.sideTree.setData(data);
+								
+							(this.$refs.moduleView as any).setTableValue(res.data.records);
+							let page = {
+								pageNo: res.data.current, //当前页
+								pageSize: res.data.size, //每页条数
+								total: res.data.total //总条数
+							};
+							(this.$refs.moduleView as any).setPage(page);
+							loading.close();
+						} else this.$message.error(res.msg);
+					}).catch(() => loading.close());
+				}
 			}).catch(() => loading.close());
 		}
 		// 工具栏方法