glj-代码提交

This commit is contained in:
glj 2023-05-06 15:17:47 +08:00
parent c08ddeb816
commit 6b80bfcaab
1 changed files with 54 additions and 42 deletions

View File

@ -17,7 +17,8 @@
</el-col>
<el-col :span="14">
<div class="system-role-padding layout-padding-auto layout-padding-view" style="height: 90vh;">
<div class="system-user-search " style="display: flex;margin-left: 10px;margin-top: 10px;margin-bottom:-15px ">
<div class="system-user-search "
style="display: flex;margin-left: 10px;margin-top: 10px;margin-bottom:-15px ">
<el-form-item label="Type">
<el-select v-model="state.searchName" placeholder="Please select data type" style="max-width: 200px"
size="default" clearable @change="getTableData(); state.queryTitle = ''">
@ -26,86 +27,86 @@
</el-select>
</el-form-item>
<el-form-item label="Review status">
<el-select v-model=" state.srarchType " placeholder="Please select data type" style="max-width: 200px"
<el-select v-model="state.srarchType" placeholder="Please select data type" style="max-width: 200px"
size="default" clearable>
<el-option value="0" label="Awaiting approval"></el-option>
<el-option value="1" label="Approved"></el-option>
<el-option value="2" label="Rejected"></el-option>
</el-select>
</el-form-item>
<el-form-item label="Title" v-if=" state.searchName == '1' ">
<el-input v-model=" state.queryTitle " placeholder="Please enter a title"></el-input>
<el-form-item label="Title" v-if="state.searchName == '1'">
<el-input v-model="state.queryTitle" placeholder="Please enter a title"></el-input>
</el-form-item>
<el-button size="default" type="primary" class="ml10" @click=" getTableData ">
<el-button size="default" type="primary" class="ml10" @click="getTableData">
<el-icon>
<ele-Search />
</el-icon>
Search
</el-button>
</div>
<el-button size="default" type="success" class="ml10" @click=" openDialog ">
<el-button size="default" type="success" class="ml10" @click="openDialog">
<el-icon>
<ele-Upload />
</el-icon>
Batch operation
</el-button>
<el-table :data=" state.tableData.data " v-loading=" state.tableData.loading "
@selection-change=" handleSelectionChange " style="width: 100%; height: 600px;">
<el-table :data="state.tableData.data" v-loading="state.tableData.loading"
@selection-change="handleSelectionChange" style="width: 100%; height: 600px;">
<el-table-column type="selection" width="55" />
<el-table-column type="index" label="ID" width="50" />
<!-- <el-table-column v-if=" state.searchName == '1' " prop="title" label="Title"
show-overflow-tooltip></el-table-column> -->
<el-table-column prop="content" label="Content" show-overflow-tooltip></el-table-column>
<el-table-column prop="type" label="Type" show-overflow-tooltip>
<template #default=" scope ">
<el-tag type="info" v-if=" state.searchName == '1' && scope.row.type == 0 ">baidu</el-tag>
<el-tag type="info" v-if=" state.searchName == '1' && scope.row.type == 1 ">bing</el-tag>
<el-tag type="info" v-if=" state.searchName == '2' && scope.row.type == 0 ">twitter</el-tag>
<el-tag type="info" v-if=" state.searchName == '2' && scope.row.type == 1 ">weibo</el-tag>
<template #default="scope">
<el-tag type="info" v-if="state.searchName == '1' && scope.row.type == 0">baidu</el-tag>
<el-tag type="info" v-if="state.searchName == '1' && scope.row.type == 1">bing</el-tag>
<el-tag type="info" v-if="state.searchName == '2' && scope.row.type == 0">twitter</el-tag>
<el-tag type="info" v-if="state.searchName == '2' && scope.row.type == 1">weibo</el-tag>
</template>
</el-table-column>
<el-table-column prop="content" label="Link" show-overflow-tooltip>
<template #default=" scope ">
<a :href=" scope.row.link " target="_blank">Read more</a>
<template #default="scope">
<a :href="scope.row.link" target="_blank">Read more</a>
</template>
</el-table-column>
<el-table-column prop="createTime" label="Create Time" show-overflow-tooltip sortable></el-table-column>
<el-table-column prop="time" label="Time" show-overflow-tooltip sortable></el-table-column>
<el-table-column prop="Operate" label="Operate" show-overflow-tooltip>
<template #default=" scope ">
<el-button size="small" text type="primary" v-if=" scope.row.status == 0 "
@click=" openDialog(scope.row, true)" >Awaiting approval</el-button>
<el-button size="small" text type="success" v-if=" scope.row.status == 1 "
@click=" openDialog(scope.row, false) " >Approved</el-button>
<el-button size="small" text type="danger" v-if=" scope.row.status == 2 "
@click=" openDialog(scope.row, false) ">Rejected</el-button>
<template #default="scope">
<el-button size="small" text type="primary" v-if="scope.row.status == 0"
@click=" openDialog(scope.row, true)">Awaiting approval</el-button>
<el-button size="small" text type="success" v-if="scope.row.status == 1"
@click=" openDialog(scope.row, false)">Approved</el-button>
<el-button size="small" text type="danger" v-if="scope.row.status == 2"
@click=" openDialog(scope.row, false)">Rejected</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination style="margin-left: 20px;" @size-change=" onHandleSizeChange "
@current-change=" onHandleCurrentChange " class="mt15" :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"
:total=" state.tableData.total ">
<el-pagination style="margin-left: 20px;" @size-change="onHandleSizeChange"
@current-change="onHandleCurrentChange" class="mt15" :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"
:total="state.tableData.total">
</el-pagination>
</div>
</el-col>
</el-row>
<el-dialog v-model=" state.dialogVisible " title="Review" width="30%">
<el-dialog v-model="state.dialogVisible" title="Review" width="30%">
Do you want to keep this data as response data?
<template #footer>
<span class="dialog-footer">
<el-button @click=" state.dialogVisible = false ">Cancel</el-button>
<el-button type="primary" @click=" reviews(1) ">
<el-button @click=" state.dialogVisible = false">Cancel</el-button>
<el-button type="primary" @click=" reviews(1)">
reserve
</el-button>
<el-button type="danger" @click=" reviews(2) ">
<el-button type="danger" @click=" reviews(2)">
not retain
</el-button>
</span>
</template>
</el-dialog>
</el-config-provider>
<boot ref="bootRef" @callback=" getTableData " />
<boot ref="bootRef" @callback="getTableData" />
</div>
</template>
@ -242,10 +243,10 @@ const getDisasterData = () => {
}
getList(param).then(res => {
state.disasterData.data = res.records;
console.log(state.disasterData.data[0],"state.disasterData.data[0]");
console.log(state.disasterData.data[0], "state.disasterData.data[0]");
state.disasterId = state.disasterData.data[0].disasterId;
console.log(state.disasterId ,"state.disasterId ");
console.log(state.disasterId, "state.disasterId ");
getTableData()
state.disasterData.data.forEach(item => {
@ -262,10 +263,22 @@ const getTableData = () => {
state.tableData.loading = true;
getNewsList(state.tableData.param.pageNum, state.tableData.param.pageSize, { "disasterId": state.disasterId, "isDeleted": 0, status: state.srarchType, title: state.queryTitle }, state.searchName == '1' ? true : false).then(res => {
state.tableData.data = res.records;
state.tableData.data.forEach(item => {
let date = item.createTime.slice(0, 10);
item.createTime = date;
})
if (state.searchName == '1') {
console.log(111111111111111111);
state.tableData.data.forEach(item => {
let date = item.createTime.slice(0, 10);
item.time = date;
})
}else{
state.tableData.data.forEach(item => {
let date = item.time.slice(0, 10);
item.time = date;
})
}
state.tableData.total = res.total;
})
/* state.tableData.data = data;
@ -368,5 +381,4 @@ onMounted(() => {
display: flex;
justify-content: end;
}
</style>