From a54300ef0d4ec09dcf364234a9b9b8de5db9b49a Mon Sep 17 00:00:00 2001 From: Wayne <943146732@qq.com> Date: Thu, 29 Feb 2024 21:54:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=9C=8D=E5=8A=A1=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/server/Index.vue | 84 +++++++++++++++++++++----------------- 1 file changed, 46 insertions(+), 38 deletions(-) diff --git a/src/views/server/Index.vue b/src/views/server/Index.vue index f58e552..fa0b7f8 100644 --- a/src/views/server/Index.vue +++ b/src/views/server/Index.vue @@ -30,14 +30,22 @@ 已下架 - 新增服务新增服务
上架 - 下架下架 删除 @@ -73,11 +81,11 @@ class="cur-p" :color="text == 1 ? 'green' : 'red'" @click="handleUpdateStatus([item.server_id], text != 1)" - >{{ text == 1 ? '上架' : '下架' }}{{ text == 1 ? '上架' : '下架' }} - + 编辑 删除 @@ -96,53 +104,53 @@ import Edit from './modules/Edit' const columns = [ { title: '服务ID', - dataIndex: 'server_id', + dataIndex: 'server_id' }, { title: '服务图片', dataIndex: 'server_image', - scopedSlots: { customRender: 'server_image' }, + scopedSlots: { customRender: 'server_image' } }, { title: '服务名称', dataIndex: 'server_name', - scopedSlots: { customRender: 'server_name' }, + scopedSlots: { customRender: 'server_name' } }, { title: '服务分类', dataIndex: 'server_category', - scopedSlots: { customRender: 'server_category' }, + scopedSlots: { customRender: 'server_category' } }, { title: '服务价格', dataIndex: 'server_price', - scopedSlots: { customRender: 'server_price' }, + scopedSlots: { customRender: 'server_price' } }, { title: '划线价格', dataIndex: 'line_price', - scopedSlots: { customRender: 'line_price' }, + scopedSlots: { customRender: 'line_price' } }, { title: '状态', dataIndex: 'status', - scopedSlots: { customRender: 'status' }, + scopedSlots: { customRender: 'status' } }, { title: '排序', - dataIndex: 'sort', + dataIndex: 'sort' }, { title: '添加时间', width: '180px', - dataIndex: 'create_time', + dataIndex: 'create_time' }, { title: '操作', dataIndex: 'action', width: '150px', - scopedSlots: { customRender: 'action' }, - }, + scopedSlots: { customRender: 'action' } + } ] export default { @@ -151,9 +159,9 @@ export default { ContentHeader, STable, Add, - Edit, + Edit }, - data() { + data () { return { // 当前表单元素 searchForm: this.$form.createForm(this), @@ -177,10 +185,10 @@ export default { return Api.serverList({ ...param, ...this.queryParam }).then((response) => { return response.data.list }) - }, + } } }, - created() { + created () { // 默认的查询参数 if (this.$route.query.status) { this.queryParam.status = this.$route.query.status @@ -189,37 +197,37 @@ export default { this.getCategoryList() }, computed: { - rowSelection() { + rowSelection () { return { selectedRowKeys: this.selectedRowKeys, - onChange: this.onSelectChange, + onChange: this.onSelectChange } - }, + } }, methods: { // 选中项发生变化时的回调 - onSelectChange(selectedRowKeys) { + onSelectChange (selectedRowKeys) { this.selectedRowKeys = selectedRowKeys }, // 切换tab - handleTabs(e) { + handleTabs (e) { this.queryParam.status = e.target.value this.handleRefresh(true) }, // 确认搜索 - handleSearch(e) { + handleSearch (e) { this.handleRefresh(true) }, // 重置搜索表单 - handleReset() { + handleReset () { this.searchForm.resetFields() }, // 获取分类列表 - getCategoryList() { + getCategoryList () { this.isLoading = true Api.categoryList() .then((result) => { @@ -229,7 +237,7 @@ export default { }, // 修改服务状态(上下架) - handleUpdateStatus(serverIds, state = true) { + handleUpdateStatus (serverIds, state = true) { this.isLoading = true Api.serverStatus({ serverIds, state }) .then((result) => { @@ -243,28 +251,28 @@ export default { }, // 删除记录 - handleDelete(serverId) { + handleDelete (serverId) { const app = this const modal = this.$confirm({ title: '您确定要删除该记录吗?', content: '删除后不可恢复', - onOk() { + onOk () { return Api.deleteServer({ serverId }) .then((result) => { app.$message.success(result.message, 1.5) app.handleRefresh() }) .finally((result) => modal.destroy()) - }, + } }) }, // 新增记录 - handleCreate() { + handleCreate () { this.$refs.AddRef.add() }, // 编辑记录 - async handleEdit(record) { + async handleEdit (record) { // 显示对话框 this.$refs.EditRef.edit(record) }, @@ -272,11 +280,11 @@ export default { * 刷新列表 * @param Boolean bool 强制刷新到第一页 */ - handleRefresh(bool = false) { + handleRefresh (bool = false) { this.selectedRowKeys = [] this.$refs.table.refresh(bool) - }, - }, + } + } }