Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
data-table
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
hookehuyr
2024-06-04 17:23:19 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
091f6ccf4f698500d5da036d8c24835ef75d7802
091f6ccf
1 parent
4fc178cf
fix 树形组件获取默认值,和测试
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
138 additions
and
159 deletions
src/components/OrgPickerField/MyComponent.vue
src/components/OrgPickerField/index.vue
src/views/index.vue
src/components/OrgPickerField/MyComponent.vue
View file @
091f6cc
<!--
* @Date: 2022-08-29 14:31:20
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-06-0
3 18:27:47
* @FilePath: /data-table/src/components/
Tree
Field/MyComponent.vue
* @LastEditTime: 2024-06-0
4 14:02:58
* @FilePath: /data-table/src/components/
OrgPicker
Field/MyComponent.vue
* @Description: 树形组件
-->
<template>
...
...
@@ -234,25 +234,20 @@ console.log("🚀 ~ file: MyComponent.vue:227 ~ props:", props);
const emit = defineEmits(["active"]);
onMounted(() => {
// props.item.value = props.item?.component_props.default;
// TODO:获取已选中数据
// emitCheckedGroup.value = {
// dept: [{
// "id": 107691,
// "name": "插花组",
// "type": "dept"
// }],
// role: [{
// "id": 137902,
// "name": "大道大商营员组长",
// "type": "role"
// }],
// user: [{
// "id": 107707,
// "name": "场地组长",
// "type": "user"
// }]
// }
// 如果有默认值处理
if (props.value) {
let default_value = JSON.parse(props.value);
default_value.forEach(item => {
if (item.type === 'dept') {
emitCheckedGroup.value.dept.push(item);
} else if (item.type === 'role') {
emitCheckedGroup.value.role.push(item);
} else if (item.type === 'user') {
emitCheckedGroup.value.user.push(item);
}
})
}
});
const openTree = () => {
...
...
src/components/OrgPickerField/index.vue
View file @
091f6cc
<!--
* @Date: 2022-08-29 14:31:20
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-06-0
3 13:29:18
* @FilePath: /data-table/src/components/
Tree
Field/index.vue
* @LastEditTime: 2024-06-0
4 13:13:03
* @FilePath: /data-table/src/components/
OrgPicker
Field/index.vue
* @Description: 树形组件
-->
<template>
...
...
@@ -44,23 +44,6 @@ const isGroup = computed(() => {
onMounted(() => {
// props.item.value = props.item.component_props.default;
// TODO:获取已选中数据
// emitCheckedGroup.value = {
// dept: [{
// "id": 107691,
// "name": "插花组",
// "type": "dept"
// }],
// role: [{
// "id": 137902,
// "name": "大道大商营员组长",
// "type": "role"
// }],
// user: [{
// "id": 107707,
// "name": "场地组长",
// "type": "user"
// }]
});
// 规则校验
...
...
src/views/index.vue
View file @
091f6cc
<!--
* @Date: 2022-07-18 10:22:22
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-06-0
3 17:06:34
* @LastEditTime: 2024-06-0
4 17:19:56
* @FilePath: /data-table/src/views/index.vue
* @Description: 首页
-->
...
...
@@ -243,7 +243,8 @@ onMounted(async () => {
// TODO:待完善,集合组保存的字段和值怎么处理,都是单条数据都要合并到相应的 group_field_name 下面?
// page_form.unshift({
// data_type : "text",
// default : "",
// default : '',
// // default : '[{ "id": 107691, "name": "插花组", "type": "dept" }, { "id": 137902, "name": "大道大商营员组长", "type": "role" },{ "id": 107707, "name": "场地组长", "type": "user" }]',
// disabled : false,
// field_id : 1414832,
// field_name : "field_4",
...
...
@@ -254,128 +255,128 @@ onMounted(async () => {
// placeholder : "请输入",
// readonly : false,
// required : true,
// tag : "
tree
",
// tag : "
org_picker
",
// unique : false,
// });
page_form.unshift({
data_type : "text",
default : "",
disabled : false,
field_id : 1414832,
field_name : "field_4",
index : 41,
interaction_type : "h5edit",
label : "物品详情",
name : "name_41",
placeholder : "请输入",
readonly : false,
required : false,
tag : "group",
unique : false,
field_groups: [{
"tag": "input",
"name": "input_21",
"index": 2,
"label": "物品描述",
"unique": false,
"default": "",
"disabled": false,
"field_id": 7985071,
"readonly": false,
"required": false,
"data_type": "text",
"field_name": "field_10",
"placeholder": "请输入",
"is_camera_scan": false,
"camera_scan_type": "",
"interaction_type": "h5edit",
"is_edit_camera_scan_result": false,
"group_field_name" : "field_4",
},{
"tag": "gender",
"name": "gender_3",
"note": "",
"index": 3,
"label": "性别",
"options": [
{
"title": "男",
"value": "男",
"checked": false,
"desc_url": "",
"is_input": false,
"desc_text": "",
"desc_type": "",
"desc_btn_name": "",
"input_required": false,
"input_placeholder": "请输入补充信息"
},
{
"title": "女",
"value": "女",
"checked": false,
"desc_url": "",
"is_input": false,
"desc_text": "",
"desc_type": "",
"desc_btn_name": "",
"input_required": false,
"input_placeholder": "请输入补充信息"
}
],
"disabled": false,
"field_id": 799603,
"required": false,
"data_type": "text",
"direction": "vertical",
"field_name": "field_4",
"option_map": {
"女": {
"title": "女",
"value": "女",
"checked": false,
"desc_url": "",
"is_input": false,
"desc_text": "",
"desc_type": "",
"desc_btn_name": "",
"input_required": false,
"input_placeholder": "请输入补充信息"
},
"男": {
"title": "男",
"value": "男",
"checked": false,
"desc_url": "",
"is_input": false,
"desc_text": "",
"desc_type": "",
"desc_btn_name": "",
"input_required": false,
"input_placeholder": "请输入补充信息"
}
},
"interaction_type": "h5edit"
},]
});
//
page_form.unshift({
//
data_type : "text",
//
default : "",
//
disabled : false,
//
field_id : 1414832,
//
field_name : "field_4",
//
index : 41,
//
interaction_type : "h5edit",
//
label : "物品详情",
//
name : "name_41",
//
placeholder : "请输入",
//
readonly : false,
//
required : false,
//
tag : "group",
//
unique : false,
//
field_groups: [{
//
"tag": "input",
//
"name": "input_21",
//
"index": 2,
//
"label": "物品描述",
//
"unique": false,
//
"default": "",
//
"disabled": false,
//
"field_id": 7985071,
//
"readonly": false,
//
"required": false,
//
"data_type": "text",
//
"field_name": "field_10",
//
"placeholder": "请输入",
//
"is_camera_scan": false,
//
"camera_scan_type": "",
//
"interaction_type": "h5edit",
//
"is_edit_camera_scan_result": false,
//
"group_field_name" : "field_4",
//
},{
//
"tag": "gender",
//
"name": "gender_3",
//
"note": "",
//
"index": 3,
//
"label": "性别",
//
"options": [
//
{
//
"title": "男",
//
"value": "男",
//
"checked": false,
//
"desc_url": "",
//
"is_input": false,
//
"desc_text": "",
//
"desc_type": "",
//
"desc_btn_name": "",
//
"input_required": false,
//
"input_placeholder": "请输入补充信息"
//
},
//
{
//
"title": "女",
//
"value": "女",
//
"checked": false,
//
"desc_url": "",
//
"is_input": false,
//
"desc_text": "",
//
"desc_type": "",
//
"desc_btn_name": "",
//
"input_required": false,
//
"input_placeholder": "请输入补充信息"
//
}
//
],
//
"disabled": false,
//
"field_id": 799603,
//
"required": false,
//
"data_type": "text",
//
"direction": "vertical",
//
"field_name": "field_4",
//
"option_map": {
//
"女": {
//
"title": "女",
//
"value": "女",
//
"checked": false,
//
"desc_url": "",
//
"is_input": false,
//
"desc_text": "",
//
"desc_type": "",
//
"desc_btn_name": "",
//
"input_required": false,
//
"input_placeholder": "请输入补充信息"
//
},
//
"男": {
//
"title": "男",
//
"value": "男",
//
"checked": false,
//
"desc_url": "",
//
"is_input": false,
//
"desc_text": "",
//
"desc_type": "",
//
"desc_btn_name": "",
//
"input_required": false,
//
"input_placeholder": "请输入补充信息"
//
}
//
},
//
"interaction_type": "h5edit"
//
},]
//
});
page_form.push({
"tag": "name",
"name": "name_2",
"index": 2,
"label": "姓名",
"unique": false,
"default": "",
"disabled": false,
"field_id": 799599,
"readonly": false,
"required": true,
"data_type": "text",
"field_name": "field_2",
"placeholder": "请输入",
"interaction_type": "h5edit"
})
//
page_form.push({
//
"tag": "name",
//
"name": "name_2",
//
"index": 2,
//
"label": "姓名",
//
"unique": false,
//
"default": "",
//
"disabled": false,
//
"field_id": 799599,
//
"readonly": false,
//
"required": true,
//
"data_type": "text",
//
"field_name": "field_2",
//
"placeholder": "请输入",
//
"interaction_type": "h5edit"
//
})
formData.value = formatData(page_form);
// TODO:再次提交测试, 需要获取原来表单数据
// formData.value.forEach((item) => {
...
...
Please
register
or
login
to post a comment