From 3a424b4719da7e86ddba14b0dc333f4ba06f9e5b Mon Sep 17 00:00:00 2001 From: ks3356143 <314298729@qq.com> Date: Tue, 25 Jul 2023 20:03:06 +0800 Subject: [PATCH] 888 --- cdTMP/src/api/request.js | 4 ++-- cdTMP/src/api/testmanage/project.js | 2 +- cdTMP/src/components/ma-crud/index.vue | 1 + cdTMP/src/layout/project-layout.vue | 8 +++++--- cdTMP/src/store/modules/user.js | 3 ++- cdTMP/src/store/project/treeData.js | 17 +++++++++++++++++ cdTMP/src/utils/request.js | 2 +- cdTMP/src/views/dashboard/usermanage/index.vue | 5 ++--- cdTMP/src/views/project/case/index.vue | 2 +- cdTMP/src/views/project/design-demand/index.vue | 2 +- cdTMP/src/views/project/dut/index.vue | 3 +-- cdTMP/src/views/project/round/index.vue | 3 +-- cdTMP/src/views/project/testDemand/index.vue | 2 +- cdTMP/src/views/testmanage/projmanage/index.vue | 6 +++--- 14 files changed, 39 insertions(+), 21 deletions(-) diff --git a/cdTMP/src/api/request.js b/cdTMP/src/api/request.js index 473ceb8..96ed6ea 100644 --- a/cdTMP/src/api/request.js +++ b/cdTMP/src/api/request.js @@ -21,12 +21,12 @@ function createService() { // 实例的response响应拦截器 service.interceptors.response.use( (res) => { - // 如果发现响应头有文件传输扩展,或则响应头为application/json,或者直接status=200 + // 如果发现响应头有文件传输扩展,或者响应头为application/json,或者直接status=200 if ( (res.headers["content-disposition"] || !/^application\/json/.test(res.headers["content-type"])) && res.status === 200 ) { - return res + return res.data // 如果发现data中有size字段直接报错 } else if (res.data.size) { res.data.code = 500 diff --git a/cdTMP/src/api/testmanage/project.js b/cdTMP/src/api/testmanage/project.js index 4b587ba..a105858 100644 --- a/cdTMP/src/api/testmanage/project.js +++ b/cdTMP/src/api/testmanage/project.js @@ -12,7 +12,7 @@ export default { }) }, /** - * 添加用户 + * 添加项目 * @returns */ save(params = {}) { diff --git a/cdTMP/src/components/ma-crud/index.vue b/cdTMP/src/components/ma-crud/index.vue index c969ddd..4b8d14d 100644 --- a/cdTMP/src/components/ma-crud/index.vue +++ b/cdTMP/src/components/ma-crud/index.vue @@ -463,6 +463,7 @@ const requestHandle = async () => { if (response.rows) { tableData.value = response.rows if (response.pageInfo) { + // 这里去找total字段 total.value = response.pageInfo.total openPagination.value = true } else { diff --git a/cdTMP/src/layout/project-layout.vue b/cdTMP/src/layout/project-layout.vue index 88a0844..0ab9858 100644 --- a/cdTMP/src/layout/project-layout.vue +++ b/cdTMP/src/layout/project-layout.vue @@ -220,14 +220,16 @@ const maFormModalRef = ref() const title = ref("") /// 点击新增轮次按钮 const handleRoundAddClick = (nodeData) => { + let create_number = treeDataStore.getRoundMiddleInfo() // 这里是文档写错了,调用form是里面组件绑定的数据 maFormModalRef.value.form = {} + // 这里如果删除中间轮次,那么新增信息应该从中间开始 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}`, + key: `${create_number}`, + name: `第${create_number + 1}轮测试`, + ident: `${route.query.ident}-R${create_number + 1}`, project: projectId.value }) title.value = "新增轮次" diff --git a/cdTMP/src/store/modules/user.js b/cdTMP/src/store/modules/user.js index cd44d5e..4e1bce6 100644 --- a/cdTMP/src/store/modules/user.js +++ b/cdTMP/src/store/modules/user.js @@ -70,8 +70,9 @@ const useUserStore = defineStore("user", { return loginAPI .login(form) .then((res) => { - if (res.data.success === true) { + if (res.success === true) { this.setToken(res.data.token) + // this.setToken(res.data.token) return true } else { return false diff --git a/cdTMP/src/store/project/treeData.js b/cdTMP/src/store/project/treeData.js index 91e89da..a13bf25 100644 --- a/cdTMP/src/store/project/treeData.js +++ b/cdTMP/src/store/project/treeData.js @@ -26,6 +26,23 @@ const useTreeDataStore = defineStore("treeDataStore", { }, setCurrentNode(nodeKey) { this.currentNode = nodeKey + }, + // 获取轮次信息中差中间的是哪几个轮次 + getRoundMiddleInfo() { + let roundLength = this.treeData.length + // 取出最后一个key的值 + let lastKey = parseInt(this.treeData[this.treeData.length - 1].key) + 1 + // 遍历数组,找出key最大值 + let key_list = [] + this.treeData.forEach((item) => { + key_list.push(parseInt(item.key)) + }) + if (roundLength !== lastKey) { + let cha = lastKey - roundLength + return lastKey - cha - 1 + } else { + return roundLength + } } } }) diff --git a/cdTMP/src/utils/request.js b/cdTMP/src/utils/request.js index 304ba16..5fe9090 100644 --- a/cdTMP/src/utils/request.js +++ b/cdTMP/src/utils/request.js @@ -28,7 +28,7 @@ function createService() { !/^application\/json/.test(response.headers["content-type"])) && response.status === 200 ) { - return response + return response.data } else if (response.data.size) { response.data.code = 500 response.data.message = "服务器内部错误" diff --git a/cdTMP/src/views/dashboard/usermanage/index.vue b/cdTMP/src/views/dashboard/usermanage/index.vue index bd5443d..da923e8 100644 --- a/cdTMP/src/views/dashboard/usermanage/index.vue +++ b/cdTMP/src/views/dashboard/usermanage/index.vue @@ -149,8 +149,8 @@ const crudRef = ref() const crudOptions = reactive({ // 顶部每行显示列数 searchColNumber: 3, - // 开启分页 - tablePagination: true, + // 不开启table的分页,但开启我们自己的分页器 + tablePagination: false, // 是否显示索引列 showIndex: false, // 行选择器 @@ -222,7 +222,6 @@ const crudColumns = reactive([ title: "邮箱", align: "center", dataIndex: "email", - search: true, width: 100, commonRules: [{ type: "email", message: "请输入正确的邮箱" }] }, diff --git a/cdTMP/src/views/project/case/index.vue b/cdTMP/src/views/project/case/index.vue index 8e60ef5..c5cf332 100644 --- a/cdTMP/src/views/project/case/index.vue +++ b/cdTMP/src/views/project/case/index.vue @@ -34,7 +34,7 @@ const crudOptions = ref({ edit: { show: true }, delete: { show: true }, searchColNumber: 3, - tablePagination: true, + tablePagination: false, operationColumn: true, scroll: { x: "100%", y: "100%" }, formOption: { diff --git a/cdTMP/src/views/project/design-demand/index.vue b/cdTMP/src/views/project/design-demand/index.vue index d4318fa..08805b6 100644 --- a/cdTMP/src/views/project/design-demand/index.vue +++ b/cdTMP/src/views/project/design-demand/index.vue @@ -32,7 +32,7 @@ const crudOptions = ref({ edit: { show: true, api: testDemandApi.editTestDemand }, delete: { show: true }, searchColNumber: 3, - tablePagination: true, + tablePagination: false, operationColumn: true, formOption: { width: 1200 diff --git a/cdTMP/src/views/project/dut/index.vue b/cdTMP/src/views/project/dut/index.vue index ddddca1..8fb51c8 100644 --- a/cdTMP/src/views/project/dut/index.vue +++ b/cdTMP/src/views/project/dut/index.vue @@ -29,7 +29,7 @@ const crudOptions = ref({ edit: { show: true, api: designDemandApi.editDesignDemand }, delete: { show: true }, searchColNumber: 3, - tablePagination: true, + tablePagination: false, operationColumn: true, operationColumnAlign:'center', formOption: { @@ -42,7 +42,6 @@ const crudColumns = ref([ align:'center', width: 50, dataIndex: "id", - search: true, commonRules: [{ required: true, message: "标识是必填" }], validateTrigger: "blur" }, diff --git a/cdTMP/src/views/project/round/index.vue b/cdTMP/src/views/project/round/index.vue index a80ad2e..fe52e61 100644 --- a/cdTMP/src/views/project/round/index.vue +++ b/cdTMP/src/views/project/round/index.vue @@ -62,7 +62,7 @@ const crudOptions = ref({ edit: { show: true }, delete: { show: true }, searchColNumber: 3, - tablePagination: true, + tablePagination: false, operationColumn: true, operationColumnAlign: "center", formOption: { @@ -83,7 +83,6 @@ const crudColumns = ref([ width: 50, align: "center", dataIndex: "id", - search: true, commonRules: [{ required: true, message: "ID是必填" }], validateTrigger: "blur" }, diff --git a/cdTMP/src/views/project/testDemand/index.vue b/cdTMP/src/views/project/testDemand/index.vue index 4757dd5..9ee9acb 100644 --- a/cdTMP/src/views/project/testDemand/index.vue +++ b/cdTMP/src/views/project/testDemand/index.vue @@ -33,7 +33,7 @@ const crudOptions = ref({ edit: { show: true }, delete: { show: true }, searchColNumber: 3, - tablePagination: true, + tablePagination: false, operationColumn: true, formOption: { width: 1200, diff --git a/cdTMP/src/views/testmanage/projmanage/index.vue b/cdTMP/src/views/testmanage/projmanage/index.vue index c211357..13f5ffe 100644 --- a/cdTMP/src/views/testmanage/projmanage/index.vue +++ b/cdTMP/src/views/testmanage/projmanage/index.vue @@ -27,7 +27,7 @@ const crudOptions = ref({ edit: { show: true,api: projectApi.update}, delete: { show: true ,api:projectApi.delete}, searchColNumber: 3, - tablePagination: true, + tablePagination: false, operationColumn: true, operationWidth: 500, showIndex: false, @@ -193,7 +193,7 @@ const crudColumns = ref([ search: true, commonRules: [{ required: true, message: "责任人必选" }], 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: "成员", @@ -202,7 +202,7 @@ const crudColumns = ref([ search: true, formType: "select", 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: "成员至少选择一个" }] }, {