优化tableData组件,修复动态字段,增加group重复验证

This commit is contained in:
2022-09-23 10:43:04 +08:00
parent a1df6a4b53
commit 409fe09573
4 changed files with 14 additions and 7 deletions

View File

@@ -4,7 +4,7 @@
<div class="placeholder" v-if="listSelected.length == 0">{{setting.placeholder}}</div>
<div class="layui-btn layui-btn-xs layui-btn-normal" v-for="(itemSelect,indexSelect) in listSelected">
<span>{{itemSelect[setting.fieldName]}}</span>
<i class="layui-icon layui-icon-close" @click.stop="removeItem(itemSelect,indexSelect)"></i>
<i class="layui-icon layui-icon-close" @click.stop="removeItem(itemSelect,indexSelect)" v-if="setting.readonly != 1"></i>
</div>
</div>

View File

@@ -46,7 +46,6 @@ define(['jquery', 'vue'], function ($, Vue) {
var options = $.extend(defaultOption, data);
var valueField = options.valueField;
if (options.index.indexOf('?') > -1) {
@@ -84,8 +83,9 @@ define(['jquery', 'vue'], function ($, Vue) {
$.get(options.index, {
page: 1,
limit: valueLength,
filter: JSON.stringify({ id: this.value }),
op: JSON.stringify({ id: 'in' })
filter: JSON.stringify({ [options.valueField]: this.value }),
op: JSON.stringify({ [options.valueField]: 'in' }),
group: options.valueField
}, (result) => {
loading.hide()
this.listSelected = result.data;
@@ -101,8 +101,12 @@ define(['jquery', 'vue'], function ($, Vue) {
methods: {
openSelectPage() {
var selectedIds = this.listSelected.map(item => item.id);
if(options.readonly == 1){
return false;
}
var selectedIds = this.listSelected.map(item => item.id);
var index = layer.open({
title: '选择数据',