Procházet zdrojové kódy

修改参数设置

chenrui před 2 roky
rodič
revize
6b414404b8

+ 46 - 15
components/customPicker/checkBoxPicker.vue

@@ -28,6 +28,10 @@ export default {
 		code: {
 			type: String,
 			default: ''
+		},
+		val: {
+			type: String,
+			default: ''
 		}
 	},
 	data() {
@@ -38,28 +42,53 @@ export default {
 			list: []
 		};
 	},
-	created() {
-		this.getList();
-	},
 	methods: {
 		getList() {
-			if(this.code =='SALES_BILL_STATUS'){
-				this.list= [
-					{ id: 1099, isChecked: false,code:'WAIT_SUBMIT', dispName: '待提交' },
-					{ id: 1100, isChecked: false,code:'SALES_BILL_STATUS', dispName: '待审核' },
-					{ id: 1102, isChecked: false,code:'SALES_BILL_STATUS', dispName: '待出库' },
-					{ id: 1103, isChecked: false, code:'FINISH',dispName: '已完结' }
-				]
-			}else{
+			if (this.code == 'SALES_BILL_STATUS') {
+				var newList = [
+					{ id: 1099, isChecked: false, code: 'WAIT_SUBMIT', dispName: '待提交' },
+					{ id: 1100, isChecked: false, code: 'WAIT_AUDIT', dispName: '待审核' },
+					{ id: 1102, isChecked: false, code: 'WAIT_OUT_WAREHOUSE', dispName: '待出库' },
+					{ id: 1103, isChecked: false, code: 'FINISH', dispName: '已完结' }
+				];
+				if (this.val) {
+					//勾选上次选中值
+					let valArr = this.val.split(',');
+					newList.forEach(con => {
+						valArr.forEach(item => {
+							if (con.code == item) {
+								con.isChecked = true;
+							} else {
+								con.isChecked = false;
+							}
+						});
+					});
+				}
+				this.list = newList;
+			} else {
 				getLookUpDatas({
 					lookupCode: this.code,
 					pageNo: 1,
 					pageSize: 1000
 				}).then(result => {
-					if (result && result.status + '' === '200') {
-						result.data.list.forEach(con => {
-							con.isChecked = false
-						});
+					if (result && result.status == 200) {
+						if (this.val) {
+							//勾选上次选中值
+							let valArr = this.val.split(',');
+							result.data.list.forEach(con => {
+								valArr.forEach(item => {
+									if (con.code == item) {
+										con.isChecked = true;
+									} else {
+										con.isChecked = false;
+									}
+								});
+							});
+						} else {
+							result.data.list.forEach(con => {
+								con.isChecked = false;
+							});
+						}
 						this.list = result.data.list;
 					}
 				});
@@ -88,6 +117,8 @@ export default {
 		isShow(newValue, oldValue) {
 			if (!newValue) {
 				this.$emit('close');
+			} else {
+				this.getList();
 			}
 		}
 	}

+ 16 - 4
components/customPicker/redioPicker.vue

@@ -28,7 +28,11 @@
 			code:{
 				type: String,
 				default: ''
-			}	
+			},
+			val:{
+				type: String,
+				default: ''
+			}
 		},
 		data(){
 			return{
@@ -38,9 +42,6 @@
 				dataList:[]
 			}
 		},
-		created() {
-			this.getList();
-		},
 		methods:{
 			getList(){
 				getLookUpDatas({
@@ -48,6 +49,15 @@
 				}).then(result => {
 				  if (result && result.status + '' === '200') {
 				    this.dataList = result.data.list
+					//勾选上次选中值
+					if(this.val){
+						let pos=result.data.list.findIndex(item=>{
+							return item.code == this.val
+						})
+						if(pos != -1){
+							this.chooseFlag = pos
+						}
+					}
 				  }
 				})
 			},
@@ -76,6 +86,8 @@
 			isShow (newValue, oldValue) {
 				if (!newValue) {
 					this.$emit('close')
+				}else{
+					this.getList();
 				}
 			}
 		}