|
|
|
@ -41,12 +41,18 @@
|
|
|
|
|
<el-table-column label="文件名称" align="center" prop="name" />
|
|
|
|
|
<el-table-column label="类型" align="center">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
{{ fileTypeMap[scope.row.lx] || scope.row.lx }}
|
|
|
|
|
<a v-if="scope.row.lx === '3'" :href="scope.row.wz" target="_blank"
|
|
|
|
|
style="color: #409EFF; text-decoration: underline;">
|
|
|
|
|
{{ fileTypeMap[scope.row.lx] || scope.row.lx }}
|
|
|
|
|
</a>
|
|
|
|
|
<span v-else>
|
|
|
|
|
{{ fileTypeMap[scope.row.lx] || scope.row.lx }}
|
|
|
|
|
</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="附件" align="center" prop="fj">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
{{ getFileName(scope.row.fj) }}
|
|
|
|
|
{{ getFileName(scope.row.fj) || "未上传" }}
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="上传用户" align="center" prop="scyh" />
|
|
|
|
@ -59,7 +65,7 @@
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
|
|
|
|
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
|
|
|
|
|
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.current" :limit.sync="queryParams.size"
|
|
|
|
|
@pagination="getList" />
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
@ -70,14 +76,22 @@
|
|
|
|
|
<el-input v-model="form.name" placeholder="请输入文件名称" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="类型" prop="lx">
|
|
|
|
|
<el-select v-model="form.lx" placeholder="请选择文件类型" style="width: 100%;">
|
|
|
|
|
<el-select v-model="form.lx" placeholder="请选择文件类型" style="width: 100%;" @change="handleTypeChange">
|
|
|
|
|
<el-option v-for="dict in dict.type.wjlx" :key="dict.value" :label="dict.label"
|
|
|
|
|
:value="dict.value"></el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<!-- 如果文件类型是网络信息(假设值为 4) -->
|
|
|
|
|
<el-form-item v-if="form.lx === '3'" label="网址" prop="scyh">
|
|
|
|
|
<el-input v-model="form.scsj" placeholder="请输入网址" />
|
|
|
|
|
<!-- 文件类型是网络信息 -->
|
|
|
|
|
<el-form-item v-if="form.lx === '3'" label="网址" prop="wz">
|
|
|
|
|
<el-input v-model="form.wz" placeholder="请输入网址" class="input-with-select">
|
|
|
|
|
<template slot="prepend">
|
|
|
|
|
<el-select v-model="select" style="width: 5.7rem;" @change="handleProtocolChange">
|
|
|
|
|
<el-option label="http" value="http"></el-option>
|
|
|
|
|
<el-option label="https" value="https"></el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
<span class="wangzhispan">://</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="上传用户" prop="scyh">
|
|
|
|
|
<el-input v-model="form.scyh" placeholder="请输入上传用户" />
|
|
|
|
@ -86,7 +100,10 @@
|
|
|
|
|
<el-date-picker v-model="form.scsj" type="date" placeholder="选择日期" value-format="yyyy-MM-dd"
|
|
|
|
|
style="width: 100%;" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="附件" prop="fj">
|
|
|
|
|
<el-form-item v-if="form.lx !== '3'" label="附件" prop="fj" required>
|
|
|
|
|
<fileload v-model="form.fj"></fileload>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item v-if="form.lx === '3'" label="附件" prop="fj">
|
|
|
|
|
<fileload v-model="form.fj"></fileload>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
@ -108,8 +125,8 @@
|
|
|
|
|
:value="dict.value"></el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item v-if="detailForm.lx === '3'" label="网址" prop="scyh">
|
|
|
|
|
<el-input v-model="detailForm.scsj" placeholder="请输入网址" readonly />
|
|
|
|
|
<el-form-item v-if="detailForm.lx === '3'" label="网址" prop="wz">
|
|
|
|
|
<el-input v-model="detailForm.wz" placeholder="wz" readonly />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="上传用户" prop="scyh">
|
|
|
|
|
<el-input v-model="detailForm.scyh" placeholder="请输入上传用户" />
|
|
|
|
@ -164,8 +181,8 @@ export default {
|
|
|
|
|
detailOpen: false,
|
|
|
|
|
// 查询参数
|
|
|
|
|
queryParams: {
|
|
|
|
|
pageNum: 1,
|
|
|
|
|
pageSize: 10,
|
|
|
|
|
current: 1,
|
|
|
|
|
size: 10,
|
|
|
|
|
name: undefined,
|
|
|
|
|
lx: undefined
|
|
|
|
|
},
|
|
|
|
@ -177,6 +194,7 @@ export default {
|
|
|
|
|
fj: undefined,
|
|
|
|
|
scsj: undefined,
|
|
|
|
|
scyh: undefined,
|
|
|
|
|
wz: undefined,
|
|
|
|
|
createBy: undefined,
|
|
|
|
|
createId: undefined,
|
|
|
|
|
createTime: undefined,
|
|
|
|
@ -192,6 +210,7 @@ export default {
|
|
|
|
|
fj: undefined,
|
|
|
|
|
scsj: undefined,
|
|
|
|
|
scyh: undefined,
|
|
|
|
|
wz: undefined,
|
|
|
|
|
createBy: undefined,
|
|
|
|
|
createId: undefined,
|
|
|
|
|
createTime: undefined,
|
|
|
|
@ -207,6 +226,9 @@ export default {
|
|
|
|
|
lx: [
|
|
|
|
|
{ required: true, message: "文件类型不能为空", trigger: "change" }
|
|
|
|
|
],
|
|
|
|
|
wz: [
|
|
|
|
|
{ required: true, message: "网址不能为空", trigger: "change" }
|
|
|
|
|
],
|
|
|
|
|
scyh: [
|
|
|
|
|
{ required: true, message: "上传用户不能为空", trigger: "blur" }
|
|
|
|
|
],
|
|
|
|
@ -220,14 +242,15 @@ export default {
|
|
|
|
|
2: "研究报告",
|
|
|
|
|
3: "网络信息",
|
|
|
|
|
4: "其他",
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
select: 'http' // 默认协议类型
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
|
this.getList();
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
//获取文件名字
|
|
|
|
|
// 获取文件名字
|
|
|
|
|
getFileName(filePath) {
|
|
|
|
|
if (filePath) {
|
|
|
|
|
return filePath.split('/').pop();
|
|
|
|
@ -237,7 +260,6 @@ export default {
|
|
|
|
|
|
|
|
|
|
querySearchAsync(queryString, cb) {
|
|
|
|
|
let results = [];
|
|
|
|
|
// 假设 getXmzskPage 是用于文件名称模糊查询的 API
|
|
|
|
|
getXmzskPage({ name: queryString }).then(res => {
|
|
|
|
|
res.data.records.forEach(item => {
|
|
|
|
|
results.push({
|
|
|
|
@ -274,6 +296,7 @@ export default {
|
|
|
|
|
fj: undefined,
|
|
|
|
|
scsj: undefined,
|
|
|
|
|
scyh: undefined,
|
|
|
|
|
wz: undefined,
|
|
|
|
|
createBy: undefined,
|
|
|
|
|
createId: undefined,
|
|
|
|
|
createTime: undefined,
|
|
|
|
@ -281,11 +304,12 @@ export default {
|
|
|
|
|
updateId: undefined,
|
|
|
|
|
updateTime: undefined
|
|
|
|
|
};
|
|
|
|
|
this.select = 'http'; // 重置协议类型
|
|
|
|
|
this.resetForm("form");
|
|
|
|
|
},
|
|
|
|
|
/** 搜索按钮操作 */
|
|
|
|
|
handleQuery() {
|
|
|
|
|
this.queryParams.pageNum = 1;
|
|
|
|
|
this.queryParams.current = 1;
|
|
|
|
|
this.getList();
|
|
|
|
|
},
|
|
|
|
|
/** 重置按钮操作 */
|
|
|
|
@ -310,6 +334,7 @@ export default {
|
|
|
|
|
this.reset();
|
|
|
|
|
const catalogId = row.id;
|
|
|
|
|
this.form = { ...row };
|
|
|
|
|
this.setProtocolType(this.form.wz); // 设置协议类型
|
|
|
|
|
this.open = true;
|
|
|
|
|
this.title = "修改项目知识库";
|
|
|
|
|
},
|
|
|
|
@ -357,6 +382,36 @@ export default {
|
|
|
|
|
}).catch(error => {
|
|
|
|
|
console.error('API Request Error:', error);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
// 设置协议类型
|
|
|
|
|
setProtocolType(url) {
|
|
|
|
|
if (url) {
|
|
|
|
|
if (url.startsWith('https://')) {
|
|
|
|
|
this.select = 'https';
|
|
|
|
|
} else if (url.startsWith('http://')) {
|
|
|
|
|
this.select = 'http';
|
|
|
|
|
} else {
|
|
|
|
|
this.select = 'http';
|
|
|
|
|
this.form.wz = 'http://' + url;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
this.select = 'http';
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
// 协议类型改变时更新网址
|
|
|
|
|
handleProtocolChange() {
|
|
|
|
|
if (this.form.wz && !this.form.wz.startsWith(this.select + '://')) {
|
|
|
|
|
this.form.wz = this.select + '://' + this.form.wz.replace(/(http|https):\/\//, '');
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
// 文件类型改变时重置网址
|
|
|
|
|
handleTypeChange() {
|
|
|
|
|
if (this.form.lx !== '3') {
|
|
|
|
|
this.form.wz = undefined;
|
|
|
|
|
this.select = 'http';
|
|
|
|
|
} else {
|
|
|
|
|
this.setProtocolType(this.form.wz);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|