mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-24 02:02:55 +08:00
--fix 路径图整体修改
This commit is contained in:
@@ -1,20 +1,22 @@
|
||||
<template>
|
||||
<div @click="openDrawer">
|
||||
<slot></slot>
|
||||
</div>
|
||||
<a-drawer
|
||||
:visible="addprojvisible"
|
||||
class="drawerStyle addonlineDrawer"
|
||||
width="80%"
|
||||
title="添加在线"
|
||||
placement="right"
|
||||
@after-visible-change="afterVisibleChange"
|
||||
:visible="visible"
|
||||
class="drawerStyle addonlineDrawer"
|
||||
width="1000"
|
||||
title="添加在线"
|
||||
placement="right"
|
||||
>
|
||||
<div class="drawerMain">
|
||||
<div class="header">
|
||||
<div v-if="edit" class="headerTitle">编辑项目</div>
|
||||
<div v-if="taskIndex>=0" class="headerTitle">编辑项目</div>
|
||||
<div v-else class="headerTitle">添加项目</div>
|
||||
<img
|
||||
style="width: 29px; height: 29px; cursor: pointer"
|
||||
src="../../assets/images/basicinfo/close.png"
|
||||
@click="closeDrawer"
|
||||
style="width: 29px; height: 29px; cursor: pointer"
|
||||
src="../../assets/images/basicinfo/close.png"
|
||||
@click="closeDrawer"
|
||||
/>
|
||||
</div>
|
||||
<div class="contentMain">
|
||||
@@ -24,10 +26,10 @@
|
||||
<div class="ipt_name"></div>
|
||||
<div class="fi_input">
|
||||
<a-input
|
||||
v-model:value="inputV1"
|
||||
style="width: 210px; height: 40px; border-radius: 8px"
|
||||
placeholder="请输入项目名称"
|
||||
maxlength="20"
|
||||
v-model:value="params.name"
|
||||
style="width: 210px; height: 40px; border-radius: 8px"
|
||||
placeholder="请输入项目名称"
|
||||
maxlength="20"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -35,10 +37,10 @@
|
||||
<div class="ipt_name"></div>
|
||||
<div class="fi_input">
|
||||
<a-input
|
||||
v-model:value="inputV2"
|
||||
style="width: 210px; height: 40px; border-radius: 8px"
|
||||
placeholder="请输入项目经理"
|
||||
maxlength="20"
|
||||
v-model:value="params.manager"
|
||||
style="width: 210px; height: 40px; border-radius: 8px"
|
||||
placeholder="请输入项目经理"
|
||||
maxlength="20"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -46,10 +48,10 @@
|
||||
<div class="ipt_name"></div>
|
||||
<div class="fi_input">
|
||||
<a-input
|
||||
v-model:value="inputV3"
|
||||
style="width: 210px; height: 40px; border-radius: 8px"
|
||||
placeholder="请输入创建人"
|
||||
maxlength="20"
|
||||
v-model:value="params.createName"
|
||||
style="width: 210px; height: 40px; border-radius: 8px"
|
||||
placeholder="请输入创建人"
|
||||
maxlength="20"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -57,9 +59,9 @@
|
||||
<div class="mi_btns" style="margin-left: 0px">
|
||||
<div class="btn btn1">
|
||||
<div class="search"></div>
|
||||
<div class="btnText" @click="searchProjectList()">搜索</div>
|
||||
<div class="btnText" @click="search">搜索</div>
|
||||
</div>
|
||||
<div class="btn btn2" @click="resetProjectList()">
|
||||
<div class="btn btn2" @click="reset">
|
||||
<div class="search"></div>
|
||||
<div class="btnText">重置</div>
|
||||
</div>
|
||||
@@ -77,7 +79,7 @@
|
||||
<div class="notice_icon"></div>
|
||||
<div v-if="selectedRows.length == 0">
|
||||
<span class="title"
|
||||
>已选择
|
||||
>已选择
|
||||
<span class="data" style="color: #4ea6ff">{{ 0 }}</span>
|
||||
条</span
|
||||
>
|
||||
@@ -85,124 +87,73 @@
|
||||
<div v-else>
|
||||
<div>
|
||||
<span class="title"
|
||||
>已选择
|
||||
>已选择
|
||||
<span class="data" style="color: #4ea6ff">{{
|
||||
selectedRows.length
|
||||
}}</span>
|
||||
selectedRows.length
|
||||
}}</span>
|
||||
条 </span
|
||||
>
|
||||
<span class="title"
|
||||
>名称:
|
||||
>名称:
|
||||
<span
|
||||
class="data"
|
||||
style="color: #4ea6ff; margin-right: 15px"
|
||||
>{{ selectedRows[0].name }}</span
|
||||
class="data"
|
||||
style="color: #4ea6ff; margin-right: 15px"
|
||||
>{{ selectedRows[0].name }}</span
|
||||
>
|
||||
</span>
|
||||
<span class="title"
|
||||
>项目经理:
|
||||
>项目经理:
|
||||
<span
|
||||
class="data"
|
||||
style="color: #4ea6ff; margin-right: 15px"
|
||||
>{{ selectedRows[0].manager }}</span
|
||||
class="data"
|
||||
style="color: #4ea6ff; margin-right: 15px"
|
||||
>{{ selectedRows[0].manager }}</span
|
||||
>
|
||||
</span>
|
||||
<span class="title"
|
||||
>创建人:
|
||||
>创建人:
|
||||
<span
|
||||
class="data"
|
||||
style="color: #4ea6ff; margin-right: 15px"
|
||||
>{{ selectedRows[0].creater }}</span
|
||||
class="data"
|
||||
style="color: #4ea6ff; margin-right: 15px"
|
||||
>{{ selectedRows[0].creater }}</span
|
||||
>
|
||||
</span>
|
||||
<span class="title"
|
||||
>创建时间:
|
||||
>创建时间:
|
||||
<span class="data" style="color: #4ea6ff">{{
|
||||
selectedRows[0].time
|
||||
}}</span>
|
||||
selectedRows[0].time
|
||||
}}</span>
|
||||
</span>
|
||||
</div>
|
||||
<!-- <div v-else>
|
||||
<span class="title"
|
||||
>已选择 <span class="data">1</span> 条;</span
|
||||
>
|
||||
<span class="title"
|
||||
>名称:
|
||||
<span class="data">{{ assessment1.createName }}</span>
|
||||
</span>
|
||||
<span class="title"
|
||||
>题数:
|
||||
<span class="data">{{
|
||||
assessment1.essayQuestionVoList.length
|
||||
}}</span>
|
||||
</span>
|
||||
<span class="title"
|
||||
>创建人:
|
||||
<span class="data">{{ assessment1.createUser }}</span>
|
||||
</span>
|
||||
<span class="title"
|
||||
>创建时间:
|
||||
<span class="data">{{ assessment1.createTime }}</span>
|
||||
</span>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="main_table">
|
||||
<div class="drawerbox">
|
||||
<!-- 添加的时候显示多选的表 -->
|
||||
|
||||
<!-- 编辑的时候显示单选的表 -->
|
||||
<a-table
|
||||
:columns="tableDataFunc()"
|
||||
:data-source="drawertableData"
|
||||
:row-selection="{
|
||||
selectedRowKeys: selectedRowKeys,
|
||||
onChange: onSelectChange,
|
||||
type: 'radio',
|
||||
}"
|
||||
:loading="tableDataTotal === -1 ? true : false"
|
||||
@expand="expandTable"
|
||||
:pagination="false"
|
||||
>
|
||||
</a-table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tableBox">
|
||||
<div class="pa">
|
||||
<a-pagination
|
||||
v-if="tableDataTotal > 10"
|
||||
:showSizeChanger="false"
|
||||
showQuickJumper="true"
|
||||
hideOnSinglePage="true"
|
||||
:pageSize="pageSize"
|
||||
v-model:current="currentPage"
|
||||
:total="tableDataTotal"
|
||||
class="pagination"
|
||||
@change="changePagination"
|
||||
style="
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
margin-top: 12px;
|
||||
margin-bottom: 12px;
|
||||
"
|
||||
:customRow="customRow"
|
||||
class="ant-table-striped"
|
||||
:row-class-name="(_, index) => (index % 2 === 1 ? 'table-striped' : null)"
|
||||
row-key="id"
|
||||
:columns="columns"
|
||||
:data-source="data"
|
||||
:loading="loading"
|
||||
:pagination="pagination"
|
||||
:row-selection="rowSelection"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="main_btns">
|
||||
<button @click="closeDrawer" class="btn1">取消</button>
|
||||
<button @click="updateTaskList" class="btn2">确定</button>
|
||||
<button @click="confirm" class="btn2">确定</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 有重复添加的项目时的弹窗 -->
|
||||
<a-modal
|
||||
v-model:visible="sameModal"
|
||||
:footer="null"
|
||||
:closable="sameCopy"
|
||||
wrapClassName="sameModal"
|
||||
centered="true"
|
||||
v-model:visible="sameModal"
|
||||
:footer="null"
|
||||
wrapClassName="sameModal"
|
||||
centered="true"
|
||||
>
|
||||
<div class="delete">
|
||||
<div class="del_header"></div>
|
||||
@@ -228,424 +179,170 @@
|
||||
</a-modal>
|
||||
</a-drawer>
|
||||
</template>
|
||||
<script>
|
||||
import { reactive, toRefs } from "vue";
|
||||
import { RouterEditTask } from "@/api/indexTask";
|
||||
import { message } from "ant-design-vue";
|
||||
// import * as apiProj from "../../api/index.js";
|
||||
import dayjs from "dayjs";
|
||||
import { useRouter } from "vue-router";
|
||||
import * as indexAudit from "../../api/indexAudit";
|
||||
<script setup>
|
||||
import {computed, defineEmits, defineProps, ref, watch} from "vue";
|
||||
import {message} from "ant-design-vue";
|
||||
import {useRouter} from "vue-router";
|
||||
import {useRowsPage} from "@/api/request";
|
||||
import {PROJECT_AUDIT_PAGE} from "@/api/apis";
|
||||
|
||||
export default {
|
||||
name: "AddProject",
|
||||
props: {
|
||||
addprojvisible: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
taskIdDraft: {
|
||||
type: Number,
|
||||
default: null,
|
||||
},
|
||||
EditProjectId: {
|
||||
type: Number,
|
||||
default: null,
|
||||
},
|
||||
edit: {
|
||||
// 是否为编辑
|
||||
type: Boolean,
|
||||
default: null,
|
||||
},
|
||||
projectId: {
|
||||
type: Number,
|
||||
default: null,
|
||||
},
|
||||
chooseStageId: {
|
||||
type: Number,
|
||||
default: null,
|
||||
},
|
||||
routerTaskId: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
isLevel: {
|
||||
// 是否是关卡页面触发
|
||||
type: Number,
|
||||
default: null,
|
||||
},
|
||||
taskCourseID: {
|
||||
type: Number,
|
||||
default: null,
|
||||
},
|
||||
projectTaskId: {
|
||||
// 要编辑的projectId
|
||||
type: Number,
|
||||
default: null,
|
||||
},
|
||||
routerId: {
|
||||
type: Number,
|
||||
default: null,
|
||||
},
|
||||
isactive: {
|
||||
type: Number,
|
||||
default: null,
|
||||
},
|
||||
// 路径图里选择的阶段下的任务列表
|
||||
chooseProjectList: {
|
||||
type: String,
|
||||
default: null,
|
||||
},
|
||||
const props = defineProps({
|
||||
type: Number,
|
||||
taskList: []
|
||||
})
|
||||
const visible = ref(false)
|
||||
const sameModal = ref(false)
|
||||
const emit = defineEmits({})
|
||||
|
||||
const columns = ref([
|
||||
{
|
||||
title: "项目名称",
|
||||
dataIndex: "name",
|
||||
key: "projectName",
|
||||
width: "40%",
|
||||
ellipsis: true,
|
||||
},
|
||||
setup(props, ctx) {
|
||||
const router = useRouter();
|
||||
const state = reactive({
|
||||
inputV1: "",
|
||||
inputV2: "",
|
||||
inputV3: "",
|
||||
textV1: "",
|
||||
statu: 0,
|
||||
checkedC1: false,
|
||||
discussSettings: "",
|
||||
addLoading: false,
|
||||
sameModal: false,
|
||||
sameCopy: false,
|
||||
sameProj: null,
|
||||
selectedRowKeys: [],
|
||||
selectedRows: [],
|
||||
currentPage: 1,
|
||||
tableDataTotal: 0,
|
||||
pageSize: 10,
|
||||
//项目抽屉、列表参数
|
||||
drawertableData: [],
|
||||
});
|
||||
|
||||
const tableDataFunc = () => {
|
||||
const drawercolumns = [
|
||||
{
|
||||
title: "项目名称",
|
||||
dataIndex: "name",
|
||||
key: "projectName",
|
||||
width: "40%",
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: "项目经理",
|
||||
dataIndex: "manager",
|
||||
key: "manager",
|
||||
width: "20%",
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
title: "创建人",
|
||||
dataIndex: "creater",
|
||||
key: "creater",
|
||||
width: "20%",
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
title: "创建时间",
|
||||
dataIndex: "time",
|
||||
key: "time",
|
||||
width: "20%",
|
||||
align: "center",
|
||||
},
|
||||
];
|
||||
return drawercolumns;
|
||||
};
|
||||
const closeDrawer = () => {
|
||||
ctx.emit("update:addprojvisible", false);
|
||||
ctx.emit("update:edit", false);
|
||||
state.currentPage = 1;
|
||||
state.tableDataTotal = 0;
|
||||
state.drawertableData = [];
|
||||
state.inputV1 = "";
|
||||
state.inputV2 = "";
|
||||
state.inputV3 = "";
|
||||
state.selectedRows = [];
|
||||
state.selectedRowKeys = [];
|
||||
};
|
||||
// const rowSelection =()=> ref({
|
||||
// checkStrictly: false,
|
||||
// onChange: (selectedRowKeys, selectedRows) => {
|
||||
// console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows);
|
||||
// },
|
||||
// onSelect: (record, selected, selectedRows) => {
|
||||
// console.log(record, selected, selectedRows);
|
||||
// },
|
||||
// onSelectAll: (selected, selectedRows, changeRows) => {
|
||||
// console.log(selected, selectedRows, changeRows);
|
||||
// },
|
||||
// });
|
||||
const start = () => {
|
||||
state.loading = true;
|
||||
// ajax request after empty completing
|
||||
setTimeout(() => {
|
||||
state.loading = false;
|
||||
}, 1000);
|
||||
};
|
||||
// const onSelectChange = (selectedRowKeys, selectedRows) => {
|
||||
// console.log("selectedRowKeys changed: ", selectedRowKeys);
|
||||
// state.selectedRowKeys = selectedRowKeys;
|
||||
// this.selectedRows = selectedRows;
|
||||
// };
|
||||
const searchProjectList = () => {
|
||||
state.selectedRowKeys = [];
|
||||
getAllProjText();
|
||||
};
|
||||
const resetProjectList = () => {
|
||||
state.selectedRowKeys = [];
|
||||
state.inputV1 = "";
|
||||
state.inputV2 = "";
|
||||
state.inputV3 = "";
|
||||
getAllProjText();
|
||||
};
|
||||
|
||||
//翻页
|
||||
const changePagination = (page) => {
|
||||
state.currentPage = page;
|
||||
getAllProjText();
|
||||
// console.log("翻页", page, pageSize);
|
||||
};
|
||||
|
||||
// 点击编辑默认选中
|
||||
const defaultValueOption = () => {
|
||||
if (props.edit) {
|
||||
state.drawertableData = [];
|
||||
state.selectedRowKeys = [props.EditProjectId];
|
||||
getCurrentPage();
|
||||
}
|
||||
};
|
||||
// TODO 这里后续需要给接口或者改动
|
||||
// 获取所有,确定分页位置
|
||||
const getCurrentPage = () => {
|
||||
indexAudit
|
||||
.auditlist({
|
||||
createName: state.inputV1,
|
||||
manager: state.inputV2,
|
||||
name: state.inputV3,
|
||||
pageNo: 1,
|
||||
pageSize: 10000,
|
||||
status: 3,
|
||||
})
|
||||
.then((res) => {
|
||||
// let arr = res.data.data.rows;
|
||||
if (res.status === 200) {
|
||||
console.log("all - project - info", res.data.data);
|
||||
|
||||
let allarr = res.data.data.rows;
|
||||
let isHav = true;
|
||||
for (let i = 0; i < allarr.length; i++) {
|
||||
if (allarr[i].projectId == props.EditProjectId) {
|
||||
isHav = false;
|
||||
state.currentPage = Math.ceil((i + 1) / 10);
|
||||
console.log("sdadasd", state.currentPage);
|
||||
getAllProjText();
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (isHav) {
|
||||
getAllProjText();
|
||||
state.currentPage = 1;
|
||||
}
|
||||
// state.drawertableData = getTableDate(arr);
|
||||
// state.tableDataTotal = res.data.data.total
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
message.destroy();
|
||||
//message.error("获取全部项目信息接口失败");
|
||||
});
|
||||
};
|
||||
|
||||
//获取全部项目信息接口
|
||||
const getAllProjText = () => {
|
||||
console.log("搜索的参数信息", {
|
||||
createName: state.inputV3,
|
||||
manager: state.inputV2,
|
||||
name: state.inputV1,
|
||||
pageNo: state.currentPage,
|
||||
pageSize: state.pageSize,
|
||||
status: 3,
|
||||
});
|
||||
|
||||
indexAudit
|
||||
.auditlist({
|
||||
createName: state.inputV3,
|
||||
manager: state.inputV2,
|
||||
name: state.inputV1,
|
||||
pageNo: state.currentPage,
|
||||
pageSize: state.pageSize,
|
||||
status: 3,
|
||||
})
|
||||
.then((res) => {
|
||||
let arr = res.data.data.rows;
|
||||
if (res.status === 200) {
|
||||
console.log("all - project - info", res.data.data);
|
||||
state.drawertableData = getTableDate(arr);
|
||||
state.tableDataTotal = res.data.data.total;
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
message.destroy();
|
||||
//message.error("获取全部项目信息接口失败");
|
||||
});
|
||||
};
|
||||
const afterVisibleChange = () => {
|
||||
if (props.edit) {
|
||||
defaultValueOption();
|
||||
} else {
|
||||
getAllProjText();
|
||||
}
|
||||
};
|
||||
|
||||
const handelChangePage = (page, pageSize) => {
|
||||
state.currentPage = page;
|
||||
state.pageSize = pageSize;
|
||||
getAllProjText();
|
||||
};
|
||||
const getTableDate = (data) => {
|
||||
let array = [];
|
||||
data.map((value) => {
|
||||
if (value.type == 3) {
|
||||
let obj = {
|
||||
key: value.id,
|
||||
parentId: value.parentId,
|
||||
projectId: value.id,
|
||||
name: value.name,
|
||||
manager: value.manager,
|
||||
time: dayjs(value.createTime).format("YYYY-MM-DD"),
|
||||
creater: value.createName,
|
||||
};
|
||||
array.push(obj);
|
||||
} else {
|
||||
let obj = {
|
||||
key: value.projectId,
|
||||
parentId: value.parentId,
|
||||
name: value.name,
|
||||
manager: value.manager,
|
||||
time: dayjs(value.createTime).format("YYYY-MM-DD"),
|
||||
children: value.subList ? getTableDate(value.subList) : [],
|
||||
creater: value.createName,
|
||||
};
|
||||
array.push(obj);
|
||||
}
|
||||
});
|
||||
return array;
|
||||
};
|
||||
//项目抽屉用的
|
||||
const updateTaskList = () => {
|
||||
//const resultArr = [];
|
||||
state.selectedRows.forEach((item) => {
|
||||
let origin = JSON.parse(props.chooseProjectList);
|
||||
console.log("ccxx", origin);
|
||||
if (origin == null) {
|
||||
closeSameModal();
|
||||
closeDrawer();
|
||||
message.destroy();
|
||||
message.warning("添加成功");
|
||||
return;
|
||||
}
|
||||
if (origin.length == 0) {
|
||||
//可以直接添加到任务列表里
|
||||
updateTask(item);
|
||||
closeDrawer();
|
||||
} else {
|
||||
//需要先判断是否含有之前的
|
||||
//根据courseId判断
|
||||
let re = origin.filter((it) => {
|
||||
return it.courseId == item.key;
|
||||
});
|
||||
console.log("re", re);
|
||||
if (re.length == 0) {
|
||||
updateTask(item);
|
||||
} else {
|
||||
state.sameProj = item;
|
||||
//询问是否重复添加
|
||||
showSameModal();
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const updateTask = async (res) => {
|
||||
if (props.isLevel == 1) {
|
||||
if (!props.isactive) {
|
||||
message.destroy();
|
||||
return message.warning("请先选中关卡");
|
||||
}
|
||||
await RouterEditTask({
|
||||
chapterId: props.isactive,
|
||||
courseId: res.key,
|
||||
name: res.name,
|
||||
routerId: props.routerId,
|
||||
routerTaskId: props.routerTaskId || 0,
|
||||
type: 13,
|
||||
id: props.taskIdDraft
|
||||
})
|
||||
.then(() => {
|
||||
message.success(`${props.edit ? "编辑" : "新增"}关卡任务成功`);
|
||||
ctx.emit("changeData", false);
|
||||
closeDrawer();
|
||||
})
|
||||
.catch(() => {
|
||||
message.error(`${props.edit ? "编辑" : "新增"}关卡任务失败`);
|
||||
});
|
||||
}
|
||||
};
|
||||
const onSelectChange = (selectedRowKeys, selectRow) => {
|
||||
console.log("selectedRowKeys changed: ", selectedRowKeys, selectRow);
|
||||
state.selectedRowKeys = selectedRowKeys;
|
||||
state.selectedRows = selectRow;
|
||||
};
|
||||
|
||||
const showSameModal = () => {
|
||||
state.sameModal = true;
|
||||
};
|
||||
const closeSameModal = () => {
|
||||
state.sameProj = null;
|
||||
state.sameModal = false;
|
||||
};
|
||||
const sureSameModal = async () => {
|
||||
// updateTask(state.sameProj);
|
||||
if (state.selectedRows && state.selectedRows.length) {
|
||||
for (const item in state.selectedRows) {
|
||||
await updateTask(item);
|
||||
}
|
||||
}
|
||||
state.sameProj = null;
|
||||
state.sameModal = false;
|
||||
closeDrawer();
|
||||
ctx.emit("changeData", false);
|
||||
};
|
||||
|
||||
// 新建项目
|
||||
const goProjectmanage = () => {
|
||||
router.push({ path: "/projectmanage" });
|
||||
}
|
||||
|
||||
return {
|
||||
...toRefs(state),
|
||||
afterVisibleChange,
|
||||
closeDrawer,
|
||||
getTableDate,
|
||||
start,
|
||||
getAllProjText,
|
||||
onSelectChange,
|
||||
tableDataFunc,
|
||||
updateTaskList,
|
||||
searchProjectList,
|
||||
resetProjectList,
|
||||
handelChangePage,
|
||||
showSameModal,
|
||||
closeSameModal,
|
||||
sureSameModal,
|
||||
changePagination,
|
||||
getCurrentPage,
|
||||
goProjectmanage
|
||||
};
|
||||
{
|
||||
title: "项目经理",
|
||||
dataIndex: "manager",
|
||||
key: "manager",
|
||||
width: "20%",
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
title: "创建人",
|
||||
dataIndex: "createName",
|
||||
key: "createName",
|
||||
width: "20%",
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
title: "创建时间",
|
||||
dataIndex: "createTime",
|
||||
key: "createTime",
|
||||
width: "20%",
|
||||
align: "center",
|
||||
},
|
||||
])
|
||||
const initParams = {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
orderAsc: true
|
||||
}
|
||||
const params = ref(initParams)
|
||||
const router = useRouter();
|
||||
const rowSelectKeys = ref([]);
|
||||
const selectsData = ref([]);
|
||||
const taskIndex = ref(-1);
|
||||
|
||||
const {data, loading, total, fetch} = useRowsPage(PROJECT_AUDIT_PAGE, params.value, {
|
||||
init: false,
|
||||
result: res => res.result.list,
|
||||
totalPage: res => res.result.totalPages,
|
||||
total: res => res.result.count
|
||||
})
|
||||
|
||||
watch(taskIndex, () => {
|
||||
// if (taskIndex.value >= 0) {
|
||||
// rowSelectKeys.value = [props.taskList[taskIndex.value].courseId]
|
||||
// selectsData.value = data.value.find(t => t.id === props.taskList[taskIndex.value].courseId) || {}
|
||||
// }
|
||||
})
|
||||
|
||||
const customRow = (record) => ({
|
||||
onClick: () => {
|
||||
rowSelectKeys.value = [record.id]
|
||||
selectsData.value = [record]
|
||||
}
|
||||
})
|
||||
|
||||
const pagination = computed(() => ({
|
||||
total: total.value,
|
||||
showSizeChanger: false,
|
||||
current: params.value.pageIndex,
|
||||
pageSize: params.value.pageSize,
|
||||
onChange: changePagination,
|
||||
}));
|
||||
|
||||
const changePagination = (e) => {
|
||||
params.value.pageIndex = e;
|
||||
fetch()
|
||||
};
|
||||
const rowSelection = computed(() => ({
|
||||
type: 'radio',
|
||||
columnWidth: 20,
|
||||
selectedRowKeys: rowSelectKeys.value,
|
||||
onChange: onSelectChange,
|
||||
preserveSelectedRowKeys: true,
|
||||
}));
|
||||
|
||||
function onSelectChange(e, l) {
|
||||
rowSelectKeys.value = e;
|
||||
selectsData.value = l;
|
||||
}
|
||||
|
||||
function search() {
|
||||
params.value.pageIndex = 1
|
||||
fetch()
|
||||
}
|
||||
|
||||
function reset() {
|
||||
rowSelectKeys.value = [];
|
||||
selectsData.value = [];
|
||||
params.value.pageIndex = 1
|
||||
params.value.keyWord = ''
|
||||
fetch()
|
||||
}
|
||||
|
||||
const closeDrawer = () => {
|
||||
visible.value = false
|
||||
taskIndex.value = -1
|
||||
reset()
|
||||
};
|
||||
|
||||
function confirm() {
|
||||
if (!selectsData.value.length || !rowSelectKeys.value.length) {
|
||||
message.warning("请选择项目!");
|
||||
return
|
||||
}
|
||||
if (taskIndex.value === -1) {
|
||||
const list = props.taskList
|
||||
list.push({
|
||||
name: selectsData.value[0].name,
|
||||
type: props.type,
|
||||
courseId: selectsData.value[0].id,
|
||||
info: selectsData.value[0]
|
||||
})
|
||||
} else {
|
||||
const data = props.taskList[taskIndex.value]
|
||||
data.name = selectsData.value[0].name
|
||||
data.courseId = selectsData.value[0].id
|
||||
data.info = selectsData.value[0]
|
||||
}
|
||||
emit('update:taskList', [...props.taskList])
|
||||
closeDrawer()
|
||||
}
|
||||
|
||||
const goProjectmanage = () => {
|
||||
router.push({path: "/projectmanage"});
|
||||
}
|
||||
|
||||
function closeSameModal() {
|
||||
sameModal.value = false
|
||||
}
|
||||
|
||||
function sureSameModal() {
|
||||
|
||||
}
|
||||
|
||||
function openDrawer(i, row) {
|
||||
row && (rowSelectKeys.value = [row.courseId]);
|
||||
row && (selectsData.value = [{name: row.name, id: row.courseId}]);
|
||||
(i >= 0) && (taskIndex.value = i)
|
||||
visible.value = true
|
||||
}
|
||||
|
||||
defineExpose({openDrawer})
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.ant-table-striped :deep(.table-striped) td {
|
||||
@@ -683,8 +380,8 @@ export default {
|
||||
width: calc(100%);
|
||||
height: 68px;
|
||||
background: linear-gradient(
|
||||
rgba(78, 166, 255, 0.2) 0%,
|
||||
rgba(78, 166, 255, 0) 100%
|
||||
rgba(78, 166, 255, 0.2) 0%,
|
||||
rgba(78, 166, 255, 0) 100%
|
||||
);
|
||||
}
|
||||
|
||||
@@ -926,8 +623,8 @@ export default {
|
||||
}
|
||||
|
||||
.ant-table-tbody
|
||||
> tr:hover:not(.ant-table-expanded-row):not(.ant-table-row-selected)
|
||||
> td {
|
||||
> tr:hover:not(.ant-table-expanded-row):not(.ant-table-row-selected)
|
||||
> td {
|
||||
background: #f6f9fd;
|
||||
}
|
||||
}
|
||||
@@ -956,28 +653,35 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.main_table {
|
||||
position: relative;
|
||||
padding-bottom: 80px;
|
||||
|
||||
.ant-checkbox-wrapper {
|
||||
align-items: center;
|
||||
margin-top: -2px;
|
||||
}
|
||||
|
||||
.ant-table-selection-column {
|
||||
padding: 0px !important;
|
||||
padding-left: 5px !important;
|
||||
}
|
||||
|
||||
.ant-table-thead > tr > th {
|
||||
background-color: rgba(239, 244, 252, 1);
|
||||
}
|
||||
|
||||
th.h {
|
||||
background-color: #eff4fc !important;
|
||||
}
|
||||
|
||||
.ant-table-tbody
|
||||
> tr:hover:not(.ant-table-expanded-row):not(.ant-table-row-selected)
|
||||
> td {
|
||||
> tr:hover:not(.ant-table-expanded-row):not(.ant-table-row-selected)
|
||||
> td {
|
||||
background: #f6f9fd;
|
||||
}
|
||||
|
||||
.pa {
|
||||
left: 0;
|
||||
width: 100%;
|
||||
@@ -987,6 +691,7 @@ export default {
|
||||
bottom: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
.main_btns {
|
||||
height: 72px;
|
||||
width: 100%;
|
||||
|
||||
Reference in New Issue
Block a user