AlanWong il y a 2 ans
Parent
commit
fd544336d2

+ 1 - 1
src/benyun/components/byInput/byInput.vue

@@ -1,6 +1,6 @@
 <template>
   <el-input 
-    v-model="value" 
+    v-model="value"
     :placeholder="attrs.placeholder?attrs.placeholder:'请输入内容'"
     :maxlength="attrs.maxlength"
     :minlength="attrs.minlength"

+ 3 - 1
src/benyun/components/byTable/byTable.vue

@@ -155,7 +155,9 @@ export default class ByTable extends VueViews {
       }
     })
   }
-
+	setTableConfig(arr : any) {
+		if(arr) this.setConfig(arr)
+	}
   //点击详情
   detail(row:any){
     let data = (this as any).$lodash.cloneDeep(row);

+ 215 - 25
src/components/ForTab/index.vue

@@ -1,45 +1,235 @@
 <template>
-	<div>
-		<el-tag :key="tag" v-for="tag in dynamicTags" closable :disable-transitions="false" @close="handleClose(tag)">
-			{{tag}}
-		</el-tag>
-		<el-input class="input-new-tag" v-if="inputVisible" v-model="inputValue" ref="saveTagInput" size="small"
-			@keyup.enter.native="handleInputConfirm" @blur="handleInputConfirm">
-		</el-input>
-		<el-button v-else class="button-new-tag" size="small" @click="showInput">+ New Tag</el-button>
+	<div class="by-tab">
+		<div v-for="(item,index) of columns" :key="index">
+			<div class="title">{{item.title}} <i class="el-icon-circle-close" @click="closeGroup(index)"></i> </div>
+			<el-tag class="item-tab" :disable-transitions="true" :key="i" v-for="(tag,i) of item.list" closable
+				@close="handleClose(tag,index)">
+				{{tag}}
+			</el-tag>
+			<by-input class="input-new-tag" :ref="'getValue_'+index"></by-input>
+			<el-button class="button-new-tag" @click="showInput(index)">添加</el-button>
+		</div>
+		<div style="margin: 20px 0;" v-if="!isAdd" key='item'>
+			<button class="el-button mr15 el-button--primary el-button--small" @click="isAdd=true">添加新规格</button>
+			<button class="el-button el-button--success el-button--small" @click="generateNow">立即生成</button>
+		</div>
+		<div style="display: flex;margin: 20px 0;" v-else key='item2'>
+			<div class="flex-item">
+				<label>规格:</label>
+				<div class="el-input el-input--small" style="width: 250px;">
+					<input type="text" v-model="norms" placeholder="请输入规格" class="el-input__inner">
+				</div>
+			</div>
+			<div class="flex-item">
+				<label>规格值:</label>
+				<div class="el-input el-input--small" style="width: 250px;">
+					<input type="text" v-model="normsValue" placeholder="请输入规格值" class="el-input__inner">
+				</div>
+			</div>
+			<button @click="doComfirm" class="el-button el-button--primary el-button--small"><span>确定</span></button>
+			<button @click="isAdd=false" class="el-button el-button--danger el-button--small"><span>取消</span></button>
+		</div>
+		<div v-if="isTable"><by-table :propConfig="config" ref="table"></by-table></div>
 	</div>
 </template>
 
 <script lang="ts">
 	import { Component, Prop, Vue, Mixins, Watch } from "vue-property-decorator";
-	import VueViews from '@/benyun/compVue/VueViews'
+	import VueViews from '@/benyun/compVue/VueViews';
 	@Component
 	export default class Tab extends VueViews {
-		dynamicTags = ['标签一', '标签二', '标签三']
-		inputVisible = false
-		inputValue = ''
+		inputValue : any = ''
+		norms : any = ''
+		normsValue : any = ''
+		isAdd : any = false
+		isTable : any = false
+		tableData : any = ''
+		config : any = {
+			attr: {
+				size: 'mini',
+				height: 486,
+				align: 'center',
+			},
+			columns: [
+				{
+					title: '价格',
+					field: 'price',
+					component: 'by-input',
+					// compConfig: {
+					// 	attrs: {
+					// 		placeholder: 0
+					// 	}
+					// }
+				},
+				{
+					title: '库存',
+					field: 'stock',
+					component: 'by-input'
+				},
+				{
+					title: '保质期(天)',
+					field: 'shelfLife',
+					component: 'by-input'
+				},
+				{
+					title: '重量',
+					field: 'weight',
+					component: 'by-input'
+				},
+				{
+					title: '长',
+					field: 'length',
+					component: 'by-input'
+				},
+				{
+					title: '宽',
+					field: 'width',
+					component: 'by-input'
+				},
+				{
+					title: '高',
+					field: 'height',
+					component: 'by-input'
+				},
+				{
+					title: '体积',
+					field: 'volume',
+					component: 'by-input'
+				},
+				{
+					width: '80px',
+					title: '操作',
+					action: true,
+					plugins: [{
+						icon: 'el-icon-delete',
+						name: '删除',
+						audit: '',
+						event: {
+							click: (item : any) => {
+								(this as any).doDelete(item)
+							}
+						}
+					}]
+				}
+			]
+		}
+		columns : Array<any> = [
+			{
+				title: '尺寸',
+				field: 'title',
+				list: ['7.5', '5.8', '6.6']
+			},
+			{
+				title: '颜色',
+				field: 'color',
+				list: ['black', 'white', 'red']
+			}
+		]
 
-		handleClose(tag : any) {
-			this.dynamicTags.splice(this.dynamicTags.indexOf(tag), 1);
+		showInput(index : any) {
+			let inputValue = (this as any).$refs['getValue_' + index][0].getValue();
+			console.log(this.columns[index]);
+			if (this.columns[index].list.indexOf(inputValue) !== -1) return (this as any).$refs['getValue_' + index][0].clearValue();
+			if (inputValue) {
+				this.columns[index].list.push(inputValue);
+			}
+			(this as any).$refs['getValue_' + index][0].clearValue();
 		}
-		showInput() {
-			this.inputVisible = true;
-			this.$nextTick(() => {
-				(this as any).$refs.saveTagInput.$refs.input.focus();
+		// 立即生成
+		generateNow() {
+			this.isTable = true;
+			this.forFun(this.columns[0], 0);
+			let data = (this as any).$lodash.cloneDeep(this.config);
+			let newColumns = (this as any).$lodash.cloneDeep(this.columns).reverse();
+			// console.log(newColumns);
+			this.tableData.map((v : any, i : any) => {
+				v.dataIndex = i
+			})
+			newColumns.map((v : any) => {
+				data.columns.unshift({
+					title: v.title,
+					field: v.field
+				})
 			});
+			setTimeout(() => {
+				(this as any).$refs.table.setValue(this.tableData); // 设置表格数据
+				(this as any).$refs.table.setTableConfig(data); // 设置表格配置
+			}, 0)
 		}
-		handleInputConfirm() {
-			let inputValue = this.inputValue;
-			if (inputValue) {
-				this.dynamicTags.push(inputValue);
+		// 添加新规格
+		doComfirm() {
+			if (!this.normsValue || !this.norms) return (this as any).$message({ type: "warning", message: '请添加完整的规格!' })
+			let obj : any = {
+				title: this.norms,
+				list: [this.normsValue]
 			}
-			this.inputVisible = false;
-			this.inputValue = '';
+			this.columns.push(obj);
+			this.norms = '';
+			this.normsValue = '';
+			this.isAdd = false;
+		}
+		// 排序生成
+		forFun(data : any, i : number, v ?: any) {
+			if (data.list) {
+				let d : Array<any> = [];
+				// data.list = data.list.reverse()
+				data.list.forEach((item : any) => {
+					if (i == 0) { // 第一次循环
+						let obj : any = {}
+						obj[data.field] = item
+						d.push(obj);
+					} else {
+						// v = v.reverse()
+						v.forEach((ele : any) => {
+							let obj : any = {};
+							obj = (this as any).$lodash.clone(ele);
+							obj[data.field] = item
+							d.push(obj);
+						});
+					}
+				});
+				i++
+				if (this.columns[i]) {
+					this.forFun(this.columns[i], i, d);
+				}
+				else {
+					this.tableData = d;
+				}
+			}
+		}
+		// 删除表格数据
+		doDelete(item:any){
+			this.tableData.splice(item.dataIndex, 1);
+		}
+		// 删除标签
+		handleClose(tag : any, index : any) {
+			// console.log(tag);
+			this.columns[index].list.splice(this.columns[index].list.indexOf(tag), 1);
+		}
+		// 删除数组
+		closeGroup(index : any) {
+			this.columns.splice(index, 1)
 		}
-
 	}
 </script>
 
 <style lang="scss" scoped>
+	.by-tab {
+		.title {
+			// padding: 10px 0 0;
+		}
 
+		.item-tab {
+			margin-right: 16px;
+		}
+
+		.input-new-tag {
+			width: 130px;
+		}
+
+
+		.flex-item {
+			margin-right: 20px;
+		}
+	}
 </style>

+ 8 - 2
src/views/audit/agencyGoods/index.vue

@@ -282,8 +282,14 @@
 			clearInterval(this.timer)
 			let query = (this.$refs.moduleView as any).getQuery();
 			query.parentId = this.parentId;
-			console.log('表单字段 ==> ', query);
-			api.pageList(query, 'maindataMaterialOrganizationCategory').then((res : any) => {
+			let newData:any = {}
+			for (let key in query) {
+				if (query[key].toString()) {
+					newData[key] = query[key]
+				}
+			}
+			console.log('表单字段 ==> ', newData);
+			api.pageList(newData, 'maindataMaterialOrganizationCategory').then((res : any) => {
 				if (res.code === 200) {
 					(this.$refs.moduleView as any).setTableValue(res.data.records);
 					let page = {

+ 0 - 6
src/views/audit/binTable/index.vue

@@ -8,12 +8,6 @@
 		<!-- 新增/编辑弹窗 -->
 		<el-dialog :title="popTitle+'仓位'" :visible.sync="dialogFormVisible" width="30%">
 			<by-form :propConfig="addConfig" ref="addFormId">
-				<template v-slot:logo>
-					<el-upload :limit='1' :action="baseURL+'/file/upload'" list-type="picture-card"
-						:on-preview="handlePictureCardPreview" :on-remove="handleRemove">
-						<i class="el-icon-plus"></i>
-					</el-upload>
-				</template>
 				<template v-slot:status class="clearfix">
 					<el-radio class="fl" style="margin-top: 8px;" v-model="radio" :label="0">显示</el-radio>
 					<el-radio class="fl" style="margin-top: 8px;" v-model="radio" :label="1">禁用</el-radio>

+ 9 - 9
src/views/audit/productClassification/index.vue

@@ -34,7 +34,7 @@
 	export default class ProductClassification extends Vue {
 		// 左边
 		data : any = []
-		parentId:any=''
+		parentId : any = ''
 		props = {
 			label: 'name',
 			children: 'children'
@@ -279,12 +279,12 @@
 			clearInterval(this.timer)
 			let query = (this.$refs.moduleView as any).getQuery();
 			query.parentId = this.parentId;
-			let newData:any = {}
+			let newData : any = {}
 			for (let key in query) {
-				if (query[key] && query[key].toString().replaceAll(/(^\s*)|(\s*$)/g, '') !== '') {
-					newData[key]=query[key]
+				if (query[key].toString()) {
+					newData[key] = query[key]
 				}
-			}			
+			}
 			console.log('表单字段 ==> ', newData);
 			api.pageList(newData, 'maindataMaterialCategory').then((res : any) => {
 				if (res.code === 200) {
@@ -320,8 +320,8 @@
 			this.popTitle = '编辑'
 			this.dialogFormVisible = true;
 			this.radio = e.status
-			api.single({id:e.parentId},'maindataMaterialCategory').then((res:any) =>{
-				if(res.code===200){
+			api.single({ id: e.parentId }, 'maindataMaterialCategory').then((res : any) => {
+				if (res.code === 200) {
 					e.parentName = res.data.name
 					setTimeout(() => {
 						if ((this as any).$refs.addFormId) (this as any).$refs.addFormId.setValue(e);
@@ -383,7 +383,7 @@
 								});
 							} else this.failHandle(res)
 						})
-					}else this.$message({ type: 'error', message: '删除失败!请稍后再试' })
+					} else this.$message({ type: 'error', message: '删除失败!请稍后再试' })
 				})
 			}).catch(() => {
 				this.$message({
@@ -394,7 +394,7 @@
 		}
 		// 导航切换
 		handleNodeClick(e : any) {
-			this.parentId=e.id
+			this.parentId = e.id
 			api.childrenTreeList({ id: e.id }, 'maindataMaterialCategory').then((res : any) => {
 				if (res.code === 200) {
 					(this.$refs.moduleView as any).setTableValue(res.data);

+ 45 - 32
src/views/audit/productManagement/index.vue

@@ -21,11 +21,19 @@
 							</el-input>
 						</template>
 						<template v-slot:radio>
-							<el-radio v-model="radio" :label="1">单规格</el-radio>
-							<el-radio v-model="radio" :label="2">多规格</el-radio>
+							<el-radio v-model="radio" :label="1" @input="isSingle=true">单规格</el-radio>
+							<el-radio v-model="radio" :label="2" @input="isSingle=false">多规格</el-radio>
 						</template>
 						<template v-slot:attribute>
-							<div>物料属性</div>
+							<div v-if="isSingle">
+								<el-select v-model="selectValue" clearable placeholder="请选择" style="width: 19.5%;">
+									<el-option v-for="item in selectList" :key="item.value" :label="item.name" :value="item.id">
+									</el-option>
+								</el-select>
+							</div>
+							<div v-if="!isSingle">
+								<ForTab />
+							</div>
 						</template>
 						<template v-slot:status>
 							<el-radio v-model="radioStatus" :label="1">启用</el-radio>
@@ -50,10 +58,12 @@
 	import { Component, Prop, Vue, Watch } from "vue-property-decorator";
 	import api from '@/api/currency'
 	import other from '@/api/other'
-	@Component({})
+	import ForTab from "@/components/ForTab/index.vue";
+	@Component({ components: { ForTab } })
 	export default class productManagement extends Vue {
 		isShow = 'home'
 		isClick = false
+		isSingle : any = true
 		timeNum = 0;
 		timer : any = null
 		data : any = []
@@ -63,8 +73,11 @@
 		issued : any = 1
 		textarea : any = ''
 		categoryId : any = ''
+		selectList = []
+		selectValue = ''
 		props = {
 			label: 'name',
+			value: 'id',
 			children: 'children'
 		}
 		toolConfig = {
@@ -307,25 +320,6 @@
 					}
 				],
 				[
-					// {
-					// 	span: 6,
-					// 	label: '物料属性表',
-					// 	prop: 'select',
-					// 	component: 'select-tree',
-					// 	compConfig:{
-					// 	  attr:{
-					// 	    label:'name',
-					// 	    clearable:true,
-					// 	    retConfig:{
-					// 	      treeName:'name',
-					// 	      treeId:'id'
-					// 	    }
-					// 	  },
-					// 	  request:{
-					// 	    url:'/maindata/maindataMaterialAttribute/page'
-					// 	  }
-					// 	}
-					// }
 				],
 				[
 					{
@@ -345,20 +339,28 @@
 				],
 				[
 					{
-						span: 20,
-						label: '物料状态',
+						span: 30,
+						label: '物料属性',
 						slot: true,
-						prop: 'status',
+						prop: 'attribute',
 					}
 				],
 				[
 					{
 						span: 20,
-						label: '是否组合商品',
+						label: '物料状态',
 						slot: true,
-						prop: 'ismakeup',
+						prop: 'status',
 					}
 				],
+				// [
+				// 	{
+				// 		span: 20,
+				// 		label: '是否组合商品',
+				// 		slot: true,
+				// 		prop: 'ismakeup',
+				// 	}
+				// ],
 				[
 					{
 						span: 20,
@@ -560,10 +562,20 @@
 		}
 		mounted() {
 			this.getTreeList()
+			this.getAttribute()
 			this.timer = setInterval(() => {
 				this.getDataList()
 			}, 500)
 		}
+		// 获取物料属性
+		getAttribute() {
+			api.pageList({}, 'maindataMaterialAttribute').then((res : any) => {
+				if (res.code === 200) {
+					this.selectList = res.data.records
+					console.log(this.selectList);
+				} else this.failHandle(res)
+			})
+		}
 		// 获取树型导航数据
 		getTreeList() {
 			api.treeList('maindataMaterialCategory').then((res : any) => {
@@ -585,13 +597,13 @@
 			clearInterval(this.timer)
 			let query = (this.$refs.moduleView as any).getQuery();
 			query.categoryId = this.categoryId;
-			let newData:any = {}
+			let newData : any = {}
 			for (let key in query) {
-				if (query[key] && query[key].toString().replaceAll(/(^\s*)|(\s*$)/g, '') !== '') {
-					newData[key]=query[key]
+				if (query[key].toString()) {
+					newData[key] = query[key]
 				}
 			}
-			console.log('表单字段 ==> ', newData);
+			// console.log('表单字段 ==> ', newData);
 			api.pageList(newData, 'maindataMaterial').then((res : any) => {
 				if (res.code === 200) {
 					(this.$refs.moduleView as any).setTableValue(res.data.records);
@@ -655,6 +667,7 @@
 		getDetail(e : any) {
 			this.isClick = true;
 			this.isShow = 'add';
+			// (this as any).getAttribute();
 			(this as any).$refs.form.setValue(e)
 		}
 		// 工具栏删除

+ 8 - 2
src/views/audit/virtually/index.vue

@@ -278,8 +278,14 @@
 			clearInterval(this.timer)
 			let query = (this.$refs.moduleView as any).getQuery();
 			query.parentId = this.parentId;
-			console.log('表单字段 ==> ', query);
-			api.pageList(query, 'maindataMaterialVmcategory').then((res : any) => {
+			let newData:any = {}
+			for (let key in query) {
+				if (query[key].toString()) {
+					newData[key] = query[key]
+				}
+			}
+			console.log('表单字段 ==> ', newData);
+			api.pageList(newData, 'maindataMaterialVmcategory').then((res : any) => {
 				if (res.code === 200) {
 					(this.$refs.moduleView as any).setTableValue(res.data.records);
 					let page = {

+ 1 - 1
src/views/demo/index.vue

@@ -65,7 +65,7 @@ export default class DemoIndex extends Vue {
   ]
 
   created(){
-    this.forFun(this.arr[0],0)
+    // this.forFun(this.arr[0],0)
   }
 
   forFun(data:any,i:number,v?:any){

+ 3 - 3
src/views/demo/tab.vue

@@ -6,10 +6,10 @@
 
 <script lang="ts">
 	import { Component, Vue } from "vue-property-decorator";
-	// import ForTab from "@/components/ForTab/index.vue";
-	@Component
+	import ForTab from "@/components/ForTab/index.vue";
+	@Component({ components: { ForTab } })
 	export default class Test extends Vue {
-		
+
 	}
 </script>