round完成

This commit is contained in:
2023-06-28 21:02:31 +08:00
parent 1063053510
commit 67cb0df5b9
12 changed files with 198 additions and 35 deletions

View File

@@ -7,7 +7,7 @@ export default {
*/ */
getNoticeList(params = {}) { getNoticeList(params = {}) {
return request({ return request({
url: "common/getNoticeList", url: "system/getNoticeList",
method: "get", method: "get",
params params
}) })

View File

@@ -11,5 +11,16 @@ export default {
method: "get", method: "get",
params params
}) })
},
/**
* 传入id以及data编辑设计需求
* @returns 成功编辑或失败
*/
editDesignDemand(id, data = {}) {
return request({
url: `project/editDesignDemand/` + id,
method: "put",
data
})
} }
} }

View File

@@ -10,5 +10,40 @@ export default {
method: "get", method: "get",
params params
}) })
},
/**
* 添加轮次
* @returns
*/
save(project_id, params = {}) {
return request({
url: "project/round/save",
method: "post",
data: params,
params: { project_id }
})
},
/**
* 更新轮次
* @returns
*/
update(id, data = {}) {
return request({
url: "project/round/update/" + id,
method: "put",
data
})
},
/**
* 更新轮次
* @returns
*/
delete(project_id, data = {}) {
return request({
url: "project/round/delete",
method: "delete",
data,
params: { project_id }
})
} }
} }

View File

@@ -90,5 +90,16 @@ export default {
method: "put", method: "put",
data data
}) })
} },
/**
* 请求所有user信息
* @returns
*/
getUserDict(params = {}) {
return request({
url: "system/user/dict",
method: "get",
params
})
},
} }

View File

@@ -10,5 +10,38 @@ export default {
method: "get", method: "get",
params params
}) })
} },
/**
* 添加用户
* @returns
*/
save(params = {}) {
return request({
url: "testmanage/project/save",
method: "post",
data: params
})
},
/**
* 更新数据
* @returns
*/
update(id, data = {}) {
return request({
url: "testmanage/project/update/" + id,
method: "put",
data
})
},
/**
* 删除项目
* @returns
*/
delete(data) {
return request({
url: "testmanage/project/delete",
method: "delete",
data
})
},
} }

View File

@@ -41,8 +41,13 @@
@click="() => handleRoundAddClick(nodeData)" @click="() => handleRoundAddClick(nodeData)"
/> />
</a-tooltip> </a-tooltip>
<a-tooltip content="点击删除轮次" <a-tooltip content="点击删除轮次">
><IconMinus <a-popconfirm
content="确定要删除该轮次吗?"
position="bottom"
@ok="handleRoundDelClick(nodeData)"
>
<IconMinus
style=" style="
position: absolute; position: absolute;
right: 25px; right: 25px;
@@ -50,8 +55,9 @@
top: 8px; top: 8px;
color: #3370ff; color: #3370ff;
" "
@click="() => handleRoundDelClick(nodeData)" />
/></a-tooltip> </a-popconfirm>
</a-tooltip>
<a-tooltip content="点击编辑当前轮次" <a-tooltip content="点击编辑当前轮次"
><IconEdit ><IconEdit
style=" style="
@@ -82,6 +88,7 @@
:column="roundColumn" :column="roundColumn"
:options="roundOption" :options="roundOption"
width="800px" width="800px"
:submit="handleRoundSubmit"
></ma-form-modal> ></ma-form-modal>
</template> </template>
@@ -92,10 +99,12 @@ import PageLayout from "@/layout/page-layout.vue"
import MaFormModal from "@/components/ma-form-modal/index.vue" import MaFormModal from "@/components/ma-form-modal/index.vue"
import projectApi from "@/api/project/project" import projectApi from "@/api/project/project"
import roundApi from "@/api/project/round" import roundApi from "@/api/project/round"
import { Message } from "@arco-design/web-vue"
import { useRoute } from "vue-router" import { useRoute } from "vue-router"
import { useRouter } from "vue-router" import { useRouter } from "vue-router"
import { useTreeDataStore } from "@/store" import { useTreeDataStore } from "@/store"
import { storeToRefs } from "pinia" import { storeToRefs } from "pinia"
import dayjs from "dayjs"
//~~~~ 缩小后的menu菜单 //~~~~ 缩小后的menu菜单
const drawerVisible = ref(false) const drawerVisible = ref(false)
provide("toggleDrawerMenu", () => { provide("toggleDrawerMenu", () => {
@@ -139,7 +148,7 @@ const { treeData, currentNode } = storeToRefs(treeDataStore)
const projectInfo = ref({ ...route.query }) const projectInfo = ref({ ...route.query })
const projectId = ref(route.query.id) const projectId = ref(route.query.id)
onMounted(async () => { onMounted(async () => {
treeDataStore.initTreeData(projectId) treeDataStore.initTreeData(projectId.value)
}) })
/// 点击树状节点-参数1:节点数组参数2:树node对象 /// 点击树状节点-参数1:节点数组参数2:树node对象
const pointNode = (value, data) => { const pointNode = (value, data) => {
@@ -209,10 +218,17 @@ const maFormModalRef = ref()
const title = ref("") const title = ref("")
/// 点击新增轮次按钮 /// 点击新增轮次按钮
const handleRoundAddClick = (nodeData) => { const handleRoundAddClick = (nodeData) => {
// 这里是文档写错了 // 这里是文档写错了,调用form是里面组件绑定的数据
console.log(maFormModalRef.value.form);
maFormModalRef.value.form = {} maFormModalRef.value.form = {}
maFormModalRef.value.open({}) maFormModalRef.value.open({
beginTime: dayjs().format("YYYY-MM-DD"),
grade: "1",
key: `${treeDataStore.treeData.length}`,
name: `${treeDataStore.treeData.length + 1}轮测试`,
ident: `${route.query.ident}-R${treeDataStore.treeData.length + 1}`,
project: projectId.value
})
title.value = "新增轮次"
} }
/// 点击编辑轮次按钮 /// 点击编辑轮次按钮
const handleRoundEditClick = async (nodeData) => { const handleRoundEditClick = async (nodeData) => {
@@ -224,8 +240,35 @@ const handleRoundEditClick = async (nodeData) => {
title.value = `编辑轮次:${data.data.name}` title.value = `编辑轮次:${data.data.name}`
} }
/// 点击删除轮次按钮 /// 点击删除轮次按钮
const handleRoundDelClick = () => { const handleRoundDelClick = async (value) => {
console.log("删除轮次") try {
await roundApi.delete(projectId.value, value)
Message.success("删除成功!")
treeDataStore.resetTreeData(projectId.value)
} catch {
Message.error("删除失败!")
}
}
/// Ma-form-Modal的提交按钮
const handleRoundSubmit = async (value) => {
console.log(value)
if (title.value.slice(0, 1) === "编") {
try {
await roundApi.update(value.id, value)
Message.success("编辑成功!")
} catch {
Message.error("编辑失败!")
}
}
if (title.value.slice(0, 1) === "新") {
try {
await roundApi.save(projectId.value, value)
Message.success("新增成功!")
treeDataStore.resetTreeData(projectId.value)
} catch {
Message.error("新增失败!")
}
}
} }
/// 设置轮次弹窗的列信息 /// 设置轮次弹窗的列信息
const roundColumn = ref([ const roundColumn = ref([

View File

@@ -70,7 +70,7 @@ const useUserStore = defineStore("user", {
return loginAPI return loginAPI
.login(form) .login(form)
.then((res) => { .then((res) => {
if (res.success) { if (res.data.success === true) {
this.setToken(res.data.token) this.setToken(res.data.token)
return true return true
} else { } else {

View File

@@ -14,10 +14,16 @@ const useTreeDataStore = defineStore("treeDataStore", {
async initTreeData(projectId) { async initTreeData(projectId) {
if (this.treeData.length === 0) { if (this.treeData.length === 0) {
const roundData = await projectApi.getRoundInfo(projectId) const roundData = await projectApi.getRoundInfo(projectId)
this.treeData = roundData this.treeData = roundData.data
this.originTreeData = roundData this.originTreeData = roundData.data
} }
}, },
// 用于新增轮次后显示
async resetTreeData(projectId) {
const roundData = await projectApi.getRoundInfo(projectId)
this.treeData = roundData.data
this.originTreeData = roundData.data
},
setCurrentNode(nodeKey) { setCurrentNode(nodeKey) {
this.currentNode = nodeKey this.currentNode = nodeKey
} }

View File

@@ -29,6 +29,7 @@ import { reactive, ref, onMounted } from "vue"
import MaTreeSlider from "@/components/ma-treeSlider/index.vue" import MaTreeSlider from "@/components/ma-treeSlider/index.vue"
import userApi from "@/api/system/user" import userApi from "@/api/system/user"
import user from "@/api/system/user" import user from "@/api/system/user"
import { Message } from "@arco-design/web-vue"
// 切换状态按钮 // 切换状态按钮
const changeStatus = (e, id) => { const changeStatus = (e, id) => {
console.log("当前值:", e) console.log("当前值:", e)
@@ -183,9 +184,24 @@ const crudOptions = reactive({
viewType: "modal" viewType: "modal"
// isFull: true // isFull: true
}, },
// 用户点击编辑/删除前的hook
beforeOpenEdit: (record) => {
if (record.id === 1) {
Message.error("创始人不可编辑,请关闭窗口!")
return false
}
return true
},
beforeDelete: (ids) => {
if (ids.includes(1)) {
Message.error("创始人不可删除")
return false
}
return true
}
}) })
const crudColumns = reactive([ const crudColumns = reactive([
{ title: "ID", dataIndex: "id", addDisplay: false, editDisplay: false, width: 50, hide: false, search: true }, { title: "ID", dataIndex: "id", addDisplay: false, editDisplay: false, width: 50, hide: false },
{ {
title: "名称", title: "名称",
align: "center", align: "center",
@@ -235,7 +251,7 @@ const crudColumns = reactive([
}, },
{ {
title: "注册时间", title: "注册时间",
dataIndex: "created_at", dataIndex: "create_datetime",
align: "center", align: "center",
width: 180, width: 180,
addDisplay: false, addDisplay: false,

View File

@@ -100,9 +100,11 @@ const handleSubmit = async ({ values, errors }) => {
await userStore.login(form) await userStore.login(form)
const { redirect, ...otherQuery } = router.currentRoute.value.query const { redirect, ...otherQuery } = router.currentRoute.value.query
router.push({ router.push({
name: redirect || "Workplace" name: redirect || "Workplace",
query:{
...otherQuery // 将退出时的查询参数放入,这样就不会错误
}
}) })
Message.success("登录成功,等待跳转")
} catch (err) { } catch (err) {
errorMessage.value = err.message errorMessage.value = err.message
} finally { } finally {

View File

@@ -26,18 +26,20 @@ const crudOptions = ref({
showIndex: false, showIndex: false,
rowSelection: { showCheckedAll: true }, rowSelection: { showCheckedAll: true },
add: { show: true }, add: { show: true },
edit: { show: true }, edit: { show: true, api: designDemandApi.editDesignDemand },
delete: { show: true }, delete: { show: true },
searchColNumber: 3, searchColNumber: 3,
tablePagination: true, tablePagination: true,
operationColumn: true, operationColumn: true,
operationColumnAlign:'center',
formOption: { formOption: {
width: 1200 width: 1200,
} }
}) })
const crudColumns = ref([ const crudColumns = ref([
{ {
title: "ID", title: "ID",
align:'center',
width: 50, width: 50,
dataIndex: "id", dataIndex: "id",
search: true, search: true,
@@ -46,6 +48,7 @@ const crudColumns = ref([
}, },
{ {
title: "标识", title: "标识",
align:'center',
width: 120, width: 120,
dataIndex: "ident", dataIndex: "ident",
search: true, search: true,
@@ -54,6 +57,7 @@ const crudColumns = ref([
}, },
{ {
title: "需求名称", title: "需求名称",
align:'center',
width: 150, width: 150,
dataIndex: "name", dataIndex: "name",
search: true, search: true,
@@ -63,6 +67,7 @@ const crudColumns = ref([
{ {
title: "需求类型", title: "需求类型",
width: 150, width: 150,
align:'center',
dataIndex: "demandType", dataIndex: "demandType",
formType: "radio", formType: "radio",
search: true, search: true,
@@ -73,6 +78,7 @@ const crudColumns = ref([
{ {
title: "需求描述", title: "需求描述",
dataIndex: "description", dataIndex: "description",
hide:true,
width: 300, width: 300,
formType: "editor", formType: "editor",
height: 300 height: 300

View File

@@ -23,9 +23,9 @@ const crudRef = ref()
const crudOptions = ref({ const crudOptions = ref({
rowSelection: { showCheckedAll: true }, rowSelection: { showCheckedAll: true },
api: projectApi.getPageList, api: projectApi.getPageList,
add: { show: true }, add: { show: true,api: projectApi.save},
edit: { show: true }, edit: { show: true,api: projectApi.update},
delete: { show: true }, delete: { show: true ,api:projectApi.delete},
searchColNumber: 3, searchColNumber: 3,
tablePagination: true, tablePagination: true,
operationColumn: true, operationColumn: true,
@@ -193,7 +193,7 @@ const crudColumns = ref([
search: true, search: true,
commonRules: [{ required: true, message: "责任人必选" }], commonRules: [{ required: true, message: "责任人必选" }],
formType: "select", formType: "select",
dict: { url: "system/user/index", props: { label: "name", value: "name" }, translation: true } dict: { url: "system/user/list", props: { label: "name", value: "name" }, translation: true }
}, },
{ {
title: "成员", title: "成员",
@@ -202,7 +202,7 @@ const crudColumns = ref([
search: true, search: true,
formType: "select", formType: "select",
multiple: true, multiple: true,
dict: { url: "system/user/index", props: { label: "name", value: "name" }, translation: true }, dict: { url: "system/user/list", props: { label: "name", value: "name" }, translation: true },
commonRules: [{ required: true, message: "成员至少选择一个" }] commonRules: [{ required: true, message: "成员至少选择一个" }]
}, },
{ {
@@ -213,7 +213,7 @@ const crudColumns = ref([
commonRules: [{ required: true, message: "关键等级必填" }], commonRules: [{ required: true, message: "关键等级必填" }],
search: true, search: true,
formType: "radio", formType: "radio",
dict: { name: "security_level", props: { label: "value", value: "key" } } dict: { name: "security_level", props: { label: "title", value: "key" } }
}, },
{ {
title: "测试级别", title: "测试级别",