lilei 4 سال پیش
والد
کامیت
7e85dcbde0

+ 28 - 10
components/uni-check-list/uni-check-list.vue

@@ -3,9 +3,12 @@
 		<view>
 			<view class="selList" v-for="(item, index) in list" :key="index">
 				<view class="radios" @click="chooseItem(item)">
-					<radio v-if="types == 'radio'" :checked="item.checked" :value="item.id" />
-					<checkbox v-if="types == 'checkbox'" :checked="item.checked" :value="item.id" />
-					<text>{{ item[titleKeys] }}</text>
+					<view v-if="checkIconPositon=='right'" style="flex-grow: 1;" class="title">{{ item[titleKeys] }}</view>
+					<view>
+						<radio v-if="types == 'radio'" :checked="item.checked" :value="item.id" />
+						<checkbox v-if="types == 'checkbox'" :checked="item.checked" :value="item.id" />
+					</view>
+					<view v-if="checkIconPositon=='left'" class="title">{{ item[titleKeys] }}</view>
 				</view>
 				<view class="details" @click="rightClick(item)">
 					<slot name="right"></slot>
@@ -46,11 +49,23 @@ export default {
 			type: Boolean,
 			default: true
 		},
+		// 赋值,格式要和backValue 一致
 		defValue: {
 			type: Array,
 			default: function() {
 				return [];
 			}
+		},
+		// 返回结果是
+		// idArr: [id,id,id...],objArr:[obj,obj,obj...]
+		backValue:{
+			type: String,
+			default: 'idArr'
+		},
+		// 选择按钮位置,left ,right
+		checkIconPositon:{
+			type: String,
+			default: 'left'
 		}
 	},
 	data() {
@@ -74,16 +89,18 @@ export default {
 	methods: {
 		hasCheck() {
 			this.list.map(item => {
-				let a = this.value.indexOf(item.id);
-				item.checked = a >= 0;
-			});
-			this.list.splice();
+				let a = this.value.findIndex(k=>{
+					return this.backValue == 'idArr' ? k == item.id : k.id == item.id
+				})
+				item.checked = a>=0
+			})
+			this.list.splice()
 		},
 		// 选中
 		chooseItem(item) {
 			// 单选
 			if (this.types == 'radio') {
-				this.value[0] = item.id;
+				this.value[0] = this.backValue == 'idArr' ? item.id : item;
 				this.$emit('ok', this.value);
 			} else {
 				// 取消选中
@@ -91,7 +108,7 @@ export default {
 					let index = this.value.indexOf(item.id);
 					this.value.splice(index, 1);
 				} else {
-					this.value.push(item.id);
+					this.value.push(this.backValue == 'idArr' ? item.id : item);
 				}
 			}
 			this.hasCheck();
@@ -114,6 +131,7 @@ export default {
 	> view {
 		&:first-child {
 			flex-grow: 1;
+			overflow: auto;
 		}
 	}
 }
@@ -131,7 +149,7 @@ export default {
 		&:active {
 			background-color: #f8f8f8;
 		}
-		text {
+		.title {
 			word-break: break-all;
 		}
 	}

+ 4 - 1
pages/evaluatePlan/evaluatePlan.vue

@@ -1,11 +1,14 @@
 <template>
-	<!-- @rightClick 只有右边部分的情况下才使用,
+	<!-- @rightClick 只有存在右边部分的情况下才使用,
 	 右边默认为空,可以使用slot="right" 自定义右边内容
 	 @ok 是单选或多选最终返回的结果
 	 types 类型 radio或checkbox
 	 titleKeys 标题对应的字段名称key,默认是name
 	 listData 是数据
 	 showArrow 是否显示右边箭头
+	 backValue 设置返回的数据是[id,id,...] 或 [obj,obj,...]
+	 defValue 设置已选择的数据,格式和backValue 一致
+	 checkIconPositon 选择图标显示左边还是右边 left or right
 	 -->
 	<uni-check-list :listData="list" :defValue="value" types="radio" @ok="chooseOk" @rightClick="viewDetail">
 		<view slot="right">

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 43 - 75
unpackage/dist/dev/app-plus/app-service.js


تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 31 - 57
unpackage/dist/dev/app-plus/app-view.js


برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است