|
@@ -4,15 +4,24 @@
|
|
:title="formTitle"
|
|
:title="formTitle"
|
|
:close-on-click-modal="false"
|
|
:close-on-click-modal="false"
|
|
v-dialogDrag
|
|
v-dialogDrag
|
|
- width="1300px"
|
|
|
|
|
|
+ width="1200px"
|
|
@close="close"
|
|
@close="close"
|
|
:visible.sync="visible">
|
|
:visible.sync="visible">
|
|
<el-form size="middle" :model="inputForm" ref="inputForm" v-loading="loading" :class="method==='view'?'readonly':''" :disabled="method === 'view'"
|
|
<el-form size="middle" :model="inputForm" ref="inputForm" v-loading="loading" :class="method==='view'?'readonly':''" :disabled="method === 'view'"
|
|
- label-width="150px" @submit.native.prevent>
|
|
|
|
|
|
+ label-width="90px" @submit.native.prevent>
|
|
<el-row :gutter="15">
|
|
<el-row :gutter="15">
|
|
|
|
|
|
<el-col :span="24">
|
|
<el-col :span="24">
|
|
- <el-form-item label="知识分享类型" prop="typeId"
|
|
|
|
|
|
+ <el-form-item label="主题" prop="title"
|
|
|
|
+ :rules="[
|
|
|
|
+ {required: true, message:'主题不能为空', trigger:'blur'}
|
|
|
|
+ ]">
|
|
|
|
+ <el-input v-model="inputForm.title" placeholder="请填写主题"></el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+
|
|
|
|
+ <el-col :span="24">
|
|
|
|
+ <el-form-item label="类型" prop="typeId"
|
|
:rules="[
|
|
:rules="[
|
|
{required: true, message:'分享类型不能为空', trigger:'blur'}
|
|
{required: true, message:'分享类型不能为空', trigger:'blur'}
|
|
]">
|
|
]">
|
|
@@ -26,21 +35,16 @@
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
- <el-col :span="24">
|
|
|
|
- <el-form-item label="主题" prop="title"
|
|
|
|
- :rules="[
|
|
|
|
- {required: true, message:'主题不能为空', trigger:'blur'}
|
|
|
|
- ]">
|
|
|
|
- <el-input v-model="inputForm.title" placeholder="请填写主题"></el-input>
|
|
|
|
- </el-form-item>
|
|
|
|
- </el-col>
|
|
|
|
|
|
|
|
<el-col>
|
|
<el-col>
|
|
<el-form-item label="内容" prop="detail"
|
|
<el-form-item label="内容" prop="detail"
|
|
:rules="[
|
|
:rules="[
|
|
{required: true, message:'内容不能为空', trigger:'blur'}
|
|
{required: true, message:'内容不能为空', trigger:'blur'}
|
|
]">
|
|
]">
|
|
- <WangEditor ref="contentEditor" v-model="inputForm.detail"/>
|
|
|
|
|
|
+ <WangEditor ref="contentEditor" v-model="inputForm.detail"
|
|
|
|
+ @getUrl="(url, lsUrl) => {
|
|
|
|
+ inputForm.editorFilesDTOList.push({temporaryUrl: lsUrl, url: url});
|
|
|
|
+ }"/>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
</el-row>
|
|
</el-row>
|
|
@@ -156,7 +160,8 @@
|
|
visits: [],
|
|
visits: [],
|
|
comments: [],
|
|
comments: [],
|
|
files: [],
|
|
files: [],
|
|
- content: ''
|
|
|
|
|
|
+ content: '',
|
|
|
|
+ editorFilesDTOList: []
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
},
|
|
@@ -177,6 +182,9 @@
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
init (method, id) {
|
|
init (method, id) {
|
|
|
|
+ this.knowledgeShareTypeService.list().then(({data}) => {
|
|
|
|
+ this.typeList = data.records
|
|
|
|
+ })
|
|
this.method = method
|
|
this.method = method
|
|
this.inputForm = {
|
|
this.inputForm = {
|
|
id: '',
|
|
id: '',
|
|
@@ -187,7 +195,8 @@
|
|
visits: [],
|
|
visits: [],
|
|
comments: [],
|
|
comments: [],
|
|
files: [],
|
|
files: [],
|
|
- content: ''
|
|
|
|
|
|
+ content: '',
|
|
|
|
+ editorFilesDTOList: []
|
|
}
|
|
}
|
|
if (method === 'add') {
|
|
if (method === 'add') {
|
|
this.formTitle = `新建知识分享`
|
|
this.formTitle = `新建知识分享`
|
|
@@ -245,11 +254,11 @@
|
|
if (this.commonJS.isEmpty(this.inputForm.files)) {
|
|
if (this.commonJS.isEmpty(this.inputForm.files)) {
|
|
this.inputForm.files = []
|
|
this.inputForm.files = []
|
|
}
|
|
}
|
|
|
|
+ this.getEditorFilesDTOList()
|
|
this.inputForm.files = this.$refs.uploadComponent.getDataList()
|
|
this.inputForm.files = this.$refs.uploadComponent.getDataList()
|
|
this.knowledgeShareInfoService.save(this.inputForm).then(({data}) => {
|
|
this.knowledgeShareInfoService.save(this.inputForm).then(({data}) => {
|
|
this.close()
|
|
this.close()
|
|
this.$message.success(data)
|
|
this.$message.success(data)
|
|
- this.$emit('refreshDataList')
|
|
|
|
this.loading = false
|
|
this.loading = false
|
|
}).catch(() => {
|
|
}).catch(() => {
|
|
this.loading = false
|
|
this.loading = false
|
|
@@ -258,11 +267,24 @@
|
|
})
|
|
})
|
|
},
|
|
},
|
|
close () {
|
|
close () {
|
|
|
|
+ this.inputForm = {
|
|
|
|
+ id: '',
|
|
|
|
+ typeId: '',
|
|
|
|
+ typeName: '',
|
|
|
|
+ title: '',
|
|
|
|
+ detail: '',
|
|
|
|
+ visits: [],
|
|
|
|
+ comments: [],
|
|
|
|
+ files: [],
|
|
|
|
+ content: '',
|
|
|
|
+ editorFilesDTOList: []
|
|
|
|
+ }
|
|
this.$refs.inputForm.resetFields()
|
|
this.$refs.inputForm.resetFields()
|
|
this.$refs.uploadComponent.clearUpload()
|
|
this.$refs.uploadComponent.clearUpload()
|
|
// 富文本处理
|
|
// 富文本处理
|
|
this.$refs.contentEditor.clear()
|
|
this.$refs.contentEditor.clear()
|
|
this.visible = false
|
|
this.visible = false
|
|
|
|
+ this.$emit('refreshDataList')
|
|
},
|
|
},
|
|
pushComment () {
|
|
pushComment () {
|
|
if (this.commonJS.isEmpty(this.inputForm.content)) {
|
|
if (this.commonJS.isEmpty(this.inputForm.content)) {
|
|
@@ -300,6 +322,21 @@
|
|
this.inputForm.typeId = rows[0].id
|
|
this.inputForm.typeId = rows[0].id
|
|
this.inputForm.typeName = rows[0].klgsType
|
|
this.inputForm.typeName = rows[0].klgsType
|
|
this.$forceUpdate()
|
|
this.$forceUpdate()
|
|
|
|
+ },
|
|
|
|
+ getEditorFilesDTOList () {
|
|
|
|
+ let a = []
|
|
|
|
+ if (this.commonJS.isNotEmpty(this.inputForm.editorFilesDTOList)) {
|
|
|
|
+ this.inputForm.detail = this.inputForm.detail.replace(/&/g, '&')
|
|
|
|
+ this.inputForm.editorFilesDTOList.forEach((item) => {
|
|
|
|
+ if (this.inputForm.detail.includes(item.temporaryUrl)) {
|
|
|
|
+ a.push(item)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ this.inputForm.editorFilesDTOList = []
|
|
|
|
+ a.forEach((item) => {
|
|
|
|
+ this.inputForm.editorFilesDTOList.push(item)
|
|
|
|
+ })
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|