完成tool
This commit is contained in:
parent
6a09af20c4
commit
a331b2b87e
|
@ -1,14 +1,17 @@
|
|||
import request from '/@/utils/request';
|
||||
import {moduleName} from '/@/utils/request';
|
||||
export const getList = (current, size, param) => {
|
||||
let params = {
|
||||
current,
|
||||
size,
|
||||
};
|
||||
if(param){
|
||||
params = Object.assign(params, param);
|
||||
}
|
||||
return request({
|
||||
url: '/api/'+moduleName+'/ui/tool/list',
|
||||
method: 'get',
|
||||
params: {
|
||||
current,
|
||||
size,
|
||||
param,
|
||||
},
|
||||
params: params,
|
||||
});
|
||||
}
|
||||
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
|
||||
})
|
||||
}
|
|
@ -1,142 +1,173 @@
|
|||
<template>
|
||||
<div class="system-user-container" style="width:calc(100% - 10px) !important ;">
|
||||
<el-row :gutter="10" >
|
||||
<el-col :span="24">
|
||||
<el-card shadow="hover">
|
||||
<div class="system-user-search mb15">
|
||||
<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-button size="default" type="primary" class="ml10" @click="initTableData" >
|
||||
<el-icon>
|
||||
<ele-Search />
|
||||
</el-icon>
|
||||
查询
|
||||
</el-button>
|
||||
</el-row>
|
||||
<el-row style="margin-top: 20px; margin-left: -10px;">
|
||||
|
||||
<div class="system-user-container" style="width:calc(100% - 10px) !important ;">
|
||||
<el-config-provider :locale="en">
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="24">
|
||||
<el-card shadow="hover">
|
||||
<div class="system-user-search mb15">
|
||||
<el-form>
|
||||
<el-row>
|
||||
<el-col :span="4">
|
||||
<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>
|
||||
<ele-Search />
|
||||
</el-icon>
|
||||
search
|
||||
</el-button>
|
||||
|
||||
</el-row>
|
||||
</el-form>
|
||||
<!-- <el-row style="margin-top: 20px; margin-left: -10px;">
|
||||
<el-button size="default" type="success" class="ml10" @click="onOpenAdd" >
|
||||
<el-icon>
|
||||
<ele-FolderAdd />
|
||||
</el-icon>
|
||||
新增
|
||||
ADD
|
||||
</el-button>
|
||||
</el-row>
|
||||
</div>
|
||||
<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-row> -->
|
||||
</div>
|
||||
<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">
|
||||
<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>
|
||||
</el-table-column>
|
||||
<el-table-column prop="label" label="label" > </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 label="Operate" width="100">
|
||||
<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" @click="onRowDel(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination
|
||||
@size-change="onHandleSizeChange"
|
||||
@current-change="onHandleCurrentChange"
|
||||
class="mt15"
|
||||
:pager-count="5"
|
||||
:page-sizes="[10, 20, 30]"
|
||||
v-model:current-page="state.tableData.param.pageNum"
|
||||
background
|
||||
<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="showName" label="Show Name"></el-table-column>
|
||||
<el-table-column prop="reviewTime" label="Review Time"></el-table-column>
|
||||
<el-table-column label="Operate" width="140">
|
||||
<template #default="scope">
|
||||
<el-button :disabled="scope.row.userName === 'admin'" size="small" text type="primary"
|
||||
@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>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination @size-change="onHandleSizeChange" @current-change="onHandleCurrentChange"
|
||||
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"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="state.tableData.total"
|
||||
>
|
||||
</el-pagination>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<Add ref = 'AddRef' @callback="initTableData"></Add>
|
||||
</div>
|
||||
layout="total, sizes, prev, pager, next, jumper" :total="state.tableData.total">
|
||||
</el-pagination>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-config-provider>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup name="systemUser">
|
||||
import { getList ,remove} from '/@/api/tool/index'
|
||||
import { ElMessageBox, ElMessage } from 'element-plus';
|
||||
import { reactive, ref,onMounted,nextTick } from 'vue';
|
||||
import Add from '/@/views/responseManagement/tool/component/add.vue';
|
||||
const AddRef = ref();
|
||||
const state = reactive({
|
||||
tableData: {
|
||||
data: [],
|
||||
total: 0,
|
||||
import en from 'element-plus/dist/locale/en.mjs'
|
||||
import { getList, remove ,review } from '/@/api/tool/index'
|
||||
import { ElMessageBox, ElMessage } from 'element-plus';
|
||||
import { reactive, ref, onMounted, nextTick } from 'vue';
|
||||
const AddRef = ref();
|
||||
const state = reactive({
|
||||
tableData: {
|
||||
data: [],
|
||||
total: 0,
|
||||
loading: false,
|
||||
param: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
},
|
||||
},
|
||||
//请求条件
|
||||
query: {
|
||||
checked: '1',
|
||||
},
|
||||
selected: [],
|
||||
//字典数据
|
||||
});
|
||||
// 初始化表格数据
|
||||
const initTableData = () => {
|
||||
state.tableData.loading = true;
|
||||
getList(state.tableData.param.pageNum, state.tableData.param.pageSize, state.query).then(res => {
|
||||
state.tableData = {
|
||||
data: res.records,
|
||||
total: res.total,
|
||||
loading: false,
|
||||
param:{
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
},
|
||||
},
|
||||
//请求条件
|
||||
query: {
|
||||
},
|
||||
selected: [],
|
||||
//字典数据
|
||||
});
|
||||
// 初始化表格数据
|
||||
const initTableData = () => {
|
||||
state.tableData.loading = true;
|
||||
getList(state.tableData.param.pageNum,state.tableData.param.pageSize,state.query).then(res=>{
|
||||
state.tableData = {
|
||||
data: res.records,
|
||||
total: res.total,
|
||||
loading :false,
|
||||
param: {
|
||||
pageNum: res.current,
|
||||
pageSize: res.size,
|
||||
}
|
||||
param: {
|
||||
pageNum: res.current,
|
||||
pageSize: res.size,
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
};
|
||||
// 打开新增
|
||||
const onOpenAdd = () => {
|
||||
AddRef.value.openDialog();
|
||||
};
|
||||
// 打开修改用户弹窗
|
||||
const onOpenEdit = (row) => {
|
||||
AddRef.value.openDialog(row);
|
||||
};
|
||||
// 删除用户
|
||||
const onRowDel = (row) => {
|
||||
ElMessageBox.confirm(`此操作将永久此参数:“${row.name}”,是否继续?`, '提示', {
|
||||
confirmButtonText: '确认',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
})
|
||||
.then(() => {
|
||||
remove(row.id).then(res=>{
|
||||
ElMessage.success('删除成功');
|
||||
initTableData();
|
||||
})
|
||||
})
|
||||
.catch(() => {});
|
||||
};
|
||||
// 分页改变
|
||||
const onHandleSizeChange = (val) => {
|
||||
state.tableData.param.pageSize = val;
|
||||
initTableData();
|
||||
};
|
||||
// 多选
|
||||
const handleSelectionChange = (val) => {
|
||||
state.selected = val;
|
||||
};
|
||||
// 分页改变
|
||||
const onHandleCurrentChange = (val) => {
|
||||
state.tableData.param.pageNum = val;
|
||||
initTableData();
|
||||
};
|
||||
onMounted(() => {
|
||||
nextTick(() => {
|
||||
};
|
||||
// 打开新增
|
||||
const onOpenAdd = () => {
|
||||
AddRef.value.openDialog();
|
||||
};
|
||||
// 打开修改用户弹窗
|
||||
const onOpenEdit = (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) => {
|
||||
ElMessageBox.confirm(`此操作将永久此参数:“${row.name}”,是否继续?`, '提示', {
|
||||
confirmButtonText: '确认',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
})
|
||||
.then(() => {
|
||||
remove(row.id).then(res => {
|
||||
ElMessage.success('删除成功');
|
||||
initTableData();
|
||||
})
|
||||
})
|
||||
.catch(() => { });
|
||||
};
|
||||
// 分页改变
|
||||
const onHandleSizeChange = (val) => {
|
||||
state.tableData.param.pageSize = val;
|
||||
initTableData();
|
||||
};
|
||||
// 多选
|
||||
const handleSelectionChange = (val) => {
|
||||
state.selected = val;
|
||||
};
|
||||
// 分页改变
|
||||
const onHandleCurrentChange = (val) => {
|
||||
state.tableData.param.pageNum = val;
|
||||
initTableData();
|
||||
};
|
||||
onMounted(() => {
|
||||
nextTick(() => {
|
||||
initTableData();
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
|
|
Loading…
Reference in New Issue