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

@@ -11,7 +11,7 @@
>
<div class="drawerMain">
<div class="header">
<div v-if="taskIndex>=0" 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"
@@ -65,16 +65,18 @@
<div class="search"></div>
<div class="btnText">重置</div>
</div>
<div class="btn btn2" @click="reset">
<div class="search"></div>
<div class="btnText">刷新</div>
</div>
</div>
</div>
<div class="main_item" style="margin-top: 16px;margin-bottom: 32px;">
<button class="xkbtn" @click="goProjectmanage">
新建项目
</button>
<div class="main_item" style="margin-top: 16px; margin-bottom: 32px">
<button class="xkbtn" @click="goProjectmanage">新建项目</button>
</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="notice_icon"></div>
<div v-if="selectedRows.length == 0">
@@ -132,7 +134,9 @@
<a-table
:customRow="customRow"
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"
:columns="columns"
:data-source="data"
@@ -180,19 +184,19 @@
</a-drawer>
</template>
<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";
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";
const props = defineProps({
type: Number,
taskList: []
})
const visible = ref(false)
const sameModal = ref(false)
const emit = defineEmits({})
taskList: [],
});
const visible = ref(false);
const sameModal = ref(false);
const emit = defineEmits({});
const columns = ref([
{
@@ -223,38 +227,42 @@ const columns = ref([
width: "20%",
align: "center",
},
])
]);
const initParams = {
pageNo: 1,
pageSize: 10,
orderAsc: true
}
const params = ref(initParams)
const router = useRouter();
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, {
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
})
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]
}
})
rowSelectKeys.value = [record.id];
selectsData.value = [record];
},
});
const pagination = computed(() => ({
total: total.value,
@@ -266,10 +274,10 @@ const pagination = computed(() => ({
const changePagination = (e) => {
params.value.pageNo = e;
fetch()
fetch();
};
const rowSelection = computed(() => ({
type: 'radio',
type: "radio",
columnWidth: 20,
selectedRowKeys: rowSelectKeys.value,
onChange: onSelectChange,
@@ -282,70 +290,69 @@ function onSelectChange(e, l) {
}
function search() {
params.value.pageNo = 1
fetch()
params.value.pageNo = 1;
fetch();
}
function reset() {
rowSelectKeys.value = [];
selectsData.value = [];
params.value.pageNo = 1
params.value.keyWord = ''
params.value.createName = ''
params.value.manager = ''
params.value.name = ''
fetch()
params.value.pageNo = 1;
params.value.keyWord = "";
params.value.createName = "";
params.value.manager = "";
params.value.name = "";
fetch();
}
const closeDrawer = () => {
visible.value = false
taskIndex.value = -1
reset()
visible.value = false;
taskIndex.value = -1;
reset();
};
function confirm() {
if (!selectsData.value.length || !rowSelectKeys.value.length) {
message.warning("请选择项目");
return
return;
}
if (taskIndex.value === -1) {
const list = props.taskList
const list = props.taskList;
list.push({
name: selectsData.value[0].name,
type: props.type,
courseId: selectsData.value[0].id,
info: {...selectsData.value[0]}
})
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]
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()
emit("update:taskList", [...props.taskList]);
closeDrawer();
}
const goProjectmanage = () => {
router.push({path: "/projectmanage"});
}
// router.push({path: "/projectmanage"});
window.open(process.env.VUE_APP_BASE + "/projectmanage");
};
function closeSameModal() {
sameModal.value = false
sameModal.value = false;
}
function sureSameModal() {
}
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
row && (selectsData.value = [{ name: row.name, id: row.courseId }]);
i >= 0 && (taskIndex.value = i);
visible.value = true;
}
defineExpose({openDrawer})
defineExpose({ openDrawer });
</script>
<style lang="scss">
.ant-table-striped :deep(.table-striped) td {

View File

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