File tree Expand file tree Collapse file tree 2 files changed +16
-15
lines changed
view/systemTools/autoCode/component Expand file tree Collapse file tree 2 files changed +16
-15
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,14 @@ export const toUpperCase = (str) => {
77 }
88}
99
10+ export const toLowerCase = ( str ) => {
11+ if ( str [ 0 ] ) {
12+ return str . replace ( str [ 0 ] , str [ 0 ] . toLowerCase ( ) )
13+ } else {
14+ return ""
15+ }
16+ }
17+
1018// 驼峰转换下划线
1119export const toSQLLine = ( str ) => {
1220 if ( str == "ID" ) return "ID"
Original file line number Diff line number Diff line change 1212 <el-col :span =" 6" >
1313 <el-input v-model =" dialogMiddle.fieldName" autocomplete =" off" ></el-input >
1414 </el-col >
15+ <el-col :offset =" 1" :span =" 2" >
16+ <el-button @click =" autoFill" >自动填充</el-button >
17+ </el-col >
1518 </el-form-item >
1619 <el-form-item label =" Field中文名" prop =" fieldDesc" >
1720 <el-col :span =" 6" >
103106</template >
104107<script >
105108import { getDict } from " @/utils/dictionary" ;
106- import { toSQLLine } from " @/utils/stringFun.js" ;
109+ import { toSQLLine , toLowerCase } from " @/utils/stringFun.js" ;
107110import { getSysDictionaryList } from " @/api/sysDictionary" ;
108111export default {
109112 name: " FieldDialog" ,
@@ -184,6 +187,10 @@ export default {
184187 };
185188 },
186189 methods: {
190+ autoFill (){
191+ this .dialogMiddle .fieldJson = toLowerCase (this .dialogMiddle .fieldName )
192+ this .dialogMiddle .columnName = toSQLLine (this .dialogMiddle .fieldJson )
193+ },
187194 async getDbfdOptions () {
188195 this .dialogMiddle .dataType = " "
189196 this .dialogMiddle .dataTypeLong = " "
@@ -203,20 +210,6 @@ export default {
203210
204211 this .dictOptions = dictRes .data .list
205212 },
206- watch: {
207- ' dialogMiddle.fieldName ' : function (val ) {
208- if (val .length > 0 ) {
209- val = val .replace (val[0 ], val[0 ].toLowerCase ());
210- val = toSQLLine (val)
211- }
212-
213- this .dialogMiddle .fieldJson = val;
214- this .dialogMiddle .columnName = val;
215- },
216- ' dialogMiddle.fieldDesc ' : function (val ) {
217- this .dialogMiddle .comment = val;
218- }
219- },
220213};
221214 </script >
222215<style lang="scss">
You can’t perform that action at this time.
0 commit comments