This commit is contained in:
NiSen
2023-06-22 12:54:06 +08:00
parent eb4085e546
commit a8c1bb47be

View File

@@ -51,10 +51,10 @@
</template> </template>
</a-table> </a-table>
</div> </div>
<div class="pa" style="display: flex;justify-content: flex-end;padding: 0 38px;"> <div class="pa" style="display: flex; justify-content: flex-end; padding: 0 38px">
<a-pagination show-quick-jumper :pageSize="searchData.pageSize" :current="searchData.pageIndex" :total="state.total" <a-pagination show-quick-jumper :pageSize="searchData.pageSize" :current="searchData.pageIndex" :total="state.total"
class="pagination" @change="handelChangePage" show-size-changer /> class="pagination" @change="handelChangePage" show-size-changer />
</div> </div>
<InitiateRecommend v-model:visible="newNext" :title="添加案例"></InitiateRecommend> <InitiateRecommend v-model:visible="newNext" :title="添加案例"></InitiateRecommend>
</div> </div>
</template> </template>
@@ -62,9 +62,14 @@
import { ref, onMounted, reactive } from "vue"; import { ref, onMounted, reactive } from "vue";
import { Form, message } from "ant-design-vue"; import { Form, message } from "ant-design-vue";
import { boeRequest } from "@/api/request"; import { boeRequest } from "@/api/request";
import { RECOMMEND_PAGE, deleteResearch, caseInfoDownload, rePushOrWithdraw } from "@/api/case"; import {
RECOMMEND_PAGE,
deleteResearch,
caseInfoDownload,
rePushOrWithdraw,
} from "@/api/case";
import dialog from "@/utils/dialog"; import dialog from "@/utils/dialog";
import InitiateRecommend from '@/components/drawers/InitiateRecommend.vue' import InitiateRecommend from "@/components/drawers/InitiateRecommend.vue";
const column = [ const column = [
{ {
@@ -87,7 +92,6 @@ const column = [
align: "center", align: "center",
className: "h", className: "h",
customRender: ({ text }) => { customRender: ({ text }) => {
return text ? text : "-"; return text ? text : "-";
}, },
}, },
@@ -122,24 +126,18 @@ const column = [
className: "h", className: "h",
customRender: ({ text }) => { customRender: ({ text }) => {
switch (text) { switch (text) {
case 1: return ( case 1:
<span>未推送</span> return <span>未推送</span>;
) case 2:
case 2: return ( return <span>推送中</span>;
<span>推送中</span> case 3:
) return <span>已推送</span>;
case 3: return ( case 4:
<span>推送</span> return <span style={{ color: "red" }}>推送失败</span>;
) case 5:
case 4: return ( return <span>已撤回</span>;
<span style={{ color: 'red' }}>推送失败</span> default:
) return <span>-</span>;
case 5: return (
<span>已撤回</span>
)
default: return (
<span>-</span>
)
} }
}, },
}, },
@@ -169,40 +167,39 @@ const state = reactive({
data: [], data: [],
total: 0, total: 0,
status: { status: {
1: '撤回', 1: "撤回",
2: '撤回', 2: "撤回",
3: '撤回', 3: "撤回",
4: '重新推送', 4: "重新推送",
5: '重新推送', 5: "重新推送",
} },
}) });
// 查询数据 // 查询数据
const searchData = ref({ const searchData = ref({
pageIndex: 1, pageIndex: 1,
pageSize: 10, pageSize: 10,
recommendName: "", recommendName: "",
recommendTimeList: [] recommendTimeList: [],
}); });
const newNext = ref(false); const newNext = ref(false);
const recommendTimeList = ref([]); const recommendTimeList = ref([]);
const loading = ref(false) const loading = ref(false);
const getList = (num) => { const getList = (num) => {
if (num === 1) searchData.value.pageIndex = 1; if (num === 1) searchData.value.pageIndex = 1;
boeRequest( boeRequest(RECOMMEND_PAGE, searchData.value)
RECOMMEND_PAGE, .then((res) => {
searchData.value loading.value = true;
).then((res) => { state.data = res?.result?.list || [];
loading.value = true; state.total = res?.result?.totalPages || 0;
state.data = res?.result?.list || [] })
state.total = res?.result?.totalPages || 0; .catch(() => {
}).catch(() => { loading.value = false;
loading.value = false });
}) };
}
// 获取列表数据 // 获取列表数据
getList() getList();
onMounted(() => { onMounted(() => {
// 是否需要触发新建弹框 // 是否需要触发新建弹框
@@ -219,7 +216,7 @@ const handle = (record) => ({
withdraw: async () => { withdraw: async () => {
try { try {
// editReleaseStatus({ assessmentId: record.id, releaseStatus: 1 }); // editReleaseStatus({ assessmentId: record.id, releaseStatus: 1 });
await rePushOrWithdraw({ casesRecommendId: record.id }) await rePushOrWithdraw({ casesRecommendId: record.id });
getList(); getList();
} catch (error) { } catch (error) {
message.info("推送失败!"); message.info("推送失败!");
@@ -227,10 +224,12 @@ const handle = (record) => ({
}, },
del: async () => { del: async () => {
loading.value = true; loading.value = true;
await deleteResearch({ id: record.id }).then(() => { await deleteResearch({ id: record.id })
message.info("删除成功!"); .then(() => {
getList(); message.info("删除成功!");
}).catch(() => loading.value = false) getList();
})
.catch(() => (loading.value = false));
}, },
}); });
@@ -244,23 +243,24 @@ function handleOper(record, type) {
} }
// 信息下载 // 信息下载
const downloadInfo = (record) => { const downloadInfo = (record) => {
caseInfoDownload({ casesRecommendId: record.id }).then((res) => { caseInfoDownload({ casesRecommendId: record.id })
console.log(res); .then((res) => {
}).catch(() => { console.log(res);
message.info("信息下载失败"); })
}) .catch(() => {
} message.info("信息下载失败");
});
};
const handelChangePage = (page, pageSize) => { const handelChangePage = (page, pageSize) => {
loading.value = false loading.value = false;
searchData.value.pageSize = pageSize searchData.value.pageSize = pageSize;
searchData.value.pageIndex = page; searchData.value.pageIndex = page;
getList(); getList();
}; };
function timeChange(time, timeStr) { function timeChange(time, timeStr) {
searchData.value.recommendTimeList = timeStr searchData.value.recommendTimeList = timeStr;
} }
const handleRest = () => { const handleRest = () => {
@@ -269,12 +269,9 @@ const handleRest = () => {
getList(); getList();
}; };
const handleNew = () => { const handleNew = () => {
newNext.value = true; newNext.value = true;
}; };
</script> </script>
<style lang="scss"> <style lang="scss">
.clearfix:before, .clearfix:before,