¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <el-form :model="queryParams" ref="queryForm" :inline="true" 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" |
| | | 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" |
| | | 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" |
| | | icon="el-icon-download" |
| | | size="mini" |
| | | @click="handleExport" |
| | | v-hasPermi="['system:config:export']" |
| | | >导åº</el-button> |
| | | </el-col> |
| | | </el-row> |
| | | |
| | | <el-table v-loading="loading" :data="list" @selection-change="handleSelectionChange"> |
| | | <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" /> |
| | | <el-table-column label="主æº" align="center" prop="operIp" width="130" :show-overflow-tooltip="true" /> |
| | | <el-table-column label="æä½å°ç¹" align="center" prop="operLocation" /> |
| | | <el-table-column label="æä½ç¶æ" align="center" prop="status" :formatter="statusFormat" /> |
| | | <el-table-column label="æä½æ¥æ" align="center" prop="operTime" 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"> |
| | | <el-form ref="form" :model="form" label-width="100px" size="mini"> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æä½æ¨¡åï¼">{{ form.title }} / ä¿®æ¹</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">æ£å¸¸</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, |
| | | // é䏿°ç» |
| | | ids: [], |
| | | // éå¤ä¸ªç¦ç¨ |
| | | multiple: true, |
| | | // æ»æ¡æ° |
| | | total: 0, |
| | | // è¡¨æ ¼æ°æ® |
| | | list: [], |
| | | // æ¯å¦æ¾ç¤ºå¼¹åºå± |
| | | open: false, |
| | | // ç±»åæ°æ®åå
¸ |
| | | typeOptions: [], |
| | | // ç±»åæ°æ®åå
¸ |
| | | statusOptions: [], |
| | | // æ¥æèå´ |
| | | dateRange: [], |
| | | // 表ååæ° |
| | | 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.handleQuery(); |
| | | }, |
| | | // å¤éæ¡é䏿°æ® |
| | | handleSelectionChange(selection) { |
| | | this.ids = selection.map(item => item.operId) |
| | | this.multiple = !selection.length |
| | | }, |
| | | /** è¯¦ç»æé®æä½ */ |
| | | 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(function() {}); |
| | | }, |
| | | /** æ¸
空æé®æä½ */ |
| | | handleClean() { |
| | | this.$confirm('æ¯å¦ç¡®è®¤æ¸
ç©ºæææä½æ¥å¿æ°æ®é¡¹?', "è¦å", { |
| | | confirmButtonText: "ç¡®å®", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning" |
| | | }).then(function() { |
| | | return cleanOperlog(); |
| | | }).then(() => { |
| | | this.getList(); |
| | | this.msgSuccess("æ¸
空æå"); |
| | | }).catch(function() {}); |
| | | }, |
| | | /** å¯¼åºæé®æä½ */ |
| | | handleExport() { |
| | | const queryParams = this.queryParams; |
| | | this.$confirm('æ¯å¦ç¡®è®¤å¯¼åºæææä½æ¥å¿æ°æ®é¡¹?', "è¦å", { |
| | | confirmButtonText: "ç¡®å®", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning" |
| | | }).then(function() { |
| | | return exportOperlog(queryParams); |
| | | }).then(response => { |
| | | this.download(response.msg); |
| | | }).catch(function() {}); |
| | | } |
| | | } |
| | | }; |
| | | </script> |
| | | |