|
@@ -45,12 +45,18 @@
|
|
|
<div class="box_content" @click="getInfo(item)">
|
|
|
<div class="header">
|
|
|
<div class="header_left">
|
|
|
- <svg-icon
|
|
|
+ <!-- <svg-icon
|
|
|
icon-class="header"
|
|
|
style="width: 34px; height: 34px"
|
|
|
- />
|
|
|
+ /> -->
|
|
|
</div>
|
|
|
<el-popover placement="bottom" trigger="hover">
|
|
|
+ <el-button
|
|
|
+ type="success"
|
|
|
+ icon="el-icon-edit"
|
|
|
+ @click="editInfo(item)"
|
|
|
+ >编辑</el-button
|
|
|
+ >
|
|
|
<el-button
|
|
|
type="danger"
|
|
|
icon="el-icon-delete"
|
|
@@ -66,15 +72,42 @@
|
|
|
</el-popover>
|
|
|
</div>
|
|
|
<div class="content">
|
|
|
- {{ item.name }}
|
|
|
+ <p style="margin: 0">{{ item.name }}</p>
|
|
|
+ <div class="content_info">{{ item.description }}</div><!-- -->
|
|
|
+ <div class="content_file">
|
|
|
+ <div class="file">
|
|
|
+ <svg-icon
|
|
|
+ icon-class="file"
|
|
|
+ style="width: 40px; height: 40px;"
|
|
|
+ />
|
|
|
+ <p>WORD</p>
|
|
|
+ <p>{{ item.word_count }}</p>
|
|
|
+ </div>
|
|
|
+ <div class="file">
|
|
|
+ <svg-icon
|
|
|
+ icon-class="file"
|
|
|
+ style="width: 40px; height: 40px;"
|
|
|
+ />
|
|
|
+ <p>EXCEL</p>
|
|
|
+ <p>{{ item.excel_count }}</p>
|
|
|
+ </div>
|
|
|
+ <div class="file">
|
|
|
+ <svg-icon
|
|
|
+ icon-class="file"
|
|
|
+ style="width: 40px; height: 40px;"
|
|
|
+ />
|
|
|
+ <p>PDF</p>
|
|
|
+ <p>{{ item.pdf_count }}</p>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
<div class="footer">
|
|
|
<div class="file">
|
|
|
- <svg-icon
|
|
|
+ <!-- <svg-icon
|
|
|
icon-class="word"
|
|
|
style="width: 18px; height: 18px; filter: grayscale(100%)"
|
|
|
/>
|
|
|
- {{ item.doc_num }}
|
|
|
+ {{ item.doc_num }} -->
|
|
|
</div>
|
|
|
<div class="date">
|
|
|
<svg-icon
|
|
@@ -92,7 +125,7 @@
|
|
|
</div>
|
|
|
<!-- 创建弹窗 -->
|
|
|
<el-dialog
|
|
|
- title="创建知识库"
|
|
|
+ :title="dialogTitle"
|
|
|
:visible.sync="dialogVisible"
|
|
|
width="30%"
|
|
|
:before-close="handleClose"
|
|
@@ -104,6 +137,16 @@
|
|
|
placeholder="请输入内容"
|
|
|
></el-input>
|
|
|
</el-form-item>
|
|
|
+ <el-form-item label="描述:" prop="description">
|
|
|
+ <el-input
|
|
|
+ show-word-limit
|
|
|
+ type="textarea"
|
|
|
+ :rows="5"
|
|
|
+ maxlength="250"
|
|
|
+ v-model="creatForm.description"
|
|
|
+ placeholder="请输入描述内容"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
</el-form>
|
|
|
<span slot="footer" class="dialog-footer">
|
|
|
<el-button @click="handleClose">取 消</el-button>
|
|
@@ -114,7 +157,12 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { listBuckets, createBucket, deleteBucket } from "@/api/knowledge";
|
|
|
+import {
|
|
|
+ listBuckets,
|
|
|
+ createBucket,
|
|
|
+ deleteBucket,
|
|
|
+ updateKbm,
|
|
|
+} from "@/api/knowledge";
|
|
|
import { mapGetters } from "vuex";
|
|
|
|
|
|
export default {
|
|
@@ -139,9 +187,13 @@ export default {
|
|
|
buckList: [],
|
|
|
visible: false,
|
|
|
dialogVisible: false,
|
|
|
+ dialogTitle: "创建知识库",
|
|
|
creatForm: {
|
|
|
+ id: null,
|
|
|
bucket_name: "",
|
|
|
- }, //知识库名称
|
|
|
+ description: "",
|
|
|
+ user_id: null,
|
|
|
+ },//知识库名称
|
|
|
creatRules: {
|
|
|
bucket_name: [
|
|
|
{ required: true, message: "请输入知识库名称", trigger: "blur" },
|
|
@@ -158,14 +210,32 @@ export default {
|
|
|
this.onSubmit();
|
|
|
},
|
|
|
methods: {
|
|
|
- /* 搜索创建模块 */
|
|
|
+ editInfo(item) {
|
|
|
+ this.dialogTitle = "编辑知识库";
|
|
|
+ this.creatForm = {
|
|
|
+ id: item.id,
|
|
|
+ bucket_name: item.name,
|
|
|
+ description: item.description,
|
|
|
+ user_id: this.$store.state.user.id,
|
|
|
+ };
|
|
|
+ this.dialogVisible = true;
|
|
|
+ },
|
|
|
+ /* 创建知识库 */
|
|
|
onCreate(e) {
|
|
|
+ this.dialogTitle = "创建知识库";
|
|
|
this.creatForm = {
|
|
|
+ id: null,
|
|
|
bucket_name: "",
|
|
|
+ description: "",
|
|
|
user_id: this.$store.state.user.id,
|
|
|
};
|
|
|
this.dialogVisible = true;
|
|
|
},
|
|
|
+ /* 关闭弹窗 */
|
|
|
+ handleClose() {
|
|
|
+ this.$refs.creatRef.resetFields();
|
|
|
+ this.dialogVisible = false;
|
|
|
+ },
|
|
|
onClose(e) {
|
|
|
this.dialogVisible = false;
|
|
|
this.onSubmit();
|
|
@@ -209,22 +279,26 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
/* 关闭弹窗 */
|
|
|
- handleClose(done) {
|
|
|
+ /* handleClose(done) {
|
|
|
this.creatForm = {};
|
|
|
done();
|
|
|
- },
|
|
|
+ }, */
|
|
|
/* 创建知识库 */
|
|
|
submitBuck() {
|
|
|
this.$refs.creatRef.validate((valid) => {
|
|
|
if (valid) {
|
|
|
- createBucket(this.creatForm).then((res) => {
|
|
|
+ const action = this.creatForm.id ? updateKbm : createBucket;
|
|
|
+ const successMessage = this.creatForm.id ? "修改成功" : "创建成功";
|
|
|
+ this.creatForm.id ? this.creatForm.name=this.creatForm.bucket_name :this.creatForm.bucket_name=this.creatForm.bucket_name ;
|
|
|
+ action(this.creatForm).then((res) => {
|
|
|
if (res.status !== 200) return;
|
|
|
this.dialogVisible = false;
|
|
|
+ this.$message.success(successMessage);
|
|
|
this.onSubmit();
|
|
|
- this.creatForm = {};
|
|
|
+ this.$refs.creatRef.resetFields();
|
|
|
});
|
|
|
} else {
|
|
|
- this.$message.error("请填写知识库名称");
|
|
|
+ this.$message.error("请填写必填项");
|
|
|
}
|
|
|
});
|
|
|
},
|