feature-sht #3

Merged
yannqing merged 18 commits from feature-sht into master 2024-04-25 16:30:58 +08:00
2 changed files with 74 additions and 61 deletions
Showing only changes of commit e7d831c1af - Show all commits

View File

@ -46,14 +46,14 @@
<el-button link style="color:deepskyblue" @click="toDetail(row.id)">查看详情</el-button>
</el-table-column>
</el-table>
<el-pagination larger background layout="prev, pager, next" :total="5" class="mt-4"
<el-pagination larger background layout="prev, pager, next" :total="total" class="mt-4"
style="display: flex;flex-direction: row;justify-content: center;margin-top:5vh" />
</el-card>
<!-- 新增弹窗 -->
<el-dialog title="新增子模块信息" v-model="dialogVisible" style="width: 27%" >
<el-form :model="editForm" label-width="100px">
<el-dialog title="新增子模块信息" v-model="dialogVisible" style="width: 27%">
<el-form :model="editForm" label-width="100px">
<!-- <el-form-item label="序号">
<el-input v-model="editForm.id" placeholder="请输入id" />
@ -70,21 +70,22 @@
<el-form-item label="周期">
<el-input v-model="editForm.cycle" placeholder="请输入周期" />
</el-form-item>
<!-- <el-form-item label="负责人">
<el-input v-model="editForm.principalUser" placeholder="请输入负责人" />
</el-form-item> -->
<el-form-item label="子系统">
<el-input :placeholder="`子系统 ${editForm.projectChildId}`" disabled />
<el-form-item label="负责人">
<el-select v-model="editForm.principalId" placeholder="请选择负责人">
<el-option v-for="person in persons" :key="person.id" :label="person.name" :value="person.id" />
</el-select>
</el-form-item>
<el-form-item label="截止时间">
<el-date-picker v-model="editForm.deadLine" type="date" placeholder="选择日期">
</el-date-picker>
</el-form-item>
<el-form-item label="子模块简介">
<el-input v-model="editForm.description" placeholder="请输入子模块简介" />
</el-form-item>
<!-- 添加其他需要编辑的表单项 -->
<el-form-item label="子系统">
<el-input :placeholder="`子系统 ${editForm.projectChildId}`" disabled />
</el-form-item>
<el-form-item label="截止时间">
<el-date-picker v-model="editForm.deadLine" type="date" placeholder="选择日期">
</el-date-picker>
</el-form-item>
<el-form-item label="子模块简介">
<el-input v-model="editForm.description" placeholder="请输入子模块简介" />
</el-form-item>
<!-- 添加其他需要编辑的表单项 -->
</el-form>
<span slot="footer" class="dialog-footer" style="display: flex;flex-direction: row;justify-content: center;">
<el-button @click="handleCloseDialog">取消</el-button>
@ -97,8 +98,8 @@
<script lang="ts" setup>
import { ref } from 'vue';
import { ElTable ,ElDialog, ElForm, ElFormItem, ElInput, ElButton } from 'element-plus';
import { getProjectModList ,addModule } from '@/api/manage';
import { ElTable, ElDialog, ElForm, ElFormItem, ElInput, ElButton } from 'element-plus';
import { getProjectModList, addModule } from '@/api/manage';
import { useRouter, useRoute } from 'vue-router';
import { getToken } from '@/utils/auth';
@ -108,6 +109,11 @@ const sysId = route.query.id;
const router = useRouter();
const dialogVisible = ref(false);
const total = ref(5);
//
const editForm = ref({
name: 'name',
@ -117,8 +123,15 @@ const editForm = ref({
projectChildId: sysId,
deadLine: '',
description: '',
principalId: '',
});
const persons = [
{id:0 ,name:"principal_user"},
{id:1 ,name:"console_user"},
{id:2 ,name:"developer_user"}
]
//
const openEditDialog = () => {
@ -128,45 +141,45 @@ const openEditDialog = () => {
};
//
const handleCloseDialog = ()=>{
const handleCloseDialog = () => {
dialogVisible.value = false;
}
const submitEditInfo = ()=>{
//
const formattedDate = editForm.value.deadLine instanceof Date ? editForm.value.deadLine.toISOString() : editForm.value.deadLine;
const submitEditInfo = () => {
//
const formattedDate = editForm.value.deadLine instanceof Date ? editForm.value.deadLine.toISOString() : editForm.value.deadLine;
const body={
name: editForm.value.name,
status: editForm.value.status,
workLoad: editForm.value.workLoad,
cycle: editForm.value.cycle,
projectChildId: sysId,
deadLine: formattedDate,
description: editForm.value.description,
principalId: 1,
const body = {
name: editForm.value.name,
status: editForm.value.status,
workLoad: editForm.value.workLoad,
cycle: editForm.value.cycle,
projectChildId: sysId,
deadLine: formattedDate,
description: editForm.value.description,
principalId: editForm.value.principalId,
}
console.log(body);
const promise = addModule(body, getToken());
console.log(promise);
promise.then(res => {
if (res.data.code === 200) {
console.log(res.data);
dialogVisible.value = false;
fetchData();
ElMessage.success('新增成功');
} else {
ElMessage.error("新增失败" + res.message);
console.log(res.message);
}
console.log(body);
const promise = addModule(body,getToken());
console.log(promise);
promise.then(res => {
if (res.data.code === 200) {
console.log(res.data);
dialogVisible.value = false;
fetchData();
ElMessage.success('新增成功');
} else {
ElMessage.error("新增失败" +res.message);
console.log(res.message);
}
}).catch(err => {
console.log(err);
})
}).catch(err => {
console.log(err);
})
@ -244,7 +257,7 @@ const fetchData = () => {
const newData = data.map(item => parseData(item))
// console.log(newData);
tableData.value = [...newData, ...tableData.value];
tableData.value = [...newData];
initialTableData.value = tableData.value.slice(); // tableDatainitialTableData
}

View File

@ -43,7 +43,7 @@
<el-button link style="color:deepskyblue" @click="toDetail(row.id)">查看详情</el-button>
</el-table-column>
</el-table>
<el-pagination larger background layout="prev, pager, next" :total="50" class="mt-4"
<el-pagination larger background layout="prev, pager, next" :total="5" class="mt-4"
style="display: flex;flex-direction: row;justify-content: center;margin-top:5vh" />
</el-card>