提交 f74ba3d5 编写于 作者: m0_50812349's avatar m0_50812349

Merge branch 'gva_gormv2_dev' of...

Merge branch 'gva_gormv2_dev' of https://github.com/flipped-aurora/gin-vue-admin into gva_gormv2_dev
...@@ -73,17 +73,12 @@ func newT(f func(chan struct{}) error) *T { ...@@ -73,17 +73,12 @@ func newT(f func(chan struct{}) error) *T {
//@description: 添加任务 //@description: 添加任务
func (t *T) AddTask() { func (t *T) AddTask() {
if len(t.ch) == 1 { select {
return case t.ch <- struct{}{}:
} default:
t.Lock()
defer t.Unlock()
if len(t.ch) == 1 {
// 代表已经有任务了 // 代表已经有任务了
// 直接丢弃这次任务 // 直接丢弃这次任务
return
} }
t.ch <- struct{}{}
} }
//@author: [songzhibin97](https://github.com/songzhibin97) //@author: [songzhibin97](https://github.com/songzhibin97)
......
...@@ -13,18 +13,20 @@ ...@@ -13,18 +13,20 @@
<el-upload <el-upload
class="image-uploader" class="image-uploader"
:action="`${path}/fileUploadAndDownload/upload`" :action="`${path}/fileUploadAndDownload/upload`"
:headers="{ 'x-token': token }"
:show-file-list="false" :show-file-list="false"
:on-success="handleImageSuccess" :on-success="handleImageSuccess"
:before-upload="beforeImageUpload" :before-upload="beforeImageUpload"
:multiple="false" :multiple="false"
> >
<img v-if="imageUrl" :src="imageUrl" class="image" /> <img v-if="imageUrl" :src="path + imageUrl" class="image" />
<i v-else class="el-icon-plus image-uploader-icon"></i> <i v-else class="el-icon-plus image-uploader-icon"></i>
</el-upload> </el-upload>
</div> </div>
</template> </template>
<script> <script>
const path = process.env.VUE_APP_BASE_API; const path = process.env.VUE_APP_BASE_API;
import { mapGetters } from "vuex";
import ImageCompress from "@/utils/image.js"; import ImageCompress from "@/utils/image.js";
export default { export default {
name: "upload-image", name: "upload-image",
...@@ -51,6 +53,9 @@ export default { ...@@ -51,6 +53,9 @@ export default {
path: path, path: path,
}; };
}, },
computed: {
...mapGetters("user", ["userInfo", "token"]),
},
methods: { methods: {
beforeImageUpload(file) { beforeImageUpload(file) {
let isRightSize = file.size / 1024 < this.fileSize; let isRightSize = file.size / 1024 < this.fileSize;
......
...@@ -7,6 +7,14 @@ export const toUpperCase = (str) => { ...@@ -7,6 +7,14 @@ export const toUpperCase = (str) => {
} }
} }
export const toLowerCase = (str) => {
if (str[0]) {
return str.replace(str[0], str[0].toLowerCase())
} else {
return ""
}
}
// 驼峰转换下划线 // 驼峰转换下划线
export const toSQLLine = (str) => { export const toSQLLine = (str) => {
if (str == "ID") return "ID" if (str == "ID") return "ID"
......
...@@ -12,6 +12,9 @@ ...@@ -12,6 +12,9 @@
<el-col :span="6"> <el-col :span="6">
<el-input v-model="dialogMiddle.fieldName" autocomplete="off"></el-input> <el-input v-model="dialogMiddle.fieldName" autocomplete="off"></el-input>
</el-col> </el-col>
<el-col :offset="1" :span="2">
<el-button @click="autoFill">自动填充</el-button>
</el-col>
</el-form-item> </el-form-item>
<el-form-item label="Field中文名" prop="fieldDesc"> <el-form-item label="Field中文名" prop="fieldDesc">
<el-col :span="6"> <el-col :span="6">
...@@ -103,6 +106,7 @@ ...@@ -103,6 +106,7 @@
</template> </template>
<script> <script>
import { getDict } from "@/utils/dictionary"; import { getDict } from "@/utils/dictionary";
import { toSQLLine , toLowerCase } from "@/utils/stringFun.js";
import { getSysDictionaryList } from "@/api/sysDictionary"; import { getSysDictionaryList } from "@/api/sysDictionary";
export default { export default {
name: "FieldDialog", name: "FieldDialog",
...@@ -183,6 +187,10 @@ export default { ...@@ -183,6 +187,10 @@ export default {
}; };
}, },
methods: { methods: {
autoFill(){
this.dialogMiddle.fieldJson = toLowerCase(this.dialogMiddle.fieldName)
this.dialogMiddle.columnName = toSQLLine(this.dialogMiddle.fieldJson)
},
async getDbfdOptions() { async getDbfdOptions() {
this.dialogMiddle.dataType = "" this.dialogMiddle.dataType = ""
this.dialogMiddle.dataTypeLong = "" this.dialogMiddle.dataTypeLong = ""
...@@ -201,7 +209,7 @@ export default { ...@@ -201,7 +209,7 @@ export default {
}); });
this.dictOptions = dictRes.data.list this.dictOptions = dictRes.data.list
} },
}; };
</script> </script>
<style lang="scss"> <style lang="scss">
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册