Commit 3b87c5d4 by Lyan

知识管理代码提交

parent 9f59cb6c
<template>
<el-dialog
:title="!dataForm.id ? '新增' : this.showInfo?'详情':'修改'"
:close-on-click-modal="false"
:visible.sync="visible">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="120px" >
<el-form-item label='一级分类' prop='class1id' >
<el-select v-model="dataForm.class1id" placeholder="请选择" clearable @change="getClass2List">
<el-option
v-for="item in class1List"
:key="item.knowledgecategoryid"
:label="item.description"
:value="item.knowledgecategoryid">
</el-option>
</el-select>
</el-form-item>
<el-form-item label='二级分类' prop='class2' >
<el-select v-model="dataForm.class2id" placeholder="请选择" clearable>
<el-option
v-for="item in class2List"
:key="item.knowledgecategoryid"
:label="item.description"
:value="item.knowledgecategoryid">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="标题:" prop="title">
<el-input v-model="dataForm.title" placeholder="请输入显示标题" v-show="!showInfo"></el-input>
<p v-show="showInfo">{{dataForm.title}}</p>
</el-form-item>
<el-form-item label='级别:' prop='levels'>
<el-select v-model="dataForm.levels" placeholder="请输入级别" v-show="!showInfo">
<el-option
v-for="item in levelList"
:key="item"
:label="item"
:value="item">
</el-option>
</el-select>
<p v-show="showInfo">{{dataForm.level}}</p>
</el-form-item>
<el-form-item label="跳转至:" prop="directpath">
<el-input v-model="dataForm.directpath" placeholder="请输入跳转地址" v-show="!showInfo"></el-input>
<p v-show="showInfo">{{dataForm.directpath}}</p>
</el-form-item>
<el-form-item label="内容:" prop="content" >
<Ueditor @ready="editorReady" :value="ueditor.value" :config="ueditor.config" ref="ue" v-show="!showInfo"></Ueditor>
<!-- <el-input v-model="dataForm.content" placeholder="请输入内容"></el-input> -->
<div v-show="showInfo" v-html="dataForm.content"></div>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer" v-show="!showInfo">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</span>
</el-dialog>
</template>
<script>
import Ueditor from '../temps/ueditor'
export default {
components: {
Ueditor
},
props: ['class1List'],
data () {
return {
loading: false,
visible: false,
showInfo: false,
defaultProps: {
children: 'children',
label: 'label'
},
dataForm: {
id: 0,
title: '',
levels: '',
class1id: '',
class2id: '',
directpath: '',
content: ''
},
dataRule: {
// title: [
// { required: true, message: '不能为空', trigger: 'blur' }
// ],
// levels: [
// { required: true, message: '不能为空', trigger: 'blur' }
// ]
},
ueditor: {
value: '',
config: {}
},
levelList: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
id: [],
title: '',
class2List: []
}
},
created () {
},
mounted () {
},
methods: {
init (id, showInfo) {
this.dataForm.id = id || 0
this.visible = true
this.showInfo = showInfo
this.$nextTick(() => {
this.clearInp()
if (this.dataForm.id) {
this.$http({
url: this.$http.adornUrl(`/office/knowledgeinfo/info/${this.dataForm.id}`),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
this.loading = false
if (data && data.code === 0) {
this.dataForm = data.data
this.ueditor.value = this.dataForm.content
this.dataForm.class1id = Number(data.data.class1id)
this.getClass2List()
this.dataForm.class2id = Number(data.data.class2id)
this.dataForm.id = data.data.knowledgeinfoid
} else {
this.$message.error(data.msg)
}
})
}
})
},
// 更新父子组件内容
editorReady (instance) {
instance.setContent(this.dataForm.content)
instance.addListener('contentChange', () => {
this.dataForm.content = instance.getContent()
})
},
// 表单提交
dataFormSubmit () {
this.loading = true
this.$refs['dataForm'].validate((valid) => {
if (valid) {
console.log(this.dataForm.id)
this.$http({
url: this.$http.adornUrl(`/office/knowledgeinfo/${!this.dataForm.id ? 'save' : 'update'}`),
method: 'post',
data: this.$http.adornData({
'id': this.dataForm.id || undefined,
'title': this.dataForm.title,
'levels': this.dataForm.levels,
'directpath': this.dataForm.directpath,
'content': this.dataForm.content,
'knowledgecategoryid': this.dataForm.class2id
})
}).then(({data}) => {
this.loading = false
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
} else {
this.$message.error(data.msg)
}
})
}
})
},
// 获取二级分类
getClass2List () {
this.$http({
url: this.$http.adornUrl('/office/knowledgecategory/getSecondLevelCategory'),
method: 'post',
data: this.$http.adornData({
parentcategoryid: this.dataForm.class1id
})
}).then(({data}) => {
if (data && data.code === 0) {
this.class2List = data.data
} else {
this.class2List = []
}
})
},
clearInp () {
this.$refs['dataForm'].resetFields()
this.dialogVisible = false
this.ueditor.value = ''
}
}
}
</script>
...@@ -3,33 +3,42 @@ ...@@ -3,33 +3,42 @@
:title="!dataForm.branchCode ? '新增' : '修改'" :title="!dataForm.branchCode ? '新增' : '修改'"
:close-on-click-modal="false" :close-on-click-modal="false"
:visible.sync="visible"> :visible.sync="visible">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px"> <el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="120px">
<el-form-item label="${column.comments}" prop="branchName"> <el-form-item label="分支机构代码:" prop="branchCode">
<el-input v-model="dataForm.branchName" placeholder="${column.comments}"></el-input> <el-input v-model="dataForm.branchCode" placeholder="请输入" disabled></el-input>
</el-form-item> </el-form-item>
<el-form-item label="${column.comments}" prop="branchAddress"> <el-form-item label="分支机构名称:" prop="branchName">
<el-input v-model="dataForm.branchAddress" placeholder="${column.comments}"></el-input> <el-input v-model="dataForm.branchName" placeholder="请输入" disabled></el-input>
</el-form-item> </el-form-item>
<el-form-item label="${column.comments}" prop="branchPostcode"> <el-form-item label="所在地:" prop="branchSimname">
<el-input v-model="dataForm.branchPostcode" placeholder="${column.comments}"></el-input> <el-input v-model="dataForm.branchSimname" placeholder="请输入" disabled></el-input>
</el-form-item> </el-form-item>
<el-form-item label="${column.comments}" prop="branchContact"> <el-form-item label="地址:" prop="branchAddress">
<el-input v-model="dataForm.branchContact" placeholder="${column.comments}"></el-input> <el-input v-model="dataForm.branchAddress" placeholder="请输入" disabled></el-input>
</el-form-item> </el-form-item>
<el-form-item label="${column.comments}" prop="tel1"> <el-form-item label="电话:" prop="tel1">
<el-input v-model="dataForm.tel1" placeholder="${column.comments}"></el-input> <el-input v-model="dataForm.tel1" placeholder="请输入" disabled></el-input>
</el-form-item> </el-form-item>
<el-form-item label="${column.comments}" prop="tel2"> <el-form-item label="邮编:" prop="branchPostcode">
<el-input v-model="dataForm.tel2" placeholder="${column.comments}"></el-input> <el-input v-model="dataForm.branchPostcode" placeholder="请输入" disabled></el-input>
</el-form-item> </el-form-item>
<el-form-item label="${column.comments}" prop="fax"> <el-form-item label="联系人:" prop="branchContact">
<el-input v-model="dataForm.fax" placeholder="${column.comments}"></el-input> <el-input v-model="dataForm.branchContact" placeholder="请输入" disabled></el-input>
</el-form-item> </el-form-item>
<el-form-item label="${column.comments}" prop="rockkey"> <el-form-item label="传真:" prop="fax">
<el-input v-model="dataForm.rockkey" placeholder="${column.comments}"></el-input> <el-input v-model="dataForm.fax" placeholder="请输入" disabled></el-input>
</el-form-item> </el-form-item>
<el-form-item label="${column.comments}" prop="branchSimname"> <el-form-item label="邮箱:" prop="mail">
<el-input v-model="dataForm.branchSimname" placeholder="${column.comments}"></el-input> <el-input v-model="dataForm.mail" placeholder="请输入"></el-input>
</el-form-item>
<el-form-item label="网址:" prop="website">
<el-input v-model="dataForm.website" placeholder="请输入"></el-input>
</el-form-item>
<el-form-item label="分支机构简介:" prop="description">
<el-input v-model="dataForm.description" rows="5" placeholder="请输入" type="textarea"></el-input>
</el-form-item>
<el-form-item label="分支机构描述:" prop="addressDescription">
<el-input v-model="dataForm.addressDescription" rows="5" placeholder="请输入" type="textarea"></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
...@@ -54,36 +63,15 @@ ...@@ -54,36 +63,15 @@
tel2: '', tel2: '',
fax: '', fax: '',
rockkey: '', rockkey: '',
branchSimname: '' branchSimname: '',
mail: '',
website: '',
description: '',
addressDescription: ''
}, },
dataRule: { dataRule: {
branchName: [
{ required: true, message: '${column.comments}不能为空', trigger: 'blur' }
],
branchAddress: [
{ required: true, message: '${column.comments}不能为空', trigger: 'blur' }
],
branchPostcode: [
{ required: true, message: '${column.comments}不能为空', trigger: 'blur' }
],
branchContact: [
{ required: true, message: '${column.comments}不能为空', trigger: 'blur' }
],
tel1: [
{ required: true, message: '${column.comments}不能为空', trigger: 'blur' }
],
tel2: [
{ required: true, message: '${column.comments}不能为空', trigger: 'blur' }
],
fax: [
{ required: true, message: '${column.comments}不能为空', trigger: 'blur' }
],
rockkey: [
{ required: true, message: '${column.comments}不能为空', trigger: 'blur' }
],
branchSimname: [
{ required: true, message: '${column.comments}不能为空', trigger: 'blur' }
]
} }
} }
}, },
...@@ -100,15 +88,7 @@ ...@@ -100,15 +88,7 @@
params: this.$http.adornParams() params: this.$http.adornParams()
}).then(({data}) => { }).then(({data}) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.dataForm.branchName = data.branch.branchName this.dataForm = data.data
this.dataForm.branchAddress = data.branch.branchAddress
this.dataForm.branchPostcode = data.branch.branchPostcode
this.dataForm.branchContact = data.branch.branchContact
this.dataForm.tel1 = data.branch.tel1
this.dataForm.tel2 = data.branch.tel2
this.dataForm.fax = data.branch.fax
this.dataForm.rockkey = data.branch.rockkey
this.dataForm.branchSimname = data.branch.branchSimname
} }
}) })
} }
...@@ -119,19 +99,15 @@ ...@@ -119,19 +99,15 @@
this.$refs['dataForm'].validate((valid) => { this.$refs['dataForm'].validate((valid) => {
if (valid) { if (valid) {
this.$http({ this.$http({
url: this.$http.adornUrl(`/manage/branch/${!this.dataForm.branchCode ? 'save' : 'update'}`), url: this.$http.adornUrl(`/office/branch/update`),
method: 'post', method: 'post',
data: this.$http.adornData({ data: this.$http.adornData({
'branchCode': this.dataForm.branchCode || undefined, 'id': this.dataForm.branchCode,
'branchName': this.dataForm.branchName, 'title': this.dataForm.branchName,
'branchAddress': this.dataForm.branchAddress, 'mail': this.dataForm.mail,
'branchPostcode': this.dataForm.branchPostcode, 'website': this.dataForm.website,
'branchContact': this.dataForm.branchContact, 'description': this.dataForm.description,
'tel1': this.dataForm.tel1, 'addressDescription': this.dataForm.addressDescription
'tel2': this.dataForm.tel2,
'fax': this.dataForm.fax,
'rockkey': this.dataForm.rockkey,
'branchSimname': this.dataForm.branchSimname
}) })
}).then(({data}) => { }).then(({data}) => {
if (data && data.code === 0) { if (data && data.code === 0) {
......
<template> <template>
<div class="mod-config"> <div class="mod-config">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()"> <el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item> <el-form-item label="分支机构名称">
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input> <el-input v-model="dataForm.branchName" placeholder="请输入分支机构名称" clearable></el-input>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button @click="getDataList()">查询</el-button> <el-button @click="getDataList()" type="primary">查询</el-button>
<el-button v-if="isAuth('manage:branch:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button> <el-button v-if="isAuth('manage:branch:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
<el-button v-if="isAuth('manage:branch:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button> <el-button v-if="isAuth('manage:branch:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button>
</el-form-item> </el-form-item>
...@@ -17,70 +17,34 @@ ...@@ -17,70 +17,34 @@
@selection-change="selectionChangeHandle" @selection-change="selectionChangeHandle"
style="width: 100%;"> style="width: 100%;">
<el-table-column <el-table-column
type="selection"
header-align="center"
align="center"
width="50">
</el-table-column>
<el-table-column
prop="branchCode" prop="branchCode"
header-align="center" header-align="center"
align="center" align="center"
label="${column.comments}"> label="分支机构代码">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="branchName" prop="branchName"
header-align="center" header-align="center"
align="center" align="center"
label="${column.comments}"> label="分支机构名称">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="branchAddress" prop="branchSimname"
header-align="center"
align="center"
label="${column.comments}">
</el-table-column>
<el-table-column
prop="branchPostcode"
header-align="center"
align="center"
label="${column.comments}">
</el-table-column>
<el-table-column
prop="branchContact"
header-align="center" header-align="center"
align="center" align="center"
label="${column.comments}"> label="所在城市">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="tel1" prop="tel1"
header-align="center" header-align="center"
align="center" align="center"
label="${column.comments}"> label="电话">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="tel2" prop="branchPostcode"
header-align="center"
align="center"
label="${column.comments}">
</el-table-column>
<el-table-column
prop="fax"
header-align="center"
align="center"
label="${column.comments}">
</el-table-column>
<el-table-column
prop="rockkey"
header-align="center"
align="center"
label="${column.comments}">
</el-table-column>
<el-table-column
prop="branchSimname"
header-align="center" header-align="center"
align="center" align="center"
label="${column.comments}"> label="邮编">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
fixed="right" fixed="right"
...@@ -114,7 +78,7 @@ ...@@ -114,7 +78,7 @@
data () { data () {
return { return {
dataForm: { dataForm: {
key: '' branchName: ''
}, },
dataList: [], dataList: [],
pageIndex: 1, pageIndex: 1,
...@@ -137,11 +101,11 @@ ...@@ -137,11 +101,11 @@
this.dataListLoading = true this.dataListLoading = true
this.$http({ this.$http({
url: this.$http.adornUrl('/office/branch/list'), url: this.$http.adornUrl('/office/branch/list'),
method: 'get', method: 'post',
params: this.$http.adornParams({ data: this.$http.adornData({
'page': this.pageIndex, 'page': this.pageIndex,
'limit': this.pageSize, 'limit': this.pageSize,
'key': this.dataForm.key 'branchName': this.dataForm.branchName
}) })
}).then(({data}) => { }).then(({data}) => {
if (data && data.code === 0) { if (data && data.code === 0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment