AlanWong 1 рік тому
батько
коміт
33df8a87a5

+ 1 - 1
src/components/productDialog/productDialog.vue

@@ -150,7 +150,7 @@ export default class ProductDialog extends Vue {
         size:'mini',
         seq:true,
         align:'center',
-        // checkbox:true
+        triggerRowCheck: 'row'
       },
       columns:[{
         title:'编码',

+ 13 - 12
src/views/audit/orderTask/components/productModal.vue

@@ -1,6 +1,6 @@
 <template>
-	<vxe-modal v-model="value" id="productDialogModal" :width="width?width+'px':'80%'" @show="show"
-		:height="height?height+'px':'80%'" min-width="500" min-height="400" show-zoom resize transfer show-footer
+	<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">
 		<template #title>
 			<span>选择商品</span>
@@ -60,39 +60,40 @@
 				attr: {
 					size: 'mini',
 					seq: true,
-					align: 'center',
+					align: 'left',
 					checkbox:true,
-					pageSize: 10
+					triggerRowCheck: 'row',
+					height:'520px'
 				},
 				columns:
 					[
 						{
 							title: '标题',
 							field: 'skuTitle',
-							// width: 150
+							width: 300
 						},
 						{
 							title: '副标题',
 							field: 'skuSubtitle',
-							// width: 150
+							width: 300
 						},
 						{
 							title: '规格',
-							field: 'materialSpec'
+							field: 'materialSpec',
+							width: 300
 						},
 						{
 							title: '单位',
-							field: 'unit'
+							field: 'unit',
+							width: 300
 						},
 						{
 							title: '单价',
-							field: 'price'
+							field: 'price',
+							width: 300
 						},
 					]
 			},
-			// request:{
-			//   url:'/system/maindataMaterial/page'
-			// }
 		}
 		brandData : Array<any> = []
 

+ 20 - 12
src/views/audit/orderTask/index.vue

@@ -95,8 +95,10 @@
 								prop: 'deliveryData',
 								component: 'by-date-picker',
 								compConfig: {
-									format: 'yyyy-MM-dd hh:ss:mm',
-									type: 'datetime',
+									attr: {
+										format: 'yyyy-MM-dd hh:ss:mm',
+										type: 'datetime',
+									},
 								}
 							},
 							{
@@ -261,8 +263,10 @@
 								prop: 'deliveryData',
 								component: 'by-date-picker',
 								compConfig: {
-									format: 'yyyy-MM-dd hh:ss:mm',
-									type: 'datetime'
+									attr: {
+										format: 'yyyy-MM-dd hh:ss:mm',
+										type: 'datetime',
+									},
 								}
 							},
 							{
@@ -414,8 +418,10 @@
 								prop: 'deliveryData',
 								component: 'by-date-picker',
 								compConfig: {
-									format: 'yyyy-MM-dd hh:ss:mm',
-									type: 'datetime'
+									attr: {
+										format: 'yyyy-MM-dd hh:ss:mm',
+										type: 'datetime',
+									},
 								}
 							},
 							{
@@ -566,8 +572,10 @@
 								prop: 'deliveryData',
 								component: 'by-date-picker',
 								compConfig: {
-									format: 'yyyy-MM-dd hh:ss:mm',
-									type: 'datetime'
+									attr: {
+										format: 'yyyy-MM-dd hh:ss:mm',
+										type: 'datetime',
+									},
 								}
 							},
 							{
@@ -735,8 +743,10 @@
 								prop: 'deliveryData',
 								component: 'by-date-picker',
 								compConfig: {
-									format: 'yyyy-MM-dd hh:ss:mm',
-									type: 'datetime'
+									attr: {
+										format: 'yyyy-MM-dd hh:ss:mm',
+										type: 'datetime',
+									},
 								}
 							},
 							{
@@ -877,7 +887,6 @@
 						query.suborderList.splice(i, 1)
 					}
 				});
-				if (query.deliveryData) query.deliveryData = query.deliveryData + ' 00:00:00';
 				console.log('保存参数query ==> ', query);
 				let loading = this.$loading({ target: '.main-container' });
 				if (this.isAdd) {
@@ -1178,7 +1187,6 @@
 			if (e === 'bill') {
 				let billConfig = (this as any).$lodash.cloneDeep(this.config.bill);
 				billConfig.tool.tools = {};
-				billConfig.tool.customTools = [];
 				(this.$refs.bill as any).setBillConfig(billConfig);
 			}
 		}

+ 36 - 0
src/views/audit/productManagement/components/brandType.vue

@@ -0,0 +1,36 @@
+<template>
+	<div>
+		<el-select v-model="value" placeholder="请选择物料品牌" style="width: 100%;" @change="change">
+			<el-option v-for="(item,index) in options" :key="index" :value="item.id" :label="item.name">
+			</el-option>
+		</el-select>
+	</div>
+</template>
+
+<script lang="ts">
+	import { Component, Prop, Vue, Watch } from "vue-property-decorator";
+	import api from "@/api/currency";
+	@Component
+	export default class BrandType extends Vue {
+		@Prop()
+		propValue : any;
+		value : any = '';
+		options : any = []
+		@Watch('propValue')
+		propValueChange(v : any) {
+			this.value = v;
+		};
+		created() {
+			api.pageList({
+				pageNo: 1, pageSize: 999
+			}, 'maindataMaterialBrand').then((res : any) => {
+				if (res.code === 200) {
+					this.options = res.data.records;
+				}
+			});
+		}
+		change(e : any) {
+			this.$emit('onChange', e)
+		}
+	}
+</script>

+ 200 - 54
src/views/audit/productManagement/index.vue

@@ -36,6 +36,12 @@
 						<template v-slot:ismakeup>
 							<el-radio v-model="ismakeup" :label="0">是</el-radio>
 							<el-radio v-model="ismakeup" :label="1">否</el-radio>
+							<el-button v-show="ismakeup===0" @click="openMakeup">选择商品</el-button>
+						</template>
+						<template v-slot:makeupTable>
+							<div v-if="makeupList.length>0">
+								<by-table :propConfig="makeupTable" ref="makeupTable"></by-table>
+							</div>
 						</template>
 						<template v-slot:issued>
 							<el-radio v-model="issued" :label="0">是</el-radio>
@@ -107,6 +113,9 @@
 				</div>
 			</div>
 		</transition-group>
+		<!-- 选择物料 -->
+		<productModal ref="product" :mulit="true" @confirm="confirmProduct" />
+		<!-- <productDialog ref="product" :mulit="true" @confirm="confirmProduct" /> -->
 	</div>
 </template>
 <script lang="ts">
@@ -114,7 +123,9 @@
 	import api from '@/api/currency'
 	import other from '@/api/other'
 	import ForTab from "@/components/ForTab/index.vue";
-	@Component({ components: { ForTab } })
+	import productModal from "../orderTask/components/productModal.vue";
+	import brandType from "./components/brandType.vue";
+	@Component({ components: { ForTab, productModal, brandType } })
 	export default class productManagement extends Vue {
 		tagsData : any = [] // 标签值
 		isShow = 'home'
@@ -125,7 +136,7 @@
 		timer : any = null
 		materialSpec : any = 0
 		status : any = 0
-		ismakeup : any = 0
+		ismakeup : any = 1
 		issued : any = 0
 		textarea : any = ''
 		categoryIds : any = ''
@@ -144,6 +155,7 @@
 		tableList : any = ''
 		attributeId : any = ''
 		intercept : any = ''
+		makeupList : any = [] // 组合商品列表
 		// tab
 		toolConfig = {
 			tools: {
@@ -472,6 +484,48 @@
 				}
 			]
 		}
+		makeupTable : any = {
+			attr: {
+				size: 'mini',
+				align: 'center',
+			},
+			columns: [
+				{
+					width: '170px',
+					title: '标题',
+					field: 'skuTitle',
+				},
+				{
+					width: '170px',
+					title: '副标题',
+					field: 'skuSubtitle',
+				},
+				{
+					width: '170px',
+					title: '数量',
+					field: 'number',
+					component: 'by-input',
+					compConfig: {
+						attr: {
+							size: 'mini',
+							defaultValue: '1',
+							type: 'number'
+						},
+					}
+				},
+				{
+					width: 120,
+					title: '操作',
+					action: true,
+					plugins: [{
+						name: '删除',
+						event: {
+							click: (item : any) => (this as any).deleteMakeup(item)
+						}
+					}]
+				}
+			]
+		}
 		formConfig = {
 			attr: {
 				size: 'medium',
@@ -483,7 +537,10 @@
 						required: true, message: '请输入基本售价', trigger: 'blur'
 					}],
 					categoryName: [{
-						required: true, message: '请输入物料分类', trigger: 'change'
+						required: true, message: '请选择物料分类', trigger: 'change'
+					}],
+					brandId: [{
+						required: true, message: '请选择物料品牌', trigger: 'change'
 					}],
 				}
 			},
@@ -608,6 +665,12 @@
 							}
 						}
 					},
+					{
+						span: 6,
+						label: '物料品牌',
+						prop: 'brandId',
+						component: brandType,
+					},
 					{
 						span: 6,
 						label: '虚拟分类',
@@ -674,14 +737,22 @@
 						prop: 'status',
 					}
 				],
-				// [
-				// 	{
-				// 		span: 20,
-				// 		label: '是否组合商品',
-				// 		slot: true,
-				// 		prop: 'ismakeup',
-				// 	}
-				// ],
+				[
+					{
+						span: 20,
+						label: '组合商品',
+						slot: true,
+						prop: 'ismakeup',
+					}
+				],
+				[
+					{
+						span: 30,
+						label: '',
+						slot: true,
+						prop: 'makeupTable',
+					}
+				],
 				[
 					{
 						span: 20,
@@ -754,21 +825,6 @@
 								}
 							}
 						},
-						{
-							span: 6,
-							label: '基本售价',
-							prop: 'basePrice',
-							component: 'by-input',
-							labelWidth: '70px',
-							compConfig: {
-								attr: {
-									placeholder: '请输入基本售价',
-									clearable: true
-								}
-							},
-						},
-					],
-					[
 						{
 							span: 6,
 							label: '财务编号',
@@ -782,7 +838,7 @@
 								}
 							}
 						},
-					]
+					],
 				]
 			},
 			tool: {
@@ -790,8 +846,17 @@
 					add: true,
 					delete: true,
 					search: true,
-					refresh: true
-				}
+					refresh: true,
+				},
+				// customTools: [
+				// 	{
+				// 		name: '同步到财务系统', icon: 'el-icon-top', audit: [''], event: {
+				// 			click: () => {
+				// 				(this as any).syncSystem()
+				// 			}
+				// 		}
+				// 	},
+				// ]
 			},
 			table: {
 				attr: {
@@ -858,6 +923,44 @@
 				this.getDataList()
 			}, 500)
 		}
+		// 确定商品新增
+		confirmProduct(e : any) {
+			this.makeupList = e;
+			this.$nextTick(() => {
+				let nowData = (this.$refs.makeupTable as any).getValue();
+				let names = '';
+				if (e.length > 0) {
+					for (const item of e) {
+						let t = true;
+						for (const t_item of nowData) {
+							if (item.id == t_item.materialSkuId) {
+								if (!names) {
+									names = item.skuTitle
+								} else {
+									names = names + ',' + item.skuTitle
+								}
+								t = false;
+								break;
+							}
+						}
+						if (t) {
+							let obj : any = {};
+							obj.skuTitle = item.skuTitle
+							obj.skuSubtitle = item.skuSubtitle
+							// obj.materialId = item.materialId
+							obj.materialSkuId = item.id
+							nowData.push(obj);
+						}
+					};
+					(this as any).$refs.makeupTable.setValue(nowData) // 设置表格数据
+					if (names) {
+						this.$alert('商品 “' + names + '”已存在!', '提示', {
+							confirmButtonText: '确定',
+						});
+					}
+				}
+			})
+		}
 		//点击树获取数据
 		onChangeTree(e : any) {
 			this.categoryIds = e.id;
@@ -885,7 +988,7 @@
 				query.attributeId = this.attributeId // 物料属性ID
 				query.status = this.status; // 物料状态
 				query.tags = this.tagsData.join(","); // 标签
-				// query.ismakeup = this.ismakeup; // 商品组合
+				query.ismakeup = this.ismakeup; // 商品组合
 				query.issued = this.issued; // 是否公布
 				query.description = this.textarea; // 备注
 				let data : any = {}
@@ -954,31 +1057,43 @@
 					data.maindataMaterialSkus[0].isDeleted = 0;
 					data.maindataMaterial.attributeList = ""
 				}
-				// console.log('data ==> ', data);
-				let loading = this.$loading({ target: '.main-container' });
-				if (this.isEdit) { // 编辑
-					other.updateSpuAndSku(data, 'maindataMaterial').then((res : any) => {
-						loading.close()
-						if (res.code === 200) {
-							this.isShow = 'home';
-							(this as any).$refs.sideTree.request();
-							this.getDataList();
-							this.$message.success('保存成功');
-						}
-					}).catch(() => loading.close());
-					// 新增
-				} else {
-					other.saveSpuAndSku(data, 'maindataMaterial').then((res : any) => {
-						loading.close()
-						if (res.code === 200) {
-							this.isShow = 'home';
-							(this as any).$refs.sideTree.request();
-							this.getDataList();
-							this.$message.success('保存成功');
-						}
-					}).catch(() => loading.close());
+				console.log('data ==> ', data);
+				if (this.ismakeup === 0) {
+					if (this.makeupList.length <= 0) return this.$message.warning('请选择组合商品');
+					let makeupData = (this as any).$refs.makeupTable.getValue();
+					for (let v of makeupData) {
+						if (parseInt(v.number) <= 0) return this.$message.warning('组合商品数量不能小于1');
+						v.materialId = data.maindataMaterial.id
+					};
+					console.log(makeupData);
+					api.saveList(makeupData, 'maindataMaterialLink').then((value : any) => {
+						console.log(value);
+					})
 				}
 
+				// let loading = this.$loading({ target: '.main-container' });
+				// if (this.isEdit) { // 编辑
+				// 	other.updateSpuAndSku(data, 'maindataMaterial').then((res : any) => {
+				// 		loading.close()
+				// 		if (res.code === 200) {
+				// 			this.isShow = 'home';
+				// 			(this as any).$refs.sideTree.request();
+				// 			this.getDataList();
+				// 			this.$message.success('保存成功');
+				// 		}
+				// 	}).catch(() => loading.close());
+				// } else {// 新增
+				// 	other.saveSpuAndSku(data, 'maindataMaterial').then((res : any) => {
+				// 		loading.close()
+				// 		if (res.code === 200) {
+				// 			this.isShow = 'home';
+				// 			(this as any).$refs.sideTree.request();
+				// 			this.getDataList();
+				// 			this.$message.success('保存成功');
+				// 		}
+				// 	}).catch(() => loading.close());
+				// }
+
 			});
 		}
 		// 打开新增
@@ -992,7 +1107,8 @@
 			this.tableList = [] // 表格数据
 			this.materialSpec = 0; // 单规格
 			this.status = 0; // 物料状态
-			this.ismakeup = 0; // 商品组合
+			this.ismakeup = 1; // 商品组合
+			this.makeupList = [] // 组合商品列表
 			this.issued = 0; // 是否公布
 			this.isSingle = true; // 显示单表格
 			this.isEdit = false; // 是否编辑
@@ -1083,6 +1199,10 @@
 					}).catch(() => loading.close());
 				}).catch(() => loading.close());
 			}).catch(() => loading.close());
+		}
+		// 同步到财务系统
+		syncSystem(){
+			
 		}
 		// 立即生成
 		generateNow() {
@@ -1189,6 +1309,10 @@
 				})
 			}).catch(() => { });
 		}
+		// 切换组合商品
+		openMakeup() {
+			(this.$refs.product as any).setShow(true); // 打开sku弹窗
+		}
 		// 切换商品规格
 		changeSingle() {
 			if (this.isSingle) {
@@ -1405,6 +1529,28 @@
 			if (e === 'onSave') this.doFormData();
 			if (e === 'onDelete') this.pageDelete(this.editInfo);
 		}
+		// 组合商品删除
+		deleteMakeup(item : any) {
+			this.$confirm('确定删除吗', '注意', {
+				confirmButtonText: '确定',
+				cancelButtonText: '取消',
+				type: 'warning',
+				center: true
+			}).then(() => {
+				let data = (this.$refs.makeupTable as any).getValue();// 获取表格数据
+				console.log(data);
+				let i = -1;
+				for (const v of data) {
+					i++;
+					if (v.id == item.id) {
+						break
+					}
+				};
+				data.splice(i, 1);
+				(this.$refs.makeupTable as any).setValue(data);// 设置表格数据
+				this.$message.success('删除成功');
+			}).catch(() => this.$message.info('已取消删除'));
+		}
 		// 内页删除
 		pageDelete(item : any) {
 			this.$confirm('确定删除吗,此操作不能撤销!', '注意', {

+ 76 - 7
src/views/audit/saleOrder/index.vue

@@ -1,7 +1,7 @@
 <template>
 	<div>
 		<by-bill :propConfig="config" @search="search" ref="bill" @resert="resert" @detail="openEdit" @onRefresh="resert"
-			@pagination="pagination" @clickTab="clickTab" @onOrder="onOrder">
+			@pagination="pagination" @clickTab="clickTab" @onOrder="onOrder" @onSave="onSave">
 		</by-bill>
 		<vxe-modal v-model="vxeValue" width="90%" height="90%" show-zoom resize transfer show-footer>
 			<template #title>
@@ -109,7 +109,7 @@
 					title: '订单任务',
 					search: {
 						attr: {
-							size: 'mini',
+							size: 'medium',
 						},
 						columns: [
 							[
@@ -143,8 +143,10 @@
 									prop: 'deliveryData',
 									component: 'by-date-picker',
 									compConfig: {
-										format: 'yyyy-MM-dd hh:ss:mm',
-										type: 'datetime'
+										attr: {
+											format: 'yyyy-MM-dd hh:ss:mm',
+											type: 'datetime',
+										},
 									}
 								},
 							],
@@ -223,6 +225,9 @@
 			// 单据
 			bill: {
 				tool: {
+					tools: {
+						save: true
+					},
 					customTools: []
 				},
 				log: {
@@ -234,7 +239,6 @@
 				form: {
 					attr: {
 						size: 'medium',
-						readonly: true,
 					},
 					columns: [
 						[
@@ -243,42 +247,79 @@
 								label: '单据编号',
 								prop: 'orderNumber',
 								component: 'by-input',
+								compConfig: {
+									attr: {
+										readonly: true,
+									},
+								}
 							},
 							{
 								span: 8,
 								label: '机构名称',
 								prop: 'organizationName',
 								component: 'by-input',
+								compConfig: {
+									attr: {
+										readonly: true,
+									},
+								}
 							},
 							{
 								span: 8,
 								label: '联系方式',
 								prop: 'phone',
 								component: 'by-input',
+								compConfig: {
+									attr: {
+										readonly: true,
+									},
+								}
 							},
 							{
 								span: 8,
 								label: '收货人',
 								prop: 'consignee',
 								component: 'by-input',
+								compConfig: {
+									attr: {
+										readonly: true,
+									},
+								}
 							},
 							{
 								span: 8,
 								label: '计划交货时间',
 								prop: 'planDeliveryData',
-								component: 'by-input',
+								component: 'by-date-picker',
+								compConfig: {
+									attr: {
+										format: 'yyyy-MM-dd hh:ss:mm',
+										type: 'datetime',
+										readonly: true,
+									},
+								}
 							},
 							{
 								span: 8,
 								label: '确定交货时间',
 								prop: 'affirmDeliveryData',
 								component: 'by-input',
+								compConfig: {
+									attr: {
+										readonly: true,
+									},
+								}
 							},
 							{
 								span: 8,
 								label: '交货地点',
 								prop: 'address',
 								component: 'by-input',
+								compConfig: {
+									attr: {
+										readonly: true,
+									},
+								}
 							},
 						],
 						[
@@ -292,7 +333,8 @@
 									attr: {
 										size: 'mini',
 										placeholder: '请输入备注',
-										type: 'textarea'
+										type: 'textarea',
+										readonly: false,
 									},
 								}
 							},
@@ -784,6 +826,20 @@
 				} else this.$message.error(res.msg)
 			}).catch(() => loading.close());
 		}
+		// 保存
+		onSave(){
+			let query = (this.$refs.bill as any).getBillFormValue(); // 获取单据数据
+			console.log('保存参数query ==> ', query);
+			let loading = this.$loading({ target: '.main-container' });
+			api.updateList(query, 'supplyPurchaseOrder').then((res : any) => {
+				loading.close();
+				if (res.code === 200) {
+					this.$message.success('保存成功');
+					this.getPageList({}, 'all'); // 综合数据
+					(this.$refs.bill as any).showTab = 'all';
+				} else this.$message.error(res.msg);
+			}).catch(() => loading.close());
+		}
 		// 打开编辑
 		openEdit(e : any) {
 			e = e.row ? e.row : e;
@@ -826,6 +882,19 @@
 						}
 					};
 					billConfig.tool.tools = {};
+					billConfig.form.columns[0].map((v:any) => {
+						v.compConfig.attr.readonly = true;
+					})
+					console.log(billConfig.form.columns[0]);
+					billConfig.form.columns[1][0].compConfig.attr.readonly = true;
+					if (parentData.status === 0) {
+						billConfig.form.columns[0][2].compConfig.attr.readonly = false;
+						billConfig.form.columns[0][3].compConfig.attr.readonly = false;
+						billConfig.form.columns[0][4].compConfig.attr.readonly = false;
+						billConfig.form.columns[0][6].compConfig.attr.readonly = false;
+						billConfig.form.columns[1][0].compConfig.attr.readonly = false;
+						billConfig.tool.tools = { save: true };
+					};
 					(this.$refs.bill as any).setBillConfig(billConfig);
 					(this.$refs.bill as any).setBillFormValue(parentData); // 设置单据表单数据
 					(this.$refs.bill as any).setBillTableValue(parentData.suborderList, 0);// 设置第1张单据表格数据

+ 1 - 1
src/views/audit/warehousing/components/businessType.vue

@@ -1,6 +1,6 @@
 <template>
 	<div>
-		<el-select v-model="value" placeholder="请选择" style="width: 100%;" @change="change">
+		<el-select v-model="value" placeholder="请选择业务类型" style="width: 100%;" @change="change">
 			<el-option v-for="(item,index) in options" :key="index" :value="item">
 			</el-option>
 		</el-select>

+ 0 - 1
src/views/audit/warehousing/index.vue

@@ -982,7 +982,6 @@
 			if (e === 'bill') {
 				let billConfig = (this as any).$lodash.cloneDeep(this.config.bill);
 				billConfig.tool.tools = {};
-				billConfig.tool.customTools = [];
 				(this.$refs.bill as any).setBillConfig(billConfig);
 			}
 		}

+ 1 - 1
vue.config.js

@@ -34,7 +34,7 @@ module.exports = defineConfig({
         ws:false,
         // target: `http://192.168.1.78:8080`,
         target: `http://192.168.2.202:8080`,
-        // target: `http://192.168.1.86:8080`,
+        // target: `http://192.168.1.134:8080`,
         changeOrigin: true,
         pathRewrite: {
           ['^' + process.env.VUE_APP_BASE_API]: ''