|
@@ -61,7 +61,7 @@
|
|
|
<i class="circle" type="danger"></i>
|
|
|
<el-text type="danger">禁用</el-text>
|
|
|
</span>
|
|
|
- <el-switch v-model="row.status"></el-switch>
|
|
|
+ <el-switch v-model="row.status" @change="handleStatusChange(row.id,row.status)"></el-switch>
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
@@ -100,7 +100,7 @@
|
|
|
</footer>
|
|
|
<CreateKBFileDialog v-model="addFileVisible" :knowledgeBase="KBData" @updateFiles="getFilesList()" />
|
|
|
<FileViewer v-if="viewFileData.show" :fileType="viewFileData.type" :fileName="viewFileData.name"
|
|
|
- :fileUrl="viewFileData.url" :width="viewFileData.width" @closeViewer="() => viewFileData.show = false" />
|
|
|
+ :fileUrl="viewFileData.url" :width="viewFileData.width" @closeViewer="handleCloseViewer" />
|
|
|
<EditKBFileDialog v-model="editKBFileData.show" :fileTable="editKBFileData.data"
|
|
|
@updateFiles="() => { getFilesList() }" />
|
|
|
</div>
|
|
@@ -166,6 +166,34 @@ async function checkLinkValidity(index, url) {
|
|
|
filesList.value[index].isValid = false // 请求失败,返回 false
|
|
|
}
|
|
|
}
|
|
|
+// 定义处理关闭查看器的方法
|
|
|
+const handleCloseViewer = () => {
|
|
|
+ viewFileData.show = false;
|
|
|
+};
|
|
|
+// 修改状态
|
|
|
+const handleStatusChange = async (id,status) => {
|
|
|
+ console.log('handleStatusChange', status)
|
|
|
+ try{
|
|
|
+ await proxy.$http.get(api.files + `${id}/changeStatus`, { params: {
|
|
|
+ status: status
|
|
|
+ }})
|
|
|
+ ElMessage({
|
|
|
+ message: '状态修改成功',
|
|
|
+ type: 'success',
|
|
|
+ })
|
|
|
+ }
|
|
|
+ catch (e) {
|
|
|
+ console.log(e)
|
|
|
+ ElMessage({
|
|
|
+ message: '状态修改失败',
|
|
|
+ type: 'error',
|
|
|
+ })
|
|
|
+ let index = filesList.value.findIndex(item => item.id === id)
|
|
|
+ filesList.value[index].status = !status // 恢复原状态
|
|
|
+ }
|
|
|
+ // 这里可以添加逻辑来处理状态变化
|
|
|
+ // 比如发送请求到后端更新状态
|
|
|
+}
|
|
|
|
|
|
function handleBatchEditFiles() {
|
|
|
const fileTableRef = proxy.$refs['fileTableRef']
|