| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template>
|
| | | <div class="app-container">
|
| | | <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
| | | <el-form-item label="åæ°åç§°" prop="configName">
|
| | | <el-input
|
| | | v-model="queryParams.configName"
|
| | | placeholder="请è¾å
¥åæ°åç§°"
|
| | | clearable
|
| | | style="width: 240px"
|
| | | @keyup.enter="handleQuery"
|
| | | />
|
| | | </el-form-item>
|
| | | <el-form-item label="åæ°é®å" prop="configKey">
|
| | | <el-input
|
| | | v-model="queryParams.configKey"
|
| | | placeholder="请è¾å
¥åæ°é®å"
|
| | | clearable
|
| | | style="width: 240px"
|
| | | @keyup.enter="handleQuery"
|
| | | />
|
| | | </el-form-item>
|
| | | <el-form-item label="ç³»ç»å
ç½®" prop="configType">
|
| | | <el-select v-model="queryParams.configType" placeholder="ç³»ç»å
ç½®" clearable style="width: 240px">
|
| | | <el-option
|
| | | v-for="dict in sys_yes_no"
|
| | | :key="dict.value"
|
| | | :label="dict.label"
|
| | | :value="dict.value"
|
| | | />
|
| | | </el-select>
|
| | | </el-form-item>
|
| | | <el-form-item label="å建æ¶é´" style="width: 308px;">
|
| | | <el-date-picker
|
| | | v-model="dateRange"
|
| | | 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="Search" @click="handleQuery">æç´¢</el-button>
|
| | | <el-button icon="Refresh" @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="Plus"
|
| | | @click="handleAdd"
|
| | | v-hasPermi="['system:config:add']"
|
| | | >æ°å¢</el-button>
|
| | | </el-col>
|
| | | <el-col :span="1.5">
|
| | | <el-button
|
| | | type="success"
|
| | | plain
|
| | | icon="Edit"
|
| | | :disabled="single"
|
| | | @click="handleUpdate"
|
| | | v-hasPermi="['system:config:edit']"
|
| | | >ä¿®æ¹</el-button>
|
| | | </el-col>
|
| | | <el-col :span="1.5">
|
| | | <el-button
|
| | | type="danger"
|
| | | plain
|
| | | icon="Delete"
|
| | | :disabled="multiple"
|
| | | @click="handleDelete"
|
| | | v-hasPermi="['system:config:remove']"
|
| | | >å é¤</el-button>
|
| | | </el-col>
|
| | | <el-col :span="1.5">
|
| | | <el-button
|
| | | type="warning"
|
| | | plain
|
| | | icon="Download"
|
| | | @click="handleExport"
|
| | | v-hasPermi="['system:config:export']"
|
| | | >导åº</el-button>
|
| | | </el-col>
|
| | | <el-col :span="1.5">
|
| | | <el-button
|
| | | type="danger"
|
| | | plain
|
| | | icon="Refresh"
|
| | | @click="handleRefreshCache"
|
| | | v-hasPermi="['system:config:remove']"
|
| | | >å·æ°ç¼å</el-button>
|
| | | </el-col>
|
| | | <right-toolbar v-model:showSearch="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" :show-overflow-tooltip="true" />
|
| | | <el-table-column label="ç³»ç»å
ç½®" align="center" prop="configType">
|
| | | <template #default="scope">
|
| | | <dict-tag :options="sys_yes_no" :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 #default="scope">
|
| | | <span>{{ parseTime(scope.row.createTime) }}</span>
|
| | | </template>
|
| | | </el-table-column>
|
| | | <el-table-column label="æä½" align="center" width="150" class-name="small-padding fixed-width">
|
| | | <template #default="scope">
|
| | | <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['system:config:edit']" >ä¿®æ¹</el-button>
|
| | | <el-button link type="primary" 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"
|
| | | v-model:page="queryParams.pageNum"
|
| | | v-model:limit="queryParams.pageSize"
|
| | | @pagination="getList"
|
| | | />
|
| | |
|
| | | <!-- æ·»å æä¿®æ¹åæ°é
ç½®å¯¹è¯æ¡ -->
|
| | | <el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
| | | <el-form ref="configRef" :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" type="textarea" placeholder="请è¾å
¥åæ°é®å¼" />
|
| | | </el-form-item>
|
| | | <el-form-item label="ç³»ç»å
ç½®" prop="configType">
|
| | | <el-radio-group v-model="form.configType">
|
| | | <el-radio
|
| | | v-for="dict in sys_yes_no"
|
| | | :key="dict.value"
|
| | | :value="dict.value"
|
| | | >{{ dict.label }}</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>
|
| | | <template #footer>
|
| | | <div class="dialog-footer">
|
| | | <el-button type="primary" @click="submitForm">ç¡® å®</el-button>
|
| | | <el-button @click="cancel">å æ¶</el-button>
|
| | | </div>
|
| | | </template>
|
| | | </el-dialog>
|
| | | </div>
|
| | | </template>
|
| | |
|
| | | <script setup name="Config">
|
| | | import { listConfig, getConfig, delConfig, addConfig, updateConfig, refreshCache } from "@/api/system/config"
|
| | |
|
| | | const { proxy } = getCurrentInstance()
|
| | | const { sys_yes_no } = proxy.useDict("sys_yes_no")
|
| | |
|
| | | const configList = ref([])
|
| | | const open = ref(false)
|
| | | const loading = ref(true)
|
| | | const showSearch = ref(true)
|
| | | const ids = ref([])
|
| | | const single = ref(true)
|
| | | const multiple = ref(true)
|
| | | const total = ref(0)
|
| | | const title = ref("")
|
| | | const dateRange = ref([])
|
| | |
|
| | | const data = reactive({
|
| | | form: {},
|
| | | queryParams: {
|
| | | pageNum: 1,
|
| | | pageSize: 10,
|
| | | configName: undefined,
|
| | | configKey: undefined,
|
| | | configType: undefined
|
| | | },
|
| | | rules: {
|
| | | configName: [{ required: true, message: "åæ°åç§°ä¸è½ä¸ºç©º", trigger: "blur" }],
|
| | | configKey: [{ required: true, message: "åæ°é®åä¸è½ä¸ºç©º", trigger: "blur" }],
|
| | | configValue: [{ required: true, message: "åæ°é®å¼ä¸è½ä¸ºç©º", trigger: "blur" }]
|
| | | }
|
| | | })
|
| | |
|
| | | const { queryParams, form, rules } = toRefs(data)
|
| | |
|
| | | /** æ¥è¯¢åæ°å表 */
|
| | | function getList() {
|
| | | loading.value = true
|
| | | listConfig(proxy.addDateRange(queryParams.value, dateRange.value)).then(response => {
|
| | | configList.value = response.rows
|
| | | total.value = response.total
|
| | | loading.value = false
|
| | | })
|
| | | }
|
| | |
|
| | | /** åæ¶æé® */
|
| | | function cancel() {
|
| | | open.value = false
|
| | | reset()
|
| | | }
|
| | |
|
| | | /** 表åéç½® */
|
| | | function reset() {
|
| | | form.value = {
|
| | | configId: undefined,
|
| | | configName: undefined,
|
| | | configKey: undefined,
|
| | | configValue: undefined,
|
| | | configType: "Y",
|
| | | remark: undefined
|
| | | }
|
| | | proxy.resetForm("configRef")
|
| | | }
|
| | |
|
| | | /** æç´¢æé®æä½ */
|
| | | function handleQuery() {
|
| | | queryParams.value.pageNum = 1
|
| | | getList()
|
| | | }
|
| | |
|
| | | /** éç½®æé®æä½ */
|
| | | function resetQuery() {
|
| | | dateRange.value = []
|
| | | proxy.resetForm("queryRef")
|
| | | handleQuery()
|
| | | }
|
| | |
|
| | | /** å¤éæ¡é䏿°æ® */
|
| | | function handleSelectionChange(selection) {
|
| | | ids.value = selection.map(item => item.configId)
|
| | | single.value = selection.length != 1
|
| | | multiple.value = !selection.length
|
| | | }
|
| | |
|
| | | /** æ°å¢æé®æä½ */
|
| | | function handleAdd() {
|
| | | reset()
|
| | | open.value = true
|
| | | title.value = "æ·»å åæ°"
|
| | | }
|
| | |
|
| | | /** ä¿®æ¹æé®æä½ */
|
| | | function handleUpdate(row) {
|
| | | reset()
|
| | | const configId = row.configId || ids.value
|
| | | getConfig(configId).then(response => {
|
| | | form.value = response.data
|
| | | open.value = true
|
| | | title.value = "ä¿®æ¹åæ°"
|
| | | })
|
| | | }
|
| | |
|
| | | /** æäº¤æé® */
|
| | | function submitForm() {
|
| | | proxy.$refs["configRef"].validate(valid => {
|
| | | if (valid) {
|
| | | if (form.value.configId != undefined) {
|
| | | updateConfig(form.value).then(response => {
|
| | | proxy.$modal.msgSuccess("ä¿®æ¹æå")
|
| | | open.value = false
|
| | | getList()
|
| | | })
|
| | | } else {
|
| | | addConfig(form.value).then(response => {
|
| | | proxy.$modal.msgSuccess("æ°å¢æå")
|
| | | open.value = false
|
| | | getList()
|
| | | })
|
| | | }
|
| | | }
|
| | | })
|
| | | }
|
| | |
|
| | | /** å é¤æé®æä½ */
|
| | | function handleDelete(row) {
|
| | | const configIds = row.configId || ids.value
|
| | | proxy.$modal.confirm('æ¯å¦ç¡®è®¤å é¤åæ°ç¼å·ä¸º"' + configIds + '"çæ°æ®é¡¹ï¼').then(function () {
|
| | | return delConfig(configIds)
|
| | | }).then(() => {
|
| | | getList()
|
| | | proxy.$modal.msgSuccess("å 餿å")
|
| | | }).catch(() => {})
|
| | | }
|
| | |
|
| | | /** å¯¼åºæé®æä½ */
|
| | | function handleExport() {
|
| | | proxy.download("system/config/export", {
|
| | | ...queryParams.value
|
| | | }, `config_${new Date().getTime()}.xlsx`)
|
| | | }
|
| | |
|
| | | /** å·æ°ç¼åæé®æä½ */
|
| | | function handleRefreshCache() {
|
| | | refreshCache().then(() => {
|
| | | proxy.$modal.msgSuccess("å·æ°ç¼åæå")
|
| | | })
|
| | | }
|
| | |
|
| | | getList()
|
| | | </script>
|