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>
<template>
<div class="mod-config mod-list-form">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()" label-width="80px">
<el-form-item label='标题' prop='title'>
<el-input v-model='dataForm.title' placeholder='请输入标题' clearable></el-input>
</el-form-item>
<el-form-item label='级别' prop='levels' >
<el-select v-model="dataForm.levels" placeholder="请选择" clearable>
<el-option
v-for="item in levelsList"
:key="item.value"
:label="item.name"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<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='status' >
<el-select v-model="dataForm.status" placeholder="请选择" clearable>
<el-option
v-for="item in statusList"
:key="item.value"
:label="item.name"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label='发布日期' prop='releaseDate'>
<el-date-picker
clearable
v-model="releaseDate"
type="daterange"
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="yyyy-MM-dd" >
</el-date-picker>
</el-form-item>
<el-button class="seach-btn" @click="getDataList2()" type="primary">搜索</el-button>
</el-form>
<div class="add-btn">
<el-button v-if="isAuth('manage:knowledgeinfo:save')" type="primary" @click="addOrUpdateHandle()"> + 添加</el-button>
</div>
<div class="table-list">
<el-table
:data="dataList"
v-loading="dataListLoading"
@selection-change="selectionChangeHandle"
border
style="width: 100%;">
<el-table-column
prop="levels"
header-align="center"
align="center"
width="50px"
label="级别">
</el-table-column>
<el-table-column
prop="title"
header-align="center"
align="center"
label="标题">
</el-table-column>
<el-table-column
prop="parentCategoryName"
header-align="center"
align="center"
label="一级分类">
</el-table-column>
<el-table-column
prop="categoryName"
header-align="center"
align="center"
label="二级分类">
</el-table-column>
<el-table-column
prop="editor"
header-align="center"
align="center"
label="编辑">
</el-table-column>
<el-table-column
prop="inputdate"
header-align="center"
align="center"
sortable
label="发布时间">
</el-table-column>
<el-table-column
prop="status"
header-align="center"
align="center"
label="状态">
<template slot-scope="scope">
<div>
<span v-if="Number(scope.row.status) === 0">等待</span>
<span v-if="Number(scope.row.status) === -1">失败</span>
<span v-if="Number(scope.row.status) === 1">成功</span>
</div>
</template>
</el-table-column>
<el-table-column
fixed="right"
header-align="center"
align="center"
width="150"
label="操作">
<template slot-scope="scope">
<el-button v-if="isAuth('manage:knowledgeinfo:check')" type="text" size="small" @click="checkHandle(scope.row.knowledgeinfoid,1)">[成功]</el-button>
<el-button v-if="isAuth('manage:knowledgeinfo:check')" type="text" size="small" @click="checkHandle(scope.row.knowledgeinfoid,-1)">[失败]</el-button>
<br v-if="isAuth('manage:knowledgeinfo:check')" />
<!-- <el-button v-if="isAuth('manage:knowledgeinfo:info')" type="text" size="small" @click="showMsg(scope.row)">预览</el-button> -->
<el-button v-if="isAuth('manage:knowledgeinfo:update')" type="text" size="small" @click="addOrUpdateHandle(scope.row.knowledgeinfoid)">修改</el-button>
<el-button v-if="isAuth('manage:knowledgeinfo:delete')" type="text" size="small" @click="deleteHandle(scope.row.knowledgeinfoid)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList" :class1List="class1List"></add-or-update>
</div>
</div>
</template>
<script>
import { piclevelList } from '@/utils'
import AddOrUpdate from './knowledgeinfo-add-or-update'
export default {
components: {
AddOrUpdate
},
data () {
return {
addOrUpdateVisible: false,
dataForm: {
title: '',
levels: '',
class1id: '',
class2id: '',
status: ''
},
releaseDate: '',
dataList: [],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
dataListSelections: [],
levelsList: piclevelList,
class1List: [],
class2List: [],
statusList: [{
name: '等待',
value: 0
},
{
name: '成功',
value: 1
},
{
name: '失败',
value: -1
}]
}
},
activated () {
this.getDataList()
},
created () {
this.getClass1List()
},
methods: {
getDataList2 () {
this.pageIndex = 1
this.getDataList()
},
// 获取数据列表
getDataList () {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/office/knowledgeinfo/list'),
method: 'post',
data: this.$http.adornData({
'page': this.pageIndex,
'limit': this.pageSize,
'title': this.dataForm.title,
'levels': this.dataForm.levels,
'status': this.dataForm.status,
'releaseTimeStart': this.releaseDate && this.releaseDate[0] ? this.releaseDate[0] + ' 00:00:00' : '',
'releaseTimeEnd': this.releaseDate && this.releaseDate[1] ? this.releaseDate[1] + ' 23:59:59' : '',
'parentCategoryId': this.dataForm.class1id,
'categoryId': this.dataForm.class2id
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.data.list
this.totalPage = data.data.totalCount
} else {
this.$message.error(data.msg)
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
})
},
// 每页数
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
// 当前页
currentChangeHandle (val) {
this.pageIndex = val
this.getDataList()
},
// 多选
selectionChangeHandle (val) {
this.dataListSelections = val
},
// 新增 / 修改
addOrUpdateHandle (id, showInfo) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id, showInfo)
})
},
showMsg (data) {
if (!data.jumppath || data.jumppath === null) {
window.open(this.$store.state.config.urls + '/News/msg?id=' + data.id, '_blank')
} else if (/^\//.test(data.jumppath)) {
window.open(this.$store.state.config.urls + data.jumppath, '_blank')
} else {
window.open(data.jumppath, '_blank')
}
},
// 删除
deleteHandle (id) {
var ids = id ? [id] : this.dataListSelections.map(item => {
return item.id
})
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/office/knowledgeinfo/delete'),
method: 'post',
data: this.$http.adornData(ids, false)
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList()
}
})
} else {
this.$message.error(data.msg)
}
})
}).catch(() => {})
},
// 获取一级分类
getClass1List () {
this.$http({
url: this.$http.adornUrl('/office/knowledgecategory/getFirstLevelCategory'),
method: 'get'
}).then(({data}) => {
if (data && data.code === 0) {
this.class1List = data.data
} else {
this.class1List = []
}
})
},
// 获取二级分类
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 = []
}
})
},
// 审核
checkHandle (id, status) {
let str = ''
if (status === 1) {
str = '成功'
} else {
str = '失败'
}
this.$confirm(`确定对[id=${id}]进行['审核${str}']操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/office/knowledgeinfo/verify'),
method: 'post',
data: this.$http.adornData({
'knowledgeinfoid': id,
'status': status
})
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList()
}
})
} else {
this.$message.error(data.msg)
}
})
}).catch(() => {})
}
}
}
</script>
......@@ -65,7 +65,7 @@
<el-form-item label="商品描述" prop="description">
<Ueditor
@ready="editorReady"
:value="dataForm.introduce"
:value="dataForm.description"
:config="ueditor.config"
ref="ue"
></Ueditor>
......@@ -87,253 +87,253 @@
</template>
<script>
import Ueditor from "../temps/ueditor";
import Ueditor from '../temps/ueditor'
export default {
components: {
Ueditor,
Ueditor
},
props: ['categoryIdList'],
data() {
data () {
return {
visible: false,
showInfo: false,
dialogVisible: false,
ueditor: {
value: "",
config: {},
value: '',
config: {}
},
imgUrl: new FormData(),
dataForm: {
id: 0,
prename: "",
company: "",
intro: "",
predate: "",
price: "",
pretype: "",
other: "",
graph2: "",
addlink: "",
prestock: "",
graph: "",
description: "",
remarks: "",
name: "",
introduce: "",
productdate: "",
score: "",
grade: "",
photo: "",
recommend: "",
solded: "",
viewnum: "",
discount: "",
sortsid: "",
categoryid: "",
pic: "",
makein: "",
adddate: "",
ranknum: "",
vipprice: "",
amount: "",
stock: "",
link: "",
mark: "",
type: "",
levels: "",
author: "",
status: "",
auditor: "",
prename: '',
company: '',
intro: '',
predate: '',
price: '',
pretype: '',
other: '',
graph2: '',
addlink: '',
prestock: '',
graph: '',
description: '',
remarks: '',
name: '',
introduce: '',
productdate: '',
score: '',
grade: '',
photo: '',
recommend: '',
solded: '',
viewnum: '',
discount: '',
sortsid: '',
categoryid: '',
pic: '',
makein: '',
adddate: '',
ranknum: '',
vipprice: '',
amount: '',
stock: '',
link: '',
mark: '',
type: '',
levels: '',
author: '',
status: '',
auditor: ''
},
dataRule: {
prename: [
{
required: true,
message: "商品名称不能为空",
trigger: "blur",
},
message: '商品名称不能为空',
trigger: 'blur'
}
],
categoryid: [
{
required: true,
message: "商品分类不能为空",
trigger: "blur",
},
message: '商品分类不能为空',
trigger: 'blur'
}
],
levels: [
{
required: true,
message: "商品等级不能为空",
trigger: "blur",
},
message: '商品等级不能为空',
trigger: 'blur'
}
],
price: [
{
required: true,
message: "商品价格不能为空",
trigger: "blur",
},
message: '商品价格不能为空',
trigger: 'blur'
}
],
predate: [
{
required: true,
message: "上市时间不能为空",
trigger: "blur",
},
message: '上市时间不能为空',
trigger: 'blur'
}
],
author: [
{
required: true,
message: "作者不能为空",
trigger: "blur",
},
message: '作者不能为空',
trigger: 'blur'
}
],
company: [
{
required: true,
message: "出版社不能为空",
trigger: "blur",
},
message: '出版社不能为空',
trigger: 'blur'
}
],
graph: [
{
required: true,
message: "产品图片不能为空",
trigger: "blur",
},
message: '产品图片不能为空',
trigger: 'blur'
}
],
introduce: [
{
required: true,
message: "商品简介不能为空",
trigger: "blur",
},
message: '商品简介不能为空',
trigger: 'blur'
}
],
description: [
{
required: true,
message: "商品描述不能为空",
trigger: "blur",
},
message: '商品描述不能为空',
trigger: 'blur'
}
],
remarks: [
{
required: true,
message: "商品备注不能为空",
trigger: "blur",
},
],
},
};
message: '商品备注不能为空',
trigger: 'blur'
}
]
}
}
},
methods: {
init(id) {
this.dataForm.id = id || 0;
this.visible = true;
init (id) {
this.dataForm.id = id || 0
this.visible = true
this.$nextTick(() => {
this.$refs["dataForm"].resetFields();
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
this.$http({
url: this.$http.adornUrl(
`/office/product/info/${this.dataForm.id}`
),
method: "get",
params: this.$http.adornParams(),
method: 'get',
params: this.$http.adornParams()
}).then(({ data }) => {
if (data && data.code === 0) {
console.log(data.product, 'data.productdata.productdata.product');
this.dataForm.prename = data.product.prename;
this.dataForm.company = data.product.company;
this.dataForm.intro = data.product.intro;
this.dataForm.predate = data.product.predate;
this.dataForm.price = data.product.price;
this.dataForm.pretype = data.product.pretype;
this.dataForm.other = data.product.other;
this.dataForm.graph2 = data.product.graph2;
this.dataForm.addlink = data.product.addlink;
this.dataForm.prestock = data.product.prestock;
this.dataForm.graph = data.product.graph;
this.dataForm.description = data.product.description;
this.dataForm.remarks = data.product.remarks;
this.dataForm.name = data.product.name;
this.dataForm.introduce = data.product.introduce;
this.dataForm.productdate = data.product.productdate;
this.dataForm.score = data.product.score;
this.dataForm.grade = data.product.grade;
this.dataForm.photo = data.product.photo;
this.dataForm.recommend = data.product.recommend;
this.dataForm.solded = data.product.solded;
this.dataForm.viewnum = data.product.viewnum;
this.dataForm.discount = data.product.discount;
this.dataForm.sortsid = data.product.sortsid;
this.dataForm.categoryid = data.product.categoryid;
this.dataForm.pic = data.product.pic;
this.dataForm.makein = data.product.makein;
this.dataForm.adddate = data.product.adddate;
this.dataForm.ranknum = data.product.ranknum;
this.dataForm.vipprice = data.product.vipprice;
this.dataForm.amount = data.product.amount;
this.dataForm.stock = data.product.stock;
this.dataForm.link = data.product.link;
this.dataForm.mark = data.product.mark;
this.dataForm.type = data.product.type;
this.dataForm.levels = data.product.levels;
this.dataForm.author = data.product.author;
this.dataForm.status = data.product.status;
this.dataForm.auditor = data.product.auditor;
console.log(data.product, 'data.productdata.productdata.product')
this.dataForm.prename = data.product.prename
this.dataForm.company = data.product.company
this.dataForm.intro = data.product.intro
this.dataForm.predate = data.product.predate
this.dataForm.price = data.product.price
this.dataForm.pretype = data.product.pretype
this.dataForm.other = data.product.other
this.dataForm.graph2 = data.product.graph2
this.dataForm.addlink = data.product.addlink
this.dataForm.prestock = data.product.prestock
this.dataForm.graph = data.product.graph
this.dataForm.description = data.product.description
this.dataForm.remarks = data.product.remarks
this.dataForm.name = data.product.name
this.dataForm.introduce = data.product.introduce
this.dataForm.productdate = data.product.productdate
this.dataForm.score = data.product.score
this.dataForm.grade = data.product.grade
this.dataForm.photo = data.product.photo
this.dataForm.recommend = data.product.recommend
this.dataForm.solded = data.product.solded
this.dataForm.viewnum = data.product.viewnum
this.dataForm.discount = data.product.discount
this.dataForm.sortsid = data.product.sortsid
this.dataForm.categoryid = data.product.categoryid
this.dataForm.pic = data.product.pic
this.dataForm.makein = data.product.makein
this.dataForm.adddate = data.product.adddate
this.dataForm.ranknum = data.product.ranknum
this.dataForm.vipprice = data.product.vipprice
this.dataForm.amount = data.product.amount
this.dataForm.stock = data.product.stock
this.dataForm.link = data.product.link
this.dataForm.mark = data.product.mark
this.dataForm.type = data.product.type
this.dataForm.levels = data.product.levels
this.dataForm.author = data.product.author
this.dataForm.status = data.product.status
this.dataForm.auditor = data.product.auditor
}
});
})
}
});
})
},
// 上传之前校验
beforeAvatarUpload(file) {
const isJPG = file.type === "image/jpeg";
const isPNG = file.type === "image/png";
const isLt2M = file.size / 1024 / 1024 < 2;
beforeAvatarUpload (file) {
const isJPG = file.type === 'image/jpeg'
const isPNG = file.type === 'image/png'
const isLt2M = file.size / 1024 / 1024 < 2
if (!isJPG) {
if (!isPNG) {
this.$message.error("上传图片只能是 JPG, PNG 格式!");
this.$message.error('上传图片只能是 JPG, PNG 格式!')
}
}
if (!isLt2M) {
this.$message.error("上传头像图片大小不能超过 2MB!");
this.$message.error('上传头像图片大小不能超过 2MB!')
}
if (file) {
var windowURL = window.URL || window.webkitURL;
this.dataForm.graph = windowURL.createObjectURL(file);
this.dialogVisible = true;
this.imgUrl.append("file", file);
var windowURL = window.URL || window.webkitURL
this.dataForm.graph = windowURL.createObjectURL(file)
this.dialogVisible = true
this.imgUrl.append('file', file)
}
},
Upload() {
Upload () {
this.$http({
url: this.$http.adornUrl("/office/file/uploadFile"),
method: "post",
url: this.$http.adornUrl('/office/file/uploadFile'),
method: 'post',
data: this.imgUrl,
headers: {
"Content-Type": "multipart/form-data",
},
'Content-Type': 'multipart/form-data'
}
})
.then((res) => {
console.log(res);
this.dataForm.graph = res.data.data;
console.log(res)
this.dataForm.graph = res.data.data
})
.catch((err) => {
console.log(err);
});
console.log(err)
})
},
// 表单提交
dataFormSubmit() {
this.$refs["dataForm"].validate((valid) => {
dataFormSubmit () {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$http({
url: this.$http.adornUrl(
`/office/product/${!this.dataForm.id ? "save" : "update"}`
`/office/product/${!this.dataForm.id ? 'save' : 'update'}`
),
method: "post",
method: 'post',
data: this.$http.adornData({
id: this.dataForm.id || undefined,
prename: this.dataForm.prename,
......@@ -374,33 +374,33 @@ export default {
levels: this.dataForm.levels,
author: this.dataForm.author,
status: this.dataForm.status,
auditor: this.dataForm.auditor,
}),
auditor: this.dataForm.auditor
})
}).then(({ data }) => {
if (data && data.code === 0) {
this.$message({
message: "操作成功",
type: "success",
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false;
this.$emit("refreshDataList");
},
});
this.visible = false
this.$emit('refreshDataList')
}
})
} else {
this.$message.error(data.msg);
this.$message.error(data.msg)
}
});
})
}
});
})
},
// 更新父子组件内容
editorReady(instance) {
instance.setContent(this.dataForm.description);
instance.addListener("contentChange", () => {
this.dataForm.description = instance.getContent();
});
},
},
};
editorReady (instance) {
instance.setContent(this.dataForm.description)
instance.addListener('contentChange', () => {
this.dataForm.description = instance.getContent()
})
}
}
}
</script>
\ No newline at end of file
......@@ -3,33 +3,42 @@
:title="!dataForm.branchCode ? '新增' : '修改'"
:close-on-click-modal="false"
:visible.sync="visible">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
<el-form-item label="${column.comments}" prop="branchName">
<el-input v-model="dataForm.branchName" placeholder="${column.comments}"></el-input>
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="120px">
<el-form-item label="分支机构代码:" prop="branchCode">
<el-input v-model="dataForm.branchCode" placeholder="请输入" disabled></el-input>
</el-form-item>
<el-form-item label="${column.comments}" prop="branchAddress">
<el-input v-model="dataForm.branchAddress" placeholder="${column.comments}"></el-input>
<el-form-item label="分支机构名称:" prop="branchName">
<el-input v-model="dataForm.branchName" placeholder="请输入" disabled></el-input>
</el-form-item>
<el-form-item label="${column.comments}" prop="branchPostcode">
<el-input v-model="dataForm.branchPostcode" placeholder="${column.comments}"></el-input>
<el-form-item label="所在地:" prop="branchSimname">
<el-input v-model="dataForm.branchSimname" placeholder="请输入" disabled></el-input>
</el-form-item>
<el-form-item label="${column.comments}" prop="branchContact">
<el-input v-model="dataForm.branchContact" placeholder="${column.comments}"></el-input>
<el-form-item label="地址:" prop="branchAddress">
<el-input v-model="dataForm.branchAddress" placeholder="请输入" disabled></el-input>
</el-form-item>
<el-form-item label="${column.comments}" prop="tel1">
<el-input v-model="dataForm.tel1" placeholder="${column.comments}"></el-input>
<el-form-item label="电话:" prop="tel1">
<el-input v-model="dataForm.tel1" placeholder="请输入" disabled></el-input>
</el-form-item>
<el-form-item label="${column.comments}" prop="tel2">
<el-input v-model="dataForm.tel2" placeholder="${column.comments}"></el-input>
<el-form-item label="邮编:" prop="branchPostcode">
<el-input v-model="dataForm.branchPostcode" placeholder="请输入" disabled></el-input>
</el-form-item>
<el-form-item label="${column.comments}" prop="fax">
<el-input v-model="dataForm.fax" placeholder="${column.comments}"></el-input>
<el-form-item label="联系人:" prop="branchContact">
<el-input v-model="dataForm.branchContact" placeholder="请输入" disabled></el-input>
</el-form-item>
<el-form-item label="${column.comments}" prop="rockkey">
<el-input v-model="dataForm.rockkey" placeholder="${column.comments}"></el-input>
<el-form-item label="传真:" prop="fax">
<el-input v-model="dataForm.fax" placeholder="请输入" disabled></el-input>
</el-form-item>
<el-form-item label="${column.comments}" prop="branchSimname">
<el-input v-model="dataForm.branchSimname" placeholder="${column.comments}"></el-input>
<el-form-item label="邮箱:" prop="mail">
<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>
<span slot="footer" class="dialog-footer">
......@@ -54,36 +63,15 @@
tel2: '',
fax: '',
rockkey: '',
branchSimname: ''
branchSimname: '',
mail: '',
website: '',
description: '',
addressDescription: ''
},
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 @@
params: this.$http.adornParams()
}).then(({data}) => {
if (data && data.code === 0) {
this.dataForm.branchName = data.branch.branchName
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
this.dataForm = data.data
}
})
}
......@@ -119,19 +99,15 @@
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$http({
url: this.$http.adornUrl(`/manage/branch/${!this.dataForm.branchCode ? 'save' : 'update'}`),
url: this.$http.adornUrl(`/office/branch/update`),
method: 'post',
data: this.$http.adornData({
'branchCode': this.dataForm.branchCode || undefined,
'branchName': this.dataForm.branchName,
'branchAddress': this.dataForm.branchAddress,
'branchPostcode': this.dataForm.branchPostcode,
'branchContact': this.dataForm.branchContact,
'tel1': this.dataForm.tel1,
'tel2': this.dataForm.tel2,
'fax': this.dataForm.fax,
'rockkey': this.dataForm.rockkey,
'branchSimname': this.dataForm.branchSimname
'id': this.dataForm.branchCode,
'title': this.dataForm.branchName,
'mail': this.dataForm.mail,
'website': this.dataForm.website,
'description': this.dataForm.description,
'addressDescription': this.dataForm.addressDescription
})
}).then(({data}) => {
if (data && data.code === 0) {
......
<template>
<div class="mod-config">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item>
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
<el-form-item label="分支机构名称">
<el-input v-model="dataForm.branchName" placeholder="请输入分支机构名称" clearable></el-input>
</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:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button>
</el-form-item>
......@@ -17,70 +17,34 @@
@selection-change="selectionChangeHandle"
style="width: 100%;">
<el-table-column
type="selection"
header-align="center"
align="center"
width="50">
</el-table-column>
<el-table-column
prop="branchCode"
header-align="center"
align="center"
label="${column.comments}">
label="分支机构代码">
</el-table-column>
<el-table-column
prop="branchName"
header-align="center"
align="center"
label="${column.comments}">
label="分支机构名称">
</el-table-column>
<el-table-column
prop="branchAddress"
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"
prop="branchSimname"
header-align="center"
align="center"
label="${column.comments}">
label="所在城市">
</el-table-column>
<el-table-column
prop="tel1"
header-align="center"
align="center"
label="${column.comments}">
label="电话">
</el-table-column>
<el-table-column
prop="tel2"
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"
prop="branchPostcode"
header-align="center"
align="center"
label="${column.comments}">
label="邮编">
</el-table-column>
<el-table-column
fixed="right"
......@@ -114,7 +78,7 @@
data () {
return {
dataForm: {
key: ''
branchName: ''
},
dataList: [],
pageIndex: 1,
......@@ -137,11 +101,11 @@
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/office/branch/list'),
method: 'get',
params: this.$http.adornParams({
method: 'post',
data: this.$http.adornData({
'page': this.pageIndex,
'limit': this.pageSize,
'key': this.dataForm.key
'branchName': this.dataForm.branchName
})
}).then(({data}) => {
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