From c822e2f6cc276af484cc7e05f59337d14f68a280 Mon Sep 17 00:00:00 2001 From: 疯狂的狮子li <15040126243@163.com> Date: 星期二, 22 六月 2021 16:56:38 +0800 Subject: [PATCH] Merge branch 'master' of https://gitee.com/y_project/RuoYi-Vue into dev --- ruoyi-ui/src/views/system/dict/data.vue | 64 ++++++++++++++- ry.sh | 2 ruoyi-ui/src/views/monitor/druid/index.vue | 19 +--- ruoyi-ui/src/views/system/dict/index.vue | 15 ++- ruoyi-ui/src/components/DictTag/index.vue | 51 ++++++++++++ ruoyi-ui/src/components/iFrame/index.vue | 36 +++++++++ ruoyi-ui/src/views/tool/swagger/index.vue | 19 +--- 7 files changed, 164 insertions(+), 42 deletions(-) diff --git a/ruoyi-ui/src/components/DictTag/index.vue b/ruoyi-ui/src/components/DictTag/index.vue new file mode 100644 index 0000000..4779415 --- /dev/null +++ b/ruoyi-ui/src/components/DictTag/index.vue @@ -0,0 +1,51 @@ +<template> + <div> + <template v-for="(item, index) in options"> + <template v-if="values.includes(item.dictValue)"> + <span + v-if="item.listClass == 'default' || item.listClass == ''" + :key="item.dictValue" + :index="index" + :class="item.cssClass" + >{{ item.dictLabel }}</span + > + <el-tag + v-else + :key="item.dictValue" + :index="index" + :type="item.listClass == 'primary' ? '' : item.listClass" + :class="item.cssClass" + > + {{ item.dictLabel }} + </el-tag> + </template> + </template> + </div> +</template> + +<script> +export default { + name: "DictTag", + props: { + options: { + type: Array, + default: null, + }, + value: [String, Array], + }, + computed: { + values() { + if (this.value) { + return Array.isArray(this.value) ? this.value : [this.value]; + } else { + return []; + } + }, + }, +}; +</script> +<style scoped> +.el-tag + .el-tag { + margin-left: 10px; +} +</style> \ No newline at end of file diff --git a/ruoyi-ui/src/components/iFrame/index.vue b/ruoyi-ui/src/components/iFrame/index.vue new file mode 100644 index 0000000..4b85f36 --- /dev/null +++ b/ruoyi-ui/src/components/iFrame/index.vue @@ -0,0 +1,36 @@ +<template> + <div v-loading="loading" :style="'height:' + height"> + <iframe + :src="src" + frameborder="no" + style="width: 100%; height: 100%" + scrolling="auto" + /> + </div> +</template> +<script> +export default { + props: { + src: { + type: String, + required: true + }, + }, + data() { + return { + height: document.documentElement.clientHeight - 94.5 + "px;", + loading: true, + url: this.src + }; + }, + mounted: function () { + setTimeout(() => { + this.loading = false; + }, 300); + const that = this; + window.onresize = function temp() { + that.height = document.documentElement.clientHeight - 94.5 + "px;"; + }; + } +}; +</script> diff --git a/ruoyi-ui/src/views/monitor/druid/index.vue b/ruoyi-ui/src/views/monitor/druid/index.vue index a1a0bd9..c6ad585 100644 --- a/ruoyi-ui/src/views/monitor/druid/index.vue +++ b/ruoyi-ui/src/views/monitor/druid/index.vue @@ -1,26 +1,15 @@ <template> - <div v-loading="loading" :style="'height:'+ height"> - <iframe :src="src" frameborder="no" style="width: 100%;height: 100%" scrolling="auto" /> - </div> + <i-frame :src="url" /> </template> <script> +import iFrame from "@/components/iFrame/index"; export default { name: "Druid", + components: { iFrame }, data() { return { - src: process.env.VUE_APP_BASE_API + "/druid/login.html", - height: document.documentElement.clientHeight - 94.5 + "px;", - loading: true + url: process.env.VUE_APP_BASE_API + "/druid/login.html" }; }, - mounted: function() { - setTimeout(() => { - this.loading = false; - }, 230); - const that = this; - window.onresize = function temp() { - that.height = document.documentElement.clientHeight - 94.5 + "px;"; - }; - } }; </script> diff --git a/ruoyi-ui/src/views/system/dict/data.vue b/ruoyi-ui/src/views/system/dict/data.vue index 9a4b429..6ad3624 100644 --- a/ruoyi-ui/src/views/system/dict/data.vue +++ b/ruoyi-ui/src/views/system/dict/data.vue @@ -86,10 +86,19 @@ <el-table v-loading="loading" :data="dataList" @selection-change="handleSelectionChange"> <el-table-column type="selection" width="55" align="center" /> <el-table-column label="瀛楀吀缂栫爜" align="center" prop="dictCode" /> - <el-table-column label="瀛楀吀鏍囩" align="center" prop="dictLabel" /> + <el-table-column label="瀛楀吀鏍囩" align="center" prop="dictLabel"> + <template slot-scope="scope"> + <span v-if="scope.row.listClass == '' || scope.row.listClass == 'default'">{{scope.row.dictLabel}}</span> + <el-tag v-else :type="scope.row.listClass == 'primary' ? '' : scope.row.listClass">{{scope.row.dictLabel}}</el-tag> + </template> + </el-table-column> <el-table-column label="瀛楀吀閿��" align="center" prop="dictValue" /> <el-table-column label="瀛楀吀鎺掑簭" align="center" prop="dictSort" /> - <el-table-column label="鐘舵��" align="center" prop="status" :formatter="statusFormat" /> + <el-table-column label="鐘舵��" align="center" prop="status"> + <template slot-scope="scope"> + <dict-tag :options="statusOptions" :value="scope.row.status"/> + </template> + </el-table-column> <el-table-column label="澶囨敞" align="center" prop="remark" :show-overflow-tooltip="true" /> <el-table-column label="鍒涘缓鏃堕棿" align="center" prop="createTime" width="180"> <template slot-scope="scope"> @@ -136,8 +145,21 @@ <el-form-item label="鏁版嵁閿��" prop="dictValue"> <el-input v-model="form.dictValue" placeholder="璇疯緭鍏ユ暟鎹敭鍊�" /> </el-form-item> + <el-form-item label="鏍峰紡灞炴��" prop="cssClass"> + <el-input v-model="form.cssClass" placeholder="璇疯緭鍏ユ牱寮忓睘鎬�" /> + </el-form-item> <el-form-item label="鏄剧ず鎺掑簭" prop="dictSort"> <el-input-number v-model="form.dictSort" controls-position="right" :min="0" /> + </el-form-item> + <el-form-item label="鍥炴樉鏍峰紡" prop="listClass"> + <el-select v-model="form.listClass"> + <el-option + v-for="item in listClassOptions" + :key="item.value" + :label="item.label" + :value="item.value" + ></el-option> + </el-select> </el-form-item> <el-form-item label="鐘舵��" prop="status"> <el-radio-group v-model="form.status"> @@ -163,9 +185,14 @@ <script> import { listData, getData, delData, addData, updateData, exportData } from "@/api/system/dict/data"; import { listType, getType } from "@/api/system/dict/type"; +// 瀛楀吀鏍囩缁勪欢锛堜娇鐢ㄩ绻佸彲鍦ㄥ叏灞�鎸傝浇锛� +import DictTag from '@/components/DictTag' export default { name: "Data", + components: { + DictTag + }, data() { return { // 閬僵灞� @@ -190,6 +217,33 @@ title: "", // 鏄惁鏄剧ず寮瑰嚭灞� open: false, + // 鏁版嵁鏍囩鍥炴樉鏍峰紡 + listClassOptions: [ + { + value: "default", + label: "榛樿" + }, + { + value: "primary", + label: "涓昏" + }, + { + value: "success", + label: "鎴愬姛" + }, + { + value: "info", + label: "淇℃伅" + }, + { + value: "warning", + label: "璀﹀憡" + }, + { + value: "danger", + label: "鍗遍櫓" + } + ], // 鐘舵�佹暟鎹瓧鍏� statusOptions: [], // 绫诲瀷鏁版嵁瀛楀吀 @@ -250,10 +304,6 @@ this.loading = false; }); }, - // 鏁版嵁鐘舵�佸瓧鍏哥炕璇� - statusFormat(row, column) { - return this.selectDictLabel(this.statusOptions, row.status); - }, // 鍙栨秷鎸夐挳 cancel() { this.open = false; @@ -265,6 +315,8 @@ dictCode: undefined, dictLabel: undefined, dictValue: undefined, + cssClass: undefined, + listClass: 'default', dictSort: 0, status: "0", remark: undefined diff --git a/ruoyi-ui/src/views/system/dict/index.vue b/ruoyi-ui/src/views/system/dict/index.vue index a6b8ba3..fad57c2 100644 --- a/ruoyi-ui/src/views/system/dict/index.vue +++ b/ruoyi-ui/src/views/system/dict/index.vue @@ -123,7 +123,11 @@ </router-link> </template> </el-table-column> - <el-table-column label="鐘舵��" align="center" prop="status" :formatter="statusFormat" /> + <el-table-column label="鐘舵��" align="center" prop="status"> + <template slot-scope="scope"> + <dict-tag :options="statusOptions" :value="scope.row.status"/> + </template> + </el-table-column> <el-table-column label="澶囨敞" align="center" prop="remark" :show-overflow-tooltip="true" /> <el-table-column label="鍒涘缓鏃堕棿" align="center" prop="createTime" width="180"> <template slot-scope="scope"> @@ -190,9 +194,14 @@ <script> import { listType, getType, delType, addType, updateType, exportType, refreshCache } from "@/api/system/dict/type"; +// 瀛楀吀鏍囩缁勪欢锛堜娇鐢ㄩ绻佸彲鍦ㄥ叏灞�鎸傝浇锛� +import DictTag from '@/components/DictTag' export default { name: "Dict", + components: { + DictTag + }, data() { return { // 閬僵灞� @@ -256,10 +265,6 @@ this.loading = false; } ); - }, - // 瀛楀吀鐘舵�佸瓧鍏哥炕璇� - statusFormat(row, column) { - return this.selectDictLabel(this.statusOptions, row.status); }, // 鍙栨秷鎸夐挳 cancel() { diff --git a/ruoyi-ui/src/views/tool/swagger/index.vue b/ruoyi-ui/src/views/tool/swagger/index.vue index 8504daf..b782968 100644 --- a/ruoyi-ui/src/views/tool/swagger/index.vue +++ b/ruoyi-ui/src/views/tool/swagger/index.vue @@ -1,26 +1,15 @@ <template> - <div v-loading="loading" :style="'height:'+ height"> - <iframe :src="src" frameborder="no" style="width: 100%;height: 100%" scrolling="auto" /> - </div> + <i-frame :src="url" /> </template> <script> +import iFrame from "@/components/iFrame/index"; export default { name: "Swagger", + components: { iFrame }, data() { return { - src: process.env.VUE_APP_BASE_API + "/doc.html", - height: document.documentElement.clientHeight - 94.5 + "px;", - loading: true + url: process.env.VUE_APP_BASE_API + "/doc.html" }; }, - mounted: function() { - setTimeout(() => { - this.loading = false; - }, 230); - const that = this; - window.onresize = function temp() { - that.height = document.documentElement.clientHeight - 94.5 + "px;"; - }; - } }; </script> diff --git a/ry.sh b/ry.sh index d296c55..d8e1a78 100644 --- a/ry.sh +++ b/ry.sh @@ -3,7 +3,7 @@ # ./ry.sh start 鍚姩 # ./ry.sh stop 鍋滄 # ./ry.sh restart 閲嶅惎 -# ./ry.sh start 鐘舵�� +# ./ry.sh status 鐘舵�� AppName=ruoyi-admin.jar # JVM鍙傛暟 -- Gitblit v1.9.3