history页面新增修改项目名字

This commit is contained in:
X1627315083
2025-11-27 10:10:28 +08:00
parent b7360d7e71
commit 9e0d1fdc9c
4 changed files with 77 additions and 6 deletions

View File

@@ -9,7 +9,7 @@
:placeholder="t('batchGeneration.Search')"
@search="searchHistoryList"
/>
<div class="history_table_content" ref="historyTable">
<div class="history_table_content" ref="historyTable" @click.stop>
<a-config-provider :locale="tableLocale">
<a-table
row-class-name="history_table_row"
@@ -28,6 +28,14 @@
}"
>
<template #bodyCell="{ column, text, record, index }">
<div class="update_name" v-if="column?.key === 'collectionName'">
<div v-if="updateName.selectIndex === index">
<input type="text" v-model="updateName.currentName">
</div>
<div v-show="updateName.selectIndex !== index">{{ record.name }}</div>
<i @click="setUpdateName(record.name,index)" v-show="updateName.selectIndex !== index" class="fi fi-rr-edit"></i>
<i @click="submitUpdateName" v-show="updateName.selectIndex === index" class="fi fi-sr-check-circle"></i>
</div>
<div class="operate_list" v-if="column?.Operations">
<div
class="operate_item"
@@ -213,6 +221,39 @@ export default defineComponent({
selectCode: selectCode,
designType: ''
}
const updateName = ref({
currentName:'',
selectIndex:-1,
})
const clearUpdateName = () => {
updateName.value.currentName = ''
updateName.value.selectIndex = -1
document.removeEventListener('click',clearUpdateName)
}
const setUpdateName = (name,index) => {
updateName.value.currentName = name
updateName.value.selectIndex = index
document.addEventListener('click',clearUpdateName)
}
const submitUpdateName = ()=>{
if(updateName.value.currentName === collectionList.value[updateName.value.selectIndex].name){
clearUpdateName()
return
}
if(updateName.value.selectIndex != -1){
if(!updateName.value.currentName)return message.info(t('HistoryPage.jsContent8'))
let data = {
id: collectionList.value[updateName.value.selectIndex].id, //library名字
name: updateName.value.currentName //history id
}
Https.axiosPost(Https.httpUrls.projectSaveOrUpdate, data)
.then(rv => {
collectionList.value[updateName.value.selectIndex].name = updateName.value.currentName
clearUpdateName()
})
.catch(res => {})
}
}
provide('type', type)
return {
store,
@@ -232,7 +273,10 @@ export default defineComponent({
tableLocale,
projectSetting,
tableSearchBar,
currentProjectPath
currentProjectPath,
updateName,
setUpdateName,
submitUpdateName,
}
},
data() {
@@ -608,6 +652,7 @@ export default defineComponent({
customTableRow(record: any) {
return {
onDblclick: () => {
if(this.updateName.selectIndex !== -1)return
this.retrieveHome(record)
}
}
@@ -726,6 +771,11 @@ export default defineComponent({
}
:deep(.ant-table-tbody > tr:hover) {
background: #ededed;
.update_name{
> .fi-rr-edit{
display: flex;
}
}
}
:deep(.ant-table-tbody > tr > td) {
border: none;
@@ -780,7 +830,26 @@ export default defineComponent({
color: #000;
}
}
.update_name{
display: flex;
align-items: center;
> div{
> input{
width: 12rem;
border-radius: .8rem;
padding-left: 1.5rem;
}
}
> i{
margin-left: 1.5rem;
cursor: pointer;
font-size: 2rem;
display: flex;
}
> .fi-rr-edit{
display: none;
}
}
.operate_list {
display: flex;
align-items: center;