Skip to content

Commit 265cd4d

Browse files
committed
Merge branch 'gva_gormv2_dev' of https://github.com/flipped-aurora/gin-vue-admin into gva_gormv2_dev
2 parents 34e6ccc + cab8de7 commit 265cd4d

File tree

4 files changed

+27
-11
lines changed

4 files changed

+27
-11
lines changed

server/utils/cmd_Task.go

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,17 +73,12 @@ func newT(f func(chan struct{}) error) *T {
7373
//@description: 添加任务
7474

7575
func (t *T) AddTask() {
76-
if len(t.ch) == 1 {
77-
return
78-
}
79-
t.Lock()
80-
defer t.Unlock()
81-
if len(t.ch) == 1 {
76+
select {
77+
case t.ch <- struct{}{}:
78+
default:
8279
// 代表已经有任务了
8380
// 直接丢弃这次任务
84-
return
8581
}
86-
t.ch <- struct{}{}
8782
}
8883

8984
//@author: [songzhibin97](https://github.com/songzhibin97)

web/src/components/upload/image.vue

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,20 @@
1313
<el-upload
1414
class="image-uploader"
1515
:action="`${path}/fileUploadAndDownload/upload`"
16+
:headers="{ 'x-token': token }"
1617
:show-file-list="false"
1718
:on-success="handleImageSuccess"
1819
:before-upload="beforeImageUpload"
1920
:multiple="false"
2021
>
21-
<img v-if="imageUrl" :src="imageUrl" class="image" />
22+
<img v-if="imageUrl" :src="path + imageUrl" class="image" />
2223
<i v-else class="el-icon-plus image-uploader-icon"></i>
2324
</el-upload>
2425
</div>
2526
</template>
2627
<script>
2728
const path = process.env.VUE_APP_BASE_API;
29+
import { mapGetters } from "vuex";
2830
import ImageCompress from "@/utils/image.js";
2931
export default {
3032
name: "upload-image",
@@ -51,6 +53,9 @@ export default {
5153
path: path,
5254
};
5355
},
56+
computed: {
57+
...mapGetters("user", ["userInfo", "token"]),
58+
},
5459
methods: {
5560
beforeImageUpload(file) {
5661
let isRightSize = file.size / 1024 < this.fileSize;
@@ -97,4 +102,4 @@ export default {
97102
height: 178px;
98103
display: block;
99104
}
100-
</style>
105+
</style>

web/src/utils/stringFun.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff 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
// 驼峰转换下划线
1119
export const toSQLLine = (str) => {
1220
if (str == "ID") return "ID"

web/src/view/systemTools/autoCode/component/fieldDialog.vue

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
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">
@@ -103,6 +106,7 @@
103106
</template>
104107
<script>
105108
import { getDict } from "@/utils/dictionary";
109+
import { toSQLLine , toLowerCase } from "@/utils/stringFun.js";
106110
import { getSysDictionaryList } from "@/api/sysDictionary";
107111
export default {
108112
name: "FieldDialog",
@@ -183,6 +187,10 @@ export default {
183187
};
184188
},
185189
methods: {
190+
autoFill(){
191+
this.dialogMiddle.fieldJson = toLowerCase(this.dialogMiddle.fieldName)
192+
this.dialogMiddle.columnName = toSQLLine(this.dialogMiddle.fieldJson)
193+
},
186194
async getDbfdOptions() {
187195
this.dialogMiddle.dataType = ""
188196
this.dialogMiddle.dataTypeLong = ""
@@ -201,7 +209,7 @@ export default {
201209
});
202210
203211
this.dictOptions = dictRes.data.list
204-
}
212+
},
205213
};
206214
</script>
207215
<style lang="scss">

0 commit comments

Comments
 (0)