From 6666ce5526b1ed17f5c3906c94620cad586745a5 Mon Sep 17 00:00:00 2001 From: RuoYi <yzz_ivy@163.com> Date: 星期五, 28 六月 2024 17:01:39 +0800 Subject: [PATCH] 优化代码 --- src/views/system/post/index.vue | 44 +++++++++++++++++++------------------------- 1 files changed, 19 insertions(+), 25 deletions(-) diff --git a/src/views/system/post/index.vue b/src/views/system/post/index.vue index a988d65..323c574 100644 --- a/src/views/system/post/index.vue +++ b/src/views/system/post/index.vue @@ -1,12 +1,12 @@ <template> <div class="app-container"> - <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px"> + <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch"> <el-form-item label="宀椾綅缂栫爜" prop="postCode"> <el-input v-model="queryParams.postCode" placeholder="璇疯緭鍏ュ矖浣嶇紪鐮�" clearable - size="small" + style="width: 200px" @keyup.enter="handleQuery" /> </el-form-item> @@ -15,12 +15,12 @@ v-model="queryParams.postName" placeholder="璇疯緭鍏ュ矖浣嶅悕绉�" clearable - size="small" + style="width: 200px" @keyup.enter="handleQuery" /> </el-form-item> <el-form-item label="鐘舵��" prop="status"> - <el-select v-model="queryParams.status" placeholder="宀椾綅鐘舵��" clearable size="small"> + <el-select v-model="queryParams.status" placeholder="宀椾綅鐘舵��" clearable style="width: 200px"> <el-option v-for="dict in sys_normal_disable" :key="dict.value" @@ -30,8 +30,8 @@ </el-select> </el-form-item> <el-form-item> - <el-button type="primary" icon="Search" size="mini" @click="handleQuery">鎼滅储</el-button> - <el-button icon="Refresh" size="mini" @click="resetQuery">閲嶇疆</el-button> + <el-button type="primary" icon="Search" @click="handleQuery">鎼滅储</el-button> + <el-button icon="Refresh" @click="resetQuery">閲嶇疆</el-button> </el-form-item> </el-form> @@ -41,7 +41,6 @@ type="primary" plain icon="Plus" - size="mini" @click="handleAdd" v-hasPermi="['system:post:add']" >鏂板</el-button> @@ -51,7 +50,6 @@ type="success" plain icon="Edit" - size="mini" :disabled="single" @click="handleUpdate" v-hasPermi="['system:post:edit']" @@ -62,7 +60,6 @@ type="danger" plain icon="Delete" - size="mini" :disabled="multiple" @click="handleDelete" v-hasPermi="['system:post:remove']" @@ -73,7 +70,6 @@ type="warning" plain icon="Download" - size="mini" @click="handleExport" v-hasPermi="['system:post:export']" >瀵煎嚭</el-button> @@ -97,22 +93,10 @@ <span>{{ parseTime(scope.row.createTime) }}</span> </template> </el-table-column> - <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width"> + <el-table-column label="鎿嶄綔" width="180" align="center" class-name="small-padding fixed-width"> <template #default="scope"> - <el-button - size="mini" - type="text" - icon="Edit" - @click="handleUpdate(scope.row)" - v-hasPermi="['system:post:edit']" - >淇敼</el-button> - <el-button - size="mini" - type="text" - icon="Delete" - @click="handleDelete(scope.row)" - v-hasPermi="['system:post:remove']" - >鍒犻櫎</el-button> + <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['system:post:edit']">淇敼</el-button> + <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['system:post:remove']">鍒犻櫎</el-button> </template> </el-table-column> </el-table> @@ -203,11 +187,13 @@ loading.value = false; }); } + /** 鍙栨秷鎸夐挳 */ function cancel() { open.value = false; reset(); } + /** 琛ㄥ崟閲嶇疆 */ function reset() { form.value = { @@ -220,28 +206,33 @@ }; proxy.resetForm("postRef"); } + /** 鎼滅储鎸夐挳鎿嶄綔 */ function handleQuery() { queryParams.value.pageNum = 1; getList(); } + /** 閲嶇疆鎸夐挳鎿嶄綔 */ function resetQuery() { proxy.resetForm("queryRef"); handleQuery(); } + /** 澶氶�夋閫変腑鏁版嵁 */ function handleSelectionChange(selection) { ids.value = selection.map(item => item.postId); single.value = selection.length != 1; multiple.value = !selection.length; } + /** 鏂板鎸夐挳鎿嶄綔 */ function handleAdd() { reset(); open.value = true; title.value = "娣诲姞宀椾綅"; } + /** 淇敼鎸夐挳鎿嶄綔 */ function handleUpdate(row) { reset(); @@ -252,6 +243,7 @@ title.value = "淇敼宀椾綅"; }); } + /** 鎻愪氦鎸夐挳 */ function submitForm() { proxy.$refs["postRef"].validate(valid => { @@ -272,6 +264,7 @@ } }); } + /** 鍒犻櫎鎸夐挳鎿嶄綔 */ function handleDelete(row) { const postIds = row.postId || ids.value; @@ -282,6 +275,7 @@ proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛"); }).catch(() => {}); } + /** 瀵煎嚭鎸夐挳鎿嶄綔 */ function handleExport() { proxy.download("system/post/export", { -- Gitblit v1.9.3