@yorha2b-lab/autodev 1.0.35 → 1.0.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/README_EN.md +3 -0
- package/config.js +3 -0
- package/example/example.json +159 -0
- package/example/example.png +0 -0
- package/package.json +1 -1
- package/src/commands/watch-page.js +12 -2
- package/src/commands/watch-part.js +1 -1
- package/src/core/react-compiler.js +1 -1
- package/src/prompts/watch-page.js +2 -2
- package/src/prompts/watch-part.js +1 -1
package/README.md
CHANGED
package/README_EN.md
CHANGED
package/config.js
CHANGED
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
{
|
|
2
|
+
"tabs": [
|
|
3
|
+
{
|
|
4
|
+
"tab": "鬼剑士",
|
|
5
|
+
"key": "ghostKnight"
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
"tab": "格斗家",
|
|
9
|
+
"key": "fighter"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"tab": "神枪手",
|
|
13
|
+
"key": "gunner"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"tab": "魔法师",
|
|
17
|
+
"key": "mage"
|
|
18
|
+
}
|
|
19
|
+
],
|
|
20
|
+
"formItems": [
|
|
21
|
+
{
|
|
22
|
+
"label": "转职职业",
|
|
23
|
+
"name": "transferJob",
|
|
24
|
+
"type": "select",
|
|
25
|
+
"options": "_CODE_transferJobOptions_CODE_"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"label": "武器类型",
|
|
29
|
+
"name": "weaponType",
|
|
30
|
+
"type": "select",
|
|
31
|
+
"options": "_CODE_weaponTypeOptions_CODE_"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"label": "职业类型",
|
|
35
|
+
"name": "jobType",
|
|
36
|
+
"type": "select",
|
|
37
|
+
"options": "_CODE_jobTypeOptions_CODE_"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"label": "觉醒名称关键词",
|
|
41
|
+
"name": "awakeningNameKeyword"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"label": "登场时间",
|
|
45
|
+
"name": "releaseDateStart,releaseDateEnd",
|
|
46
|
+
"type": "daterange"
|
|
47
|
+
}
|
|
48
|
+
],
|
|
49
|
+
"table": {
|
|
50
|
+
"pagination": true,
|
|
51
|
+
"expandable": true,
|
|
52
|
+
"rowSelection": true,
|
|
53
|
+
"staticInfo": {
|
|
54
|
+
"has": false,
|
|
55
|
+
"text": ""
|
|
56
|
+
},
|
|
57
|
+
"operation": [
|
|
58
|
+
{
|
|
59
|
+
"label": "查看",
|
|
60
|
+
"action": "viewByRecord"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"label": "编辑",
|
|
64
|
+
"action": "editByRecord"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"label": "删除",
|
|
68
|
+
"action": "deleteByRecord"
|
|
69
|
+
}
|
|
70
|
+
],
|
|
71
|
+
"columns": [
|
|
72
|
+
{
|
|
73
|
+
"title": "职业",
|
|
74
|
+
"dataIndex": "jobName"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"title": "一觉",
|
|
78
|
+
"dataIndex": "firstAwakening"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"title": "二觉",
|
|
82
|
+
"dataIndex": "secondAwakening"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"title": "三觉",
|
|
86
|
+
"dataIndex": "thirdAwakening"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"title": "武器类型",
|
|
90
|
+
"dataIndex": "weaponType",
|
|
91
|
+
"render": "_CODE_text=>weaponTypeOptions.find(item=>item.value===text)?.label_CODE_"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"title": "职业类型",
|
|
95
|
+
"dataIndex": "jobType",
|
|
96
|
+
"render": "_CODE_text=>jobTypeOptions.find(item=>item.value===text)?.label_CODE_"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"title": "登场时间",
|
|
100
|
+
"dataIndex": "releaseDate",
|
|
101
|
+
"render": "_CODE_text=>timeRender({time:text})_CODE_"
|
|
102
|
+
}
|
|
103
|
+
]
|
|
104
|
+
},
|
|
105
|
+
"optionDict": {
|
|
106
|
+
"_CODE_transferJobOptions_CODE_": [
|
|
107
|
+
{
|
|
108
|
+
"label": "剑魂",
|
|
109
|
+
"value": "swordSoul"
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"label": "狂战士",
|
|
113
|
+
"value": "berserker"
|
|
114
|
+
}
|
|
115
|
+
],
|
|
116
|
+
"_CODE_weaponTypeOptions_CODE_": [
|
|
117
|
+
{
|
|
118
|
+
"label": "光剑",
|
|
119
|
+
"value": "lightSword"
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"label": "太刀",
|
|
123
|
+
"value": "katana"
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"label": "巨剑",
|
|
127
|
+
"value": "greatSword"
|
|
128
|
+
}
|
|
129
|
+
],
|
|
130
|
+
"_CODE_jobTypeOptions_CODE_": [
|
|
131
|
+
{
|
|
132
|
+
"label": "物理",
|
|
133
|
+
"value": "physical"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"label": "魔法",
|
|
137
|
+
"value": "magic"
|
|
138
|
+
}
|
|
139
|
+
]
|
|
140
|
+
},
|
|
141
|
+
"functionButton": [
|
|
142
|
+
{
|
|
143
|
+
"btn": "查询",
|
|
144
|
+
"action": "queryJobList"
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"btn": "重置",
|
|
148
|
+
"action": "resetJobList"
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
"btn": "批量删除",
|
|
152
|
+
"action": "deleteBySelectedJobList"
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"btn": "批量导出",
|
|
156
|
+
"action": "exportJobList"
|
|
157
|
+
}
|
|
158
|
+
]
|
|
159
|
+
}
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -64,7 +64,7 @@ const watchPage = options => {
|
|
|
64
64
|
)))
|
|
65
65
|
const constantDir = path.join(process.cwd(), config.utilsDir)
|
|
66
66
|
if (!fs.existsSync(constantDir)) fs.mkdirSync(constantDir, { recursive: true })
|
|
67
|
-
fs.writeFileSync(path.join(constantDir, '
|
|
67
|
+
fs.writeFileSync(path.join(constantDir, 'menus.js'), `export const menus = ${stringify.default(menus, { indent: 4, maxLength: 50 })}`)
|
|
68
68
|
console.log(chalk.green(language(
|
|
69
69
|
'🤖 Pod 042: [肯定] Menu 配置同步成功。',
|
|
70
70
|
'🤖 Pod 042: [Affirmative] Menu configuration synced successfully.'
|
|
@@ -95,7 +95,17 @@ const watchPage = options => {
|
|
|
95
95
|
if (!fs.existsSync(mockDir)) fs.mkdirSync(mockDir, { recursive: true })
|
|
96
96
|
if (!fs.existsSync(targetDir)) fs.mkdirSync(targetDir, { recursive: true })
|
|
97
97
|
|
|
98
|
-
|
|
98
|
+
let pageConfig
|
|
99
|
+
if (config.useDemo) {
|
|
100
|
+
console.log(chalk.yellow(language(
|
|
101
|
+
`\nPod 042: [报告] 使用演示数据...`,
|
|
102
|
+
`\nPod 042: [Report] Using demo data...`
|
|
103
|
+
)))
|
|
104
|
+
pageConfig = require(path.join(__dirname, '../../example/example.json'))
|
|
105
|
+
} else {
|
|
106
|
+
pageConfig = await recognizePage(pagePrompt, filePath)
|
|
107
|
+
}
|
|
108
|
+
console.log(stringify.default(pageConfig, { indent: 4, maxLength: 200 }))
|
|
99
109
|
fs.writeFileSync(path.join(targetDir, 'resource.js'), resource({ pageConfig, resourceTpl }))
|
|
100
110
|
fs.writeFileSync(path.join(targetDir, 'index.js'), index({ config, fileName, indexTpl, pageConfig }))
|
|
101
111
|
|
|
@@ -43,7 +43,7 @@ const watchPart = () => {
|
|
|
43
43
|
|
|
44
44
|
let optionsCodeStr = ''
|
|
45
45
|
Object.keys(optionDict).forEach(key => {
|
|
46
|
-
const varName = key.
|
|
46
|
+
const varName = key.replaceAll('_CODE_', '')
|
|
47
47
|
const optionsArray = optionDict[key]
|
|
48
48
|
const arrayItemsStr = optionsArray.map(opt => ` { label: '${opt.label}', value: '${opt.value}' }`).join(',\n')
|
|
49
49
|
optionsCodeStr += `\nexport const ${varName} = [\n${arrayItemsStr}\n]\n`
|
|
@@ -28,7 +28,7 @@ const resource = ({ pageConfig, resourceTpl }) => {
|
|
|
28
28
|
// 提取所有下拉框字典配置
|
|
29
29
|
dictBlocks: pageConfig.formItems
|
|
30
30
|
?.filter(item => item.type === 'select') // 过滤出下拉框类型
|
|
31
|
-
?.map(item => ({ name: item.options.
|
|
31
|
+
?.map(item => ({ name: item.options.replaceAll('_CODE_', ''), data: pageConfig.optionDict[item.options] ?? [] })) // 转换为字典格式
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
// 渲染模板并清理代码
|
|
@@ -33,8 +33,8 @@ module.exports = `
|
|
|
33
33
|
如果和表格行操作重复请在action加上BySelected前缀
|
|
34
34
|
如果是导出功能,对应的动词为export+对应的英文名词,没有名词则为exportData
|
|
35
35
|
6.下拉选项字典
|
|
36
|
-
optionDict:{_CODE_对应的英文名词
|
|
37
|
-
|
|
36
|
+
optionDict:{_CODE_对应的英文名词Options_CODE_:[]]}
|
|
37
|
+
⚠️⚠️⚠️注意:数组值为对应列展示的内容组成的类似{label:'',value:''}的数组
|
|
38
38
|
最后输出一个JSON对象,不要包含任何Markdown标签,格式如下
|
|
39
39
|
{ tabs: [], table: {}, formItems: [], optionDict: {}, functionButton: []}
|
|
40
40
|
`
|
|
@@ -15,7 +15,7 @@ module.exports = `
|
|
|
15
15
|
如果是下拉框,请加入type:'select',options:_CODE_对应的英文名词Options_CODE_
|
|
16
16
|
如果是时间范围查询,请加入type:'daterange',name:'对应的英文名词start,对应的英文名词end'
|
|
17
17
|
3.下拉选项字典
|
|
18
|
-
optionDict:{_CODE_对应的英文名词
|
|
18
|
+
optionDict:{_CODE_对应的英文名词Options_CODE_:[]]}
|
|
19
19
|
数组值为对应列展示的内容组成的类似{label:'',value:''}的数组
|
|
20
20
|
4.弹窗表单
|
|
21
21
|
modalItems:[{label:'基础项',name:'对应的英文名词',type:'text',rules:[{required:true,message:'字段不能为空'}]}]
|