完成tool

This commit is contained in:
yyhouc 2023-04-14 09:17:51 +08:00
parent 6a09af20c4
commit a331b2b87e
2 changed files with 168 additions and 127 deletions

View File

@ -1,14 +1,17 @@
import request from '/@/utils/request'; import request from '/@/utils/request';
import {moduleName} from '/@/utils/request'; import {moduleName} from '/@/utils/request';
export const getList = (current, size, param) => { export const getList = (current, size, param) => {
let params = {
current,
size,
};
if(param){
params = Object.assign(params, param);
}
return request({ return request({
url: '/api/'+moduleName+'/ui/tool/list', url: '/api/'+moduleName+'/ui/tool/list',
method: 'get', method: 'get',
params: { params: params,
current,
size,
param,
},
}); });
} }
export const submit = (row) => { export const submit = (row) => {
@ -37,3 +40,10 @@ export const detail = (id) => {
} }
}) })
} }
export const review = (data) => {
return request({
url: '/api/'+moduleName+'/ui/tool/review',
method: 'post',
data:data
})
}

View File

@ -1,68 +1,85 @@
<template> <template>
<div class="system-user-container" style="width:calc(100% - 10px) !important ;"> <div class="system-user-container" style="width:calc(100% - 10px) !important ;">
<el-config-provider :locale="en">
<el-row :gutter="10"> <el-row :gutter="10">
<el-col :span="24"> <el-col :span="24">
<el-card shadow="hover"> <el-card shadow="hover">
<div class="system-user-search mb15"> <div class="system-user-search mb15">
<el-form>
<el-row> <el-row>
<span class="label-span">名称:</span><el-input size="default" placeholder="请输入名称" style="max-width: 180px" v-model="state.query.name" clearable> </el-input> <el-col :span="4">
<el-button size="default" type="primary" class="ml10" @click="initTableData" > <el-form-item label="Tool Name"><el-input size="default" style="max-width: 180px"
v-model="state.query.toolName" clearable> </el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="checked">
<el-select size="default" v-model="state.query.checked" clearable
placeholder="Please select">
<el-option label="checked" value="0"></el-option>
<el-option label="unchecked" value="1"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-button size="default" type="primary" class="ml15" style="margin-top: 4px ;"
@click="initTableData">
<el-icon> <el-icon>
<ele-Search /> <ele-Search />
</el-icon> </el-icon>
查询 search
</el-button> </el-button>
</el-row> </el-row>
<el-row style="margin-top: 20px; margin-left: -10px;"> </el-form>
<!-- <el-row style="margin-top: 20px; margin-left: -10px;">
<el-button size="default" type="success" class="ml10" @click="onOpenAdd" > <el-button size="default" type="success" class="ml10" @click="onOpenAdd" >
<el-icon> <el-icon>
<ele-FolderAdd /> <ele-FolderAdd />
</el-icon> </el-icon>
新增 ADD
</el-button> </el-button>
</el-row> </el-row> -->
</div> </div>
<el-table :data="state.tableData.data" style="width: 100%" v-loading="state.tableData.loading" @selection-change="handleSelectionChange"> <el-table :data="state.tableData.data" style="width: 100%" v-loading="state.tableData.loading"
@selection-change="handleSelectionChange">
<el-table-column prop="toolName" label="Tool Name"> <el-table-column prop="toolName" label="Tool Name">
<template #default="scope"> <template #default="scope">
<a :href="scope.row.link" target="_blank">{{ scope.row.toolName }}</a> <a :href="scope.row.link" target="_blank">{{ scope.row.toolName }}</a>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="label" label="label" > </el-table-column> <el-table-column prop="label" label="label" width="140"> </el-table-column>
<el-table-column prop="introduction" label="introduction"> </el-table-column> <el-table-column prop="introduction" label="introduction"> </el-table-column>
<el-table-column prop="showName" label="Show Name"></el-table-column> <el-table-column prop="showName" label="Show Name"></el-table-column>
<el-table-column label="Operate" width="100"> <el-table-column prop="reviewTime" label="Review Time"></el-table-column>
<el-table-column label="Operate" width="140">
<template #default="scope"> <template #default="scope">
<el-button :disabled="scope.row.userName === 'admin'" size="small" text type="primary" @click="onOpenEdit(scope.row)">修改</el-button> <el-button :disabled="scope.row.userName === 'admin'" size="small" text type="primary"
<el-button :disabled="scope.row.userName === 'admin'" size="small" text type="primary" @click="onRowDel(scope.row)">删除</el-button> @click="onOpenEdit(scope.row)">Review</el-button>
<el-button :disabled="scope.row.userName === 'admin'" size="small" text type="primary"
@click="onRowDel(scope.row)">Delete</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<el-pagination <el-pagination @size-change="onHandleSizeChange" @current-change="onHandleCurrentChange"
@size-change="onHandleSizeChange" class="mt15" :pager-count="5" :page-sizes="[10, 20, 30]"
@current-change="onHandleCurrentChange" v-model:current-page="state.tableData.param.pageNum" background
class="mt15"
:pager-count="5"
:page-sizes="[10, 20, 30]"
v-model:current-page="state.tableData.param.pageNum"
background
v-model:page-size="state.tableData.param.pageSize" v-model:page-size="state.tableData.param.pageSize"
layout="total, sizes, prev, pager, next, jumper" layout="total, sizes, prev, pager, next, jumper" :total="state.tableData.total">
:total="state.tableData.total"
>
</el-pagination> </el-pagination>
</el-card> </el-card>
</el-col> </el-col>
</el-row> </el-row>
<Add ref = 'AddRef' @callback="initTableData"></Add> </el-config-provider>
</div> </div>
</template> </template>
<script setup name="systemUser"> <script setup name="systemUser">
import { getList ,remove} from '/@/api/tool/index' import en from 'element-plus/dist/locale/en.mjs'
import { getList, remove ,review } from '/@/api/tool/index'
import { ElMessageBox, ElMessage } from 'element-plus'; import { ElMessageBox, ElMessage } from 'element-plus';
import { reactive, ref, onMounted, nextTick } from 'vue'; import { reactive, ref, onMounted, nextTick } from 'vue';
import Add from '/@/views/responseManagement/tool/component/add.vue';
const AddRef = ref(); const AddRef = ref();
const state = reactive({ const state = reactive({
tableData: { tableData: {
@ -76,6 +93,7 @@
}, },
// //
query: { query: {
checked: '1',
}, },
selected: [], selected: [],
// //
@ -102,7 +120,20 @@
}; };
// //
const onOpenEdit = (row) => { const onOpenEdit = (row) => {
AddRef.value.openDialog(row); // AddRef.value.openDialog(row);
ElMessageBox.confirm(`Is it approved? This will be publicly displayed!`, 'Tips', {
confirmButtonText: 'Yes',
cancelButtonText: 'cancel',
type: 'warning',
})
.then(() => {
review({id:row.id}).then(res => {
ElMessage.success('success');
initTableData();
})
})
.catch(() => { });
}; };
// //
const onRowDel = (row) => { const onRowDel = (row) => {