feat:修改评估任务及项目任务

This commit is contained in:
lixg
2023-02-24 11:31:27 +08:00
parent 8c1bcea020
commit 25bc245dd8
2 changed files with 146 additions and 132 deletions

View File

@@ -65,16 +65,18 @@
<div class="search"></div> <div class="search"></div>
<div class="btnText">重置</div> <div class="btnText">重置</div>
</div> </div>
<div class="btn btn2" @click="reset">
<div class="search"></div>
<div class="btnText">刷新</div>
</div>
</div> </div>
</div> </div>
<div class="main_item" style="margin-top: 16px;margin-bottom: 32px;"> <div class="main_item" style="margin-top: 16px; margin-bottom: 32px">
<button class="xkbtn" @click="goProjectmanage"> <button class="xkbtn" @click="goProjectmanage">新建项目</button>
新建项目
</button>
</div> </div>
<div class="main_notice" v-if="edit" style="display:none;"> <div class="main_notice" v-if="edit" style="display: none">
<div class="mntc_left"> <div class="mntc_left">
<div class="notice_icon"></div> <div class="notice_icon"></div>
<div v-if="selectedRows.length == 0"> <div v-if="selectedRows.length == 0">
@@ -132,7 +134,9 @@
<a-table <a-table
:customRow="customRow" :customRow="customRow"
class="ant-table-striped" class="ant-table-striped"
:row-class-name="(_, index) => (index % 2 === 1 ? 'table-striped' : null)" :row-class-name="
(_, index) => (index % 2 === 1 ? 'table-striped' : null)
"
row-key="id" row-key="id"
:columns="columns" :columns="columns"
:data-source="data" :data-source="data"
@@ -182,17 +186,17 @@
<script setup> <script setup>
import { computed, defineEmits, defineProps, ref, watch } from "vue"; import { computed, defineEmits, defineProps, ref, watch } from "vue";
import { message } from "ant-design-vue"; import { message } from "ant-design-vue";
import {useRouter} from "vue-router"; // import { useRouter } from "vue-router";
import { useRowsPage } from "@/api/request"; import { useRowsPage } from "@/api/request";
import { PROJECT_AUDIT_PAGE } from "@/api/apis"; import { PROJECT_AUDIT_PAGE } from "@/api/apis";
const props = defineProps({ const props = defineProps({
type: Number, type: Number,
taskList: [] taskList: [],
}) });
const visible = ref(false) const visible = ref(false);
const sameModal = ref(false) const sameModal = ref(false);
const emit = defineEmits({}) const emit = defineEmits({});
const columns = ref([ const columns = ref([
{ {
@@ -223,38 +227,42 @@ const columns = ref([
width: "20%", width: "20%",
align: "center", align: "center",
}, },
]) ]);
const initParams = { const initParams = {
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
orderAsc: true orderAsc: true,
} };
const params = ref(initParams) const params = ref(initParams);
const router = useRouter(); // const router = useRouter();
const rowSelectKeys = ref([]); const rowSelectKeys = ref([]);
const selectsData = ref([]); const selectsData = ref([]);
const taskIndex = ref(-1); const taskIndex = ref(-1);
const {data, loading, total, fetch} = useRowsPage(PROJECT_AUDIT_PAGE, params.value, { const { data, loading, total, fetch } = useRowsPage(
PROJECT_AUDIT_PAGE,
params.value,
{
init: false, init: false,
result: res => res.result.list, result: (res) => res.result.list,
totalPage: res => res.result.totalPages, totalPage: (res) => res.result.totalPages,
total: res => res.result.count total: (res) => res.result.count,
}) }
);
watch(taskIndex, () => { watch(taskIndex, () => {
// if (taskIndex.value >= 0) { // if (taskIndex.value >= 0) {
// rowSelectKeys.value = [props.taskList[taskIndex.value].courseId] // rowSelectKeys.value = [props.taskList[taskIndex.value].courseId]
// selectsData.value = data.value.find(t => t.id === props.taskList[taskIndex.value].courseId) || {} // selectsData.value = data.value.find(t => t.id === props.taskList[taskIndex.value].courseId) || {}
// } // }
}) });
const customRow = (record) => ({ const customRow = (record) => ({
onClick: () => { onClick: () => {
rowSelectKeys.value = [record.id] rowSelectKeys.value = [record.id];
selectsData.value = [record] selectsData.value = [record];
} },
}) });
const pagination = computed(() => ({ const pagination = computed(() => ({
total: total.value, total: total.value,
@@ -266,10 +274,10 @@ const pagination = computed(() => ({
const changePagination = (e) => { const changePagination = (e) => {
params.value.pageNo = e; params.value.pageNo = e;
fetch() fetch();
}; };
const rowSelection = computed(() => ({ const rowSelection = computed(() => ({
type: 'radio', type: "radio",
columnWidth: 20, columnWidth: 20,
selectedRowKeys: rowSelectKeys.value, selectedRowKeys: rowSelectKeys.value,
onChange: onSelectChange, onChange: onSelectChange,
@@ -282,70 +290,69 @@ function onSelectChange(e, l) {
} }
function search() { function search() {
params.value.pageNo = 1 params.value.pageNo = 1;
fetch() fetch();
} }
function reset() { function reset() {
rowSelectKeys.value = []; rowSelectKeys.value = [];
selectsData.value = []; selectsData.value = [];
params.value.pageNo = 1 params.value.pageNo = 1;
params.value.keyWord = '' params.value.keyWord = "";
params.value.createName = '' params.value.createName = "";
params.value.manager = '' params.value.manager = "";
params.value.name = '' params.value.name = "";
fetch() fetch();
} }
const closeDrawer = () => { const closeDrawer = () => {
visible.value = false visible.value = false;
taskIndex.value = -1 taskIndex.value = -1;
reset() reset();
}; };
function confirm() { function confirm() {
if (!selectsData.value.length || !rowSelectKeys.value.length) { if (!selectsData.value.length || !rowSelectKeys.value.length) {
message.warning("请选择项目"); message.warning("请选择项目");
return return;
} }
if (taskIndex.value === -1) { if (taskIndex.value === -1) {
const list = props.taskList const list = props.taskList;
list.push({ list.push({
name: selectsData.value[0].name, name: selectsData.value[0].name,
type: props.type, type: props.type,
courseId: selectsData.value[0].id, courseId: selectsData.value[0].id,
info: {...selectsData.value[0]} info: { ...selectsData.value[0] },
}) });
} else { } else {
const data = props.taskList[taskIndex.value] const data = props.taskList[taskIndex.value];
data.name = selectsData.value[0].name data.name = selectsData.value[0].name;
data.courseId = selectsData.value[0].id data.courseId = selectsData.value[0].id;
data.info = selectsData.value[0] data.info = selectsData.value[0];
} }
emit('update:taskList', [...props.taskList]) emit("update:taskList", [...props.taskList]);
closeDrawer() closeDrawer();
} }
const goProjectmanage = () => { const goProjectmanage = () => {
router.push({path: "/projectmanage"}); // router.push({path: "/projectmanage"});
} window.open(process.env.VUE_APP_BASE + "/projectmanage");
};
function closeSameModal() { function closeSameModal() {
sameModal.value = false sameModal.value = false;
} }
function sureSameModal() { function sureSameModal() {}
}
function openDrawer(i, row) { function openDrawer(i, row) {
row && (rowSelectKeys.value = [row.courseId]); row && (rowSelectKeys.value = [row.courseId]);
row && (selectsData.value = [{ name: row.name, id: row.courseId }]); row && (selectsData.value = [{ name: row.name, id: row.courseId }]);
(i >= 0) && (taskIndex.value = i) i >= 0 && (taskIndex.value = i);
visible.value = true visible.value = true;
} }
defineExpose({openDrawer}) defineExpose({ openDrawer });
</script> </script>
<style lang="scss"> <style lang="scss">
.ant-table-striped :deep(.table-striped) td { .ant-table-striped :deep(.table-striped) td {

View File

@@ -17,10 +17,16 @@
<div class="search"></div> <div class="search"></div>
<div class="btnText">重置</div> <div class="btnText">重置</div>
</div> </div>
<div class="btnsn" @click="reset">
<div class="search"></div>
<div class="btnText">刷新</div>
</div>
</div> </div>
<div class="main_item"> <div class="main_item">
<button class="xkbtn" style="margin:0" @click="goResearchmanage">新建评估</button> <button class="xkbtn" style="margin: 0" @click="goResearchmanage">
新建评估
</button>
</div> </div>
<div class="main_notice" style="display: none"> <div class="main_notice" style="display: none">
@@ -44,7 +50,7 @@
</template> </template>
<script setup> <script setup>
import { computed, defineEmits, defineProps, ref, watch } from "vue"; import { computed, defineEmits, defineProps, ref, watch } from "vue";
import { useRouter } from "vue-router"; // import { useRouter } from "vue-router";
import { useRowsPage } from "@/api/request"; import { useRowsPage } from "@/api/request";
import { ASSESSMENT_PAGE } from "@/api/apis"; import { ASSESSMENT_PAGE } from "@/api/apis";
@@ -105,7 +111,7 @@ const initParams = {
pageSize: 10, pageSize: 10,
releaseStatus: 2, releaseStatus: 2,
}; };
const router = useRouter(); // const router = useRouter();
const params = ref(initParams); const params = ref(initParams);
const rowSelectKeys = ref([]); const rowSelectKeys = ref([]);
@@ -147,7 +153,7 @@ const pagination = computed(() => ({
})); }));
const changePagination = (e) => { const changePagination = (e) => {
params.value.pageIndex = e; params.value.pageNo = e;
fetch(); fetch();
}; };
const rowSelection = computed(() => ({ const rowSelection = computed(() => ({
@@ -156,12 +162,12 @@ const rowSelection = computed(() => ({
selectedRowKeys: rowSelectKeys.value, selectedRowKeys: rowSelectKeys.value,
onChange: onSelectChange, onChange: onSelectChange,
preserveSelectedRowKeys: true, preserveSelectedRowKeys: true,
getCheckboxProps: getCheckboxProps getCheckboxProps: getCheckboxProps,
})); }));
const getCheckboxProps = () => ({ const getCheckboxProps = () => ({
// 某几项默认禁止选中(R: 当state等于1时) // 某几项默认禁止选中(R: 当state等于1时)
disabled: false disabled: false,
}) });
function onSelectChange(e, l) { function onSelectChange(e, l) {
rowSelectKeys.value = e; rowSelectKeys.value = e;
@@ -185,7 +191,8 @@ function reset() {
} }
const goResearchmanage = () => { const goResearchmanage = () => {
router.push({ path: "/researchmanage" }); // router.push({ path: "/researchmanage" });
window.open(process.env.VUE_APP_BASE + "/researchmanage");
}; };
</script> </script>
<style lang="scss"> <style lang="scss">