feat: web知识库设置
This commit is contained in:
parent
d0ca56d9fe
commit
65136549be
@ -82,7 +82,7 @@ const postDateset: (data: datasetData, loading?: Ref<boolean>) => Promise<Result
|
|||||||
* {
|
* {
|
||||||
"name": "string",
|
"name": "string",
|
||||||
"desc": "string",
|
"desc": "string",
|
||||||
"url": "string",
|
"source_url": "string",
|
||||||
"selector": "string",
|
"selector": "string",
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -32,11 +32,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</el-card>
|
</el-card>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="Web 根地址" prop="url" v-if="detail.type === '1'">
|
<el-form-item label="Web 根地址" prop="source_url" v-if="detail.type === '1'">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="form.url"
|
v-model="form.source_url"
|
||||||
placeholder="请输入 Web 根地址"
|
placeholder="请输入 Web 根地址"
|
||||||
@blur="form.url = form.url.trim()"
|
@blur="form.source_url = form.source_url.trim()"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="选择器" v-if="detail.type === '1'">
|
<el-form-item label="选择器" v-if="detail.type === '1'">
|
||||||
@ -97,12 +97,12 @@ const detail = ref<any>({})
|
|||||||
const application_list = ref<Array<ApplicationFormType>>([])
|
const application_list = ref<Array<ApplicationFormType>>([])
|
||||||
const application_id_list = ref([])
|
const application_id_list = ref([])
|
||||||
const form = ref<any>({
|
const form = ref<any>({
|
||||||
url: '',
|
source_url: '',
|
||||||
selector: ''
|
selector: ''
|
||||||
})
|
})
|
||||||
|
|
||||||
const rules = reactive({
|
const rules = reactive({
|
||||||
url: [{ required: true, message: '请输入 Web 根地址', trigger: 'blur' }]
|
source_url: [{ required: true, message: '请输入 Web 根地址', trigger: 'blur' }]
|
||||||
})
|
})
|
||||||
|
|
||||||
async function submit() {
|
async function submit() {
|
||||||
@ -110,10 +110,16 @@ async function submit() {
|
|||||||
await webFormRef.value.validate((valid: any) => {
|
await webFormRef.value.validate((valid: any) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
const obj = {
|
const obj =
|
||||||
application_id_list: application_id_list.value,
|
detail.value.type === '1'
|
||||||
...BaseFormRef.value.form
|
? {
|
||||||
}
|
...BaseFormRef.value.form,
|
||||||
|
...form.value
|
||||||
|
}
|
||||||
|
: {
|
||||||
|
application_id_list: application_id_list.value,
|
||||||
|
...BaseFormRef.value.form
|
||||||
|
}
|
||||||
datasetApi
|
datasetApi
|
||||||
.putDateset(id, obj)
|
.putDateset(id, obj)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
@ -131,6 +137,10 @@ async function submit() {
|
|||||||
function getDetail() {
|
function getDetail() {
|
||||||
dataset.asyncGetDatesetDetail(id, loading).then((res: any) => {
|
dataset.asyncGetDatesetDetail(id, loading).then((res: any) => {
|
||||||
detail.value = res.data
|
detail.value = res.data
|
||||||
|
if (detail.value.type === '1') {
|
||||||
|
form.value = res.data.meta
|
||||||
|
}
|
||||||
|
|
||||||
application_id_list.value = res.data?.application_id_list
|
application_id_list.value = res.data?.application_id_list
|
||||||
datasetApi.listUsableApplication(id, loading).then((ok) => {
|
datasetApi.listUsableApplication(id, loading).then((ok) => {
|
||||||
application_list.value = ok.data
|
application_list.value = ok.data
|
||||||
|
|||||||
@ -43,11 +43,11 @@
|
|||||||
</el-row>
|
</el-row>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="Web 根地址" prop="url" v-if="form.type === '1'">
|
<el-form-item label="Web 根地址" prop="source_url" v-if="form.type === '1'">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="form.url"
|
v-model="form.source_url"
|
||||||
placeholder="请输入 Web 根地址"
|
placeholder="请输入 Web 根地址"
|
||||||
@blur="form.url = form.url.trim()"
|
@blur="form.source_url = form.source_url.trim()"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="选择器" v-if="form.type === '1'">
|
<el-form-item label="选择器" v-if="form.type === '1'">
|
||||||
@ -88,12 +88,12 @@ const loading = ref(false)
|
|||||||
|
|
||||||
const form = ref<any>({
|
const form = ref<any>({
|
||||||
type: '0',
|
type: '0',
|
||||||
url: '',
|
source_url: '',
|
||||||
selector: ''
|
selector: ''
|
||||||
})
|
})
|
||||||
|
|
||||||
const rules = reactive({
|
const rules = reactive({
|
||||||
url: [{ required: true, message: '请输入 Web 根地址', trigger: 'blur' }]
|
source_url: [{ required: true, message: '请输入 Web 根地址', trigger: 'blur' }]
|
||||||
})
|
})
|
||||||
|
|
||||||
watch(form.value, (value) => {
|
watch(form.value, (value) => {
|
||||||
@ -106,7 +106,7 @@ watch(form.value, (value) => {
|
|||||||
|
|
||||||
function radioChange() {
|
function radioChange() {
|
||||||
dataset.saveDocumentsFile([])
|
dataset.saveDocumentsFile([])
|
||||||
form.value.url = ''
|
form.value.source_url = ''
|
||||||
form.value.selector = ''
|
form.value.selector = ''
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user