From 8040ad8c0391ca46d6359348a5ecc850ff41d574 Mon Sep 17 00:00:00 2001 From: 马小法 <ma_0425@163.com> Date: 星期一, 30 八月 2021 16:53:16 +0800 Subject: [PATCH] 修改数据字典回显 --- ruoyi-ui/src/views/monitor/job/log.vue | 22 ruoyi-ui/src/views/system/notice/index.vue | 666 +++--- ruoyi-ui/src/views/system/menu/index.vue | 874 ++++---- ruoyi-ui/src/views/system/dept/index.vue | 634 +++--- ruoyi-ui/src/views/monitor/job/index.vue | 1046 +++++----- ruoyi-ui/src/views/monitor/logininfor/index.vue | 494 ++-- ruoyi-ui/src/views/monitor/operlog/index.vue | 674 +++--- ruoyi-ui/src/views/system/config/index.vue | 732 +++--- ruoyi-ui/src/views/system/post/index.vue | 662 +++--- 9 files changed, 2,893 insertions(+), 2,911 deletions(-) diff --git a/ruoyi-ui/src/views/monitor/job/index.vue b/ruoyi-ui/src/views/monitor/job/index.vue index 53cfb32..6146633 100644 --- a/ruoyi-ui/src/views/monitor/job/index.vue +++ b/ruoyi-ui/src/views/monitor/job/index.vue @@ -1,523 +1,523 @@ -<template> - <div class="app-container"> - <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> - <el-form-item label="浠诲姟鍚嶇О" prop="jobName"> - <el-input - v-model="queryParams.jobName" - placeholder="璇疯緭鍏ヤ换鍔″悕绉�" - clearable - size="small" - @keyup.enter.native="handleQuery" - /> - </el-form-item> - <el-form-item label="浠诲姟缁勫悕" prop="jobGroup"> - <el-select v-model="queryParams.jobGroup" placeholder="璇烽�夋嫨浠诲姟缁勫悕" clearable size="small"> - <el-option - v-for="dict in jobGroupOptions" - :key="dict.dictValue" - :label="dict.dictLabel" - :value="dict.dictValue" - /> - </el-select> - </el-form-item> - <el-form-item label="浠诲姟鐘舵��" prop="status"> - <el-select v-model="queryParams.status" placeholder="璇烽�夋嫨浠诲姟鐘舵��" clearable size="small"> - <el-option - v-for="dict in statusOptions" - :key="dict.dictValue" - :label="dict.dictLabel" - :value="dict.dictValue" - /> - </el-select> - </el-form-item> - <el-form-item> - <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> - <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button> - </el-form-item> - </el-form> - - <el-row :gutter="10" class="mb8"> - <el-col :span="1.5"> - <el-button - type="primary" - plain - icon="el-icon-plus" - size="mini" - @click="handleAdd" - v-hasPermi="['monitor:job:add']" - >鏂板</el-button> - </el-col> - <el-col :span="1.5"> - <el-button - type="success" - plain - icon="el-icon-edit" - size="mini" - :disabled="single" - @click="handleUpdate" - v-hasPermi="['monitor:job:edit']" - >淇敼</el-button> - </el-col> - <el-col :span="1.5"> - <el-button - type="danger" - plain - icon="el-icon-delete" - size="mini" - :disabled="multiple" - @click="handleDelete" - v-hasPermi="['monitor:job:remove']" - >鍒犻櫎</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="['monitor:job:export']" - >瀵煎嚭</el-button> - </el-col> - <el-col :span="1.5"> - <el-button - type="info" - plain - icon="el-icon-s-operation" - size="mini" - @click="handleJobLog" - v-hasPermi="['monitor:job:query']" - >鏃ュ織</el-button> - </el-col> - <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> - </el-row> - - <el-table v-loading="loading" :data="jobList" @selection-change="handleSelectionChange"> - <el-table-column type="selection" width="55" align="center" /> - <el-table-column label="浠诲姟缂栧彿" align="center" prop="jobId" /> - <el-table-column label="浠诲姟鍚嶇О" align="center" prop="jobName" :show-overflow-tooltip="true" /> - <el-table-column label="浠诲姟缁勫悕" align="center" prop="jobGroup" :formatter="jobGroupFormat" /> - <el-table-column label="璋冪敤鐩爣瀛楃涓�" align="center" prop="invokeTarget" :show-overflow-tooltip="true" /> - <el-table-column label="cron鎵ц琛ㄨ揪寮�" align="center" prop="cronExpression" :show-overflow-tooltip="true" /> - <el-table-column label="鐘舵��" align="center"> - <template slot-scope="scope"> - <el-switch - v-model="scope.row.status" - active-value="0" - inactive-value="1" - @change="handleStatusChange(scope.row)" - ></el-switch> - </template> - </el-table-column> - <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width"> - <template slot-scope="scope"> - <el-button - size="mini" - type="text" - icon="el-icon-edit" - @click="handleUpdate(scope.row)" - v-hasPermi="['monitor:job:edit']" - >淇敼</el-button> - <el-button - size="mini" - type="text" - icon="el-icon-delete" - @click="handleDelete(scope.row)" - v-hasPermi="['monitor:job:remove']" - >鍒犻櫎</el-button> - <el-dropdown size="mini" @command="(command) => handleCommand(command, scope.row)" v-hasPermi="['monitor:job:changeStatus', 'monitor:job:query']"> - <span class="el-dropdown-link"> - <i class="el-icon-d-arrow-right el-icon--right"></i>鏇村 - </span> - <el-dropdown-menu slot="dropdown"> - <el-dropdown-item command="handleRun" icon="el-icon-caret-right" - v-hasPermi="['monitor:job:changeStatus']">鎵ц涓�娆�</el-dropdown-item> - <el-dropdown-item command="handleView" icon="el-icon-view" - v-hasPermi="['monitor:job:query']">浠诲姟璇︾粏</el-dropdown-item> - <el-dropdown-item command="handleJobLog" icon="el-icon-s-operation" - v-hasPermi="['monitor:job:query']">璋冨害鏃ュ織</el-dropdown-item> - </el-dropdown-menu> - </el-dropdown> - </template> - </el-table-column> - </el-table> - - <pagination - v-show="total>0" - :total="total" - :page.sync="queryParams.pageNum" - :limit.sync="queryParams.pageSize" - @pagination="getList" - /> - - <!-- 娣诲姞鎴栦慨鏀瑰畾鏃朵换鍔″璇濇 --> - <el-dialog :title="title" :visible.sync="open" width="700px" append-to-body> - <el-form ref="form" :model="form" :rules="rules" label-width="120px"> - <el-row> - <el-col :span="12"> - <el-form-item label="浠诲姟鍚嶇О" prop="jobName"> - <el-input v-model="form.jobName" placeholder="璇疯緭鍏ヤ换鍔″悕绉�" /> - </el-form-item> - </el-col> - <el-col :span="12"> - <el-form-item label="浠诲姟鍒嗙粍" prop="jobGroup"> - <el-select v-model="form.jobGroup" placeholder="璇烽�夋嫨"> - <el-option - v-for="dict in jobGroupOptions" - :key="dict.dictValue" - :label="dict.dictLabel" - :value="dict.dictValue" - ></el-option> - </el-select> - </el-form-item> - </el-col> - <el-col :span="24"> - <el-form-item prop="invokeTarget"> - <span slot="label"> - 璋冪敤鏂规硶 - <el-tooltip placement="top"> - <div slot="content"> - Bean璋冪敤绀轰緥锛歳yTask.ryParams('ry') - <br />Class绫昏皟鐢ㄧず渚嬶細com.ruoyi.quartz.task.RyTask.ryParams('ry') - <br />鍙傛暟璇存槑锛氭敮鎸佸瓧绗︿覆锛屽竷灏旂被鍨嬶紝闀挎暣鍨嬶紝娴偣鍨嬶紝鏁村瀷 - </div> - <i class="el-icon-question"></i> - </el-tooltip> - </span> - <el-input v-model="form.invokeTarget" placeholder="璇疯緭鍏ヨ皟鐢ㄧ洰鏍囧瓧绗︿覆" /> - </el-form-item> - </el-col> - <el-col :span="12"> - <el-form-item label="cron琛ㄨ揪寮�" prop="cronExpression"> - <el-input v-model="form.cronExpression" placeholder="璇疯緭鍏ron鎵ц琛ㄨ揪寮�" /> - </el-form-item> - </el-col> - <el-col :span="12"> - <el-form-item label="鏄惁骞跺彂" prop="concurrent"> - <el-radio-group v-model="form.concurrent" size="small"> - <el-radio-button label="0">鍏佽</el-radio-button> - <el-radio-button label="1">绂佹</el-radio-button> - </el-radio-group> - </el-form-item> - </el-col> - <el-col :span="24"> - <el-form-item label="閿欒绛栫暐" prop="misfirePolicy"> - <el-radio-group v-model="form.misfirePolicy" size="small"> - <el-radio-button label="1">绔嬪嵆鎵ц</el-radio-button> - <el-radio-button label="2">鎵ц涓�娆�</el-radio-button> - <el-radio-button label="3">鏀惧純鎵ц</el-radio-button> - </el-radio-group> - </el-form-item> - </el-col> - <el-col :span="24"> - <el-form-item label="鐘舵��"> - <el-radio-group v-model="form.status"> - <el-radio - v-for="dict in statusOptions" - :key="dict.dictValue" - :label="dict.dictValue" - >{{dict.dictLabel}}</el-radio> - </el-radio-group> - </el-form-item> - </el-col> - </el-row> - </el-form> - <div slot="footer" class="dialog-footer"> - <el-button type="primary" @click="submitForm">纭� 瀹�</el-button> - <el-button @click="cancel">鍙� 娑�</el-button> - </div> - </el-dialog> - - <!-- 浠诲姟鏃ュ織璇︾粏 --> - <el-dialog title="浠诲姟璇︾粏" :visible.sync="openView" width="700px" append-to-body> - <el-form ref="form" :model="form" label-width="120px" size="mini"> - <el-row> - <el-col :span="12"> - <el-form-item label="浠诲姟缂栧彿锛�">{{ form.jobId }}</el-form-item> - <el-form-item label="浠诲姟鍚嶇О锛�">{{ form.jobName }}</el-form-item> - </el-col> - <el-col :span="12"> - <el-form-item label="浠诲姟鍒嗙粍锛�">{{ jobGroupFormat(form) }}</el-form-item> - <el-form-item label="鍒涘缓鏃堕棿锛�">{{ form.createTime }}</el-form-item> - </el-col> - <el-col :span="12"> - <el-form-item label="cron琛ㄨ揪寮忥細">{{ form.cronExpression }}</el-form-item> - </el-col> - <el-col :span="12"> - <el-form-item label="涓嬫鎵ц鏃堕棿锛�">{{ parseTime(form.nextValidTime) }}</el-form-item> - </el-col> - <el-col :span="24"> - <el-form-item label="璋冪敤鐩爣鏂规硶锛�">{{ form.invokeTarget }}</el-form-item> - </el-col> - <el-col :span="12"> - <el-form-item label="浠诲姟鐘舵�侊細"> - <div v-if="form.status == 0">姝e父</div> - <div v-else-if="form.status == 1">澶辫触</div> - </el-form-item> - </el-col> - <el-col :span="12"> - <el-form-item label="鏄惁骞跺彂锛�"> - <div v-if="form.concurrent == 0">鍏佽</div> - <div v-else-if="form.concurrent == 1">绂佹</div> - </el-form-item> - </el-col> - <el-col :span="12"> - <el-form-item label="鎵ц绛栫暐锛�"> - <div v-if="form.misfirePolicy == 0">榛樿绛栫暐</div> - <div v-else-if="form.misfirePolicy == 1">绔嬪嵆鎵ц</div> - <div v-else-if="form.misfirePolicy == 2">鎵ц涓�娆�</div> - <div v-else-if="form.misfirePolicy == 3">鏀惧純鎵ц</div> - </el-form-item> - </el-col> - </el-row> - </el-form> - <div slot="footer" class="dialog-footer"> - <el-button @click="openView = false">鍏� 闂�</el-button> - </div> - </el-dialog> - </div> -</template> - -<script> -import { listJob, getJob, delJob, addJob, updateJob, exportJob, runJob, changeJobStatus } from "@/api/monitor/job"; - -export default { - name: "Job", - data() { - return { - // 閬僵灞� - loading: true, - // 瀵煎嚭閬僵灞� - exportLoading: false, - // 閫変腑鏁扮粍 - ids: [], - // 闈炲崟涓鐢� - single: true, - // 闈炲涓鐢� - multiple: true, - // 鏄剧ず鎼滅储鏉′欢 - showSearch: true, - // 鎬绘潯鏁� - total: 0, - // 瀹氭椂浠诲姟琛ㄦ牸鏁版嵁 - jobList: [], - // 寮瑰嚭灞傛爣棰� - title: "", - // 鏄惁鏄剧ず寮瑰嚭灞� - open: false, - // 鏄惁鏄剧ず璇︾粏寮瑰嚭灞� - openView: false, - // 浠诲姟缁勫悕瀛楀吀 - jobGroupOptions: [], - // 鐘舵�佸瓧鍏� - statusOptions: [], - // 鏌ヨ鍙傛暟 - queryParams: { - pageNum: 1, - pageSize: 10, - jobName: undefined, - jobGroup: undefined, - status: undefined - }, - // 琛ㄥ崟鍙傛暟 - form: {}, - // 琛ㄥ崟鏍¢獙 - rules: { - jobName: [ - { required: true, message: "浠诲姟鍚嶇О涓嶈兘涓虹┖", trigger: "blur" } - ], - invokeTarget: [ - { required: true, message: "璋冪敤鐩爣瀛楃涓蹭笉鑳戒负绌�", trigger: "blur" } - ], - cronExpression: [ - { required: true, message: "cron鎵ц琛ㄨ揪寮忎笉鑳戒负绌�", trigger: "blur" } - ] - } - }; - }, - created() { - this.getList(); - this.getDicts("sys_job_group").then(response => { - this.jobGroupOptions = response.data; - }); - this.getDicts("sys_job_status").then(response => { - this.statusOptions = response.data; - }); - }, - methods: { - /** 鏌ヨ瀹氭椂浠诲姟鍒楄〃 */ - getList() { - this.loading = true; - listJob(this.queryParams).then(response => { - this.jobList = response.rows; - this.total = response.total; - this.loading = false; - }); - }, - // 浠诲姟缁勫悕瀛楀吀缈昏瘧 - jobGroupFormat(row, column) { - return this.selectDictLabel(this.jobGroupOptions, row.jobGroup); - }, - // 鐘舵�佸瓧鍏哥炕璇� - statusFormat(row, column) { - return this.selectDictLabel(this.statusOptions, row.status); - }, - // 鍙栨秷鎸夐挳 - cancel() { - this.open = false; - this.reset(); - }, - // 琛ㄥ崟閲嶇疆 - reset() { - this.form = { - jobId: undefined, - jobName: undefined, - jobGroup: undefined, - invokeTarget: undefined, - cronExpression: undefined, - misfirePolicy: 1, - concurrent: 1, - status: "0" - }; - this.resetForm("form"); - }, - /** 鎼滅储鎸夐挳鎿嶄綔 */ - handleQuery() { - this.queryParams.pageNum = 1; - this.getList(); - }, - /** 閲嶇疆鎸夐挳鎿嶄綔 */ - resetQuery() { - this.resetForm("queryForm"); - this.handleQuery(); - }, - // 澶氶�夋閫変腑鏁版嵁 - handleSelectionChange(selection) { - this.ids = selection.map(item => item.jobId); - this.single = selection.length != 1; - this.multiple = !selection.length; - }, - // 鏇村鎿嶄綔瑙﹀彂 - handleCommand(command, row) { - switch (command) { - case "handleRun": - this.handleRun(row); - break; - case "handleView": - this.handleView(row); - break; - case "handleJobLog": - this.handleJobLog(row); - break; - default: - break; - } - }, - // 浠诲姟鐘舵�佷慨鏀� - handleStatusChange(row) { - let text = row.status === "0" ? "鍚敤" : "鍋滅敤"; - this.$confirm('纭瑕�"' + text + '""' + row.jobName + '"浠诲姟鍚�?', "璀﹀憡", { - confirmButtonText: "纭畾", - cancelButtonText: "鍙栨秷", - type: "warning" - }).then(function() { - return changeJobStatus(row.jobId, row.status); - }).then(() => { - this.msgSuccess(text + "鎴愬姛"); - }).catch(function() { - row.status = row.status === "0" ? "1" : "0"; - }); - }, - /* 绔嬪嵆鎵ц涓�娆� */ - handleRun(row) { - this.$confirm('纭瑕佺珛鍗虫墽琛屼竴娆�"' + row.jobName + '"浠诲姟鍚�?', "璀﹀憡", { - confirmButtonText: "纭畾", - cancelButtonText: "鍙栨秷", - type: "warning" - }).then(function() { - return runJob(row.jobId, row.jobGroup); - }).then(() => { - this.msgSuccess("鎵ц鎴愬姛"); - }).catch(() => {}); - }, - /** 浠诲姟璇︾粏淇℃伅 */ - handleView(row) { - getJob(row.jobId).then(response => { - this.form = response.data; - this.openView = true; - }); - }, - /** 浠诲姟鏃ュ織鍒楄〃鏌ヨ */ - handleJobLog(row) { - const jobId = row.jobId || 0; - this.$router.push({ path: '/monitor/job-log/index', query: { jobId: jobId } }) - }, - /** 鏂板鎸夐挳鎿嶄綔 */ - handleAdd() { - this.reset(); - this.open = true; - this.title = "娣诲姞浠诲姟"; - }, - /** 淇敼鎸夐挳鎿嶄綔 */ - handleUpdate(row) { - this.reset(); - const jobId = row.jobId || this.ids; - getJob(jobId).then(response => { - this.form = response.data; - this.open = true; - this.title = "淇敼浠诲姟"; - }); - }, - /** 鎻愪氦鎸夐挳 */ - submitForm: function() { - this.$refs["form"].validate(valid => { - if (valid) { - if (this.form.jobId != undefined) { - updateJob(this.form).then(response => { - this.msgSuccess("淇敼鎴愬姛"); - this.open = false; - this.getList(); - }); - } else { - addJob(this.form).then(response => { - this.msgSuccess("鏂板鎴愬姛"); - this.open = false; - this.getList(); - }); - } - } - }); - }, - /** 鍒犻櫎鎸夐挳鎿嶄綔 */ - handleDelete(row) { - const jobIds = row.jobId || this.ids; - this.$confirm('鏄惁纭鍒犻櫎瀹氭椂浠诲姟缂栧彿涓�"' + jobIds + '"鐨勬暟鎹」?', "璀﹀憡", { - confirmButtonText: "纭畾", - cancelButtonText: "鍙栨秷", - type: "warning" - }).then(function() { - return delJob(jobIds); - }).then(() => { - this.getList(); - this.msgSuccess("鍒犻櫎鎴愬姛"); - }).catch(() => {}); - }, - /** 瀵煎嚭鎸夐挳鎿嶄綔 */ - handleExport() { - const queryParams = this.queryParams; - this.$confirm("鏄惁纭瀵煎嚭鎵�鏈夊畾鏃朵换鍔℃暟鎹」?", "璀﹀憡", { - confirmButtonText: "纭畾", - cancelButtonText: "鍙栨秷", - type: "warning" - }).then(() => { - this.exportLoading = true; - return exportJob(queryParams); - }).then(response => { - this.download(response.msg); - this.exportLoading = false; - }).catch(() => {}); - } - } -}; -</script> \ No newline at end of file +<template> + <div class="app-container"> + <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> + <el-form-item label="浠诲姟鍚嶇О" prop="jobName"> + <el-input + v-model="queryParams.jobName" + placeholder="璇疯緭鍏ヤ换鍔″悕绉�" + clearable + size="small" + @keyup.enter.native="handleQuery" + /> + </el-form-item> + <el-form-item label="浠诲姟缁勫悕" prop="jobGroup"> + <el-select v-model="queryParams.jobGroup" placeholder="璇烽�夋嫨浠诲姟缁勫悕" clearable size="small"> + <el-option + v-for="dict in jobGroupOptions" + :key="dict.dictValue" + :label="dict.dictLabel" + :value="dict.dictValue" + /> + </el-select> + </el-form-item> + <el-form-item label="浠诲姟鐘舵��" prop="status"> + <el-select v-model="queryParams.status" placeholder="璇烽�夋嫨浠诲姟鐘舵��" clearable size="small"> + <el-option + v-for="dict in statusOptions" + :key="dict.dictValue" + :label="dict.dictLabel" + :value="dict.dictValue" + /> + </el-select> + </el-form-item> + <el-form-item> + <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> + <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button> + </el-form-item> + </el-form> + + <el-row :gutter="10" class="mb8"> + <el-col :span="1.5"> + <el-button + type="primary" + plain + icon="el-icon-plus" + size="mini" + @click="handleAdd" + v-hasPermi="['monitor:job:add']" + >鏂板</el-button> + </el-col> + <el-col :span="1.5"> + <el-button + type="success" + plain + icon="el-icon-edit" + size="mini" + :disabled="single" + @click="handleUpdate" + v-hasPermi="['monitor:job:edit']" + >淇敼</el-button> + </el-col> + <el-col :span="1.5"> + <el-button + type="danger" + plain + icon="el-icon-delete" + size="mini" + :disabled="multiple" + @click="handleDelete" + v-hasPermi="['monitor:job:remove']" + >鍒犻櫎</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="['monitor:job:export']" + >瀵煎嚭</el-button> + </el-col> + <el-col :span="1.5"> + <el-button + type="info" + plain + icon="el-icon-s-operation" + size="mini" + @click="handleJobLog" + v-hasPermi="['monitor:job:query']" + >鏃ュ織</el-button> + </el-col> + <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> + </el-row> + + <el-table v-loading="loading" :data="jobList" @selection-change="handleSelectionChange"> + <el-table-column type="selection" width="55" align="center" /> + <el-table-column label="浠诲姟缂栧彿" align="center" prop="jobId" /> + <el-table-column label="浠诲姟鍚嶇О" align="center" prop="jobName" :show-overflow-tooltip="true" /> + <el-table-column label="浠诲姟缁勫悕" align="center" prop="jobGroup"> + <template slot-scope="scope"> + <dict-tag :options="jobGroupOptions" :value="scope.row.jobGroup"/> + </template> + </el-table-column> + <el-table-column label="璋冪敤鐩爣瀛楃涓�" align="center" prop="invokeTarget" :show-overflow-tooltip="true" /> + <el-table-column label="cron鎵ц琛ㄨ揪寮�" align="center" prop="cronExpression" :show-overflow-tooltip="true" /> + <el-table-column label="鐘舵��" align="center"> + <template slot-scope="scope"> + <el-switch + v-model="scope.row.status" + active-value="0" + inactive-value="1" + @change="handleStatusChange(scope.row)" + ></el-switch> + </template> + </el-table-column> + <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width"> + <template slot-scope="scope"> + <el-button + size="mini" + type="text" + icon="el-icon-edit" + @click="handleUpdate(scope.row)" + v-hasPermi="['monitor:job:edit']" + >淇敼</el-button> + <el-button + size="mini" + type="text" + icon="el-icon-delete" + @click="handleDelete(scope.row)" + v-hasPermi="['monitor:job:remove']" + >鍒犻櫎</el-button> + <el-dropdown size="mini" @command="(command) => handleCommand(command, scope.row)" v-hasPermi="['monitor:job:changeStatus', 'monitor:job:query']"> + <span class="el-dropdown-link"> + <i class="el-icon-d-arrow-right el-icon--right"></i>鏇村 + </span> + <el-dropdown-menu slot="dropdown"> + <el-dropdown-item command="handleRun" icon="el-icon-caret-right" + v-hasPermi="['monitor:job:changeStatus']">鎵ц涓�娆�</el-dropdown-item> + <el-dropdown-item command="handleView" icon="el-icon-view" + v-hasPermi="['monitor:job:query']">浠诲姟璇︾粏</el-dropdown-item> + <el-dropdown-item command="handleJobLog" icon="el-icon-s-operation" + v-hasPermi="['monitor:job:query']">璋冨害鏃ュ織</el-dropdown-item> + </el-dropdown-menu> + </el-dropdown> + </template> + </el-table-column> + </el-table> + + <pagination + v-show="total>0" + :total="total" + :page.sync="queryParams.pageNum" + :limit.sync="queryParams.pageSize" + @pagination="getList" + /> + + <!-- 娣诲姞鎴栦慨鏀瑰畾鏃朵换鍔″璇濇 --> + <el-dialog :title="title" :visible.sync="open" width="700px" append-to-body> + <el-form ref="form" :model="form" :rules="rules" label-width="120px"> + <el-row> + <el-col :span="12"> + <el-form-item label="浠诲姟鍚嶇О" prop="jobName"> + <el-input v-model="form.jobName" placeholder="璇疯緭鍏ヤ换鍔″悕绉�" /> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="浠诲姟鍒嗙粍" prop="jobGroup"> + <el-select v-model="form.jobGroup" placeholder="璇烽�夋嫨"> + <el-option + v-for="dict in jobGroupOptions" + :key="dict.dictValue" + :label="dict.dictLabel" + :value="dict.dictValue" + ></el-option> + </el-select> + </el-form-item> + </el-col> + <el-col :span="24"> + <el-form-item prop="invokeTarget"> + <span slot="label"> + 璋冪敤鏂规硶 + <el-tooltip placement="top"> + <div slot="content"> + Bean璋冪敤绀轰緥锛歳yTask.ryParams('ry') + <br />Class绫昏皟鐢ㄧず渚嬶細com.ruoyi.quartz.task.RyTask.ryParams('ry') + <br />鍙傛暟璇存槑锛氭敮鎸佸瓧绗︿覆锛屽竷灏旂被鍨嬶紝闀挎暣鍨嬶紝娴偣鍨嬶紝鏁村瀷 + </div> + <i class="el-icon-question"></i> + </el-tooltip> + </span> + <el-input v-model="form.invokeTarget" placeholder="璇疯緭鍏ヨ皟鐢ㄧ洰鏍囧瓧绗︿覆" /> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="cron琛ㄨ揪寮�" prop="cronExpression"> + <el-input v-model="form.cronExpression" placeholder="璇疯緭鍏ron鎵ц琛ㄨ揪寮�" /> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鏄惁骞跺彂" prop="concurrent"> + <el-radio-group v-model="form.concurrent" size="small"> + <el-radio-button label="0">鍏佽</el-radio-button> + <el-radio-button label="1">绂佹</el-radio-button> + </el-radio-group> + </el-form-item> + </el-col> + <el-col :span="24"> + <el-form-item label="閿欒绛栫暐" prop="misfirePolicy"> + <el-radio-group v-model="form.misfirePolicy" size="small"> + <el-radio-button label="1">绔嬪嵆鎵ц</el-radio-button> + <el-radio-button label="2">鎵ц涓�娆�</el-radio-button> + <el-radio-button label="3">鏀惧純鎵ц</el-radio-button> + </el-radio-group> + </el-form-item> + </el-col> + <el-col :span="24"> + <el-form-item label="鐘舵��"> + <el-radio-group v-model="form.status"> + <el-radio + v-for="dict in statusOptions" + :key="dict.dictValue" + :label="dict.dictValue" + >{{dict.dictLabel}}</el-radio> + </el-radio-group> + </el-form-item> + </el-col> + </el-row> + </el-form> + <div slot="footer" class="dialog-footer"> + <el-button type="primary" @click="submitForm">纭� 瀹�</el-button> + <el-button @click="cancel">鍙� 娑�</el-button> + </div> + </el-dialog> + + <!-- 浠诲姟鏃ュ織璇︾粏 --> + <el-dialog title="浠诲姟璇︾粏" :visible.sync="openView" width="700px" append-to-body> + <el-form ref="form" :model="form" label-width="120px" size="mini"> + <el-row> + <el-col :span="12"> + <el-form-item label="浠诲姟缂栧彿锛�">{{ form.jobId }}</el-form-item> + <el-form-item label="浠诲姟鍚嶇О锛�">{{ form.jobName }}</el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="浠诲姟鍒嗙粍锛�">{{ jobGroupFormat(form) }}</el-form-item> + <el-form-item label="鍒涘缓鏃堕棿锛�">{{ form.createTime }}</el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="cron琛ㄨ揪寮忥細">{{ form.cronExpression }}</el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="涓嬫鎵ц鏃堕棿锛�">{{ parseTime(form.nextValidTime) }}</el-form-item> + </el-col> + <el-col :span="24"> + <el-form-item label="璋冪敤鐩爣鏂规硶锛�">{{ form.invokeTarget }}</el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="浠诲姟鐘舵�侊細"> + <div v-if="form.status == 0">姝e父</div> + <div v-else-if="form.status == 1">澶辫触</div> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鏄惁骞跺彂锛�"> + <div v-if="form.concurrent == 0">鍏佽</div> + <div v-else-if="form.concurrent == 1">绂佹</div> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鎵ц绛栫暐锛�"> + <div v-if="form.misfirePolicy == 0">榛樿绛栫暐</div> + <div v-else-if="form.misfirePolicy == 1">绔嬪嵆鎵ц</div> + <div v-else-if="form.misfirePolicy == 2">鎵ц涓�娆�</div> + <div v-else-if="form.misfirePolicy == 3">鏀惧純鎵ц</div> + </el-form-item> + </el-col> + </el-row> + </el-form> + <div slot="footer" class="dialog-footer"> + <el-button @click="openView = false">鍏� 闂�</el-button> + </div> + </el-dialog> + </div> +</template> + +<script> +import { listJob, getJob, delJob, addJob, updateJob, exportJob, runJob, changeJobStatus } from "@/api/monitor/job"; + +export default { + name: "Job", + data() { + return { + // 閬僵灞� + loading: true, + // 瀵煎嚭閬僵灞� + exportLoading: false, + // 閫変腑鏁扮粍 + ids: [], + // 闈炲崟涓鐢� + single: true, + // 闈炲涓鐢� + multiple: true, + // 鏄剧ず鎼滅储鏉′欢 + showSearch: true, + // 鎬绘潯鏁� + total: 0, + // 瀹氭椂浠诲姟琛ㄦ牸鏁版嵁 + jobList: [], + // 寮瑰嚭灞傛爣棰� + title: "", + // 鏄惁鏄剧ず寮瑰嚭灞� + open: false, + // 鏄惁鏄剧ず璇︾粏寮瑰嚭灞� + openView: false, + // 浠诲姟缁勫悕瀛楀吀 + jobGroupOptions: [], + // 鐘舵�佸瓧鍏� + statusOptions: [], + // 鏌ヨ鍙傛暟 + queryParams: { + pageNum: 1, + pageSize: 10, + jobName: undefined, + jobGroup: undefined, + status: undefined + }, + // 琛ㄥ崟鍙傛暟 + form: {}, + // 琛ㄥ崟鏍¢獙 + rules: { + jobName: [ + { required: true, message: "浠诲姟鍚嶇О涓嶈兘涓虹┖", trigger: "blur" } + ], + invokeTarget: [ + { required: true, message: "璋冪敤鐩爣瀛楃涓蹭笉鑳戒负绌�", trigger: "blur" } + ], + cronExpression: [ + { required: true, message: "cron鎵ц琛ㄨ揪寮忎笉鑳戒负绌�", trigger: "blur" } + ] + } + }; + }, + created() { + this.getList(); + this.getDicts("sys_job_group").then(response => { + this.jobGroupOptions = response.data; + }); + this.getDicts("sys_job_status").then(response => { + this.statusOptions = response.data; + }); + }, + methods: { + /** 鏌ヨ瀹氭椂浠诲姟鍒楄〃 */ + getList() { + this.loading = true; + listJob(this.queryParams).then(response => { + this.jobList = response.rows; + this.total = response.total; + this.loading = false; + }); + }, + // 浠诲姟缁勫悕瀛楀吀缈昏瘧 + jobGroupFormat(row, column) { + return this.selectDictLabel(this.jobGroupOptions, row.jobGroup); + }, + // 鍙栨秷鎸夐挳 + cancel() { + this.open = false; + this.reset(); + }, + // 琛ㄥ崟閲嶇疆 + reset() { + this.form = { + jobId: undefined, + jobName: undefined, + jobGroup: undefined, + invokeTarget: undefined, + cronExpression: undefined, + misfirePolicy: 1, + concurrent: 1, + status: "0" + }; + this.resetForm("form"); + }, + /** 鎼滅储鎸夐挳鎿嶄綔 */ + handleQuery() { + this.queryParams.pageNum = 1; + this.getList(); + }, + /** 閲嶇疆鎸夐挳鎿嶄綔 */ + resetQuery() { + this.resetForm("queryForm"); + this.handleQuery(); + }, + // 澶氶�夋閫変腑鏁版嵁 + handleSelectionChange(selection) { + this.ids = selection.map(item => item.jobId); + this.single = selection.length != 1; + this.multiple = !selection.length; + }, + // 鏇村鎿嶄綔瑙﹀彂 + handleCommand(command, row) { + switch (command) { + case "handleRun": + this.handleRun(row); + break; + case "handleView": + this.handleView(row); + break; + case "handleJobLog": + this.handleJobLog(row); + break; + default: + break; + } + }, + // 浠诲姟鐘舵�佷慨鏀� + handleStatusChange(row) { + let text = row.status === "0" ? "鍚敤" : "鍋滅敤"; + this.$confirm('纭瑕�"' + text + '""' + row.jobName + '"浠诲姟鍚�?', "璀﹀憡", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning" + }).then(function() { + return changeJobStatus(row.jobId, row.status); + }).then(() => { + this.msgSuccess(text + "鎴愬姛"); + }).catch(function() { + row.status = row.status === "0" ? "1" : "0"; + }); + }, + /* 绔嬪嵆鎵ц涓�娆� */ + handleRun(row) { + this.$confirm('纭瑕佺珛鍗虫墽琛屼竴娆�"' + row.jobName + '"浠诲姟鍚�?', "璀﹀憡", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning" + }).then(function() { + return runJob(row.jobId, row.jobGroup); + }).then(() => { + this.msgSuccess("鎵ц鎴愬姛"); + }).catch(() => {}); + }, + /** 浠诲姟璇︾粏淇℃伅 */ + handleView(row) { + getJob(row.jobId).then(response => { + this.form = response.data; + this.openView = true; + }); + }, + /** 浠诲姟鏃ュ織鍒楄〃鏌ヨ */ + handleJobLog(row) { + const jobId = row.jobId || 0; + this.$router.push({ path: '/monitor/job-log/index', query: { jobId: jobId } }) + }, + /** 鏂板鎸夐挳鎿嶄綔 */ + handleAdd() { + this.reset(); + this.open = true; + this.title = "娣诲姞浠诲姟"; + }, + /** 淇敼鎸夐挳鎿嶄綔 */ + handleUpdate(row) { + this.reset(); + const jobId = row.jobId || this.ids; + getJob(jobId).then(response => { + this.form = response.data; + this.open = true; + this.title = "淇敼浠诲姟"; + }); + }, + /** 鎻愪氦鎸夐挳 */ + submitForm: function() { + this.$refs["form"].validate(valid => { + if (valid) { + if (this.form.jobId != undefined) { + updateJob(this.form).then(response => { + this.msgSuccess("淇敼鎴愬姛"); + this.open = false; + this.getList(); + }); + } else { + addJob(this.form).then(response => { + this.msgSuccess("鏂板鎴愬姛"); + this.open = false; + this.getList(); + }); + } + } + }); + }, + /** 鍒犻櫎鎸夐挳鎿嶄綔 */ + handleDelete(row) { + const jobIds = row.jobId || this.ids; + this.$confirm('鏄惁纭鍒犻櫎瀹氭椂浠诲姟缂栧彿涓�"' + jobIds + '"鐨勬暟鎹」?', "璀﹀憡", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning" + }).then(function() { + return delJob(jobIds); + }).then(() => { + this.getList(); + this.msgSuccess("鍒犻櫎鎴愬姛"); + }).catch(() => {}); + }, + /** 瀵煎嚭鎸夐挳鎿嶄綔 */ + handleExport() { + const queryParams = this.queryParams; + this.$confirm("鏄惁纭瀵煎嚭鎵�鏈夊畾鏃朵换鍔℃暟鎹」?", "璀﹀憡", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning" + }).then(() => { + this.exportLoading = true; + return exportJob(queryParams); + }).then(response => { + this.download(response.msg); + this.exportLoading = false; + }).catch(() => {}); + } + } +}; +</script> diff --git a/ruoyi-ui/src/views/monitor/job/log.vue b/ruoyi-ui/src/views/monitor/job/log.vue index 25db43f..b55b011 100644 --- a/ruoyi-ui/src/views/monitor/job/log.vue +++ b/ruoyi-ui/src/views/monitor/job/log.vue @@ -110,10 +110,18 @@ <el-table-column type="selection" width="55" align="center" /> <el-table-column label="鏃ュ織缂栧彿" width="80" align="center" prop="jobLogId" /> <el-table-column label="浠诲姟鍚嶇О" align="center" prop="jobName" :show-overflow-tooltip="true" /> - <el-table-column label="浠诲姟缁勫悕" align="center" prop="jobGroup" :formatter="jobGroupFormat" :show-overflow-tooltip="true" /> + <el-table-column label="浠诲姟缁勫悕" align="center" prop="jobGroup" :show-overflow-tooltip="true"> + <template slot-scope="scope"> + <dict-tag :options="jobGroupOptions" :value="scope.row.jobGroup"/> + </template> + </el-table-column> <el-table-column label="璋冪敤鐩爣瀛楃涓�" align="center" prop="invokeTarget" :show-overflow-tooltip="true" /> <el-table-column label="鏃ュ織淇℃伅" align="center" prop="jobMessage" :show-overflow-tooltip="true" /> - <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="createTime" width="180"> <template slot-scope="scope"> <span>{{ parseTime(scope.row.createTime) }}</span> @@ -247,14 +255,6 @@ } ); }, - // 鎵ц鐘舵�佸瓧鍏哥炕璇� - statusFormat(row, column) { - return this.selectDictLabel(this.statusOptions, row.status); - }, - // 浠诲姟缁勫悕瀛楀吀缈昏瘧 - jobGroupFormat(row, column) { - return this.selectDictLabel(this.jobGroupOptions, row.jobGroup); - }, // 杩斿洖鎸夐挳 handleClose() { this.$store.dispatch("tagsView/delView", this.$route); @@ -325,4 +325,4 @@ } } }; -</script> \ No newline at end of file +</script> diff --git a/ruoyi-ui/src/views/monitor/logininfor/index.vue b/ruoyi-ui/src/views/monitor/logininfor/index.vue index 8b051b3..59df72c 100644 --- a/ruoyi-ui/src/views/monitor/logininfor/index.vue +++ b/ruoyi-ui/src/views/monitor/logininfor/index.vue @@ -1,247 +1,247 @@ -<template> - <div class="app-container"> - <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> - <el-form-item label="鐧诲綍鍦板潃" prop="ipaddr"> - <el-input - v-model="queryParams.ipaddr" - placeholder="璇疯緭鍏ョ櫥褰曞湴鍧�" - clearable - style="width: 240px;" - size="small" - @keyup.enter.native="handleQuery" - /> - </el-form-item> - <el-form-item label="鐢ㄦ埛鍚嶇О" prop="userName"> - <el-input - v-model="queryParams.userName" - placeholder="璇疯緭鍏ョ敤鎴峰悕绉�" - clearable - style="width: 240px;" - size="small" - @keyup.enter.native="handleQuery" - /> - </el-form-item> - <el-form-item label="鐘舵��" prop="status"> - <el-select - v-model="queryParams.status" - placeholder="鐧诲綍鐘舵��" - clearable - size="small" - style="width: 240px" - > - <el-option - v-for="dict in statusOptions" - :key="dict.dictValue" - :label="dict.dictLabel" - :value="dict.dictValue" - /> - </el-select> - </el-form-item> - <el-form-item label="鐧诲綍鏃堕棿"> - <el-date-picker - v-model="dateRange" - size="small" - style="width: 240px" - value-format="yyyy-MM-dd" - type="daterange" - range-separator="-" - start-placeholder="寮�濮嬫棩鏈�" - end-placeholder="缁撴潫鏃ユ湡" - ></el-date-picker> - </el-form-item> - <el-form-item> - <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> - <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button> - </el-form-item> - </el-form> - - <el-row :gutter="10" class="mb8"> - <el-col :span="1.5"> - <el-button - type="danger" - plain - icon="el-icon-delete" - size="mini" - :disabled="multiple" - @click="handleDelete" - v-hasPermi="['monitor:logininfor:remove']" - >鍒犻櫎</el-button> - </el-col> - <el-col :span="1.5"> - <el-button - type="danger" - plain - icon="el-icon-delete" - size="mini" - @click="handleClean" - v-hasPermi="['monitor:logininfor:remove']" - >娓呯┖</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="['monitor:logininfor:export']" - >瀵煎嚭</el-button> - </el-col> - <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> - </el-row> - - <el-table ref="tables" v-loading="loading" :data="list" @selection-change="handleSelectionChange" :default-sort="defaultSort" @sort-change="handleSortChange"> - <el-table-column type="selection" width="55" align="center" /> - <el-table-column label="璁块棶缂栧彿" align="center" prop="infoId" /> - <el-table-column label="鐢ㄦ埛鍚嶇О" align="center" prop="userName" :show-overflow-tooltip="true" sortable="custom" :sort-orders="['descending', 'ascending']" /> - <el-table-column label="鐧诲綍鍦板潃" align="center" prop="ipaddr" width="130" :show-overflow-tooltip="true" /> - <el-table-column label="鐧诲綍鍦扮偣" align="center" prop="loginLocation" :show-overflow-tooltip="true" /> - <el-table-column label="娴忚鍣�" align="center" prop="browser" :show-overflow-tooltip="true" /> - <el-table-column label="鎿嶄綔绯荤粺" align="center" prop="os" /> - <el-table-column label="鐧诲綍鐘舵��" align="center" prop="status" :formatter="statusFormat" /> - <el-table-column label="鎿嶄綔淇℃伅" align="center" prop="msg" /> - <el-table-column label="鐧诲綍鏃ユ湡" align="center" prop="loginTime" sortable="custom" :sort-orders="['descending', 'ascending']" width="180"> - <template slot-scope="scope"> - <span>{{ parseTime(scope.row.loginTime) }}</span> - </template> - </el-table-column> - </el-table> - - <pagination - v-show="total>0" - :total="total" - :page.sync="queryParams.pageNum" - :limit.sync="queryParams.pageSize" - @pagination="getList" - /> - </div> -</template> - -<script> -import { list, delLogininfor, cleanLogininfor, exportLogininfor } from "@/api/monitor/logininfor"; - -export default { - name: "Logininfor", - data() { - return { - // 閬僵灞� - loading: true, - // 瀵煎嚭閬僵灞� - exportLoading: false, - // 閫変腑鏁扮粍 - ids: [], - // 闈炲涓鐢� - multiple: true, - // 鏄剧ず鎼滅储鏉′欢 - showSearch: true, - // 鎬绘潯鏁� - total: 0, - // 琛ㄦ牸鏁版嵁 - list: [], - // 鐘舵�佹暟鎹瓧鍏� - statusOptions: [], - // 鏃ユ湡鑼冨洿 - dateRange: [], - // 榛樿鎺掑簭 - defaultSort: {prop: 'loginTime', order: 'descending'}, - // 鏌ヨ鍙傛暟 - queryParams: { - pageNum: 1, - pageSize: 10, - ipaddr: undefined, - userName: undefined, - status: undefined - } - }; - }, - created() { - this.getList(); - this.getDicts("sys_common_status").then(response => { - this.statusOptions = response.data; - }); - }, - methods: { - /** 鏌ヨ鐧诲綍鏃ュ織鍒楄〃 */ - getList() { - this.loading = true; - list(this.addDateRange(this.queryParams, this.dateRange)).then(response => { - this.list = response.rows; - this.total = response.total; - this.loading = false; - } - ); - }, - // 鐧诲綍鐘舵�佸瓧鍏哥炕璇� - statusFormat(row, column) { - return this.selectDictLabel(this.statusOptions, row.status); - }, - /** 鎼滅储鎸夐挳鎿嶄綔 */ - handleQuery() { - this.queryParams.pageNum = 1; - this.getList(); - }, - /** 閲嶇疆鎸夐挳鎿嶄綔 */ - resetQuery() { - this.dateRange = []; - this.resetForm("queryForm"); - this.$refs.tables.sort(this.defaultSort.prop, this.defaultSort.order) - this.handleQuery(); - }, - /** 澶氶�夋閫変腑鏁版嵁 */ - handleSelectionChange(selection) { - this.ids = selection.map(item => item.infoId) - this.multiple = !selection.length - }, - /** 鎺掑簭瑙﹀彂浜嬩欢 */ - handleSortChange(column, prop, order) { - this.queryParams.orderByColumn = column.prop; - this.queryParams.isAsc = column.order; - this.getList(); - }, - /** 鍒犻櫎鎸夐挳鎿嶄綔 */ - handleDelete(row) { - const infoIds = row.infoId || this.ids; - this.$confirm('鏄惁纭鍒犻櫎璁块棶缂栧彿涓�"' + infoIds + '"鐨勬暟鎹」?', "璀﹀憡", { - confirmButtonText: "纭畾", - cancelButtonText: "鍙栨秷", - type: "warning" - }).then(function() { - return delLogininfor(infoIds); - }).then(() => { - this.getList(); - this.msgSuccess("鍒犻櫎鎴愬姛"); - }).catch(() => {}); - }, - /** 娓呯┖鎸夐挳鎿嶄綔 */ - handleClean() { - this.$confirm('鏄惁纭娓呯┖鎵�鏈夌櫥褰曟棩蹇楁暟鎹」?', "璀﹀憡", { - confirmButtonText: "纭畾", - cancelButtonText: "鍙栨秷", - type: "warning" - }).then(function() { - return cleanLogininfor(); - }).then(() => { - this.getList(); - this.msgSuccess("娓呯┖鎴愬姛"); - }).catch(() => {}); - }, - /** 瀵煎嚭鎸夐挳鎿嶄綔 */ - handleExport() { - const queryParams = this.queryParams; - this.$confirm('鏄惁纭瀵煎嚭鎵�鏈夋搷浣滄棩蹇楁暟鎹」?', "璀﹀憡", { - confirmButtonText: "纭畾", - cancelButtonText: "鍙栨秷", - type: "warning" - }).then(() => { - this.exportLoading = true; - return exportLogininfor(queryParams); - }).then(response => { - this.download(response.msg); - this.exportLoading = false; - }).catch(() => {}); - } - } -}; -</script> - +<template> + <div class="app-container"> + <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> + <el-form-item label="鐧诲綍鍦板潃" prop="ipaddr"> + <el-input + v-model="queryParams.ipaddr" + placeholder="璇疯緭鍏ョ櫥褰曞湴鍧�" + clearable + style="width: 240px;" + size="small" + @keyup.enter.native="handleQuery" + /> + </el-form-item> + <el-form-item label="鐢ㄦ埛鍚嶇О" prop="userName"> + <el-input + v-model="queryParams.userName" + placeholder="璇疯緭鍏ョ敤鎴峰悕绉�" + clearable + style="width: 240px;" + size="small" + @keyup.enter.native="handleQuery" + /> + </el-form-item> + <el-form-item label="鐘舵��" prop="status"> + <el-select + v-model="queryParams.status" + placeholder="鐧诲綍鐘舵��" + clearable + size="small" + style="width: 240px" + > + <el-option + v-for="dict in statusOptions" + :key="dict.dictValue" + :label="dict.dictLabel" + :value="dict.dictValue" + /> + </el-select> + </el-form-item> + <el-form-item label="鐧诲綍鏃堕棿"> + <el-date-picker + v-model="dateRange" + size="small" + style="width: 240px" + value-format="yyyy-MM-dd" + type="daterange" + range-separator="-" + start-placeholder="寮�濮嬫棩鏈�" + end-placeholder="缁撴潫鏃ユ湡" + ></el-date-picker> + </el-form-item> + <el-form-item> + <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> + <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button> + </el-form-item> + </el-form> + + <el-row :gutter="10" class="mb8"> + <el-col :span="1.5"> + <el-button + type="danger" + plain + icon="el-icon-delete" + size="mini" + :disabled="multiple" + @click="handleDelete" + v-hasPermi="['monitor:logininfor:remove']" + >鍒犻櫎</el-button> + </el-col> + <el-col :span="1.5"> + <el-button + type="danger" + plain + icon="el-icon-delete" + size="mini" + @click="handleClean" + v-hasPermi="['monitor:logininfor:remove']" + >娓呯┖</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="['monitor:logininfor:export']" + >瀵煎嚭</el-button> + </el-col> + <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> + </el-row> + + <el-table ref="tables" v-loading="loading" :data="list" @selection-change="handleSelectionChange" :default-sort="defaultSort" @sort-change="handleSortChange"> + <el-table-column type="selection" width="55" align="center" /> + <el-table-column label="璁块棶缂栧彿" align="center" prop="infoId" /> + <el-table-column label="鐢ㄦ埛鍚嶇О" align="center" prop="userName" :show-overflow-tooltip="true" sortable="custom" :sort-orders="['descending', 'ascending']" /> + <el-table-column label="鐧诲綍鍦板潃" align="center" prop="ipaddr" width="130" :show-overflow-tooltip="true" /> + <el-table-column label="鐧诲綍鍦扮偣" align="center" prop="loginLocation" :show-overflow-tooltip="true" /> + <el-table-column label="娴忚鍣�" align="center" prop="browser" :show-overflow-tooltip="true" /> + <el-table-column label="鎿嶄綔绯荤粺" align="center" prop="os" /> + <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="msg" /> + <el-table-column label="鐧诲綍鏃ユ湡" align="center" prop="loginTime" sortable="custom" :sort-orders="['descending', 'ascending']" width="180"> + <template slot-scope="scope"> + <span>{{ parseTime(scope.row.loginTime) }}</span> + </template> + </el-table-column> + </el-table> + + <pagination + v-show="total>0" + :total="total" + :page.sync="queryParams.pageNum" + :limit.sync="queryParams.pageSize" + @pagination="getList" + /> + </div> +</template> + +<script> +import { list, delLogininfor, cleanLogininfor, exportLogininfor } from "@/api/monitor/logininfor"; + +export default { + name: "Logininfor", + data() { + return { + // 閬僵灞� + loading: true, + // 瀵煎嚭閬僵灞� + exportLoading: false, + // 閫変腑鏁扮粍 + ids: [], + // 闈炲涓鐢� + multiple: true, + // 鏄剧ず鎼滅储鏉′欢 + showSearch: true, + // 鎬绘潯鏁� + total: 0, + // 琛ㄦ牸鏁版嵁 + list: [], + // 鐘舵�佹暟鎹瓧鍏� + statusOptions: [], + // 鏃ユ湡鑼冨洿 + dateRange: [], + // 榛樿鎺掑簭 + defaultSort: {prop: 'loginTime', order: 'descending'}, + // 鏌ヨ鍙傛暟 + queryParams: { + pageNum: 1, + pageSize: 10, + ipaddr: undefined, + userName: undefined, + status: undefined + } + }; + }, + created() { + this.getList(); + this.getDicts("sys_common_status").then(response => { + this.statusOptions = response.data; + }); + }, + methods: { + /** 鏌ヨ鐧诲綍鏃ュ織鍒楄〃 */ + getList() { + this.loading = true; + list(this.addDateRange(this.queryParams, this.dateRange)).then(response => { + this.list = response.rows; + this.total = response.total; + this.loading = false; + } + ); + }, + /** 鎼滅储鎸夐挳鎿嶄綔 */ + handleQuery() { + this.queryParams.pageNum = 1; + this.getList(); + }, + /** 閲嶇疆鎸夐挳鎿嶄綔 */ + resetQuery() { + this.dateRange = []; + this.resetForm("queryForm"); + this.$refs.tables.sort(this.defaultSort.prop, this.defaultSort.order) + this.handleQuery(); + }, + /** 澶氶�夋閫変腑鏁版嵁 */ + handleSelectionChange(selection) { + this.ids = selection.map(item => item.infoId) + this.multiple = !selection.length + }, + /** 鎺掑簭瑙﹀彂浜嬩欢 */ + handleSortChange(column, prop, order) { + this.queryParams.orderByColumn = column.prop; + this.queryParams.isAsc = column.order; + this.getList(); + }, + /** 鍒犻櫎鎸夐挳鎿嶄綔 */ + handleDelete(row) { + const infoIds = row.infoId || this.ids; + this.$confirm('鏄惁纭鍒犻櫎璁块棶缂栧彿涓�"' + infoIds + '"鐨勬暟鎹」?', "璀﹀憡", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning" + }).then(function() { + return delLogininfor(infoIds); + }).then(() => { + this.getList(); + this.msgSuccess("鍒犻櫎鎴愬姛"); + }).catch(() => {}); + }, + /** 娓呯┖鎸夐挳鎿嶄綔 */ + handleClean() { + this.$confirm('鏄惁纭娓呯┖鎵�鏈夌櫥褰曟棩蹇楁暟鎹」?', "璀﹀憡", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning" + }).then(function() { + return cleanLogininfor(); + }).then(() => { + this.getList(); + this.msgSuccess("娓呯┖鎴愬姛"); + }).catch(() => {}); + }, + /** 瀵煎嚭鎸夐挳鎿嶄綔 */ + handleExport() { + const queryParams = this.queryParams; + this.$confirm('鏄惁纭瀵煎嚭鎵�鏈夋搷浣滄棩蹇楁暟鎹」?', "璀﹀憡", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning" + }).then(() => { + this.exportLoading = true; + return exportLogininfor(queryParams); + }).then(response => { + this.download(response.msg); + this.exportLoading = false; + }).catch(() => {}); + } + } +}; +</script> + diff --git a/ruoyi-ui/src/views/monitor/operlog/index.vue b/ruoyi-ui/src/views/monitor/operlog/index.vue index 64158e6..783908b 100644 --- a/ruoyi-ui/src/views/monitor/operlog/index.vue +++ b/ruoyi-ui/src/views/monitor/operlog/index.vue @@ -1,335 +1,339 @@ -<template> - <div class="app-container"> - <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> - <el-form-item label="绯荤粺妯″潡" prop="title"> - <el-input - v-model="queryParams.title" - placeholder="璇疯緭鍏ョ郴缁熸ā鍧�" - clearable - style="width: 240px;" - size="small" - @keyup.enter.native="handleQuery" - /> - </el-form-item> - <el-form-item label="鎿嶄綔浜哄憳" prop="operName"> - <el-input - v-model="queryParams.operName" - placeholder="璇疯緭鍏ユ搷浣滀汉鍛�" - clearable - style="width: 240px;" - size="small" - @keyup.enter.native="handleQuery" - /> - </el-form-item> - <el-form-item label="绫诲瀷" prop="businessType"> - <el-select - v-model="queryParams.businessType" - placeholder="鎿嶄綔绫诲瀷" - clearable - size="small" - style="width: 240px" - > - <el-option - v-for="dict in typeOptions" - :key="dict.dictValue" - :label="dict.dictLabel" - :value="dict.dictValue" - /> - </el-select> - </el-form-item> - <el-form-item label="鐘舵��" prop="status"> - <el-select - v-model="queryParams.status" - placeholder="鎿嶄綔鐘舵��" - clearable - size="small" - style="width: 240px" - > - <el-option - v-for="dict in statusOptions" - :key="dict.dictValue" - :label="dict.dictLabel" - :value="dict.dictValue" - /> - </el-select> - </el-form-item> - <el-form-item label="鎿嶄綔鏃堕棿"> - <el-date-picker - v-model="dateRange" - size="small" - style="width: 240px" - value-format="yyyy-MM-dd" - type="daterange" - range-separator="-" - start-placeholder="寮�濮嬫棩鏈�" - end-placeholder="缁撴潫鏃ユ湡" - ></el-date-picker> - </el-form-item> - <el-form-item> - <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> - <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button> - </el-form-item> - </el-form> - - <el-row :gutter="10" class="mb8"> - <el-col :span="1.5"> - <el-button - type="danger" - plain - icon="el-icon-delete" - size="mini" - :disabled="multiple" - @click="handleDelete" - v-hasPermi="['monitor:operlog:remove']" - >鍒犻櫎</el-button> - </el-col> - <el-col :span="1.5"> - <el-button - type="danger" - plain - icon="el-icon-delete" - size="mini" - @click="handleClean" - v-hasPermi="['monitor:operlog:remove']" - >娓呯┖</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="['monitor:operlog:export']" - >瀵煎嚭</el-button> - </el-col> - <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> - </el-row> - - <el-table ref="tables" v-loading="loading" :data="list" @selection-change="handleSelectionChange" :default-sort="defaultSort" @sort-change="handleSortChange"> - <el-table-column type="selection" width="55" align="center" /> - <el-table-column label="鏃ュ織缂栧彿" align="center" prop="operId" /> - <el-table-column label="绯荤粺妯″潡" align="center" prop="title" /> - <el-table-column label="鎿嶄綔绫诲瀷" align="center" prop="businessType" :formatter="typeFormat" /> - <el-table-column label="璇锋眰鏂瑰紡" align="center" prop="requestMethod" /> - <el-table-column label="鎿嶄綔浜哄憳" align="center" prop="operName" width="100" :show-overflow-tooltip="true" sortable="custom" :sort-orders="['descending', 'ascending']" /> - <el-table-column label="鎿嶄綔鍦板潃" align="center" prop="operIp" width="130" :show-overflow-tooltip="true" /> - <el-table-column label="鎿嶄綔鍦扮偣" align="center" prop="operLocation" :show-overflow-tooltip="true" /> - <el-table-column label="鎿嶄綔鐘舵��" align="center" prop="status" :formatter="statusFormat" /> - <el-table-column label="鎿嶄綔鏃ユ湡" align="center" prop="operTime" sortable="custom" :sort-orders="['descending', 'ascending']" width="180"> - <template slot-scope="scope"> - <span>{{ parseTime(scope.row.operTime) }}</span> - </template> - </el-table-column> - <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width"> - <template slot-scope="scope"> - <el-button - size="mini" - type="text" - icon="el-icon-view" - @click="handleView(scope.row,scope.index)" - v-hasPermi="['monitor:operlog:query']" - >璇︾粏</el-button> - </template> - </el-table-column> - </el-table> - - <pagination - v-show="total>0" - :total="total" - :page.sync="queryParams.pageNum" - :limit.sync="queryParams.pageSize" - @pagination="getList" - /> - - <!-- 鎿嶄綔鏃ュ織璇︾粏 --> - <el-dialog title="鎿嶄綔鏃ュ織璇︾粏" :visible.sync="open" width="700px" append-to-body> - <el-form ref="form" :model="form" label-width="100px" size="mini"> - <el-row> - <el-col :span="12"> - <el-form-item label="鎿嶄綔妯″潡锛�">{{ form.title }} / {{ typeFormat(form) }}</el-form-item> - <el-form-item - label="鐧诲綍淇℃伅锛�" - >{{ form.operName }} / {{ form.operIp }} / {{ form.operLocation }}</el-form-item> - </el-col> - <el-col :span="12"> - <el-form-item label="璇锋眰鍦板潃锛�">{{ form.operUrl }}</el-form-item> - <el-form-item label="璇锋眰鏂瑰紡锛�">{{ form.requestMethod }}</el-form-item> - </el-col> - <el-col :span="24"> - <el-form-item label="鎿嶄綔鏂规硶锛�">{{ form.method }}</el-form-item> - </el-col> - <el-col :span="24"> - <el-form-item label="璇锋眰鍙傛暟锛�">{{ form.operParam }}</el-form-item> - </el-col> - <el-col :span="24"> - <el-form-item label="杩斿洖鍙傛暟锛�">{{ form.jsonResult }}</el-form-item> - </el-col> - <el-col :span="12"> - <el-form-item label="鎿嶄綔鐘舵�侊細"> - <div v-if="form.status === 0">姝e父</div> - <div v-else-if="form.status === 1">澶辫触</div> - </el-form-item> - </el-col> - <el-col :span="12"> - <el-form-item label="鎿嶄綔鏃堕棿锛�">{{ parseTime(form.operTime) }}</el-form-item> - </el-col> - <el-col :span="24"> - <el-form-item label="寮傚父淇℃伅锛�" v-if="form.status === 1">{{ form.errorMsg }}</el-form-item> - </el-col> - </el-row> - </el-form> - <div slot="footer" class="dialog-footer"> - <el-button @click="open = false">鍏� 闂�</el-button> - </div> - </el-dialog> - </div> -</template> - -<script> -import { list, delOperlog, cleanOperlog, exportOperlog } from "@/api/monitor/operlog"; - -export default { - name: "Operlog", - data() { - return { - // 閬僵灞� - loading: true, - // 瀵煎嚭閬僵灞� - exportLoading: false, - // 閫変腑鏁扮粍 - ids: [], - // 闈炲涓鐢� - multiple: true, - // 鏄剧ず鎼滅储鏉′欢 - showSearch: true, - // 鎬绘潯鏁� - total: 0, - // 琛ㄦ牸鏁版嵁 - list: [], - // 鏄惁鏄剧ず寮瑰嚭灞� - open: false, - // 绫诲瀷鏁版嵁瀛楀吀 - typeOptions: [], - // 绫诲瀷鏁版嵁瀛楀吀 - statusOptions: [], - // 鏃ユ湡鑼冨洿 - dateRange: [], - // 榛樿鎺掑簭 - defaultSort: {prop: 'operTime', order: 'descending'}, - // 琛ㄥ崟鍙傛暟 - form: {}, - // 鏌ヨ鍙傛暟 - queryParams: { - pageNum: 1, - pageSize: 10, - title: undefined, - operName: undefined, - businessType: undefined, - status: undefined - } - }; - }, - created() { - this.getList(); - this.getDicts("sys_oper_type").then(response => { - this.typeOptions = response.data; - }); - this.getDicts("sys_common_status").then(response => { - this.statusOptions = response.data; - }); - }, - methods: { - /** 鏌ヨ鐧诲綍鏃ュ織 */ - getList() { - this.loading = true; - list(this.addDateRange(this.queryParams, this.dateRange)).then( response => { - this.list = response.rows; - this.total = response.total; - this.loading = false; - } - ); - }, - // 鎿嶄綔鏃ュ織鐘舵�佸瓧鍏哥炕璇� - statusFormat(row, column) { - return this.selectDictLabel(this.statusOptions, row.status); - }, - // 鎿嶄綔鏃ュ織绫诲瀷瀛楀吀缈昏瘧 - typeFormat(row, column) { - return this.selectDictLabel(this.typeOptions, row.businessType); - }, - /** 鎼滅储鎸夐挳鎿嶄綔 */ - handleQuery() { - this.queryParams.pageNum = 1; - this.getList(); - }, - /** 閲嶇疆鎸夐挳鎿嶄綔 */ - resetQuery() { - this.dateRange = []; - this.resetForm("queryForm"); - this.$refs.tables.sort(this.defaultSort.prop, this.defaultSort.order) - this.handleQuery(); - }, - /** 澶氶�夋閫変腑鏁版嵁 */ - handleSelectionChange(selection) { - this.ids = selection.map(item => item.operId) - this.multiple = !selection.length - }, - /** 鎺掑簭瑙﹀彂浜嬩欢 */ - handleSortChange(column, prop, order) { - this.queryParams.orderByColumn = column.prop; - this.queryParams.isAsc = column.order; - this.getList(); - }, - /** 璇︾粏鎸夐挳鎿嶄綔 */ - handleView(row) { - this.open = true; - this.form = row; - }, - /** 鍒犻櫎鎸夐挳鎿嶄綔 */ - handleDelete(row) { - const operIds = row.operId || this.ids; - this.$confirm('鏄惁纭鍒犻櫎鏃ュ織缂栧彿涓�"' + operIds + '"鐨勬暟鎹」?', "璀﹀憡", { - confirmButtonText: "纭畾", - cancelButtonText: "鍙栨秷", - type: "warning" - }).then(function() { - return delOperlog(operIds); - }).then(() => { - this.getList(); - this.msgSuccess("鍒犻櫎鎴愬姛"); - }).catch(() => {}); - }, - /** 娓呯┖鎸夐挳鎿嶄綔 */ - handleClean() { - this.$confirm('鏄惁纭娓呯┖鎵�鏈夋搷浣滄棩蹇楁暟鎹」?', "璀﹀憡", { - confirmButtonText: "纭畾", - cancelButtonText: "鍙栨秷", - type: "warning" - }).then(function() { - return cleanOperlog(); - }).then(() => { - this.getList(); - this.msgSuccess("娓呯┖鎴愬姛"); - }).catch(() => {}); - }, - /** 瀵煎嚭鎸夐挳鎿嶄綔 */ - handleExport() { - const queryParams = this.queryParams; - this.$confirm('鏄惁纭瀵煎嚭鎵�鏈夋搷浣滄棩蹇楁暟鎹」?', "璀﹀憡", { - confirmButtonText: "纭畾", - cancelButtonText: "鍙栨秷", - type: "warning" - }).then(() => { - this.exportLoading = true; - return exportOperlog(queryParams); - }).then(response => { - this.download(response.msg); - this.exportLoading = false; - }).catch(() => {}); - } - } -}; -</script> - +<template> + <div class="app-container"> + <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> + <el-form-item label="绯荤粺妯″潡" prop="title"> + <el-input + v-model="queryParams.title" + placeholder="璇疯緭鍏ョ郴缁熸ā鍧�" + clearable + style="width: 240px;" + size="small" + @keyup.enter.native="handleQuery" + /> + </el-form-item> + <el-form-item label="鎿嶄綔浜哄憳" prop="operName"> + <el-input + v-model="queryParams.operName" + placeholder="璇疯緭鍏ユ搷浣滀汉鍛�" + clearable + style="width: 240px;" + size="small" + @keyup.enter.native="handleQuery" + /> + </el-form-item> + <el-form-item label="绫诲瀷" prop="businessType"> + <el-select + v-model="queryParams.businessType" + placeholder="鎿嶄綔绫诲瀷" + clearable + size="small" + style="width: 240px" + > + <el-option + v-for="dict in typeOptions" + :key="dict.dictValue" + :label="dict.dictLabel" + :value="dict.dictValue" + /> + </el-select> + </el-form-item> + <el-form-item label="鐘舵��" prop="status"> + <el-select + v-model="queryParams.status" + placeholder="鎿嶄綔鐘舵��" + clearable + size="small" + style="width: 240px" + > + <el-option + v-for="dict in statusOptions" + :key="dict.dictValue" + :label="dict.dictLabel" + :value="dict.dictValue" + /> + </el-select> + </el-form-item> + <el-form-item label="鎿嶄綔鏃堕棿"> + <el-date-picker + v-model="dateRange" + size="small" + style="width: 240px" + value-format="yyyy-MM-dd" + type="daterange" + range-separator="-" + start-placeholder="寮�濮嬫棩鏈�" + end-placeholder="缁撴潫鏃ユ湡" + ></el-date-picker> + </el-form-item> + <el-form-item> + <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> + <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button> + </el-form-item> + </el-form> + + <el-row :gutter="10" class="mb8"> + <el-col :span="1.5"> + <el-button + type="danger" + plain + icon="el-icon-delete" + size="mini" + :disabled="multiple" + @click="handleDelete" + v-hasPermi="['monitor:operlog:remove']" + >鍒犻櫎</el-button> + </el-col> + <el-col :span="1.5"> + <el-button + type="danger" + plain + icon="el-icon-delete" + size="mini" + @click="handleClean" + v-hasPermi="['monitor:operlog:remove']" + >娓呯┖</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="['monitor:operlog:export']" + >瀵煎嚭</el-button> + </el-col> + <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> + </el-row> + + <el-table ref="tables" v-loading="loading" :data="list" @selection-change="handleSelectionChange" :default-sort="defaultSort" @sort-change="handleSortChange"> + <el-table-column type="selection" width="55" align="center" /> + <el-table-column label="鏃ュ織缂栧彿" align="center" prop="operId" /> + <el-table-column label="绯荤粺妯″潡" align="center" prop="title" /> + <el-table-column label="鎿嶄綔绫诲瀷" align="center" prop="businessType"> + <template slot-scope="scope"> + <dict-tag :options="typeOptions" :value="scope.row.businessType"/> + </template> + </el-table-column> + <el-table-column label="璇锋眰鏂瑰紡" align="center" prop="requestMethod" /> + <el-table-column label="鎿嶄綔浜哄憳" align="center" prop="operName" width="100" :show-overflow-tooltip="true" sortable="custom" :sort-orders="['descending', 'ascending']" /> + <el-table-column label="鎿嶄綔鍦板潃" align="center" prop="operIp" width="130" :show-overflow-tooltip="true" /> + <el-table-column label="鎿嶄綔鍦扮偣" align="center" prop="operLocation" :show-overflow-tooltip="true" /> + <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="operTime" sortable="custom" :sort-orders="['descending', 'ascending']" width="180"> + <template slot-scope="scope"> + <span>{{ parseTime(scope.row.operTime) }}</span> + </template> + </el-table-column> + <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width"> + <template slot-scope="scope"> + <el-button + size="mini" + type="text" + icon="el-icon-view" + @click="handleView(scope.row,scope.index)" + v-hasPermi="['monitor:operlog:query']" + >璇︾粏</el-button> + </template> + </el-table-column> + </el-table> + + <pagination + v-show="total>0" + :total="total" + :page.sync="queryParams.pageNum" + :limit.sync="queryParams.pageSize" + @pagination="getList" + /> + + <!-- 鎿嶄綔鏃ュ織璇︾粏 --> + <el-dialog title="鎿嶄綔鏃ュ織璇︾粏" :visible.sync="open" width="700px" append-to-body> + <el-form ref="form" :model="form" label-width="100px" size="mini"> + <el-row> + <el-col :span="12"> + <el-form-item label="鎿嶄綔妯″潡锛�">{{ form.title }} / {{ typeFormat(form) }}</el-form-item> + <el-form-item + label="鐧诲綍淇℃伅锛�" + >{{ form.operName }} / {{ form.operIp }} / {{ form.operLocation }}</el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="璇锋眰鍦板潃锛�">{{ form.operUrl }}</el-form-item> + <el-form-item label="璇锋眰鏂瑰紡锛�">{{ form.requestMethod }}</el-form-item> + </el-col> + <el-col :span="24"> + <el-form-item label="鎿嶄綔鏂规硶锛�">{{ form.method }}</el-form-item> + </el-col> + <el-col :span="24"> + <el-form-item label="璇锋眰鍙傛暟锛�">{{ form.operParam }}</el-form-item> + </el-col> + <el-col :span="24"> + <el-form-item label="杩斿洖鍙傛暟锛�">{{ form.jsonResult }}</el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鎿嶄綔鐘舵�侊細"> + <div v-if="form.status === 0">姝e父</div> + <div v-else-if="form.status === 1">澶辫触</div> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鎿嶄綔鏃堕棿锛�">{{ parseTime(form.operTime) }}</el-form-item> + </el-col> + <el-col :span="24"> + <el-form-item label="寮傚父淇℃伅锛�" v-if="form.status === 1">{{ form.errorMsg }}</el-form-item> + </el-col> + </el-row> + </el-form> + <div slot="footer" class="dialog-footer"> + <el-button @click="open = false">鍏� 闂�</el-button> + </div> + </el-dialog> + </div> +</template> + +<script> +import { list, delOperlog, cleanOperlog, exportOperlog } from "@/api/monitor/operlog"; + +export default { + name: "Operlog", + data() { + return { + // 閬僵灞� + loading: true, + // 瀵煎嚭閬僵灞� + exportLoading: false, + // 閫変腑鏁扮粍 + ids: [], + // 闈炲涓鐢� + multiple: true, + // 鏄剧ず鎼滅储鏉′欢 + showSearch: true, + // 鎬绘潯鏁� + total: 0, + // 琛ㄦ牸鏁版嵁 + list: [], + // 鏄惁鏄剧ず寮瑰嚭灞� + open: false, + // 绫诲瀷鏁版嵁瀛楀吀 + typeOptions: [], + // 绫诲瀷鏁版嵁瀛楀吀 + statusOptions: [], + // 鏃ユ湡鑼冨洿 + dateRange: [], + // 榛樿鎺掑簭 + defaultSort: {prop: 'operTime', order: 'descending'}, + // 琛ㄥ崟鍙傛暟 + form: {}, + // 鏌ヨ鍙傛暟 + queryParams: { + pageNum: 1, + pageSize: 10, + title: undefined, + operName: undefined, + businessType: undefined, + status: undefined + } + }; + }, + created() { + this.getList(); + this.getDicts("sys_oper_type").then(response => { + this.typeOptions = response.data; + }); + this.getDicts("sys_common_status").then(response => { + this.statusOptions = response.data; + }); + }, + methods: { + /** 鏌ヨ鐧诲綍鏃ュ織 */ + getList() { + this.loading = true; + list(this.addDateRange(this.queryParams, this.dateRange)).then( response => { + this.list = response.rows; + this.total = response.total; + this.loading = false; + } + ); + }, + // 鎿嶄綔鏃ュ織绫诲瀷瀛楀吀缈昏瘧 + typeFormat(row, column) { + return this.selectDictLabel(this.typeOptions, row.businessType); + }, + /** 鎼滅储鎸夐挳鎿嶄綔 */ + handleQuery() { + this.queryParams.pageNum = 1; + this.getList(); + }, + /** 閲嶇疆鎸夐挳鎿嶄綔 */ + resetQuery() { + this.dateRange = []; + this.resetForm("queryForm"); + this.$refs.tables.sort(this.defaultSort.prop, this.defaultSort.order) + this.handleQuery(); + }, + /** 澶氶�夋閫変腑鏁版嵁 */ + handleSelectionChange(selection) { + this.ids = selection.map(item => item.operId) + this.multiple = !selection.length + }, + /** 鎺掑簭瑙﹀彂浜嬩欢 */ + handleSortChange(column, prop, order) { + this.queryParams.orderByColumn = column.prop; + this.queryParams.isAsc = column.order; + this.getList(); + }, + /** 璇︾粏鎸夐挳鎿嶄綔 */ + handleView(row) { + this.open = true; + this.form = row; + }, + /** 鍒犻櫎鎸夐挳鎿嶄綔 */ + handleDelete(row) { + const operIds = row.operId || this.ids; + this.$confirm('鏄惁纭鍒犻櫎鏃ュ織缂栧彿涓�"' + operIds + '"鐨勬暟鎹」?', "璀﹀憡", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning" + }).then(function() { + return delOperlog(operIds); + }).then(() => { + this.getList(); + this.msgSuccess("鍒犻櫎鎴愬姛"); + }).catch(() => {}); + }, + /** 娓呯┖鎸夐挳鎿嶄綔 */ + handleClean() { + this.$confirm('鏄惁纭娓呯┖鎵�鏈夋搷浣滄棩蹇楁暟鎹」?', "璀﹀憡", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning" + }).then(function() { + return cleanOperlog(); + }).then(() => { + this.getList(); + this.msgSuccess("娓呯┖鎴愬姛"); + }).catch(() => {}); + }, + /** 瀵煎嚭鎸夐挳鎿嶄綔 */ + handleExport() { + const queryParams = this.queryParams; + this.$confirm('鏄惁纭瀵煎嚭鎵�鏈夋搷浣滄棩蹇楁暟鎹」?', "璀﹀憡", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning" + }).then(() => { + this.exportLoading = true; + return exportOperlog(queryParams); + }).then(response => { + this.download(response.msg); + this.exportLoading = false; + }).catch(() => {}); + } + } +}; +</script> + diff --git a/ruoyi-ui/src/views/system/config/index.vue b/ruoyi-ui/src/views/system/config/index.vue index d942f8f..b8472a8 100644 --- a/ruoyi-ui/src/views/system/config/index.vue +++ b/ruoyi-ui/src/views/system/config/index.vue @@ -1,366 +1,366 @@ -<template> - <div class="app-container"> - <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> - <el-form-item label="鍙傛暟鍚嶇О" prop="configName"> - <el-input - v-model="queryParams.configName" - placeholder="璇疯緭鍏ュ弬鏁板悕绉�" - clearable - size="small" - style="width: 240px" - @keyup.enter.native="handleQuery" - /> - </el-form-item> - <el-form-item label="鍙傛暟閿悕" prop="configKey"> - <el-input - v-model="queryParams.configKey" - placeholder="璇疯緭鍏ュ弬鏁伴敭鍚�" - clearable - size="small" - style="width: 240px" - @keyup.enter.native="handleQuery" - /> - </el-form-item> - <el-form-item label="绯荤粺鍐呯疆" prop="configType"> - <el-select v-model="queryParams.configType" placeholder="绯荤粺鍐呯疆" clearable size="small"> - <el-option - v-for="dict in typeOptions" - :key="dict.dictValue" - :label="dict.dictLabel" - :value="dict.dictValue" - /> - </el-select> - </el-form-item> - <el-form-item label="鍒涘缓鏃堕棿"> - <el-date-picker - v-model="dateRange" - size="small" - style="width: 240px" - value-format="yyyy-MM-dd" - type="daterange" - range-separator="-" - start-placeholder="寮�濮嬫棩鏈�" - end-placeholder="缁撴潫鏃ユ湡" - ></el-date-picker> - </el-form-item> - <el-form-item> - <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> - <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button> - </el-form-item> - </el-form> - - <el-row :gutter="10" class="mb8"> - <el-col :span="1.5"> - <el-button - type="primary" - plain - icon="el-icon-plus" - size="mini" - @click="handleAdd" - v-hasPermi="['system:config:add']" - >鏂板</el-button> - </el-col> - <el-col :span="1.5"> - <el-button - type="success" - plain - icon="el-icon-edit" - size="mini" - :disabled="single" - @click="handleUpdate" - v-hasPermi="['system:config:edit']" - >淇敼</el-button> - </el-col> - <el-col :span="1.5"> - <el-button - type="danger" - plain - icon="el-icon-delete" - size="mini" - :disabled="multiple" - @click="handleDelete" - v-hasPermi="['system:config:remove']" - >鍒犻櫎</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="['system:config:export']" - >瀵煎嚭</el-button> - </el-col> - <el-col :span="1.5"> - <el-button - type="danger" - plain - icon="el-icon-refresh" - size="mini" - @click="handleRefreshCache" - v-hasPermi="['system:config:remove']" - >鍒锋柊缂撳瓨</el-button> - </el-col> - <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> - </el-row> - - <el-table v-loading="loading" :data="configList" @selection-change="handleSelectionChange"> - <el-table-column type="selection" width="55" align="center" /> - <el-table-column label="鍙傛暟涓婚敭" align="center" prop="configId" /> - <el-table-column label="鍙傛暟鍚嶇О" align="center" prop="configName" :show-overflow-tooltip="true" /> - <el-table-column label="鍙傛暟閿悕" align="center" prop="configKey" :show-overflow-tooltip="true" /> - <el-table-column label="鍙傛暟閿��" align="center" prop="configValue" /> - <el-table-column label="绯荤粺鍐呯疆" align="center" prop="configType" :formatter="typeFormat" /> - <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"> - <span>{{ parseTime(scope.row.createTime) }}</span> - </template> - </el-table-column> - <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width"> - <template slot-scope="scope"> - <el-button - size="mini" - type="text" - icon="el-icon-edit" - @click="handleUpdate(scope.row)" - v-hasPermi="['system:config:edit']" - >淇敼</el-button> - <el-button - size="mini" - type="text" - icon="el-icon-delete" - @click="handleDelete(scope.row)" - v-hasPermi="['system:config:remove']" - >鍒犻櫎</el-button> - </template> - </el-table-column> - </el-table> - - <pagination - v-show="total>0" - :total="total" - :page.sync="queryParams.pageNum" - :limit.sync="queryParams.pageSize" - @pagination="getList" - /> - - <!-- 娣诲姞鎴栦慨鏀瑰弬鏁伴厤缃璇濇 --> - <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> - <el-form ref="form" :model="form" :rules="rules" label-width="80px"> - <el-form-item label="鍙傛暟鍚嶇О" prop="configName"> - <el-input v-model="form.configName" placeholder="璇疯緭鍏ュ弬鏁板悕绉�" /> - </el-form-item> - <el-form-item label="鍙傛暟閿悕" prop="configKey"> - <el-input v-model="form.configKey" placeholder="璇疯緭鍏ュ弬鏁伴敭鍚�" /> - </el-form-item> - <el-form-item label="鍙傛暟閿��" prop="configValue"> - <el-input v-model="form.configValue" placeholder="璇疯緭鍏ュ弬鏁伴敭鍊�" /> - </el-form-item> - <el-form-item label="绯荤粺鍐呯疆" prop="configType"> - <el-radio-group v-model="form.configType"> - <el-radio - v-for="dict in typeOptions" - :key="dict.dictValue" - :label="dict.dictValue" - >{{dict.dictLabel}}</el-radio> - </el-radio-group> - </el-form-item> - <el-form-item label="澶囨敞" prop="remark"> - <el-input v-model="form.remark" type="textarea" placeholder="璇疯緭鍏ュ唴瀹�" /> - </el-form-item> - </el-form> - <div slot="footer" class="dialog-footer"> - <el-button type="primary" @click="submitForm">纭� 瀹�</el-button> - <el-button @click="cancel">鍙� 娑�</el-button> - </div> - </el-dialog> - </div> -</template> - -<script> -import { listConfig, getConfig, delConfig, addConfig, updateConfig, exportConfig, refreshCache } from "@/api/system/config"; - -export default { - name: "Config", - data() { - return { - // 閬僵灞� - loading: true, - // 瀵煎嚭閬僵灞� - exportLoading: false, - // 閫変腑鏁扮粍 - ids: [], - // 闈炲崟涓鐢� - single: true, - // 闈炲涓鐢� - multiple: true, - // 鏄剧ず鎼滅储鏉′欢 - showSearch: true, - // 鎬绘潯鏁� - total: 0, - // 鍙傛暟琛ㄦ牸鏁版嵁 - configList: [], - // 寮瑰嚭灞傛爣棰� - title: "", - // 鏄惁鏄剧ず寮瑰嚭灞� - open: false, - // 绫诲瀷鏁版嵁瀛楀吀 - typeOptions: [], - // 鏃ユ湡鑼冨洿 - dateRange: [], - // 鏌ヨ鍙傛暟 - queryParams: { - pageNum: 1, - pageSize: 10, - configName: undefined, - configKey: undefined, - configType: undefined - }, - // 琛ㄥ崟鍙傛暟 - form: {}, - // 琛ㄥ崟鏍¢獙 - rules: { - configName: [ - { required: true, message: "鍙傛暟鍚嶇О涓嶈兘涓虹┖", trigger: "blur" } - ], - configKey: [ - { required: true, message: "鍙傛暟閿悕涓嶈兘涓虹┖", trigger: "blur" } - ], - configValue: [ - { required: true, message: "鍙傛暟閿�间笉鑳戒负绌�", trigger: "blur" } - ] - } - }; - }, - created() { - this.getList(); - this.getDicts("sys_yes_no").then(response => { - this.typeOptions = response.data; - }); - }, - methods: { - /** 鏌ヨ鍙傛暟鍒楄〃 */ - getList() { - this.loading = true; - listConfig(this.addDateRange(this.queryParams, this.dateRange)).then(response => { - this.configList = response.rows; - this.total = response.total; - this.loading = false; - } - ); - }, - // 鍙傛暟绯荤粺鍐呯疆瀛楀吀缈昏瘧 - typeFormat(row, column) { - return this.selectDictLabel(this.typeOptions, row.configType); - }, - // 鍙栨秷鎸夐挳 - cancel() { - this.open = false; - this.reset(); - }, - // 琛ㄥ崟閲嶇疆 - reset() { - this.form = { - configId: undefined, - configName: undefined, - configKey: undefined, - configValue: undefined, - configType: "Y", - remark: undefined - }; - this.resetForm("form"); - }, - /** 鎼滅储鎸夐挳鎿嶄綔 */ - handleQuery() { - this.queryParams.pageNum = 1; - this.getList(); - }, - /** 閲嶇疆鎸夐挳鎿嶄綔 */ - resetQuery() { - this.dateRange = []; - this.resetForm("queryForm"); - this.handleQuery(); - }, - /** 鏂板鎸夐挳鎿嶄綔 */ - handleAdd() { - this.reset(); - this.open = true; - this.title = "娣诲姞鍙傛暟"; - }, - // 澶氶�夋閫変腑鏁版嵁 - handleSelectionChange(selection) { - this.ids = selection.map(item => item.configId) - this.single = selection.length!=1 - this.multiple = !selection.length - }, - /** 淇敼鎸夐挳鎿嶄綔 */ - handleUpdate(row) { - this.reset(); - const configId = row.configId || this.ids - getConfig(configId).then(response => { - this.form = response.data; - this.open = true; - this.title = "淇敼鍙傛暟"; - }); - }, - /** 鎻愪氦鎸夐挳 */ - submitForm: function() { - this.$refs["form"].validate(valid => { - if (valid) { - if (this.form.configId != undefined) { - updateConfig(this.form).then(response => { - this.msgSuccess("淇敼鎴愬姛"); - this.open = false; - this.getList(); - }); - } else { - addConfig(this.form).then(response => { - this.msgSuccess("鏂板鎴愬姛"); - this.open = false; - this.getList(); - }); - } - } - }); - }, - /** 鍒犻櫎鎸夐挳鎿嶄綔 */ - handleDelete(row) { - const configIds = row.configId || this.ids; - this.$confirm('鏄惁纭鍒犻櫎鍙傛暟缂栧彿涓�"' + configIds + '"鐨勬暟鎹」?', "璀﹀憡", { - confirmButtonText: "纭畾", - cancelButtonText: "鍙栨秷", - type: "warning" - }).then(function() { - return delConfig(configIds); - }).then(() => { - this.getList(); - this.msgSuccess("鍒犻櫎鎴愬姛"); - }).catch(() => {}); - }, - /** 瀵煎嚭鎸夐挳鎿嶄綔 */ - handleExport() { - const queryParams = this.queryParams; - this.$confirm('鏄惁纭瀵煎嚭鎵�鏈夊弬鏁版暟鎹」?', "璀﹀憡", { - confirmButtonText: "纭畾", - cancelButtonText: "鍙栨秷", - type: "warning" - }).then(() => { - this.exportLoading = true; - return exportConfig(queryParams); - }).then(response => { - this.download(response.msg); - this.exportLoading = false; - }).catch(() => {}); - }, - /** 鍒锋柊缂撳瓨鎸夐挳鎿嶄綔 */ - handleRefreshCache() { - refreshCache().then(() => { - this.msgSuccess("鍒锋柊鎴愬姛"); - }); - } - } -}; -</script> \ No newline at end of file +<template> + <div class="app-container"> + <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> + <el-form-item label="鍙傛暟鍚嶇О" prop="configName"> + <el-input + v-model="queryParams.configName" + placeholder="璇疯緭鍏ュ弬鏁板悕绉�" + clearable + size="small" + style="width: 240px" + @keyup.enter.native="handleQuery" + /> + </el-form-item> + <el-form-item label="鍙傛暟閿悕" prop="configKey"> + <el-input + v-model="queryParams.configKey" + placeholder="璇疯緭鍏ュ弬鏁伴敭鍚�" + clearable + size="small" + style="width: 240px" + @keyup.enter.native="handleQuery" + /> + </el-form-item> + <el-form-item label="绯荤粺鍐呯疆" prop="configType"> + <el-select v-model="queryParams.configType" placeholder="绯荤粺鍐呯疆" clearable size="small"> + <el-option + v-for="dict in typeOptions" + :key="dict.dictValue" + :label="dict.dictLabel" + :value="dict.dictValue" + /> + </el-select> + </el-form-item> + <el-form-item label="鍒涘缓鏃堕棿"> + <el-date-picker + v-model="dateRange" + size="small" + style="width: 240px" + value-format="yyyy-MM-dd" + type="daterange" + range-separator="-" + start-placeholder="寮�濮嬫棩鏈�" + end-placeholder="缁撴潫鏃ユ湡" + ></el-date-picker> + </el-form-item> + <el-form-item> + <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> + <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button> + </el-form-item> + </el-form> + + <el-row :gutter="10" class="mb8"> + <el-col :span="1.5"> + <el-button + type="primary" + plain + icon="el-icon-plus" + size="mini" + @click="handleAdd" + v-hasPermi="['system:config:add']" + >鏂板</el-button> + </el-col> + <el-col :span="1.5"> + <el-button + type="success" + plain + icon="el-icon-edit" + size="mini" + :disabled="single" + @click="handleUpdate" + v-hasPermi="['system:config:edit']" + >淇敼</el-button> + </el-col> + <el-col :span="1.5"> + <el-button + type="danger" + plain + icon="el-icon-delete" + size="mini" + :disabled="multiple" + @click="handleDelete" + v-hasPermi="['system:config:remove']" + >鍒犻櫎</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="['system:config:export']" + >瀵煎嚭</el-button> + </el-col> + <el-col :span="1.5"> + <el-button + type="danger" + plain + icon="el-icon-refresh" + size="mini" + @click="handleRefreshCache" + v-hasPermi="['system:config:remove']" + >鍒锋柊缂撳瓨</el-button> + </el-col> + <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> + </el-row> + + <el-table v-loading="loading" :data="configList" @selection-change="handleSelectionChange"> + <el-table-column type="selection" width="55" align="center" /> + <el-table-column label="鍙傛暟涓婚敭" align="center" prop="configId" /> + <el-table-column label="鍙傛暟鍚嶇О" align="center" prop="configName" :show-overflow-tooltip="true" /> + <el-table-column label="鍙傛暟閿悕" align="center" prop="configKey" :show-overflow-tooltip="true" /> + <el-table-column label="鍙傛暟閿��" align="center" prop="configValue" /> + <el-table-column label="绯荤粺鍐呯疆" align="center" prop="configType"> + <template slot-scope="scope"> + <dict-tag :options="typeOptions" :value="scope.row.configType"/> + </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"> + <span>{{ parseTime(scope.row.createTime) }}</span> + </template> + </el-table-column> + <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width"> + <template slot-scope="scope"> + <el-button + size="mini" + type="text" + icon="el-icon-edit" + @click="handleUpdate(scope.row)" + v-hasPermi="['system:config:edit']" + >淇敼</el-button> + <el-button + size="mini" + type="text" + icon="el-icon-delete" + @click="handleDelete(scope.row)" + v-hasPermi="['system:config:remove']" + >鍒犻櫎</el-button> + </template> + </el-table-column> + </el-table> + + <pagination + v-show="total>0" + :total="total" + :page.sync="queryParams.pageNum" + :limit.sync="queryParams.pageSize" + @pagination="getList" + /> + + <!-- 娣诲姞鎴栦慨鏀瑰弬鏁伴厤缃璇濇 --> + <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> + <el-form ref="form" :model="form" :rules="rules" label-width="80px"> + <el-form-item label="鍙傛暟鍚嶇О" prop="configName"> + <el-input v-model="form.configName" placeholder="璇疯緭鍏ュ弬鏁板悕绉�" /> + </el-form-item> + <el-form-item label="鍙傛暟閿悕" prop="configKey"> + <el-input v-model="form.configKey" placeholder="璇疯緭鍏ュ弬鏁伴敭鍚�" /> + </el-form-item> + <el-form-item label="鍙傛暟閿��" prop="configValue"> + <el-input v-model="form.configValue" placeholder="璇疯緭鍏ュ弬鏁伴敭鍊�" /> + </el-form-item> + <el-form-item label="绯荤粺鍐呯疆" prop="configType"> + <el-radio-group v-model="form.configType"> + <el-radio + v-for="dict in typeOptions" + :key="dict.dictValue" + :label="dict.dictValue" + >{{dict.dictLabel}}</el-radio> + </el-radio-group> + </el-form-item> + <el-form-item label="澶囨敞" prop="remark"> + <el-input v-model="form.remark" type="textarea" placeholder="璇疯緭鍏ュ唴瀹�" /> + </el-form-item> + </el-form> + <div slot="footer" class="dialog-footer"> + <el-button type="primary" @click="submitForm">纭� 瀹�</el-button> + <el-button @click="cancel">鍙� 娑�</el-button> + </div> + </el-dialog> + </div> +</template> + +<script> +import { listConfig, getConfig, delConfig, addConfig, updateConfig, exportConfig, refreshCache } from "@/api/system/config"; + +export default { + name: "Config", + data() { + return { + // 閬僵灞� + loading: true, + // 瀵煎嚭閬僵灞� + exportLoading: false, + // 閫変腑鏁扮粍 + ids: [], + // 闈炲崟涓鐢� + single: true, + // 闈炲涓鐢� + multiple: true, + // 鏄剧ず鎼滅储鏉′欢 + showSearch: true, + // 鎬绘潯鏁� + total: 0, + // 鍙傛暟琛ㄦ牸鏁版嵁 + configList: [], + // 寮瑰嚭灞傛爣棰� + title: "", + // 鏄惁鏄剧ず寮瑰嚭灞� + open: false, + // 绫诲瀷鏁版嵁瀛楀吀 + typeOptions: [], + // 鏃ユ湡鑼冨洿 + dateRange: [], + // 鏌ヨ鍙傛暟 + queryParams: { + pageNum: 1, + pageSize: 10, + configName: undefined, + configKey: undefined, + configType: undefined + }, + // 琛ㄥ崟鍙傛暟 + form: {}, + // 琛ㄥ崟鏍¢獙 + rules: { + configName: [ + { required: true, message: "鍙傛暟鍚嶇О涓嶈兘涓虹┖", trigger: "blur" } + ], + configKey: [ + { required: true, message: "鍙傛暟閿悕涓嶈兘涓虹┖", trigger: "blur" } + ], + configValue: [ + { required: true, message: "鍙傛暟閿�间笉鑳戒负绌�", trigger: "blur" } + ] + } + }; + }, + created() { + this.getList(); + this.getDicts("sys_yes_no").then(response => { + this.typeOptions = response.data; + }); + }, + methods: { + /** 鏌ヨ鍙傛暟鍒楄〃 */ + getList() { + this.loading = true; + listConfig(this.addDateRange(this.queryParams, this.dateRange)).then(response => { + this.configList = response.rows; + this.total = response.total; + this.loading = false; + } + ); + }, + // 鍙栨秷鎸夐挳 + cancel() { + this.open = false; + this.reset(); + }, + // 琛ㄥ崟閲嶇疆 + reset() { + this.form = { + configId: undefined, + configName: undefined, + configKey: undefined, + configValue: undefined, + configType: "Y", + remark: undefined + }; + this.resetForm("form"); + }, + /** 鎼滅储鎸夐挳鎿嶄綔 */ + handleQuery() { + this.queryParams.pageNum = 1; + this.getList(); + }, + /** 閲嶇疆鎸夐挳鎿嶄綔 */ + resetQuery() { + this.dateRange = []; + this.resetForm("queryForm"); + this.handleQuery(); + }, + /** 鏂板鎸夐挳鎿嶄綔 */ + handleAdd() { + this.reset(); + this.open = true; + this.title = "娣诲姞鍙傛暟"; + }, + // 澶氶�夋閫変腑鏁版嵁 + handleSelectionChange(selection) { + this.ids = selection.map(item => item.configId) + this.single = selection.length!=1 + this.multiple = !selection.length + }, + /** 淇敼鎸夐挳鎿嶄綔 */ + handleUpdate(row) { + this.reset(); + const configId = row.configId || this.ids + getConfig(configId).then(response => { + this.form = response.data; + this.open = true; + this.title = "淇敼鍙傛暟"; + }); + }, + /** 鎻愪氦鎸夐挳 */ + submitForm: function() { + this.$refs["form"].validate(valid => { + if (valid) { + if (this.form.configId != undefined) { + updateConfig(this.form).then(response => { + this.msgSuccess("淇敼鎴愬姛"); + this.open = false; + this.getList(); + }); + } else { + addConfig(this.form).then(response => { + this.msgSuccess("鏂板鎴愬姛"); + this.open = false; + this.getList(); + }); + } + } + }); + }, + /** 鍒犻櫎鎸夐挳鎿嶄綔 */ + handleDelete(row) { + const configIds = row.configId || this.ids; + this.$confirm('鏄惁纭鍒犻櫎鍙傛暟缂栧彿涓�"' + configIds + '"鐨勬暟鎹」?', "璀﹀憡", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning" + }).then(function() { + return delConfig(configIds); + }).then(() => { + this.getList(); + this.msgSuccess("鍒犻櫎鎴愬姛"); + }).catch(() => {}); + }, + /** 瀵煎嚭鎸夐挳鎿嶄綔 */ + handleExport() { + const queryParams = this.queryParams; + this.$confirm('鏄惁纭瀵煎嚭鎵�鏈夊弬鏁版暟鎹」?', "璀﹀憡", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning" + }).then(() => { + this.exportLoading = true; + return exportConfig(queryParams); + }).then(response => { + this.download(response.msg); + this.exportLoading = false; + }).catch(() => {}); + }, + /** 鍒锋柊缂撳瓨鎸夐挳鎿嶄綔 */ + handleRefreshCache() { + refreshCache().then(() => { + this.msgSuccess("鍒锋柊鎴愬姛"); + }); + } + } +}; +</script> diff --git a/ruoyi-ui/src/views/system/dept/index.vue b/ruoyi-ui/src/views/system/dept/index.vue index 2d58f64..edb8d7c 100644 --- a/ruoyi-ui/src/views/system/dept/index.vue +++ b/ruoyi-ui/src/views/system/dept/index.vue @@ -1,317 +1,317 @@ -<template> - <div class="app-container"> - <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch"> - <el-form-item label="閮ㄩ棬鍚嶇О" prop="deptName"> - <el-input - v-model="queryParams.deptName" - placeholder="璇疯緭鍏ラ儴闂ㄥ悕绉�" - clearable - size="small" - @keyup.enter.native="handleQuery" - /> - </el-form-item> - <el-form-item label="鐘舵��" prop="status"> - <el-select v-model="queryParams.status" placeholder="閮ㄩ棬鐘舵��" clearable size="small"> - <el-option - v-for="dict in statusOptions" - :key="dict.dictValue" - :label="dict.dictLabel" - :value="dict.dictValue" - /> - </el-select> - </el-form-item> - <el-form-item> - <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> - <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button> - </el-form-item> - </el-form> - - <el-row :gutter="10" class="mb8"> - <el-col :span="1.5"> - <el-button - type="primary" - plain - icon="el-icon-plus" - size="mini" - @click="handleAdd" - v-hasPermi="['system:dept:add']" - >鏂板</el-button> - </el-col> - <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> - </el-row> - - <el-table - v-loading="loading" - :data="deptList" - row-key="deptId" - default-expand-all - :tree-props="{children: 'children', hasChildren: 'hasChildren'}" - > - <el-table-column prop="deptName" label="閮ㄩ棬鍚嶇О" width="260"></el-table-column> - <el-table-column prop="orderNum" label="鎺掑簭" width="200"></el-table-column> - <el-table-column prop="status" label="鐘舵��" :formatter="statusFormat" width="100"></el-table-column> - <el-table-column label="鍒涘缓鏃堕棿" align="center" prop="createTime" width="200"> - <template slot-scope="scope"> - <span>{{ parseTime(scope.row.createTime) }}</span> - </template> - </el-table-column> - <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width"> - <template slot-scope="scope"> - <el-button - size="mini" - type="text" - icon="el-icon-edit" - @click="handleUpdate(scope.row)" - v-hasPermi="['system:dept:edit']" - >淇敼</el-button> - <el-button - size="mini" - type="text" - icon="el-icon-plus" - @click="handleAdd(scope.row)" - v-hasPermi="['system:dept:add']" - >鏂板</el-button> - <el-button - v-if="scope.row.parentId != 0" - size="mini" - type="text" - icon="el-icon-delete" - @click="handleDelete(scope.row)" - v-hasPermi="['system:dept:remove']" - >鍒犻櫎</el-button> - </template> - </el-table-column> - </el-table> - - <!-- 娣诲姞鎴栦慨鏀归儴闂ㄥ璇濇 --> - <el-dialog :title="title" :visible.sync="open" width="600px" append-to-body> - <el-form ref="form" :model="form" :rules="rules" label-width="80px"> - <el-row> - <el-col :span="24" v-if="form.parentId !== 0"> - <el-form-item label="涓婄骇閮ㄩ棬" prop="parentId"> - <treeselect v-model="form.parentId" :options="deptOptions" :normalizer="normalizer" placeholder="閫夋嫨涓婄骇閮ㄩ棬" /> - </el-form-item> - </el-col> - <el-col :span="12"> - <el-form-item label="閮ㄩ棬鍚嶇О" prop="deptName"> - <el-input v-model="form.deptName" placeholder="璇疯緭鍏ラ儴闂ㄥ悕绉�" /> - </el-form-item> - </el-col> - <el-col :span="12"> - <el-form-item label="鏄剧ず鎺掑簭" prop="orderNum"> - <el-input-number v-model="form.orderNum" controls-position="right" :min="0" /> - </el-form-item> - </el-col> - <el-col :span="12"> - <el-form-item label="璐熻矗浜�" prop="leader"> - <el-input v-model="form.leader" placeholder="璇疯緭鍏ヨ礋璐d汉" maxlength="20" /> - </el-form-item> - </el-col> - <el-col :span="12"> - <el-form-item label="鑱旂郴鐢佃瘽" prop="phone"> - <el-input v-model="form.phone" placeholder="璇疯緭鍏ヨ仈绯荤數璇�" maxlength="11" /> - </el-form-item> - </el-col> - <el-col :span="12"> - <el-form-item label="閭" prop="email"> - <el-input v-model="form.email" placeholder="璇疯緭鍏ラ偖绠�" maxlength="50" /> - </el-form-item> - </el-col> - <el-col :span="12"> - <el-form-item label="閮ㄩ棬鐘舵��"> - <el-radio-group v-model="form.status"> - <el-radio - v-for="dict in statusOptions" - :key="dict.dictValue" - :label="dict.dictValue" - >{{dict.dictLabel}}</el-radio> - </el-radio-group> - </el-form-item> - </el-col> - </el-row> - </el-form> - <div slot="footer" class="dialog-footer"> - <el-button type="primary" @click="submitForm">纭� 瀹�</el-button> - <el-button @click="cancel">鍙� 娑�</el-button> - </div> - </el-dialog> - </div> -</template> - -<script> -import { listDept, getDept, delDept, addDept, updateDept, listDeptExcludeChild } from "@/api/system/dept"; -import Treeselect from "@riophae/vue-treeselect"; -import "@riophae/vue-treeselect/dist/vue-treeselect.css"; - -export default { - name: "Dept", - components: { Treeselect }, - data() { - return { - // 閬僵灞� - loading: true, - // 鏄剧ず鎼滅储鏉′欢 - showSearch: true, - // 琛ㄦ牸鏍戞暟鎹� - deptList: [], - // 閮ㄩ棬鏍戦�夐」 - deptOptions: [], - // 寮瑰嚭灞傛爣棰� - title: "", - // 鏄惁鏄剧ず寮瑰嚭灞� - open: false, - // 鐘舵�佹暟鎹瓧鍏� - statusOptions: [], - // 鏌ヨ鍙傛暟 - queryParams: { - deptName: undefined, - status: undefined - }, - // 琛ㄥ崟鍙傛暟 - form: {}, - // 琛ㄥ崟鏍¢獙 - rules: { - parentId: [ - { required: true, message: "涓婄骇閮ㄩ棬涓嶈兘涓虹┖", trigger: "blur" } - ], - deptName: [ - { required: true, message: "閮ㄩ棬鍚嶇О涓嶈兘涓虹┖", trigger: "blur" } - ], - orderNum: [ - { required: true, message: "鏄剧ず鎺掑簭涓嶈兘涓虹┖", trigger: "blur" } - ], - email: [ - { - type: "email", - message: "'璇疯緭鍏ユ纭殑閭鍦板潃", - trigger: ["blur", "change"] - } - ], - phone: [ - { - pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, - message: "璇疯緭鍏ユ纭殑鎵嬫満鍙风爜", - trigger: "blur" - } - ] - } - }; - }, - created() { - this.getList(); - this.getDicts("sys_normal_disable").then(response => { - this.statusOptions = response.data; - }); - }, - methods: { - /** 鏌ヨ閮ㄩ棬鍒楄〃 */ - getList() { - this.loading = true; - listDept(this.queryParams).then(response => { - this.deptList = this.handleTree(response.data, "deptId"); - this.loading = false; - }); - }, - /** 杞崲閮ㄩ棬鏁版嵁缁撴瀯 */ - normalizer(node) { - if (node.children && !node.children.length) { - delete node.children; - } - return { - id: node.deptId, - label: node.deptName, - children: node.children - }; - }, - // 瀛楀吀鐘舵�佸瓧鍏哥炕璇� - statusFormat(row, column) { - return this.selectDictLabel(this.statusOptions, row.status); - }, - // 鍙栨秷鎸夐挳 - cancel() { - this.open = false; - this.reset(); - }, - // 琛ㄥ崟閲嶇疆 - reset() { - this.form = { - deptId: undefined, - parentId: undefined, - deptName: undefined, - orderNum: undefined, - leader: undefined, - phone: undefined, - email: undefined, - status: "0" - }; - this.resetForm("form"); - }, - /** 鎼滅储鎸夐挳鎿嶄綔 */ - handleQuery() { - this.getList(); - }, - /** 閲嶇疆鎸夐挳鎿嶄綔 */ - resetQuery() { - this.resetForm("queryForm"); - this.handleQuery(); - }, - /** 鏂板鎸夐挳鎿嶄綔 */ - handleAdd(row) { - this.reset(); - if (row != undefined) { - this.form.parentId = row.deptId; - } - this.open = true; - this.title = "娣诲姞閮ㄩ棬"; - listDept().then(response => { - this.deptOptions = this.handleTree(response.data, "deptId"); - }); - }, - /** 淇敼鎸夐挳鎿嶄綔 */ - handleUpdate(row) { - this.reset(); - getDept(row.deptId).then(response => { - this.form = response.data; - this.open = true; - this.title = "淇敼閮ㄩ棬"; - }); - listDeptExcludeChild(row.deptId).then(response => { - this.deptOptions = this.handleTree(response.data, "deptId"); - }); - }, - /** 鎻愪氦鎸夐挳 */ - submitForm: function() { - this.$refs["form"].validate(valid => { - if (valid) { - if (this.form.deptId != undefined) { - updateDept(this.form).then(response => { - this.msgSuccess("淇敼鎴愬姛"); - this.open = false; - this.getList(); - }); - } else { - addDept(this.form).then(response => { - this.msgSuccess("鏂板鎴愬姛"); - this.open = false; - this.getList(); - }); - } - } - }); - }, - /** 鍒犻櫎鎸夐挳鎿嶄綔 */ - handleDelete(row) { - this.$confirm('鏄惁纭鍒犻櫎鍚嶇О涓�"' + row.deptName + '"鐨勬暟鎹」?', "璀﹀憡", { - confirmButtonText: "纭畾", - cancelButtonText: "鍙栨秷", - type: "warning" - }).then(function() { - return delDept(row.deptId); - }).then(() => { - this.getList(); - this.msgSuccess("鍒犻櫎鎴愬姛"); - }).catch(() => {}); - } - } -}; -</script> \ No newline at end of file +<template> + <div class="app-container"> + <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch"> + <el-form-item label="閮ㄩ棬鍚嶇О" prop="deptName"> + <el-input + v-model="queryParams.deptName" + placeholder="璇疯緭鍏ラ儴闂ㄥ悕绉�" + clearable + size="small" + @keyup.enter.native="handleQuery" + /> + </el-form-item> + <el-form-item label="鐘舵��" prop="status"> + <el-select v-model="queryParams.status" placeholder="閮ㄩ棬鐘舵��" clearable size="small"> + <el-option + v-for="dict in statusOptions" + :key="dict.dictValue" + :label="dict.dictLabel" + :value="dict.dictValue" + /> + </el-select> + </el-form-item> + <el-form-item> + <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> + <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button> + </el-form-item> + </el-form> + + <el-row :gutter="10" class="mb8"> + <el-col :span="1.5"> + <el-button + type="primary" + plain + icon="el-icon-plus" + size="mini" + @click="handleAdd" + v-hasPermi="['system:dept:add']" + >鏂板</el-button> + </el-col> + <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> + </el-row> + + <el-table + v-loading="loading" + :data="deptList" + row-key="deptId" + default-expand-all + :tree-props="{children: 'children', hasChildren: 'hasChildren'}" + > + <el-table-column prop="deptName" label="閮ㄩ棬鍚嶇О" width="260"></el-table-column> + <el-table-column prop="orderNum" label="鎺掑簭" width="200"></el-table-column> + <el-table-column prop="status" label="鐘舵��" width="100"> + <template slot-scope="scope"> + <dict-tag :options="statusOptions" :value="scope.row.status"/> + </template> + </el-table-column> + <el-table-column label="鍒涘缓鏃堕棿" align="center" prop="createTime" width="200"> + <template slot-scope="scope"> + <span>{{ parseTime(scope.row.createTime) }}</span> + </template> + </el-table-column> + <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width"> + <template slot-scope="scope"> + <el-button + size="mini" + type="text" + icon="el-icon-edit" + @click="handleUpdate(scope.row)" + v-hasPermi="['system:dept:edit']" + >淇敼</el-button> + <el-button + size="mini" + type="text" + icon="el-icon-plus" + @click="handleAdd(scope.row)" + v-hasPermi="['system:dept:add']" + >鏂板</el-button> + <el-button + v-if="scope.row.parentId != 0" + size="mini" + type="text" + icon="el-icon-delete" + @click="handleDelete(scope.row)" + v-hasPermi="['system:dept:remove']" + >鍒犻櫎</el-button> + </template> + </el-table-column> + </el-table> + + <!-- 娣诲姞鎴栦慨鏀归儴闂ㄥ璇濇 --> + <el-dialog :title="title" :visible.sync="open" width="600px" append-to-body> + <el-form ref="form" :model="form" :rules="rules" label-width="80px"> + <el-row> + <el-col :span="24" v-if="form.parentId !== 0"> + <el-form-item label="涓婄骇閮ㄩ棬" prop="parentId"> + <treeselect v-model="form.parentId" :options="deptOptions" :normalizer="normalizer" placeholder="閫夋嫨涓婄骇閮ㄩ棬" /> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="閮ㄩ棬鍚嶇О" prop="deptName"> + <el-input v-model="form.deptName" placeholder="璇疯緭鍏ラ儴闂ㄥ悕绉�" /> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鏄剧ず鎺掑簭" prop="orderNum"> + <el-input-number v-model="form.orderNum" controls-position="right" :min="0" /> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="璐熻矗浜�" prop="leader"> + <el-input v-model="form.leader" placeholder="璇疯緭鍏ヨ礋璐d汉" maxlength="20" /> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鑱旂郴鐢佃瘽" prop="phone"> + <el-input v-model="form.phone" placeholder="璇疯緭鍏ヨ仈绯荤數璇�" maxlength="11" /> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="閭" prop="email"> + <el-input v-model="form.email" placeholder="璇疯緭鍏ラ偖绠�" maxlength="50" /> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="閮ㄩ棬鐘舵��"> + <el-radio-group v-model="form.status"> + <el-radio + v-for="dict in statusOptions" + :key="dict.dictValue" + :label="dict.dictValue" + >{{dict.dictLabel}}</el-radio> + </el-radio-group> + </el-form-item> + </el-col> + </el-row> + </el-form> + <div slot="footer" class="dialog-footer"> + <el-button type="primary" @click="submitForm">纭� 瀹�</el-button> + <el-button @click="cancel">鍙� 娑�</el-button> + </div> + </el-dialog> + </div> +</template> + +<script> +import { listDept, getDept, delDept, addDept, updateDept, listDeptExcludeChild } from "@/api/system/dept"; +import Treeselect from "@riophae/vue-treeselect"; +import "@riophae/vue-treeselect/dist/vue-treeselect.css"; + +export default { + name: "Dept", + components: { Treeselect }, + data() { + return { + // 閬僵灞� + loading: true, + // 鏄剧ず鎼滅储鏉′欢 + showSearch: true, + // 琛ㄦ牸鏍戞暟鎹� + deptList: [], + // 閮ㄩ棬鏍戦�夐」 + deptOptions: [], + // 寮瑰嚭灞傛爣棰� + title: "", + // 鏄惁鏄剧ず寮瑰嚭灞� + open: false, + // 鐘舵�佹暟鎹瓧鍏� + statusOptions: [], + // 鏌ヨ鍙傛暟 + queryParams: { + deptName: undefined, + status: undefined + }, + // 琛ㄥ崟鍙傛暟 + form: {}, + // 琛ㄥ崟鏍¢獙 + rules: { + parentId: [ + { required: true, message: "涓婄骇閮ㄩ棬涓嶈兘涓虹┖", trigger: "blur" } + ], + deptName: [ + { required: true, message: "閮ㄩ棬鍚嶇О涓嶈兘涓虹┖", trigger: "blur" } + ], + orderNum: [ + { required: true, message: "鏄剧ず鎺掑簭涓嶈兘涓虹┖", trigger: "blur" } + ], + email: [ + { + type: "email", + message: "'璇疯緭鍏ユ纭殑閭鍦板潃", + trigger: ["blur", "change"] + } + ], + phone: [ + { + pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, + message: "璇疯緭鍏ユ纭殑鎵嬫満鍙风爜", + trigger: "blur" + } + ] + } + }; + }, + created() { + this.getList(); + this.getDicts("sys_normal_disable").then(response => { + this.statusOptions = response.data; + }); + }, + methods: { + /** 鏌ヨ閮ㄩ棬鍒楄〃 */ + getList() { + this.loading = true; + listDept(this.queryParams).then(response => { + this.deptList = this.handleTree(response.data, "deptId"); + this.loading = false; + }); + }, + /** 杞崲閮ㄩ棬鏁版嵁缁撴瀯 */ + normalizer(node) { + if (node.children && !node.children.length) { + delete node.children; + } + return { + id: node.deptId, + label: node.deptName, + children: node.children + }; + }, + // 鍙栨秷鎸夐挳 + cancel() { + this.open = false; + this.reset(); + }, + // 琛ㄥ崟閲嶇疆 + reset() { + this.form = { + deptId: undefined, + parentId: undefined, + deptName: undefined, + orderNum: undefined, + leader: undefined, + phone: undefined, + email: undefined, + status: "0" + }; + this.resetForm("form"); + }, + /** 鎼滅储鎸夐挳鎿嶄綔 */ + handleQuery() { + this.getList(); + }, + /** 閲嶇疆鎸夐挳鎿嶄綔 */ + resetQuery() { + this.resetForm("queryForm"); + this.handleQuery(); + }, + /** 鏂板鎸夐挳鎿嶄綔 */ + handleAdd(row) { + this.reset(); + if (row != undefined) { + this.form.parentId = row.deptId; + } + this.open = true; + this.title = "娣诲姞閮ㄩ棬"; + listDept().then(response => { + this.deptOptions = this.handleTree(response.data, "deptId"); + }); + }, + /** 淇敼鎸夐挳鎿嶄綔 */ + handleUpdate(row) { + this.reset(); + getDept(row.deptId).then(response => { + this.form = response.data; + this.open = true; + this.title = "淇敼閮ㄩ棬"; + }); + listDeptExcludeChild(row.deptId).then(response => { + this.deptOptions = this.handleTree(response.data, "deptId"); + }); + }, + /** 鎻愪氦鎸夐挳 */ + submitForm: function() { + this.$refs["form"].validate(valid => { + if (valid) { + if (this.form.deptId != undefined) { + updateDept(this.form).then(response => { + this.msgSuccess("淇敼鎴愬姛"); + this.open = false; + this.getList(); + }); + } else { + addDept(this.form).then(response => { + this.msgSuccess("鏂板鎴愬姛"); + this.open = false; + this.getList(); + }); + } + } + }); + }, + /** 鍒犻櫎鎸夐挳鎿嶄綔 */ + handleDelete(row) { + this.$confirm('鏄惁纭鍒犻櫎鍚嶇О涓�"' + row.deptName + '"鐨勬暟鎹」?', "璀﹀憡", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning" + }).then(function() { + return delDept(row.deptId); + }).then(() => { + this.getList(); + this.msgSuccess("鍒犻櫎鎴愬姛"); + }).catch(() => {}); + } + } +}; +</script> diff --git a/ruoyi-ui/src/views/system/menu/index.vue b/ruoyi-ui/src/views/system/menu/index.vue index b0ea59a..e59d1a6 100644 --- a/ruoyi-ui/src/views/system/menu/index.vue +++ b/ruoyi-ui/src/views/system/menu/index.vue @@ -1,442 +1,432 @@ -<template> - <div class="app-container"> - <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch"> - <el-form-item label="鑿滃崟鍚嶇О" prop="menuName"> - <el-input - v-model="queryParams.menuName" - placeholder="璇疯緭鍏ヨ彍鍗曞悕绉�" - clearable - size="small" - @keyup.enter.native="handleQuery" - /> - </el-form-item> - <el-form-item label="鐘舵��" prop="status"> - <el-select v-model="queryParams.status" placeholder="鑿滃崟鐘舵��" clearable size="small"> - <el-option - v-for="dict in statusOptions" - :key="dict.dictValue" - :label="dict.dictLabel" - :value="dict.dictValue" - /> - </el-select> - </el-form-item> - <el-form-item> - <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> - <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button> - </el-form-item> - </el-form> - - <el-row :gutter="10" class="mb8"> - <el-col :span="1.5"> - <el-button - type="primary" - plain - icon="el-icon-plus" - size="mini" - @click="handleAdd" - v-hasPermi="['system:menu:add']" - >鏂板</el-button> - </el-col> - <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> - </el-row> - - <el-table - v-loading="loading" - :data="menuList" - row-key="menuId" - :tree-props="{children: 'children', hasChildren: 'hasChildren'}" - > - <el-table-column prop="menuName" label="鑿滃崟鍚嶇О" :show-overflow-tooltip="true" width="160"></el-table-column> - <el-table-column prop="icon" label="鍥炬爣" align="center" width="100"> - <template slot-scope="scope"> - <svg-icon :icon-class="scope.row.icon" /> - </template> - </el-table-column> - <el-table-column prop="orderNum" label="鎺掑簭" width="60"></el-table-column> - <el-table-column prop="perms" label="鏉冮檺鏍囪瘑" :show-overflow-tooltip="true"></el-table-column> - <el-table-column prop="component" label="缁勪欢璺緞" :show-overflow-tooltip="true"></el-table-column> - <el-table-column prop="status" label="鐘舵��" :formatter="statusFormat" width="80"></el-table-column> - <el-table-column label="鍒涘缓鏃堕棿" align="center" prop="createTime"> - <template slot-scope="scope"> - <span>{{ parseTime(scope.row.createTime) }}</span> - </template> - </el-table-column> - <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width"> - <template slot-scope="scope"> - <el-button size="mini" - type="text" - icon="el-icon-edit" - @click="handleUpdate(scope.row)" - v-hasPermi="['system:menu:edit']" - >淇敼</el-button> - <el-button - size="mini" - type="text" - icon="el-icon-plus" - @click="handleAdd(scope.row)" - v-hasPermi="['system:menu:add']" - >鏂板</el-button> - <el-button - size="mini" - type="text" - icon="el-icon-delete" - @click="handleDelete(scope.row)" - v-hasPermi="['system:menu:remove']" - >鍒犻櫎</el-button> - </template> - </el-table-column> - </el-table> - - <!-- 娣诲姞鎴栦慨鏀硅彍鍗曞璇濇 --> - <el-dialog :title="title" :visible.sync="open" width="680px" append-to-body> - <el-form ref="form" :model="form" :rules="rules" label-width="100px"> - <el-row> - <el-col :span="24"> - <el-form-item label="涓婄骇鑿滃崟"> - <treeselect - v-model="form.parentId" - :options="menuOptions" - :normalizer="normalizer" - :show-count="true" - placeholder="閫夋嫨涓婄骇鑿滃崟" - /> - </el-form-item> - </el-col> - <el-col :span="24"> - <el-form-item label="鑿滃崟绫诲瀷" prop="menuType"> - <el-radio-group v-model="form.menuType"> - <el-radio label="M">鐩綍</el-radio> - <el-radio label="C">鑿滃崟</el-radio> - <el-radio label="F">鎸夐挳</el-radio> - </el-radio-group> - </el-form-item> - </el-col> - <el-col :span="24"> - <el-form-item v-if="form.menuType != 'F'" label="鑿滃崟鍥炬爣"> - <el-popover - placement="bottom-start" - width="460" - trigger="click" - @show="$refs['iconSelect'].reset()" - > - <IconSelect ref="iconSelect" @selected="selected" /> - <el-input slot="reference" v-model="form.icon" placeholder="鐐瑰嚮閫夋嫨鍥炬爣" readonly> - <svg-icon - v-if="form.icon" - slot="prefix" - :icon-class="form.icon" - class="el-input__icon" - style="height: 32px;width: 16px;" - /> - <i v-else slot="prefix" class="el-icon-search el-input__icon" /> - </el-input> - </el-popover> - </el-form-item> - </el-col> - <el-col :span="12"> - <el-form-item label="鑿滃崟鍚嶇О" prop="menuName"> - <el-input v-model="form.menuName" placeholder="璇疯緭鍏ヨ彍鍗曞悕绉�" /> - </el-form-item> - </el-col> - <el-col :span="12"> - <el-form-item label="鏄剧ず鎺掑簭" prop="orderNum"> - <el-input-number v-model="form.orderNum" controls-position="right" :min="0" /> - </el-form-item> - </el-col> - <el-col :span="12"> - <el-form-item v-if="form.menuType != 'F'"> - <span slot="label"> - <el-tooltip content="閫夋嫨鏄閾惧垯璺敱鍦板潃闇�瑕佷互`http(s)://`寮�澶�" placement="top"> - <i class="el-icon-question"></i> - </el-tooltip> - 鏄惁澶栭摼 - </span> - <el-radio-group v-model="form.isFrame"> - <el-radio label="0">鏄�</el-radio> - <el-radio label="1">鍚�</el-radio> - </el-radio-group> - </el-form-item> - </el-col> - <el-col :span="12"> - <el-form-item v-if="form.menuType != 'F'" prop="path"> - <span slot="label"> - <el-tooltip content="璁块棶鐨勮矾鐢卞湴鍧�锛屽锛歚user`锛屽澶栫綉鍦板潃闇�鍐呴摼璁块棶鍒欎互`http(s)://`寮�澶�" placement="top"> - <i class="el-icon-question"></i> - </el-tooltip> - 璺敱鍦板潃 - </span> - <el-input v-model="form.path" placeholder="璇疯緭鍏ヨ矾鐢卞湴鍧�" /> - </el-form-item> - </el-col> - <el-col :span="12" v-if="form.menuType == 'C'"> - <el-form-item prop="component"> - <span slot="label"> - <el-tooltip content="璁块棶鐨勭粍浠惰矾寰勶紝濡傦細`system/user/index`锛岄粯璁ゅ湪`views`鐩綍涓�" placement="top"> - <i class="el-icon-question"></i> - </el-tooltip> - 缁勪欢璺緞 - </span> - <el-input v-model="form.component" placeholder="璇疯緭鍏ョ粍浠惰矾寰�" /> - </el-form-item> - </el-col> - <el-col :span="12"> - <el-form-item v-if="form.menuType != 'M'"> - <el-input v-model="form.perms" placeholder="璇疯緭鍏ユ潈闄愭爣璇�" maxlength="100" /> - <span slot="label"> - <el-tooltip content="鎺у埗鍣ㄤ腑瀹氫箟鐨勬潈闄愬瓧绗︼紝濡傦細@PreAuthorize(`@ss.hasPermi('system:user:list')`)" placement="top"> - <i class="el-icon-question"></i> - </el-tooltip> - 鏉冮檺瀛楃 - </span> - </el-form-item> - </el-col> - <el-col :span="12"> - <el-form-item v-if="form.menuType != 'F'"> - <span slot="label"> - <el-tooltip content="閫夋嫨闅愯棌鍒欒矾鐢卞皢涓嶄細鍑虹幇鍦ㄤ晶杈规爮锛屼絾浠嶇劧鍙互璁块棶" placement="top"> - <i class="el-icon-question"></i> - </el-tooltip> - 鏄剧ず鐘舵�� - </span> - <el-radio-group v-model="form.visible"> - <el-radio - v-for="dict in visibleOptions" - :key="dict.dictValue" - :label="dict.dictValue" - >{{dict.dictLabel}}</el-radio> - </el-radio-group> - </el-form-item> - </el-col> - <el-col :span="12"> - <el-form-item v-if="form.menuType != 'F'"> - <span slot="label"> - <el-tooltip content="閫夋嫨鍋滅敤鍒欒矾鐢卞皢涓嶄細鍑虹幇鍦ㄤ晶杈规爮锛屼篃涓嶈兘琚闂�" placement="top"> - <i class="el-icon-question"></i> - </el-tooltip> - 鑿滃崟鐘舵�� - </span> - <el-radio-group v-model="form.status"> - <el-radio - v-for="dict in statusOptions" - :key="dict.dictValue" - :label="dict.dictValue" - >{{dict.dictLabel}}</el-radio> - </el-radio-group> - </el-form-item> - </el-col> - <el-col :span="12"> - <el-form-item v-if="form.menuType == 'C'"> - <span slot="label"> - <el-tooltip content="閫夋嫨鏄垯浼氳`keep-alive`缂撳瓨锛岄渶瑕佸尮閰嶇粍浠剁殑`name`鍜屽湴鍧�淇濇寔涓�鑷�" placement="top"> - <i class="el-icon-question"></i> - </el-tooltip> - 鏄惁缂撳瓨 - </span> - <el-radio-group v-model="form.isCache"> - <el-radio label="0">缂撳瓨</el-radio> - <el-radio label="1">涓嶇紦瀛�</el-radio> - </el-radio-group> - </el-form-item> - </el-col> - </el-row> - </el-form> - <div slot="footer" class="dialog-footer"> - <el-button type="primary" @click="submitForm">纭� 瀹�</el-button> - <el-button @click="cancel">鍙� 娑�</el-button> - </div> - </el-dialog> - </div> -</template> - -<script> -import { listMenu, getMenu, delMenu, addMenu, updateMenu } from "@/api/system/menu"; -import Treeselect from "@riophae/vue-treeselect"; -import "@riophae/vue-treeselect/dist/vue-treeselect.css"; -import IconSelect from "@/components/IconSelect"; - -export default { - name: "Menu", - components: { Treeselect, IconSelect }, - data() { - return { - // 閬僵灞� - loading: true, - // 鏄剧ず鎼滅储鏉′欢 - showSearch: true, - // 鑿滃崟琛ㄦ牸鏍戞暟鎹� - menuList: [], - // 鑿滃崟鏍戦�夐」 - menuOptions: [], - // 寮瑰嚭灞傛爣棰� - title: "", - // 鏄惁鏄剧ず寮瑰嚭灞� - open: false, - // 鏄剧ず鐘舵�佹暟鎹瓧鍏� - visibleOptions: [], - // 鑿滃崟鐘舵�佹暟鎹瓧鍏� - statusOptions: [], - // 鏌ヨ鍙傛暟 - queryParams: { - menuName: undefined, - visible: undefined - }, - // 琛ㄥ崟鍙傛暟 - form: {}, - // 琛ㄥ崟鏍¢獙 - rules: { - menuName: [ - { required: true, message: "鑿滃崟鍚嶇О涓嶈兘涓虹┖", trigger: "blur" } - ], - orderNum: [ - { required: true, message: "鑿滃崟椤哄簭涓嶈兘涓虹┖", trigger: "blur" } - ], - path: [ - { required: true, message: "璺敱鍦板潃涓嶈兘涓虹┖", trigger: "blur" } - ] - } - }; - }, - created() { - this.getList(); - this.getDicts("sys_show_hide").then(response => { - this.visibleOptions = response.data; - }); - this.getDicts("sys_normal_disable").then(response => { - this.statusOptions = response.data; - }); - }, - methods: { - // 閫夋嫨鍥炬爣 - selected(name) { - this.form.icon = name; - }, - /** 鏌ヨ鑿滃崟鍒楄〃 */ - getList() { - this.loading = true; - listMenu(this.queryParams).then(response => { - this.menuList = this.handleTree(response.data, "menuId"); - this.loading = false; - }); - }, - /** 杞崲鑿滃崟鏁版嵁缁撴瀯 */ - normalizer(node) { - if (node.children && !node.children.length) { - delete node.children; - } - return { - id: node.menuId, - label: node.menuName, - children: node.children - }; - }, - /** 鏌ヨ鑿滃崟涓嬫媺鏍戠粨鏋� */ - getTreeselect() { - listMenu().then(response => { - this.menuOptions = []; - const menu = { menuId: 0, menuName: '涓荤被鐩�', children: [] }; - menu.children = this.handleTree(response.data, "menuId"); - this.menuOptions.push(menu); - }); - }, - // 鏄剧ず鐘舵�佸瓧鍏哥炕璇� - visibleFormat(row, column) { - if (row.menuType == "F") { - return ""; - } - return this.selectDictLabel(this.visibleOptions, row.visible); - }, - // 鑿滃崟鐘舵�佸瓧鍏哥炕璇� - statusFormat(row, column) { - if (row.menuType == "F") { - return ""; - } - return this.selectDictLabel(this.statusOptions, row.status); - }, - // 鍙栨秷鎸夐挳 - cancel() { - this.open = false; - this.reset(); - }, - // 琛ㄥ崟閲嶇疆 - reset() { - this.form = { - menuId: undefined, - parentId: 0, - menuName: undefined, - icon: undefined, - menuType: "M", - orderNum: undefined, - isFrame: "1", - isCache: "0", - visible: "0", - status: "0" - }; - this.resetForm("form"); - }, - /** 鎼滅储鎸夐挳鎿嶄綔 */ - handleQuery() { - this.getList(); - }, - /** 閲嶇疆鎸夐挳鎿嶄綔 */ - resetQuery() { - this.resetForm("queryForm"); - this.handleQuery(); - }, - /** 鏂板鎸夐挳鎿嶄綔 */ - handleAdd(row) { - this.reset(); - this.getTreeselect(); - if (row != null && row.menuId) { - this.form.parentId = row.menuId; - } else { - this.form.parentId = 0; - } - this.open = true; - this.title = "娣诲姞鑿滃崟"; - }, - /** 淇敼鎸夐挳鎿嶄綔 */ - handleUpdate(row) { - this.reset(); - this.getTreeselect(); - getMenu(row.menuId).then(response => { - this.form = response.data; - this.open = true; - this.title = "淇敼鑿滃崟"; - }); - }, - /** 鎻愪氦鎸夐挳 */ - submitForm: function() { - this.$refs["form"].validate(valid => { - if (valid) { - if (this.form.menuId != undefined) { - updateMenu(this.form).then(response => { - this.msgSuccess("淇敼鎴愬姛"); - this.open = false; - this.getList(); - }); - } else { - addMenu(this.form).then(response => { - this.msgSuccess("鏂板鎴愬姛"); - this.open = false; - this.getList(); - }); - } - } - }); - }, - /** 鍒犻櫎鎸夐挳鎿嶄綔 */ - handleDelete(row) { - this.$confirm('鏄惁纭鍒犻櫎鍚嶇О涓�"' + row.menuName + '"鐨勬暟鎹」?', "璀﹀憡", { - confirmButtonText: "纭畾", - cancelButtonText: "鍙栨秷", - type: "warning" - }).then(function() { - return delMenu(row.menuId); - }).then(() => { - this.getList(); - this.msgSuccess("鍒犻櫎鎴愬姛"); - }).catch(() => {}); - } - } -}; -</script> \ No newline at end of file +<template> + <div class="app-container"> + <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch"> + <el-form-item label="鑿滃崟鍚嶇О" prop="menuName"> + <el-input + v-model="queryParams.menuName" + placeholder="璇疯緭鍏ヨ彍鍗曞悕绉�" + clearable + size="small" + @keyup.enter.native="handleQuery" + /> + </el-form-item> + <el-form-item label="鐘舵��" prop="status"> + <el-select v-model="queryParams.status" placeholder="鑿滃崟鐘舵��" clearable size="small"> + <el-option + v-for="dict in statusOptions" + :key="dict.dictValue" + :label="dict.dictLabel" + :value="dict.dictValue" + /> + </el-select> + </el-form-item> + <el-form-item> + <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> + <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button> + </el-form-item> + </el-form> + + <el-row :gutter="10" class="mb8"> + <el-col :span="1.5"> + <el-button + type="primary" + plain + icon="el-icon-plus" + size="mini" + @click="handleAdd" + v-hasPermi="['system:menu:add']" + >鏂板</el-button> + </el-col> + <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> + </el-row> + + <el-table + v-loading="loading" + :data="menuList" + row-key="menuId" + :tree-props="{children: 'children', hasChildren: 'hasChildren'}" + > + <el-table-column prop="menuName" label="鑿滃崟鍚嶇О" :show-overflow-tooltip="true" width="160"></el-table-column> + <el-table-column prop="icon" label="鍥炬爣" align="center" width="100"> + <template slot-scope="scope"> + <svg-icon :icon-class="scope.row.icon" /> + </template> + </el-table-column> + <el-table-column prop="orderNum" label="鎺掑簭" width="60"></el-table-column> + <el-table-column prop="perms" label="鏉冮檺鏍囪瘑" :show-overflow-tooltip="true"></el-table-column> + <el-table-column prop="component" label="缁勪欢璺緞" :show-overflow-tooltip="true"></el-table-column> + <el-table-column prop="status" label="鐘舵��" width="80"> + <template slot-scope="scope"> + <dict-tag :options="statusOptions" :value="scope.row.status"/> + </template> + </el-table-column> + <el-table-column label="鍒涘缓鏃堕棿" align="center" prop="createTime"> + <template slot-scope="scope"> + <span>{{ parseTime(scope.row.createTime) }}</span> + </template> + </el-table-column> + <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width"> + <template slot-scope="scope"> + <el-button size="mini" + type="text" + icon="el-icon-edit" + @click="handleUpdate(scope.row)" + v-hasPermi="['system:menu:edit']" + >淇敼</el-button> + <el-button + size="mini" + type="text" + icon="el-icon-plus" + @click="handleAdd(scope.row)" + v-hasPermi="['system:menu:add']" + >鏂板</el-button> + <el-button + size="mini" + type="text" + icon="el-icon-delete" + @click="handleDelete(scope.row)" + v-hasPermi="['system:menu:remove']" + >鍒犻櫎</el-button> + </template> + </el-table-column> + </el-table> + + <!-- 娣诲姞鎴栦慨鏀硅彍鍗曞璇濇 --> + <el-dialog :title="title" :visible.sync="open" width="680px" append-to-body> + <el-form ref="form" :model="form" :rules="rules" label-width="100px"> + <el-row> + <el-col :span="24"> + <el-form-item label="涓婄骇鑿滃崟"> + <treeselect + v-model="form.parentId" + :options="menuOptions" + :normalizer="normalizer" + :show-count="true" + placeholder="閫夋嫨涓婄骇鑿滃崟" + /> + </el-form-item> + </el-col> + <el-col :span="24"> + <el-form-item label="鑿滃崟绫诲瀷" prop="menuType"> + <el-radio-group v-model="form.menuType"> + <el-radio label="M">鐩綍</el-radio> + <el-radio label="C">鑿滃崟</el-radio> + <el-radio label="F">鎸夐挳</el-radio> + </el-radio-group> + </el-form-item> + </el-col> + <el-col :span="24"> + <el-form-item v-if="form.menuType != 'F'" label="鑿滃崟鍥炬爣"> + <el-popover + placement="bottom-start" + width="460" + trigger="click" + @show="$refs['iconSelect'].reset()" + > + <IconSelect ref="iconSelect" @selected="selected" /> + <el-input slot="reference" v-model="form.icon" placeholder="鐐瑰嚮閫夋嫨鍥炬爣" readonly> + <svg-icon + v-if="form.icon" + slot="prefix" + :icon-class="form.icon" + class="el-input__icon" + style="height: 32px;width: 16px;" + /> + <i v-else slot="prefix" class="el-icon-search el-input__icon" /> + </el-input> + </el-popover> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鑿滃崟鍚嶇О" prop="menuName"> + <el-input v-model="form.menuName" placeholder="璇疯緭鍏ヨ彍鍗曞悕绉�" /> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鏄剧ず鎺掑簭" prop="orderNum"> + <el-input-number v-model="form.orderNum" controls-position="right" :min="0" /> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item v-if="form.menuType != 'F'"> + <span slot="label"> + <el-tooltip content="閫夋嫨鏄閾惧垯璺敱鍦板潃闇�瑕佷互`http(s)://`寮�澶�" placement="top"> + <i class="el-icon-question"></i> + </el-tooltip> + 鏄惁澶栭摼 + </span> + <el-radio-group v-model="form.isFrame"> + <el-radio label="0">鏄�</el-radio> + <el-radio label="1">鍚�</el-radio> + </el-radio-group> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item v-if="form.menuType != 'F'" prop="path"> + <span slot="label"> + <el-tooltip content="璁块棶鐨勮矾鐢卞湴鍧�锛屽锛歚user`锛屽澶栫綉鍦板潃闇�鍐呴摼璁块棶鍒欎互`http(s)://`寮�澶�" placement="top"> + <i class="el-icon-question"></i> + </el-tooltip> + 璺敱鍦板潃 + </span> + <el-input v-model="form.path" placeholder="璇疯緭鍏ヨ矾鐢卞湴鍧�" /> + </el-form-item> + </el-col> + <el-col :span="12" v-if="form.menuType == 'C'"> + <el-form-item prop="component"> + <span slot="label"> + <el-tooltip content="璁块棶鐨勭粍浠惰矾寰勶紝濡傦細`system/user/index`锛岄粯璁ゅ湪`views`鐩綍涓�" placement="top"> + <i class="el-icon-question"></i> + </el-tooltip> + 缁勪欢璺緞 + </span> + <el-input v-model="form.component" placeholder="璇疯緭鍏ョ粍浠惰矾寰�" /> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item v-if="form.menuType != 'M'"> + <el-input v-model="form.perms" placeholder="璇疯緭鍏ユ潈闄愭爣璇�" maxlength="100" /> + <span slot="label"> + <el-tooltip content="鎺у埗鍣ㄤ腑瀹氫箟鐨勬潈闄愬瓧绗︼紝濡傦細@PreAuthorize(`@ss.hasPermi('system:user:list')`)" placement="top"> + <i class="el-icon-question"></i> + </el-tooltip> + 鏉冮檺瀛楃 + </span> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item v-if="form.menuType != 'F'"> + <span slot="label"> + <el-tooltip content="閫夋嫨闅愯棌鍒欒矾鐢卞皢涓嶄細鍑虹幇鍦ㄤ晶杈规爮锛屼絾浠嶇劧鍙互璁块棶" placement="top"> + <i class="el-icon-question"></i> + </el-tooltip> + 鏄剧ず鐘舵�� + </span> + <el-radio-group v-model="form.visible"> + <el-radio + v-for="dict in visibleOptions" + :key="dict.dictValue" + :label="dict.dictValue" + >{{dict.dictLabel}}</el-radio> + </el-radio-group> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item v-if="form.menuType != 'F'"> + <span slot="label"> + <el-tooltip content="閫夋嫨鍋滅敤鍒欒矾鐢卞皢涓嶄細鍑虹幇鍦ㄤ晶杈规爮锛屼篃涓嶈兘琚闂�" placement="top"> + <i class="el-icon-question"></i> + </el-tooltip> + 鑿滃崟鐘舵�� + </span> + <el-radio-group v-model="form.status"> + <el-radio + v-for="dict in statusOptions" + :key="dict.dictValue" + :label="dict.dictValue" + >{{dict.dictLabel}}</el-radio> + </el-radio-group> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item v-if="form.menuType == 'C'"> + <span slot="label"> + <el-tooltip content="閫夋嫨鏄垯浼氳`keep-alive`缂撳瓨锛岄渶瑕佸尮閰嶇粍浠剁殑`name`鍜屽湴鍧�淇濇寔涓�鑷�" placement="top"> + <i class="el-icon-question"></i> + </el-tooltip> + 鏄惁缂撳瓨 + </span> + <el-radio-group v-model="form.isCache"> + <el-radio label="0">缂撳瓨</el-radio> + <el-radio label="1">涓嶇紦瀛�</el-radio> + </el-radio-group> + </el-form-item> + </el-col> + </el-row> + </el-form> + <div slot="footer" class="dialog-footer"> + <el-button type="primary" @click="submitForm">纭� 瀹�</el-button> + <el-button @click="cancel">鍙� 娑�</el-button> + </div> + </el-dialog> + </div> +</template> + +<script> +import { listMenu, getMenu, delMenu, addMenu, updateMenu } from "@/api/system/menu"; +import Treeselect from "@riophae/vue-treeselect"; +import "@riophae/vue-treeselect/dist/vue-treeselect.css"; +import IconSelect from "@/components/IconSelect"; + +export default { + name: "Menu", + components: { Treeselect, IconSelect }, + data() { + return { + // 閬僵灞� + loading: true, + // 鏄剧ず鎼滅储鏉′欢 + showSearch: true, + // 鑿滃崟琛ㄦ牸鏍戞暟鎹� + menuList: [], + // 鑿滃崟鏍戦�夐」 + menuOptions: [], + // 寮瑰嚭灞傛爣棰� + title: "", + // 鏄惁鏄剧ず寮瑰嚭灞� + open: false, + // 鏄剧ず鐘舵�佹暟鎹瓧鍏� + visibleOptions: [], + // 鑿滃崟鐘舵�佹暟鎹瓧鍏� + statusOptions: [], + // 鏌ヨ鍙傛暟 + queryParams: { + menuName: undefined, + visible: undefined + }, + // 琛ㄥ崟鍙傛暟 + form: {}, + // 琛ㄥ崟鏍¢獙 + rules: { + menuName: [ + { required: true, message: "鑿滃崟鍚嶇О涓嶈兘涓虹┖", trigger: "blur" } + ], + orderNum: [ + { required: true, message: "鑿滃崟椤哄簭涓嶈兘涓虹┖", trigger: "blur" } + ], + path: [ + { required: true, message: "璺敱鍦板潃涓嶈兘涓虹┖", trigger: "blur" } + ] + } + }; + }, + created() { + this.getList(); + this.getDicts("sys_show_hide").then(response => { + this.visibleOptions = response.data; + }); + this.getDicts("sys_normal_disable").then(response => { + this.statusOptions = response.data; + }); + }, + methods: { + // 閫夋嫨鍥炬爣 + selected(name) { + this.form.icon = name; + }, + /** 鏌ヨ鑿滃崟鍒楄〃 */ + getList() { + this.loading = true; + listMenu(this.queryParams).then(response => { + this.menuList = this.handleTree(response.data, "menuId"); + this.loading = false; + }); + }, + /** 杞崲鑿滃崟鏁版嵁缁撴瀯 */ + normalizer(node) { + if (node.children && !node.children.length) { + delete node.children; + } + return { + id: node.menuId, + label: node.menuName, + children: node.children + }; + }, + /** 鏌ヨ鑿滃崟涓嬫媺鏍戠粨鏋� */ + getTreeselect() { + listMenu().then(response => { + this.menuOptions = []; + const menu = { menuId: 0, menuName: '涓荤被鐩�', children: [] }; + menu.children = this.handleTree(response.data, "menuId"); + this.menuOptions.push(menu); + }); + }, + // 鍙栨秷鎸夐挳 + cancel() { + this.open = false; + this.reset(); + }, + // 琛ㄥ崟閲嶇疆 + reset() { + this.form = { + menuId: undefined, + parentId: 0, + menuName: undefined, + icon: undefined, + menuType: "M", + orderNum: undefined, + isFrame: "1", + isCache: "0", + visible: "0", + status: "0" + }; + this.resetForm("form"); + }, + /** 鎼滅储鎸夐挳鎿嶄綔 */ + handleQuery() { + this.getList(); + }, + /** 閲嶇疆鎸夐挳鎿嶄綔 */ + resetQuery() { + this.resetForm("queryForm"); + this.handleQuery(); + }, + /** 鏂板鎸夐挳鎿嶄綔 */ + handleAdd(row) { + this.reset(); + this.getTreeselect(); + if (row != null && row.menuId) { + this.form.parentId = row.menuId; + } else { + this.form.parentId = 0; + } + this.open = true; + this.title = "娣诲姞鑿滃崟"; + }, + /** 淇敼鎸夐挳鎿嶄綔 */ + handleUpdate(row) { + this.reset(); + this.getTreeselect(); + getMenu(row.menuId).then(response => { + this.form = response.data; + this.open = true; + this.title = "淇敼鑿滃崟"; + }); + }, + /** 鎻愪氦鎸夐挳 */ + submitForm: function() { + this.$refs["form"].validate(valid => { + if (valid) { + if (this.form.menuId != undefined) { + updateMenu(this.form).then(response => { + this.msgSuccess("淇敼鎴愬姛"); + this.open = false; + this.getList(); + }); + } else { + addMenu(this.form).then(response => { + this.msgSuccess("鏂板鎴愬姛"); + this.open = false; + this.getList(); + }); + } + } + }); + }, + /** 鍒犻櫎鎸夐挳鎿嶄綔 */ + handleDelete(row) { + this.$confirm('鏄惁纭鍒犻櫎鍚嶇О涓�"' + row.menuName + '"鐨勬暟鎹」?', "璀﹀憡", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning" + }).then(function() { + return delMenu(row.menuId); + }).then(() => { + this.getList(); + this.msgSuccess("鍒犻櫎鎴愬姛"); + }).catch(() => {}); + } + } +}; +</script> diff --git a/ruoyi-ui/src/views/system/notice/index.vue b/ruoyi-ui/src/views/system/notice/index.vue index cfbe761..7b4eb2d 100644 --- a/ruoyi-ui/src/views/system/notice/index.vue +++ b/ruoyi-ui/src/views/system/notice/index.vue @@ -1,339 +1,327 @@ -<template> - <div class="app-container"> - <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> - <el-form-item label="鍏憡鏍囬" prop="noticeTitle"> - <el-input - v-model="queryParams.noticeTitle" - placeholder="璇疯緭鍏ュ叕鍛婃爣棰�" - clearable - size="small" - @keyup.enter.native="handleQuery" - /> - </el-form-item> - <el-form-item label="鎿嶄綔浜哄憳" prop="createBy"> - <el-input - v-model="queryParams.createBy" - placeholder="璇疯緭鍏ユ搷浣滀汉鍛�" - clearable - size="small" - @keyup.enter.native="handleQuery" - /> - </el-form-item> - <el-form-item label="绫诲瀷" prop="noticeType"> - <el-select v-model="queryParams.noticeType" placeholder="鍏憡绫诲瀷" clearable size="small"> - <el-option - v-for="dict in typeOptions" - :key="dict.dictValue" - :label="dict.dictLabel" - :value="dict.dictValue" - /> - </el-select> - </el-form-item> - <el-form-item> - <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> - <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button> - </el-form-item> - </el-form> - - <el-row :gutter="10" class="mb8"> - <el-col :span="1.5"> - <el-button - type="primary" - plain - icon="el-icon-plus" - size="mini" - @click="handleAdd" - v-hasPermi="['system:notice:add']" - >鏂板</el-button> - </el-col> - <el-col :span="1.5"> - <el-button - type="success" - plain - icon="el-icon-edit" - size="mini" - :disabled="single" - @click="handleUpdate" - v-hasPermi="['system:notice:edit']" - >淇敼</el-button> - </el-col> - <el-col :span="1.5"> - <el-button - type="danger" - plain - icon="el-icon-delete" - size="mini" - :disabled="multiple" - @click="handleDelete" - v-hasPermi="['system:notice:remove']" - >鍒犻櫎</el-button> - </el-col> - <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> - </el-row> - - <el-table v-loading="loading" :data="noticeList" @selection-change="handleSelectionChange"> - <el-table-column type="selection" width="55" align="center" /> - <el-table-column label="搴忓彿" align="center" prop="noticeId" width="100" /> - <el-table-column - label="鍏憡鏍囬" - align="center" - prop="noticeTitle" - :show-overflow-tooltip="true" - /> - <el-table-column - label="鍏憡绫诲瀷" - align="center" - prop="noticeType" - :formatter="typeFormat" - width="100" - /> - <el-table-column - label="鐘舵��" - align="center" - prop="status" - :formatter="statusFormat" - width="100" - /> - <el-table-column label="鍒涘缓鑰�" align="center" prop="createBy" width="100" /> - <el-table-column label="鍒涘缓鏃堕棿" align="center" prop="createTime" width="100"> - <template slot-scope="scope"> - <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span> - </template> - </el-table-column> - <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width"> - <template slot-scope="scope"> - <el-button - size="mini" - type="text" - icon="el-icon-edit" - @click="handleUpdate(scope.row)" - v-hasPermi="['system:notice:edit']" - >淇敼</el-button> - <el-button - size="mini" - type="text" - icon="el-icon-delete" - @click="handleDelete(scope.row)" - v-hasPermi="['system:notice:remove']" - >鍒犻櫎</el-button> - </template> - </el-table-column> - </el-table> - - <pagination - v-show="total>0" - :total="total" - :page.sync="queryParams.pageNum" - :limit.sync="queryParams.pageSize" - @pagination="getList" - /> - - <!-- 娣诲姞鎴栦慨鏀瑰叕鍛婂璇濇 --> - <el-dialog :title="title" :visible.sync="open" width="780px" append-to-body> - <el-form ref="form" :model="form" :rules="rules" label-width="80px"> - <el-row> - <el-col :span="12"> - <el-form-item label="鍏憡鏍囬" prop="noticeTitle"> - <el-input v-model="form.noticeTitle" placeholder="璇疯緭鍏ュ叕鍛婃爣棰�" /> - </el-form-item> - </el-col> - <el-col :span="12"> - <el-form-item label="鍏憡绫诲瀷" prop="noticeType"> - <el-select v-model="form.noticeType" placeholder="璇烽�夋嫨"> - <el-option - v-for="dict in typeOptions" - :key="dict.dictValue" - :label="dict.dictLabel" - :value="dict.dictValue" - ></el-option> - </el-select> - </el-form-item> - </el-col> - <el-col :span="24"> - <el-form-item label="鐘舵��"> - <el-radio-group v-model="form.status"> - <el-radio - v-for="dict in statusOptions" - :key="dict.dictValue" - :label="dict.dictValue" - >{{dict.dictLabel}}</el-radio> - </el-radio-group> - </el-form-item> - </el-col> - <el-col :span="24"> - <el-form-item label="鍐呭"> - <editor v-model="form.noticeContent" :min-height="192"/> - </el-form-item> - </el-col> - </el-row> - </el-form> - <div slot="footer" class="dialog-footer"> - <el-button type="primary" @click="submitForm">纭� 瀹�</el-button> - <el-button @click="cancel">鍙� 娑�</el-button> - </div> - </el-dialog> - </div> -</template> - -<script> -import { listNotice, getNotice, delNotice, addNotice, updateNotice } from "@/api/system/notice"; - -export default { - name: "Notice", - data() { - return { - // 閬僵灞� - loading: true, - // 閫変腑鏁扮粍 - ids: [], - // 闈炲崟涓鐢� - single: true, - // 闈炲涓鐢� - multiple: true, - // 鏄剧ず鎼滅储鏉′欢 - showSearch: true, - // 鎬绘潯鏁� - total: 0, - // 鍏憡琛ㄦ牸鏁版嵁 - noticeList: [], - // 寮瑰嚭灞傛爣棰� - title: "", - // 鏄惁鏄剧ず寮瑰嚭灞� - open: false, - // 绫诲瀷鏁版嵁瀛楀吀 - statusOptions: [], - // 鐘舵�佹暟鎹瓧鍏� - typeOptions: [], - // 鏌ヨ鍙傛暟 - queryParams: { - pageNum: 1, - pageSize: 10, - noticeTitle: undefined, - createBy: undefined, - status: undefined - }, - // 琛ㄥ崟鍙傛暟 - form: {}, - // 琛ㄥ崟鏍¢獙 - rules: { - noticeTitle: [ - { required: true, message: "鍏憡鏍囬涓嶈兘涓虹┖", trigger: "blur" } - ], - noticeType: [ - { required: true, message: "鍏憡绫诲瀷涓嶈兘涓虹┖", trigger: "change" } - ] - } - }; - }, - created() { - this.getList(); - this.getDicts("sys_notice_status").then(response => { - this.statusOptions = response.data; - }); - this.getDicts("sys_notice_type").then(response => { - this.typeOptions = response.data; - }); - }, - methods: { - /** 鏌ヨ鍏憡鍒楄〃 */ - getList() { - this.loading = true; - listNotice(this.queryParams).then(response => { - this.noticeList = response.rows; - this.total = response.total; - this.loading = false; - }); - }, - // 鍏憡鐘舵�佸瓧鍏哥炕璇� - statusFormat(row, column) { - return this.selectDictLabel(this.statusOptions, row.status); - }, - // 鍏憡鐘舵�佸瓧鍏哥炕璇� - typeFormat(row, column) { - return this.selectDictLabel(this.typeOptions, row.noticeType); - }, - // 鍙栨秷鎸夐挳 - cancel() { - this.open = false; - this.reset(); - }, - // 琛ㄥ崟閲嶇疆 - reset() { - this.form = { - noticeId: undefined, - noticeTitle: undefined, - noticeType: undefined, - noticeContent: undefined, - status: "0" - }; - this.resetForm("form"); - }, - /** 鎼滅储鎸夐挳鎿嶄綔 */ - handleQuery() { - this.queryParams.pageNum = 1; - this.getList(); - }, - /** 閲嶇疆鎸夐挳鎿嶄綔 */ - resetQuery() { - this.resetForm("queryForm"); - this.handleQuery(); - }, - // 澶氶�夋閫変腑鏁版嵁 - handleSelectionChange(selection) { - this.ids = selection.map(item => item.noticeId) - this.single = selection.length!=1 - this.multiple = !selection.length - }, - /** 鏂板鎸夐挳鎿嶄綔 */ - handleAdd() { - this.reset(); - this.open = true; - this.title = "娣诲姞鍏憡"; - }, - /** 淇敼鎸夐挳鎿嶄綔 */ - handleUpdate(row) { - this.reset(); - const noticeId = row.noticeId || this.ids - getNotice(noticeId).then(response => { - this.form = response.data; - this.open = true; - this.title = "淇敼鍏憡"; - }); - }, - /** 鎻愪氦鎸夐挳 */ - submitForm: function() { - this.$refs["form"].validate(valid => { - if (valid) { - if (this.form.noticeId != undefined) { - updateNotice(this.form).then(response => { - this.msgSuccess("淇敼鎴愬姛"); - this.open = false; - this.getList(); - }); - } else { - addNotice(this.form).then(response => { - this.msgSuccess("鏂板鎴愬姛"); - this.open = false; - this.getList(); - }); - } - } - }); - }, - /** 鍒犻櫎鎸夐挳鎿嶄綔 */ - handleDelete(row) { - const noticeIds = row.noticeId || this.ids - this.$confirm('鏄惁纭鍒犻櫎鍏憡缂栧彿涓�"' + noticeIds + '"鐨勬暟鎹」?', "璀﹀憡", { - confirmButtonText: "纭畾", - cancelButtonText: "鍙栨秷", - type: "warning" - }).then(function() { - return delNotice(noticeIds); - }).then(() => { - this.getList(); - this.msgSuccess("鍒犻櫎鎴愬姛"); - }).catch(() => {}); - } - } -}; -</script> \ No newline at end of file +<template> + <div class="app-container"> + <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> + <el-form-item label="鍏憡鏍囬" prop="noticeTitle"> + <el-input + v-model="queryParams.noticeTitle" + placeholder="璇疯緭鍏ュ叕鍛婃爣棰�" + clearable + size="small" + @keyup.enter.native="handleQuery" + /> + </el-form-item> + <el-form-item label="鎿嶄綔浜哄憳" prop="createBy"> + <el-input + v-model="queryParams.createBy" + placeholder="璇疯緭鍏ユ搷浣滀汉鍛�" + clearable + size="small" + @keyup.enter.native="handleQuery" + /> + </el-form-item> + <el-form-item label="绫诲瀷" prop="noticeType"> + <el-select v-model="queryParams.noticeType" placeholder="鍏憡绫诲瀷" clearable size="small"> + <el-option + v-for="dict in typeOptions" + :key="dict.dictValue" + :label="dict.dictLabel" + :value="dict.dictValue" + /> + </el-select> + </el-form-item> + <el-form-item> + <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> + <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button> + </el-form-item> + </el-form> + + <el-row :gutter="10" class="mb8"> + <el-col :span="1.5"> + <el-button + type="primary" + plain + icon="el-icon-plus" + size="mini" + @click="handleAdd" + v-hasPermi="['system:notice:add']" + >鏂板</el-button> + </el-col> + <el-col :span="1.5"> + <el-button + type="success" + plain + icon="el-icon-edit" + size="mini" + :disabled="single" + @click="handleUpdate" + v-hasPermi="['system:notice:edit']" + >淇敼</el-button> + </el-col> + <el-col :span="1.5"> + <el-button + type="danger" + plain + icon="el-icon-delete" + size="mini" + :disabled="multiple" + @click="handleDelete" + v-hasPermi="['system:notice:remove']" + >鍒犻櫎</el-button> + </el-col> + <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> + </el-row> + + <el-table v-loading="loading" :data="noticeList" @selection-change="handleSelectionChange"> + <el-table-column type="selection" width="55" align="center" /> + <el-table-column label="搴忓彿" align="center" prop="noticeId" width="100" /> + <el-table-column + label="鍏憡鏍囬" + align="center" + prop="noticeTitle" + :show-overflow-tooltip="true" + /> + <el-table-column label="鍏憡绫诲瀷" align="center" prop="noticeType" width="100"> + <template slot-scope="scope"> + <dict-tag :options="typeOptions" :value="scope.row.noticeType"/> + </template> + </el-table-column> + <el-table-column label="鐘舵��" align="center" prop="status" width="100"> + <template slot-scope="scope"> + <dict-tag :options="statusOptions" :value="scope.row.status"/> + </template> + </el-table-column> + <el-table-column label="鍒涘缓鑰�" align="center" prop="createBy" width="100" /> + <el-table-column label="鍒涘缓鏃堕棿" align="center" prop="createTime" width="100"> + <template slot-scope="scope"> + <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span> + </template> + </el-table-column> + <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width"> + <template slot-scope="scope"> + <el-button + size="mini" + type="text" + icon="el-icon-edit" + @click="handleUpdate(scope.row)" + v-hasPermi="['system:notice:edit']" + >淇敼</el-button> + <el-button + size="mini" + type="text" + icon="el-icon-delete" + @click="handleDelete(scope.row)" + v-hasPermi="['system:notice:remove']" + >鍒犻櫎</el-button> + </template> + </el-table-column> + </el-table> + + <pagination + v-show="total>0" + :total="total" + :page.sync="queryParams.pageNum" + :limit.sync="queryParams.pageSize" + @pagination="getList" + /> + + <!-- 娣诲姞鎴栦慨鏀瑰叕鍛婂璇濇 --> + <el-dialog :title="title" :visible.sync="open" width="780px" append-to-body> + <el-form ref="form" :model="form" :rules="rules" label-width="80px"> + <el-row> + <el-col :span="12"> + <el-form-item label="鍏憡鏍囬" prop="noticeTitle"> + <el-input v-model="form.noticeTitle" placeholder="璇疯緭鍏ュ叕鍛婃爣棰�" /> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鍏憡绫诲瀷" prop="noticeType"> + <el-select v-model="form.noticeType" placeholder="璇烽�夋嫨"> + <el-option + v-for="dict in typeOptions" + :key="dict.dictValue" + :label="dict.dictLabel" + :value="dict.dictValue" + ></el-option> + </el-select> + </el-form-item> + </el-col> + <el-col :span="24"> + <el-form-item label="鐘舵��"> + <el-radio-group v-model="form.status"> + <el-radio + v-for="dict in statusOptions" + :key="dict.dictValue" + :label="dict.dictValue" + >{{dict.dictLabel}}</el-radio> + </el-radio-group> + </el-form-item> + </el-col> + <el-col :span="24"> + <el-form-item label="鍐呭"> + <editor v-model="form.noticeContent" :min-height="192"/> + </el-form-item> + </el-col> + </el-row> + </el-form> + <div slot="footer" class="dialog-footer"> + <el-button type="primary" @click="submitForm">纭� 瀹�</el-button> + <el-button @click="cancel">鍙� 娑�</el-button> + </div> + </el-dialog> + </div> +</template> + +<script> +import { listNotice, getNotice, delNotice, addNotice, updateNotice } from "@/api/system/notice"; + +export default { + name: "Notice", + data() { + return { + // 閬僵灞� + loading: true, + // 閫変腑鏁扮粍 + ids: [], + // 闈炲崟涓鐢� + single: true, + // 闈炲涓鐢� + multiple: true, + // 鏄剧ず鎼滅储鏉′欢 + showSearch: true, + // 鎬绘潯鏁� + total: 0, + // 鍏憡琛ㄦ牸鏁版嵁 + noticeList: [], + // 寮瑰嚭灞傛爣棰� + title: "", + // 鏄惁鏄剧ず寮瑰嚭灞� + open: false, + // 绫诲瀷鏁版嵁瀛楀吀 + statusOptions: [], + // 鐘舵�佹暟鎹瓧鍏� + typeOptions: [], + // 鏌ヨ鍙傛暟 + queryParams: { + pageNum: 1, + pageSize: 10, + noticeTitle: undefined, + createBy: undefined, + status: undefined + }, + // 琛ㄥ崟鍙傛暟 + form: {}, + // 琛ㄥ崟鏍¢獙 + rules: { + noticeTitle: [ + { required: true, message: "鍏憡鏍囬涓嶈兘涓虹┖", trigger: "blur" } + ], + noticeType: [ + { required: true, message: "鍏憡绫诲瀷涓嶈兘涓虹┖", trigger: "change" } + ] + } + }; + }, + created() { + this.getList(); + this.getDicts("sys_notice_status").then(response => { + this.statusOptions = response.data; + }); + this.getDicts("sys_notice_type").then(response => { + this.typeOptions = response.data; + }); + }, + methods: { + /** 鏌ヨ鍏憡鍒楄〃 */ + getList() { + this.loading = true; + listNotice(this.queryParams).then(response => { + this.noticeList = response.rows; + this.total = response.total; + this.loading = false; + }); + }, + // 鍙栨秷鎸夐挳 + cancel() { + this.open = false; + this.reset(); + }, + // 琛ㄥ崟閲嶇疆 + reset() { + this.form = { + noticeId: undefined, + noticeTitle: undefined, + noticeType: undefined, + noticeContent: undefined, + status: "0" + }; + this.resetForm("form"); + }, + /** 鎼滅储鎸夐挳鎿嶄綔 */ + handleQuery() { + this.queryParams.pageNum = 1; + this.getList(); + }, + /** 閲嶇疆鎸夐挳鎿嶄綔 */ + resetQuery() { + this.resetForm("queryForm"); + this.handleQuery(); + }, + // 澶氶�夋閫変腑鏁版嵁 + handleSelectionChange(selection) { + this.ids = selection.map(item => item.noticeId) + this.single = selection.length!=1 + this.multiple = !selection.length + }, + /** 鏂板鎸夐挳鎿嶄綔 */ + handleAdd() { + this.reset(); + this.open = true; + this.title = "娣诲姞鍏憡"; + }, + /** 淇敼鎸夐挳鎿嶄綔 */ + handleUpdate(row) { + this.reset(); + const noticeId = row.noticeId || this.ids + getNotice(noticeId).then(response => { + this.form = response.data; + this.open = true; + this.title = "淇敼鍏憡"; + }); + }, + /** 鎻愪氦鎸夐挳 */ + submitForm: function() { + this.$refs["form"].validate(valid => { + if (valid) { + if (this.form.noticeId != undefined) { + updateNotice(this.form).then(response => { + this.msgSuccess("淇敼鎴愬姛"); + this.open = false; + this.getList(); + }); + } else { + addNotice(this.form).then(response => { + this.msgSuccess("鏂板鎴愬姛"); + this.open = false; + this.getList(); + }); + } + } + }); + }, + /** 鍒犻櫎鎸夐挳鎿嶄綔 */ + handleDelete(row) { + const noticeIds = row.noticeId || this.ids + this.$confirm('鏄惁纭鍒犻櫎鍏憡缂栧彿涓�"' + noticeIds + '"鐨勬暟鎹」?', "璀﹀憡", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning" + }).then(function() { + return delNotice(noticeIds); + }).then(() => { + this.getList(); + this.msgSuccess("鍒犻櫎鎴愬姛"); + }).catch(() => {}); + } + } +}; +</script> diff --git a/ruoyi-ui/src/views/system/post/index.vue b/ruoyi-ui/src/views/system/post/index.vue index 0b10126..10eca78 100644 --- a/ruoyi-ui/src/views/system/post/index.vue +++ b/ruoyi-ui/src/views/system/post/index.vue @@ -1,331 +1,331 @@ -<template> - <div class="app-container"> - <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> - <el-form-item label="宀椾綅缂栫爜" prop="postCode"> - <el-input - v-model="queryParams.postCode" - placeholder="璇疯緭鍏ュ矖浣嶇紪鐮�" - clearable - size="small" - @keyup.enter.native="handleQuery" - /> - </el-form-item> - <el-form-item label="宀椾綅鍚嶇О" prop="postName"> - <el-input - v-model="queryParams.postName" - placeholder="璇疯緭鍏ュ矖浣嶅悕绉�" - clearable - size="small" - @keyup.enter.native="handleQuery" - /> - </el-form-item> - <el-form-item label="鐘舵��" prop="status"> - <el-select v-model="queryParams.status" placeholder="宀椾綅鐘舵��" clearable size="small"> - <el-option - v-for="dict in statusOptions" - :key="dict.dictValue" - :label="dict.dictLabel" - :value="dict.dictValue" - /> - </el-select> - </el-form-item> - <el-form-item> - <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> - <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button> - </el-form-item> - </el-form> - - <el-row :gutter="10" class="mb8"> - <el-col :span="1.5"> - <el-button - type="primary" - plain - icon="el-icon-plus" - size="mini" - @click="handleAdd" - v-hasPermi="['system:post:add']" - >鏂板</el-button> - </el-col> - <el-col :span="1.5"> - <el-button - type="success" - plain - icon="el-icon-edit" - size="mini" - :disabled="single" - @click="handleUpdate" - v-hasPermi="['system:post:edit']" - >淇敼</el-button> - </el-col> - <el-col :span="1.5"> - <el-button - type="danger" - plain - icon="el-icon-delete" - size="mini" - :disabled="multiple" - @click="handleDelete" - v-hasPermi="['system:post:remove']" - >鍒犻櫎</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="['system:post:export']" - >瀵煎嚭</el-button> - </el-col> - <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> - </el-row> - - <el-table v-loading="loading" :data="postList" @selection-change="handleSelectionChange"> - <el-table-column type="selection" width="55" align="center" /> - <el-table-column label="宀椾綅缂栧彿" align="center" prop="postId" /> - <el-table-column label="宀椾綅缂栫爜" align="center" prop="postCode" /> - <el-table-column label="宀椾綅鍚嶇О" align="center" prop="postName" /> - <el-table-column label="宀椾綅鎺掑簭" align="center" prop="postSort" /> - <el-table-column label="鐘舵��" align="center" prop="status" :formatter="statusFormat" /> - <el-table-column label="鍒涘缓鏃堕棿" align="center" prop="createTime" width="180"> - <template slot-scope="scope"> - <span>{{ parseTime(scope.row.createTime) }}</span> - </template> - </el-table-column> - <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width"> - <template slot-scope="scope"> - <el-button - size="mini" - type="text" - icon="el-icon-edit" - @click="handleUpdate(scope.row)" - v-hasPermi="['system:post:edit']" - >淇敼</el-button> - <el-button - size="mini" - type="text" - icon="el-icon-delete" - @click="handleDelete(scope.row)" - v-hasPermi="['system:post:remove']" - >鍒犻櫎</el-button> - </template> - </el-table-column> - </el-table> - - <pagination - v-show="total>0" - :total="total" - :page.sync="queryParams.pageNum" - :limit.sync="queryParams.pageSize" - @pagination="getList" - /> - - <!-- 娣诲姞鎴栦慨鏀瑰矖浣嶅璇濇 --> - <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> - <el-form ref="form" :model="form" :rules="rules" label-width="80px"> - <el-form-item label="宀椾綅鍚嶇О" prop="postName"> - <el-input v-model="form.postName" placeholder="璇疯緭鍏ュ矖浣嶅悕绉�" /> - </el-form-item> - <el-form-item label="宀椾綅缂栫爜" prop="postCode"> - <el-input v-model="form.postCode" placeholder="璇疯緭鍏ョ紪鐮佸悕绉�" /> - </el-form-item> - <el-form-item label="宀椾綅椤哄簭" prop="postSort"> - <el-input-number v-model="form.postSort" controls-position="right" :min="0" /> - </el-form-item> - <el-form-item label="宀椾綅鐘舵��" prop="status"> - <el-radio-group v-model="form.status"> - <el-radio - v-for="dict in statusOptions" - :key="dict.dictValue" - :label="dict.dictValue" - >{{dict.dictLabel}}</el-radio> - </el-radio-group> - </el-form-item> - <el-form-item label="澶囨敞" prop="remark"> - <el-input v-model="form.remark" type="textarea" placeholder="璇疯緭鍏ュ唴瀹�" /> - </el-form-item> - </el-form> - <div slot="footer" class="dialog-footer"> - <el-button type="primary" @click="submitForm">纭� 瀹�</el-button> - <el-button @click="cancel">鍙� 娑�</el-button> - </div> - </el-dialog> - </div> -</template> - -<script> -import { listPost, getPost, delPost, addPost, updatePost, exportPost } from "@/api/system/post"; - -export default { - name: "Post", - data() { - return { - // 閬僵灞� - loading: true, - // 瀵煎嚭閬僵灞� - exportLoading: false, - // 閫変腑鏁扮粍 - ids: [], - // 闈炲崟涓鐢� - single: true, - // 闈炲涓鐢� - multiple: true, - // 鏄剧ず鎼滅储鏉′欢 - showSearch: true, - // 鎬绘潯鏁� - total: 0, - // 宀椾綅琛ㄦ牸鏁版嵁 - postList: [], - // 寮瑰嚭灞傛爣棰� - title: "", - // 鏄惁鏄剧ず寮瑰嚭灞� - open: false, - // 鐘舵�佹暟鎹瓧鍏� - statusOptions: [], - // 鏌ヨ鍙傛暟 - queryParams: { - pageNum: 1, - pageSize: 10, - postCode: undefined, - postName: undefined, - status: undefined - }, - // 琛ㄥ崟鍙傛暟 - form: {}, - // 琛ㄥ崟鏍¢獙 - rules: { - postName: [ - { required: true, message: "宀椾綅鍚嶇О涓嶈兘涓虹┖", trigger: "blur" } - ], - postCode: [ - { required: true, message: "宀椾綅缂栫爜涓嶈兘涓虹┖", trigger: "blur" } - ], - postSort: [ - { required: true, message: "宀椾綅椤哄簭涓嶈兘涓虹┖", trigger: "blur" } - ] - } - }; - }, - created() { - this.getList(); - this.getDicts("sys_normal_disable").then(response => { - this.statusOptions = response.data; - }); - }, - methods: { - /** 鏌ヨ宀椾綅鍒楄〃 */ - getList() { - this.loading = true; - listPost(this.queryParams).then(response => { - this.postList = response.rows; - this.total = response.total; - this.loading = false; - }); - }, - // 宀椾綅鐘舵�佸瓧鍏哥炕璇� - statusFormat(row, column) { - return this.selectDictLabel(this.statusOptions, row.status); - }, - // 鍙栨秷鎸夐挳 - cancel() { - this.open = false; - this.reset(); - }, - // 琛ㄥ崟閲嶇疆 - reset() { - this.form = { - postId: undefined, - postCode: undefined, - postName: undefined, - postSort: 0, - status: "0", - remark: undefined - }; - this.resetForm("form"); - }, - /** 鎼滅储鎸夐挳鎿嶄綔 */ - handleQuery() { - this.queryParams.pageNum = 1; - this.getList(); - }, - /** 閲嶇疆鎸夐挳鎿嶄綔 */ - resetQuery() { - this.resetForm("queryForm"); - this.handleQuery(); - }, - // 澶氶�夋閫変腑鏁版嵁 - handleSelectionChange(selection) { - this.ids = selection.map(item => item.postId) - this.single = selection.length!=1 - this.multiple = !selection.length - }, - /** 鏂板鎸夐挳鎿嶄綔 */ - handleAdd() { - this.reset(); - this.open = true; - this.title = "娣诲姞宀椾綅"; - }, - /** 淇敼鎸夐挳鎿嶄綔 */ - handleUpdate(row) { - this.reset(); - const postId = row.postId || this.ids - getPost(postId).then(response => { - this.form = response.data; - this.open = true; - this.title = "淇敼宀椾綅"; - }); - }, - /** 鎻愪氦鎸夐挳 */ - submitForm: function() { - this.$refs["form"].validate(valid => { - if (valid) { - if (this.form.postId != undefined) { - updatePost(this.form).then(response => { - this.msgSuccess("淇敼鎴愬姛"); - this.open = false; - this.getList(); - }); - } else { - addPost(this.form).then(response => { - this.msgSuccess("鏂板鎴愬姛"); - this.open = false; - this.getList(); - }); - } - } - }); - }, - /** 鍒犻櫎鎸夐挳鎿嶄綔 */ - handleDelete(row) { - const postIds = row.postId || this.ids; - this.$confirm('鏄惁纭鍒犻櫎宀椾綅缂栧彿涓�"' + postIds + '"鐨勬暟鎹」?', "璀﹀憡", { - confirmButtonText: "纭畾", - cancelButtonText: "鍙栨秷", - type: "warning" - }).then(function() { - return delPost(postIds); - }).then(() => { - this.getList(); - this.msgSuccess("鍒犻櫎鎴愬姛"); - }).catch(() => {}); - }, - /** 瀵煎嚭鎸夐挳鎿嶄綔 */ - handleExport() { - const queryParams = this.queryParams; - this.$confirm('鏄惁纭瀵煎嚭鎵�鏈夊矖浣嶆暟鎹」?', "璀﹀憡", { - confirmButtonText: "纭畾", - cancelButtonText: "鍙栨秷", - type: "warning" - }).then(() => { - this.exportLoading = true; - return exportPost(queryParams); - }).then(response => { - this.download(response.msg); - this.exportLoading = false; - }).catch(() => {}); - } - } -}; -</script> \ No newline at end of file +<template> + <div class="app-container"> + <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> + <el-form-item label="宀椾綅缂栫爜" prop="postCode"> + <el-input + v-model="queryParams.postCode" + placeholder="璇疯緭鍏ュ矖浣嶇紪鐮�" + clearable + size="small" + @keyup.enter.native="handleQuery" + /> + </el-form-item> + <el-form-item label="宀椾綅鍚嶇О" prop="postName"> + <el-input + v-model="queryParams.postName" + placeholder="璇疯緭鍏ュ矖浣嶅悕绉�" + clearable + size="small" + @keyup.enter.native="handleQuery" + /> + </el-form-item> + <el-form-item label="鐘舵��" prop="status"> + <el-select v-model="queryParams.status" placeholder="宀椾綅鐘舵��" clearable size="small"> + <el-option + v-for="dict in statusOptions" + :key="dict.dictValue" + :label="dict.dictLabel" + :value="dict.dictValue" + /> + </el-select> + </el-form-item> + <el-form-item> + <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> + <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button> + </el-form-item> + </el-form> + + <el-row :gutter="10" class="mb8"> + <el-col :span="1.5"> + <el-button + type="primary" + plain + icon="el-icon-plus" + size="mini" + @click="handleAdd" + v-hasPermi="['system:post:add']" + >鏂板</el-button> + </el-col> + <el-col :span="1.5"> + <el-button + type="success" + plain + icon="el-icon-edit" + size="mini" + :disabled="single" + @click="handleUpdate" + v-hasPermi="['system:post:edit']" + >淇敼</el-button> + </el-col> + <el-col :span="1.5"> + <el-button + type="danger" + plain + icon="el-icon-delete" + size="mini" + :disabled="multiple" + @click="handleDelete" + v-hasPermi="['system:post:remove']" + >鍒犻櫎</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="['system:post:export']" + >瀵煎嚭</el-button> + </el-col> + <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> + </el-row> + + <el-table v-loading="loading" :data="postList" @selection-change="handleSelectionChange"> + <el-table-column type="selection" width="55" align="center" /> + <el-table-column label="宀椾綅缂栧彿" align="center" prop="postId" /> + <el-table-column label="宀椾綅缂栫爜" align="center" prop="postCode" /> + <el-table-column label="宀椾綅鍚嶇О" align="center" prop="postName" /> + <el-table-column label="宀椾綅鎺掑簭" align="center" prop="postSort" /> + <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="createTime" width="180"> + <template slot-scope="scope"> + <span>{{ parseTime(scope.row.createTime) }}</span> + </template> + </el-table-column> + <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width"> + <template slot-scope="scope"> + <el-button + size="mini" + type="text" + icon="el-icon-edit" + @click="handleUpdate(scope.row)" + v-hasPermi="['system:post:edit']" + >淇敼</el-button> + <el-button + size="mini" + type="text" + icon="el-icon-delete" + @click="handleDelete(scope.row)" + v-hasPermi="['system:post:remove']" + >鍒犻櫎</el-button> + </template> + </el-table-column> + </el-table> + + <pagination + v-show="total>0" + :total="total" + :page.sync="queryParams.pageNum" + :limit.sync="queryParams.pageSize" + @pagination="getList" + /> + + <!-- 娣诲姞鎴栦慨鏀瑰矖浣嶅璇濇 --> + <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> + <el-form ref="form" :model="form" :rules="rules" label-width="80px"> + <el-form-item label="宀椾綅鍚嶇О" prop="postName"> + <el-input v-model="form.postName" placeholder="璇疯緭鍏ュ矖浣嶅悕绉�" /> + </el-form-item> + <el-form-item label="宀椾綅缂栫爜" prop="postCode"> + <el-input v-model="form.postCode" placeholder="璇疯緭鍏ョ紪鐮佸悕绉�" /> + </el-form-item> + <el-form-item label="宀椾綅椤哄簭" prop="postSort"> + <el-input-number v-model="form.postSort" controls-position="right" :min="0" /> + </el-form-item> + <el-form-item label="宀椾綅鐘舵��" prop="status"> + <el-radio-group v-model="form.status"> + <el-radio + v-for="dict in statusOptions" + :key="dict.dictValue" + :label="dict.dictValue" + >{{dict.dictLabel}}</el-radio> + </el-radio-group> + </el-form-item> + <el-form-item label="澶囨敞" prop="remark"> + <el-input v-model="form.remark" type="textarea" placeholder="璇疯緭鍏ュ唴瀹�" /> + </el-form-item> + </el-form> + <div slot="footer" class="dialog-footer"> + <el-button type="primary" @click="submitForm">纭� 瀹�</el-button> + <el-button @click="cancel">鍙� 娑�</el-button> + </div> + </el-dialog> + </div> +</template> + +<script> +import { listPost, getPost, delPost, addPost, updatePost, exportPost } from "@/api/system/post"; + +export default { + name: "Post", + data() { + return { + // 閬僵灞� + loading: true, + // 瀵煎嚭閬僵灞� + exportLoading: false, + // 閫変腑鏁扮粍 + ids: [], + // 闈炲崟涓鐢� + single: true, + // 闈炲涓鐢� + multiple: true, + // 鏄剧ず鎼滅储鏉′欢 + showSearch: true, + // 鎬绘潯鏁� + total: 0, + // 宀椾綅琛ㄦ牸鏁版嵁 + postList: [], + // 寮瑰嚭灞傛爣棰� + title: "", + // 鏄惁鏄剧ず寮瑰嚭灞� + open: false, + // 鐘舵�佹暟鎹瓧鍏� + statusOptions: [], + // 鏌ヨ鍙傛暟 + queryParams: { + pageNum: 1, + pageSize: 10, + postCode: undefined, + postName: undefined, + status: undefined + }, + // 琛ㄥ崟鍙傛暟 + form: {}, + // 琛ㄥ崟鏍¢獙 + rules: { + postName: [ + { required: true, message: "宀椾綅鍚嶇О涓嶈兘涓虹┖", trigger: "blur" } + ], + postCode: [ + { required: true, message: "宀椾綅缂栫爜涓嶈兘涓虹┖", trigger: "blur" } + ], + postSort: [ + { required: true, message: "宀椾綅椤哄簭涓嶈兘涓虹┖", trigger: "blur" } + ] + } + }; + }, + created() { + this.getList(); + this.getDicts("sys_normal_disable").then(response => { + this.statusOptions = response.data; + }); + }, + methods: { + /** 鏌ヨ宀椾綅鍒楄〃 */ + getList() { + this.loading = true; + listPost(this.queryParams).then(response => { + this.postList = response.rows; + this.total = response.total; + this.loading = false; + }); + }, + // 鍙栨秷鎸夐挳 + cancel() { + this.open = false; + this.reset(); + }, + // 琛ㄥ崟閲嶇疆 + reset() { + this.form = { + postId: undefined, + postCode: undefined, + postName: undefined, + postSort: 0, + status: "0", + remark: undefined + }; + this.resetForm("form"); + }, + /** 鎼滅储鎸夐挳鎿嶄綔 */ + handleQuery() { + this.queryParams.pageNum = 1; + this.getList(); + }, + /** 閲嶇疆鎸夐挳鎿嶄綔 */ + resetQuery() { + this.resetForm("queryForm"); + this.handleQuery(); + }, + // 澶氶�夋閫変腑鏁版嵁 + handleSelectionChange(selection) { + this.ids = selection.map(item => item.postId) + this.single = selection.length!=1 + this.multiple = !selection.length + }, + /** 鏂板鎸夐挳鎿嶄綔 */ + handleAdd() { + this.reset(); + this.open = true; + this.title = "娣诲姞宀椾綅"; + }, + /** 淇敼鎸夐挳鎿嶄綔 */ + handleUpdate(row) { + this.reset(); + const postId = row.postId || this.ids + getPost(postId).then(response => { + this.form = response.data; + this.open = true; + this.title = "淇敼宀椾綅"; + }); + }, + /** 鎻愪氦鎸夐挳 */ + submitForm: function() { + this.$refs["form"].validate(valid => { + if (valid) { + if (this.form.postId != undefined) { + updatePost(this.form).then(response => { + this.msgSuccess("淇敼鎴愬姛"); + this.open = false; + this.getList(); + }); + } else { + addPost(this.form).then(response => { + this.msgSuccess("鏂板鎴愬姛"); + this.open = false; + this.getList(); + }); + } + } + }); + }, + /** 鍒犻櫎鎸夐挳鎿嶄綔 */ + handleDelete(row) { + const postIds = row.postId || this.ids; + this.$confirm('鏄惁纭鍒犻櫎宀椾綅缂栧彿涓�"' + postIds + '"鐨勬暟鎹」?', "璀﹀憡", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning" + }).then(function() { + return delPost(postIds); + }).then(() => { + this.getList(); + this.msgSuccess("鍒犻櫎鎴愬姛"); + }).catch(() => {}); + }, + /** 瀵煎嚭鎸夐挳鎿嶄綔 */ + handleExport() { + const queryParams = this.queryParams; + this.$confirm('鏄惁纭瀵煎嚭鎵�鏈夊矖浣嶆暟鎹」?', "璀﹀憡", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning" + }).then(() => { + this.exportLoading = true; + return exportPost(queryParams); + }).then(response => { + this.download(response.msg); + this.exportLoading = false; + }).catch(() => {}); + } + } +}; +</script> -- Gitblit v1.9.3