提交 ac54cbdd authored 作者: lidongxu's avatar lidongxu

refactor(supply/index.vue): 修复表格宽度问题_新增编辑删除自定义分组对接接口

同上
上级 abed4ffc
...@@ -38,3 +38,11 @@ export function editReportGroupAPI(data) { ...@@ -38,3 +38,11 @@ export function editReportGroupAPI(data) {
data data
}) })
} }
// 删除自定义分组
export function deleteReportGroupAPI(groupId) {
return request({
url: `/report/customer/core/group/delete?groupId=${groupId}`,
method: 'DELETE'
})
}
\ No newline at end of file
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
<el-input v-else <el-input v-else
v-model="group.groupName" v-model="group.groupName"
ref="groupNameRef" ref="groupNameRef"
@blur="blue"></el-input> @blur="groupNameBlur(group)"></el-input>
</div> </div>
<div class="card-header-right"> <div class="card-header-right">
<el-button type="primary" <el-button type="primary"
...@@ -125,7 +125,7 @@ ...@@ -125,7 +125,7 @@
</template> </template>
<script setup> <script setup>
import { getReportListAPI, getReportListBySelfAPI, getReportListByGroupAPI, addReportGroupAPI, editReportGroupAPI } from '@/api' import { getReportListAPI, getReportListBySelfAPI, getReportListByGroupAPI, addReportGroupAPI, editReportGroupAPI, deleteReportGroupAPI } from '@/api'
import draggable from 'vuedraggable' import draggable from 'vuedraggable'
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
const visible = ref(false) const visible = ref(false)
...@@ -162,13 +162,23 @@ const groupChange = async (e) => { ...@@ -162,13 +162,23 @@ const groupChange = async (e) => {
} }
getReportList() getReportList()
// 修改分组名 // 修改分组名-触发
const changeGroupName = (group) => { const changeGroupName = (group) => {
group.showEdit = true group.showEdit = true
nextTick(() => { nextTick(() => {
proxy.$refs['groupNameRef'][0].focus() proxy.$refs['groupNameRef'][0].focus()
}) })
} }
// 修改分组名-确认
const groupNameBlur = async (group) => {
group.showEdit = false
await editReportGroupAPI({
groupId: group.groupId,
groupName: group.groupName,
categoryName: '供应链报表'
})
}
// 删除分组 // 删除分组
const removeGroupName = (group) => { const removeGroupName = (group) => {
// 判断组内还有下属表,给提示不让删除 // 判断组内还有下属表,给提示不让删除
...@@ -177,8 +187,9 @@ const removeGroupName = (group) => { ...@@ -177,8 +187,9 @@ const removeGroupName = (group) => {
return return
} }
// 确认删除吗? // 确认删除吗?
proxy.$modal.confirm('确认删除分组"' + group.groupName + '"?删除后下属报表自动回到左侧列表中').then(async () => { proxy.$modal.confirm('确认删除分组"' + group.groupName + '"?').then(async () => {
// 把当前分组的报表放到左侧 // 把当前分组的报表放到左侧
await deleteReportGroupAPI(group.groupId)
reportList.value = reportList.value.concat(group.items) reportList.value = reportList.value.concat(group.items)
const index = groups.value.indexOf(group) const index = groups.value.indexOf(group)
groups.value.splice(index, 1) groups.value.splice(index, 1)
...@@ -186,12 +197,11 @@ const removeGroupName = (group) => { ...@@ -186,12 +197,11 @@ const removeGroupName = (group) => {
} }
// 新增分组 // 新增分组
const addGroups = async () => { const addGroups = async () => {
await editReportGroupAPI({
// await editReportGroupAPI({ groupName: '新分组',
// groupName: '新分组', categoryName: '供应链报表',
// categoryName: '供应链报表', items: []
// items: [] })
// })
groups.value.push({ groups.value.push({
groupName: '新分组', groupName: '新分组',
...@@ -217,12 +227,7 @@ const addGroups = async () => { ...@@ -217,12 +227,7 @@ const addGroups = async () => {
padding: 0 0 0 20px; padding: 0 0 0 20px;
.link_item { .link_item {
padding: 10px 0; padding: 10px;
width: 25%;
/* 超出宽度文字省略号 */
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
} }
} }
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论