完成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,142 +1,173 @@
<template> <template>
<div class="system-user-container" style="width:calc(100% - 10px) !important ;">
<el-row :gutter="10" > <div class="system-user-container" style="width:calc(100% - 10px) !important ;">
<el-col :span="24"> <el-config-provider :locale="en">
<el-card shadow="hover"> <el-row :gutter="10">
<div class="system-user-search mb15"> <el-col :span="24">
<el-row> <el-card shadow="hover">
<span class="label-span">名称:</span><el-input size="default" placeholder="请输入名称" style="max-width: 180px" v-model="state.query.name" clearable> </el-input> <div class="system-user-search mb15">
<el-button size="default" type="primary" class="ml10" @click="initTableData" > <el-form>
<el-icon> <el-row>
<ele-Search /> <el-col :span="4">
</el-icon> <el-form-item label="Tool Name"><el-input size="default" style="max-width: 180px"
查询 v-model="state.query.toolName" clearable> </el-input>
</el-button> </el-form-item>
</el-row> </el-col>
<el-row style="margin-top: 20px; margin-left: -10px;"> <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-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"
<el-table-column prop="toolName" label="Tool Name" > @selection-change="handleSelectionChange">
<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>
<template #default="scope"> <el-table-column label="Operate" width="140">
<el-button :disabled="scope.row.userName === 'admin'" size="small" text type="primary" @click="onOpenEdit(scope.row)">修改</el-button> <template #default="scope">
<el-button :disabled="scope.row.userName === 'admin'" size="small" text type="primary" @click="onRowDel(scope.row)">删除</el-button> <el-button :disabled="scope.row.userName === 'admin'" size="small" text type="primary"
</template> @click="onOpenEdit(scope.row)">Review</el-button>
</el-table-column> <el-button :disabled="scope.row.userName === 'admin'" size="small" text type="primary"
</el-table> @click="onRowDel(scope.row)">Delete</el-button>
<el-pagination </template>
@size-change="onHandleSizeChange" </el-table-column>
@current-change="onHandleCurrentChange" </el-table>
class="mt15" <el-pagination @size-change="onHandleSizeChange" @current-change="onHandleCurrentChange"
:pager-count="5" class="mt15" :pager-count="5" :page-sizes="[10, 20, 30]"
:page-sizes="[10, 20, 30]" v-model:current-page="state.tableData.param.pageNum" background
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-card>
</el-pagination> </el-col>
</el-card> </el-row>
</el-col> </el-config-provider>
</el-row> </div>
<Add ref = 'AddRef' @callback="initTableData"></Add>
</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 { ElMessageBox, ElMessage } from 'element-plus'; import { getList, remove ,review } from '/@/api/tool/index'
import { reactive, ref,onMounted,nextTick } from 'vue'; import { ElMessageBox, ElMessage } from 'element-plus';
import Add from '/@/views/responseManagement/tool/component/add.vue'; import { reactive, ref, onMounted, nextTick } from 'vue';
const AddRef = ref(); const AddRef = ref();
const state = reactive({ const state = reactive({
tableData: { tableData: {
data: [], data: [],
total: 0, 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, loading: false,
param:{ param: {
pageNum: 1, pageNum: res.current,
pageSize: 10, pageSize: res.size,
},
},
//
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,
}
} }
}) }
})
}; };
// //
const onOpenAdd = () => { const onOpenAdd = () => {
AddRef.value.openDialog(); AddRef.value.openDialog();
}; };
// //
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',
const onRowDel = (row) => { cancelButtonText: 'cancel',
ElMessageBox.confirm(`此操作将永久此参数:“${row.name}”,是否继续?`, '提示', { type: 'warning',
confirmButtonText: '确认', })
cancelButtonText: '取消', .then(() => {
type: 'warning', review({id:row.id}).then(res => {
}) ElMessage.success('success');
.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(); 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> </script>