From 5cce09b5c2e520954d85e6e42b9b6f55472dbb59 Mon Sep 17 00:00:00 2001 From: 疯狂的狮子Li <15040126243@163.com> Date: 星期五, 03 二月 2023 00:39:15 +0800 Subject: [PATCH] fix 修复 翻译模块 无法翻译实体属性值为 Null 的字段的问题 --- ruoyi-ui/src/views/demo/demo/index.vue | 148 ++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 120 insertions(+), 28 deletions(-) diff --git a/ruoyi-ui/src/views/demo/demo/index.vue b/ruoyi-ui/src/views/demo/demo/index.vue index b831ad9..c49ce43 100644 --- a/ruoyi-ui/src/views/demo/demo/index.vue +++ b/ruoyi-ui/src/views/demo/demo/index.vue @@ -33,6 +33,7 @@ </el-form-item> <el-form-item> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> + <el-button type="primary" icon="el-icon-search" size="mini" @click="handlePage">鎼滅储(鑷畾涔夊垎椤垫帴鍙�)</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button> </el-form-item> </el-form> @@ -72,11 +73,20 @@ </el-col> <el-col :span="1.5"> <el-button + type="info" + plain + icon="el-icon-upload2" + size="mini" + @click="handleImport" + v-hasPermi="['demo:demo:import']" + >瀵煎叆(鏍¢獙)</el-button> + </el-col> + <el-col :span="1.5"> + <el-button type="warning" plain icon="el-icon-download" size="mini" - :loading="exportLoading" @click="handleExport" v-hasPermi="['demo:demo:export']" >瀵煎嚭</el-button> @@ -97,13 +107,13 @@ <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span> </template> </el-table-column> - <el-table-column label="鍒涘缓浜�" align="center" prop="createBy" /> + <el-table-column label="鍒涘缓浜�" align="center" prop="createByName" /> <el-table-column label="鏇存柊鏃堕棿" align="center" prop="updateTime" width="180"> <template slot-scope="scope"> <span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d}') }}</span> </template> </el-table-column> - <el-table-column label="鏇存柊浜�" align="center" prop="updateBy" /> + <el-table-column label="鏇存柊浜�" align="center" prop="updateByName" /> <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width"> <template slot-scope="scope"> <el-button @@ -150,17 +160,48 @@ <el-form-item label="鍊�" prop="value"> <el-input v-model="form.value" placeholder="璇疯緭鍏ュ��" /> </el-form-item> + <el-form-item label="鍒涘缓鏃堕棿" prop="createTime"> + <el-date-picker clearable size="small" + v-model="form.createTime" + type="datetime" + value-format="yyyy-MM-dd HH:mm:ss" + placeholder="閫夋嫨鍒涘缓鏃堕棿"> + </el-date-picker> + </el-form-item> </el-form> <div slot="footer" class="dialog-footer"> - <el-button type="primary" @click="submitForm">纭� 瀹�</el-button> + <el-button :loading="buttonLoading" type="primary" @click="submitForm">纭� 瀹�</el-button> <el-button @click="cancel">鍙� 娑�</el-button> + </div> + </el-dialog> + <!-- 鐢ㄦ埛瀵煎叆瀵硅瘽妗� --> + <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body> + <el-upload + ref="upload" + :limit="1" + accept=".xlsx, .xls" + :headers="upload.headers" + :action="upload.url + '?updateSupport=' + upload.updateSupport" + :disabled="upload.isUploading" + :on-progress="handleFileUploadProgress" + :on-success="handleFileSuccess" + :auto-upload="false" + drag + > + <i class="el-icon-upload"></i> + <div class="el-upload__text">灏嗘枃浠舵嫋鍒版澶勶紝鎴�<em>鐐瑰嚮涓婁紶</em></div> + </el-upload> + <div slot="footer" class="dialog-footer"> + <el-button type="primary" @click="submitFileForm">纭� 瀹�</el-button> + <el-button @click="upload.open = false">鍙� 娑�</el-button> </div> </el-dialog> </div> </template> <script> -import { listDemo, getDemo, delDemo, addDemo, updateDemo, exportDemo } from "@/api/demo/demo"; +import { listDemo, pageDemo, getDemo, delDemo, addDemo, updateDemo } from "@/api/demo/demo"; +import {getToken} from "@/utils/auth"; export default { name: "Demo", @@ -168,10 +209,10 @@ }, data() { return { + //鎸夐挳loading + buttonLoading: false, // 閬僵灞� loading: true, - // 瀵煎嚭閬僵灞� - exportLoading: false, // 閫変腑鏁扮粍 ids: [], // 闈炲崟涓鐢� @@ -190,6 +231,19 @@ open: false, // 鍒涘缓鏃堕棿鏃堕棿鑼冨洿 daterangeCreateTime: [], + // 鐢ㄦ埛瀵煎叆鍙傛暟 + upload: { + // 鏄惁鏄剧ず寮瑰嚭灞傦紙鐢ㄦ埛瀵煎叆锛� + open: false, + // 寮瑰嚭灞傛爣棰橈紙鐢ㄦ埛瀵煎叆锛� + title: "", + // 鏄惁绂佺敤涓婁紶 + isUploading: false, + // 璁剧疆涓婁紶鐨勮姹傚ご閮� + headers: { Authorization: "Bearer " + getToken() }, + // 涓婁紶鐨勫湴鍧� + url: process.env.VUE_APP_BASE_API + "/demo/demo/importData" + }, // 鏌ヨ鍙傛暟 queryParams: { pageNum: 1, @@ -229,6 +283,20 @@ this.loading = false; }); }, + /** 鑷畾涔夊垎椤垫煡璇� */ + getPage() { + this.loading = true; + this.queryParams.params = {}; + if (null != this.daterangeCreateTime && '' != this.daterangeCreateTime) { + this.queryParams.params["beginCreateTime"] = this.daterangeCreateTime[0]; + this.queryParams.params["endCreateTime"] = this.daterangeCreateTime[1]; + } + pageDemo(this.queryParams).then(response => { + this.demoList = response.rows; + this.total = response.total; + this.loading = false; + }); + }, // 鍙栨秷鎸夐挳 cancel() { this.open = false; @@ -257,6 +325,11 @@ this.queryParams.pageNum = 1; this.getList(); }, + /** 鎼滅储鎸夐挳鎿嶄綔 */ + handlePage() { + this.queryParams.pageNum = 1; + this.getPage(); + }, /** 閲嶇疆鎸夐挳鎿嶄綔 */ resetQuery() { this.daterangeCreateTime = []; @@ -277,9 +350,11 @@ }, /** 淇敼鎸夐挳鎿嶄綔 */ handleUpdate(row) { + this.loading = true; this.reset(); const id = row.id || this.ids getDemo(id).then(response => { + this.loading = false; this.form = response.data; this.open = true; this.title = "淇敼娴嬭瘯鍗曡〃"; @@ -289,17 +364,22 @@ submitForm() { this.$refs["form"].validate(valid => { if (valid) { + this.buttonLoading = true; if (this.form.id != null) { updateDemo(this.form).then(response => { - this.msgSuccess("淇敼鎴愬姛"); + this.$modal.msgSuccess("淇敼鎴愬姛"); this.open = false; this.getList(); + }).finally(() => { + this.buttonLoading = false; }); } else { addDemo(this.form).then(response => { - this.msgSuccess("鏂板鎴愬姛"); + this.$modal.msgSuccess("鏂板鎴愬姛"); this.open = false; this.getList(); + }).finally(() => { + this.buttonLoading = false; }); } } @@ -308,31 +388,43 @@ /** 鍒犻櫎鎸夐挳鎿嶄綔 */ handleDelete(row) { const ids = row.id || this.ids; - this.$confirm('鏄惁纭鍒犻櫎娴嬭瘯鍗曡〃缂栧彿涓�"' + ids + '"鐨勬暟鎹」?', "璀﹀憡", { - confirmButtonText: "纭畾", - cancelButtonText: "鍙栨秷", - type: "warning" - }).then(function() { + this.$modal.confirm('鏄惁纭鍒犻櫎娴嬭瘯鍗曡〃缂栧彿涓�"' + ids + '"鐨勬暟鎹」锛�').then(() => { + this.loading = true; return delDemo(ids); }).then(() => { + this.loading = false; this.getList(); - this.msgSuccess("鍒犻櫎鎴愬姛"); - }) + this.$modal.msgSuccess("鍒犻櫎鎴愬姛"); + }).finally(() => { + this.loading = false; + }); + }, + /** 瀵煎叆鎸夐挳鎿嶄綔 */ + handleImport() { + this.upload.title = "鐢ㄦ埛瀵煎叆"; + this.upload.open = true; }, /** 瀵煎嚭鎸夐挳鎿嶄綔 */ handleExport() { - const queryParams = this.queryParams; - this.$confirm('鏄惁纭瀵煎嚭鎵�鏈夋祴璇曞崟琛ㄦ暟鎹」?', "璀﹀憡", { - confirmButtonText: "纭畾", - cancelButtonText: "鍙栨秷", - type: "warning" - }).then(() => { - this.exportLoading = true; - return exportDemo(queryParams); - }).then(response => { - this.download(response.msg); - this.exportLoading = false; - }) + this.download('demo/demo/export', { + ...this.queryParams + }, `demo_${new Date().getTime()}.xlsx`) + }, + // 鏂囦欢涓婁紶涓鐞� + handleFileUploadProgress(event, file, fileList) { + this.upload.isUploading = true; + }, + // 鏂囦欢涓婁紶鎴愬姛澶勭悊 + handleFileSuccess(response, file, fileList) { + this.upload.open = false; + this.upload.isUploading = false; + this.$refs.upload.clearFiles(); + this.$alert(response.msg, "瀵煎叆缁撴灉", { dangerouslyUseHTMLString: true }); + this.getList(); + }, + // 鎻愪氦涓婁紶鏂囦欢 + submitFileForm() { + this.$refs.upload.submit(); } } }; -- Gitblit v1.9.3