30843
This commit is contained in:
@@ -104,9 +104,9 @@
|
|||||||
<ai-dialog title="选择网格" :visible.sync="showGrid" :customFooter="true" :destroyOnClose="true" border width="720px" append-to-body>
|
<ai-dialog title="选择网格" :visible.sync="showGrid" :customFooter="true" :destroyOnClose="true" border width="720px" append-to-body>
|
||||||
<div class="grid">
|
<div class="grid">
|
||||||
<el-tree :data="treeObj.treeList" :props="treeObj.defaultProps" node-key="id" ref="tree"
|
<el-tree :data="treeObj.treeList" :props="treeObj.defaultProps" node-key="id" ref="tree"
|
||||||
:check-strictly="true" show-checkbox lazy :load="loadNode" :default-checked-keys="currCheckedKeys" @check="onCheckChange">
|
show-checkbox lazy :load="loadNode" :default-checked-keys="currCheckedKeys" @check="onCheckChange">
|
||||||
</el-tree>
|
</el-tree>
|
||||||
<!-- :default-expand-all="true" -->
|
<!-- :default-expand-all="true" :check-strictly="true" :check-strictly="true" -->
|
||||||
</div>
|
</div>
|
||||||
<div class="dialog-footer" slot="footer">
|
<div class="dialog-footer" slot="footer">
|
||||||
<el-button size="medium" @click="showGrid = false">取消</el-button>
|
<el-button size="medium" @click="showGrid = false">取消</el-button>
|
||||||
@@ -127,6 +127,21 @@ export default {
|
|||||||
permissions: Function,
|
permissions: Function,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
var validcode = (rule, value, callback) => {
|
||||||
|
if(value) {
|
||||||
|
if (value != 0) {
|
||||||
|
if(!/^([+-]?([1-9]{1}\d*)|(0{1}))(\.\d{1,2})?$/.test(value)) {
|
||||||
|
callback(new Error('请输入积分分值,可输入正数、负数、最多保留两位小数'))
|
||||||
|
}else{
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
callback(new Error('请输入有效的积分分值'));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
callback(new Error('请输入积分分值'));
|
||||||
|
}
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
search: {
|
search: {
|
||||||
status: "",
|
status: "",
|
||||||
@@ -195,13 +210,7 @@ export default {
|
|||||||
scoringCycle: [
|
scoringCycle: [
|
||||||
{ required: true, message: "请选择周期范围", trigger: "change" },
|
{ required: true, message: "请选择周期范围", trigger: "change" },
|
||||||
],
|
],
|
||||||
integral: [
|
integral: [{required: true, validator: validcode,trigger: "blur"},],
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
pattern: /(^[1-9]{1}[0-9]*$)|(^[0-9]*\.[0-9]{2}$)/,
|
|
||||||
message: "请输入积分分值,最多保留两位小数",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
validRangeType: [
|
validRangeType: [
|
||||||
{ required: true, message: "请选择有效范围", trigger: "change" },
|
{ required: true, message: "请选择有效范围", trigger: "change" },
|
||||||
],
|
],
|
||||||
@@ -219,7 +228,7 @@ export default {
|
|||||||
defaultProps: {
|
defaultProps: {
|
||||||
label: "girdName",
|
label: "girdName",
|
||||||
value: "id",
|
value: "id",
|
||||||
children: 'children', // 节点是否拥有子节点
|
children: 'children',
|
||||||
isLeaf: 'leaf'
|
isLeaf: 'leaf'
|
||||||
},
|
},
|
||||||
checkedKeys: [],
|
checkedKeys: [],
|
||||||
@@ -227,6 +236,7 @@ export default {
|
|||||||
girdInfoList: [],
|
girdInfoList: [],
|
||||||
currCheckedKeys: [],
|
currCheckedKeys: [],
|
||||||
rulueType: "0",
|
rulueType: "0",
|
||||||
|
// tree12: []
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
@@ -235,7 +245,7 @@ export default {
|
|||||||
this.getList();
|
this.getList();
|
||||||
this.getRulesList();
|
this.getRulesList();
|
||||||
this.beforeSelectTree();
|
this.beforeSelectTree();
|
||||||
this.getList12()
|
// this.getList12()
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -265,6 +275,9 @@ export default {
|
|||||||
validRangeType: "0",
|
validRangeType: "0",
|
||||||
validRangeData: "",
|
validRangeData: "",
|
||||||
};
|
};
|
||||||
|
if(!this.isEdit) {
|
||||||
|
this.girdInfoList = []
|
||||||
|
}
|
||||||
},
|
},
|
||||||
toEdit(row) {
|
toEdit(row) {
|
||||||
this.form = {...row}
|
this.form = {...row}
|
||||||
@@ -428,10 +441,13 @@ export default {
|
|||||||
this.treeObj.checkedKeys = [];
|
this.treeObj.checkedKeys = [];
|
||||||
this.instance.post(`/app/appgirdinfo/listAll3`, null, null).then((res) => {
|
this.instance.post(`/app/appgirdinfo/listAll3`, null, null).then((res) => {
|
||||||
if (res.code == 0) {
|
if (res.code == 0) {
|
||||||
this.treeObj.treeList = this.girdToTree(res.data);
|
let tree = this.girdToTree(res.data);
|
||||||
|
this.treeObj.treeList = this.addKey(tree)
|
||||||
|
|
||||||
this.girdInfoList.map((e) => {
|
this.girdInfoList.map((e) => {
|
||||||
this.treeObj.checkedKeys.push(e.id);
|
this.treeObj.checkedKeys.push(e.id);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.currCheckedKeys = this.girdInfoList;
|
this.currCheckedKeys = this.girdInfoList;
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
@@ -441,30 +457,33 @@ export default {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// 最后一级追加属性
|
||||||
|
addKey(arr) {
|
||||||
|
for (let index = 0; index < arr.length; index++) {
|
||||||
|
const item = arr[index]
|
||||||
|
if (!item.children || !item.children.length) {
|
||||||
|
item.leaf = true
|
||||||
|
} else {
|
||||||
|
this.addKey(item.children)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return arr
|
||||||
|
},
|
||||||
|
|
||||||
// el-tree懒加载
|
// el-tree懒加载
|
||||||
loadNode(node, resolve) {
|
loadNode(node, resolve) {
|
||||||
if (node.level === 0) {
|
if (node.level === 0) {
|
||||||
this.instance.post('/app/appgirdinfo/listBy12').then((res) => {
|
return resolve(this.treeObj.treeList);
|
||||||
if(res?.data) {
|
}
|
||||||
console.log(this.girdToTree(res.data))
|
if (node.level >= 1 || node.data.children && node.data.children.length) {
|
||||||
}
|
return resolve(node.data.children)
|
||||||
|
} else {
|
||||||
|
return resolve({
|
||||||
|
name: 'girdName',
|
||||||
|
isLeaf: true
|
||||||
})
|
})
|
||||||
let arr = node.childNodes;
|
|
||||||
return resolve(arr);
|
|
||||||
}
|
}
|
||||||
if (node.level >= 1) {
|
|
||||||
let arr1 = node.data.children
|
|
||||||
return resolve(arr1);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
// 加载一二级数据
|
|
||||||
getList12() {
|
|
||||||
this.instance.post('/app/appgirdinfo/listBy12').then((res) => {
|
|
||||||
if(res?.data) {
|
|
||||||
console.log(this.girdToTree(res.data))
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
|
||||||
onCheckChange(e) {
|
onCheckChange(e) {
|
||||||
|
|||||||
@@ -103,7 +103,7 @@
|
|||||||
</template>
|
</template>
|
||||||
</ai-detail>
|
</ai-detail>
|
||||||
<span slot="footer" class="dialog-footer" center>
|
<span slot="footer" class="dialog-footer" center>
|
||||||
<el-button @click="dialog = false">关闭</el-button>
|
<el-button @click="dialog = false" style="width: 92px">关闭</el-button>
|
||||||
</span>
|
</span>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user