吴门医述

This commit is contained in:
徐哼唧L
2024-01-16 11:16:42 +08:00
parent 454c162b4e
commit b9ca779f7a
4 changed files with 761 additions and 735 deletions

View File

@@ -419,10 +419,10 @@
// 表单提交 // 表单提交
dataFormSubmit() { dataFormSubmit() {
console.log('11111', this.dataForm.medicaldesBookType) console.log('11111', this.dataForm.medicaldesBookType)
if (this.dataForm.medicaldesBookType.length == 0) { // if (this.dataForm.medicaldesBookType.length == 0) {
this.$message.error("请选择图书类型"); // this.$message.error("请选择图书类型");
return // return
} // }
this.$refs['dataForm'].validate((valid) => { this.$refs['dataForm'].validate((valid) => {
if (valid) { if (valid) {
this.$http({ this.$http({

View File

@@ -1,420 +1,436 @@
<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 label="分类"> <el-form-item label="分类">
<el-select v-model="dataForm.dictType" placeholder="请选择分类"> <el-select v-model="dataForm.dictType" placeholder="请选择分类">
<el-option v-for="(item,index) in typeList" :key="index" :label="item.dictValue" :value="item.dictType"> <el-option v-for="(item,index) in typeList" :key="index" :label="item.dictValue" :value="item.dictType">
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="姓名"> <el-form-item label="姓名">
<el-input v-model="dataForm.bookName" placeholder="请输入书名"></el-input> <el-input v-model="dataForm.bookName" placeholder="请输入书名"></el-input>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button @click="pageIndex = 1;getDataList()">查询</el-button> <el-button @click="pageIndex = 1;getDataList()">查询</el-button>
<el-button v-if="isAuth('book:shopproduct:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button> <el-button v-if="isAuth('book:shopproduct:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-table <el-table :data="dataList" border v-loading="dataListLoading" style="width: 100%;">
:data="dataList" <el-table-column prop="name" header-align="center" align="center" label="姓名">
border </el-table-column>
v-loading="dataListLoading" <el-table-column label="url" align="center">
style="width: 100%;"> <template slot-scope="scope">
<el-table-column <a :href="'http://' + scope.row.url" target="_blank">{{ scope.row.url }}</a>
prop="name" </template>
header-align="center" </el-table-column>
align="center" <el-table-column label="图片" align="center">
label="姓名"> <template slot-scope="scope">
</el-table-column> <img v-for="item in scope.row.imgList" :src="item.url" alt="" style="width:70px;height:100px;margin: 0 5px;" />
<el-table-column label="url" align="center"> </template>
<template slot-scope="scope"> </el-table-column>
<a :href ="'http://' + scope.row.url" target="_blank">{{ scope.row.url }}</a> <!-- <el-table-column label="内容" align="center" prop="content">
</template>
</el-table-column>
<el-table-column label="图片" align="center">
<template slot-scope="scope">
<img :src="scope.row.img" alt="" style="width:70px;height:100px" />
</template>
</el-table-column>
<!-- <el-table-column label="内容" align="center" prop="content">
</el-table-column> --> </el-table-column> -->
<el-table-column label="分类" align="center" prop="type"> <el-table-column label="分类" align="center" prop="type">
<template slot-scope="scope"> <template slot-scope="scope">
{{ filterAA(scope.row.type) }} {{ filterAA(scope.row.type) }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="地址" align="center" prop="cityId"> <el-table-column label="地址" align="center" prop="cityId">
<template slot-scope="scope"> <template slot-scope="scope">
{{ translateaddr(scope.row.cityId) }} {{ translateaddr(scope.row.cityId) }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column label="排序" align="center" prop="sort" width="50">
fixed="right" <template slot-scope="scope">
header-align="center" {{ scope.row.sort }}
align="center" </template>
width="150" </el-table-column>
label="操作"> <el-table-column fixed="right" header-align="center" align="center" width="100" label="操作">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" size="small" @click="editOrUpdateHandle(scope.row)">修改</el-button> <el-button type="text" size="small" @click="editOrUpdateHandle(scope.row)">修改</el-button>
<el-button type="text" size="small" @click="deleteHandle(scope.row.id)">删除</el-button> <el-button type="text" size="small" @click="deleteHandle(scope.row.id)">删除</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<el-pagination <el-pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" :current-page="pageIndex"
@size-change="sizeChangeHandle" :page-sizes="[10, 20, 50, 100]" :page-size="pageSize" :total="totalPage"
@current-change="currentChangeHandle" layout="total, sizes, prev, pager, next, jumper">
:current-page="pageIndex" </el-pagination>
:page-sizes="[10, 20, 50, 100]" <!-- 弹窗, 新增 / 修改 -->
:page-size="pageSize" <el-dialog :visible.sync="addOrUpdateVisible" :close-on-click-modal="false" :append-to-body="true" :title="titlesub" width="50%"
:total="totalPage" @close="cancleClose">
layout="total, sizes, prev, pager, next, jumper"> <el-form :inline="true" :model="addForm" ref="addFormRef" :rules="addFormRule">
</el-pagination> <el-row type="flex" justify="center">
<!-- 弹窗, 新增 / 修改 --> <el-form-item label="姓名" prop="name">
<el-dialog :visible.sync="addOrUpdateVisible" :append-to-body="true" :title="titlesub" width="50%" @close="cancleClose"> <el-input style="width:500px" v-model="addForm.name"></el-input>
<el-form :inline="true" :model="addForm" ref="addFormRef" :rules="addFormRule"> </el-form-item>
<el-row type="flex" justify="center"> </el-row>
<el-form-item label="姓名" prop="name"> <el-row type="flex" justify="center">
<el-input style="width:500px" v-model="addForm.name"></el-input> <el-form-item label="分类" prop="typeId">
</el-form-item> <el-select v-model="addForm.typeId" placeholder="请选择分类" style="width: 500px;">
</el-row> <el-option v-for="(item,index) in typeList" :key="index" :label="item.dictValue" :value="item.dictType">
<el-row type="flex" justify="center"> </el-option>
<el-form-item label="分类" prop="typeId"> </el-select>
<el-select v-model="addForm.typeId" placeholder="请选择分类" style="width: 500px;"> </el-form-item>
<el-option v-for="(item,index) in typeList" :key="index" :label="item.dictValue" :value="item.dictType"> </el-row>
</el-option> <el-row type="flex" justify="center">
</el-select> <el-form-item label="url" prop="url" label-width="48px">
</el-form-item> <el-input style="width:500px" v-model="addForm.url"></el-input>
</el-row> </el-form-item>
<el-row type="flex" justify="center"> </el-row>
<el-form-item label="url" prop="url" label-width="48px"> <el-row type="flex" justify="center">
<el-input style="width:500px" v-model="addForm.url"></el-input> <el-form-item label="内容" prop="content" label-width="48px">
</el-form-item> <el-input style="width:500px" v-model="addForm.content" :rows="5" type="textarea"></el-input>
</el-row> </el-form-item>
<el-row type="flex" justify="center"> </el-row>
<el-form-item label="内容" prop="content" label-width="48px"> <el-row type="flex" justify="center">
<el-input style="width:500px" v-model="addForm.content" :rows="5" type="textarea"></el-input> <el-form-item label="地址" prop="cityId" label-width="48px">
</el-form-item> <el-select v-model="addForm.provId" placeholder="请选择省份" style="width:249px" @change="provinceChange">
</el-row> <el-option v-for="item in provinceEntity" :key="item.provId" :label="item.provName" :value="item.provId">
<el-row type="flex" justify="center"> </el-option>
<el-form-item label="地址" prop="cityId" label-width="48px"> </el-select>
<el-select v-model="addForm.provId" placeholder="请选择省份" style="width:249px" <el-select v-model="addForm.cityId" placeholder="请选择" style="width:249px">
@change="provinceChange"> <el-option v-for="item in cityEntity" :key="item.cityId" :label="item.cityName" :value="item.cityId">
<el-option v-for="item in provinceEntity" :key="item.provId" :label="item.provName" </el-option>
:value="item.provId"> </el-select>
</el-option> </el-form-item>
</el-select> </el-row>
<el-select v-model="addForm.cityId" placeholder="请选择市" style="width:249px"> <el-row type="flex" justify="center">
<el-option v-for="item in cityEntity" :key="item.cityId" :label="item.cityName" <el-form-item label="图片" prop="img" label-width="48px">
:value="item.cityId"> <el-upload class="el-uploadfeng " ref="files"
</el-option> :class="{ uoloadSty: dataForm.showBtnDealImg, disUoloadSty: dataForm.noneBtnImg }"
</el-select> :action="baseUrl + '/oss/fileoss'" list-type="picture-card" :file-list="fileList"
</el-form-item> :on-success="handlePicSuccess" accept=".jpeg,.jpg,.gif,.png" :on-remove="handleRemove">
</el-row> <i class="el-icon-plus"></i>
<el-row type="flex" justify="center"> </el-upload>
<el-form-item label="图片" prop="img" label-width="48px"> </el-form-item>
<el-upload :limit="1" class="el-uploadfeng " </el-row>
ref="files" <el-row type="flex" justify="center">
:class="{ uoloadSty: dataForm.showBtnDealImg, disUoloadSty: dataForm.noneBtnImg }" <el-form-item label="排序" label-width="48px">
:action="baseUrl + '/oss/fileoss'" list-type="picture-card" :on-preview="handlePictureCardPreview" <el-input style="width:500px" v-model="addForm.sort"></el-input>
:file-list="fileList" :on-success="handlePicSuccess" accept=".jpeg,.jpg,.gif,.png" :on-remove="handleRemove"> </el-form-item>
<i class="el-icon-plus"></i> </el-row>
</el-upload> </el-form>
<el-dialog :visible.sync="dialogVisible" :append-to-body="true"> <span slot="footer" class="dialog-footer">
<img width="100%" :src="addForm.productImages" alt=""> <el-button @click="cancleClose"> </el-button>
</el-dialog> <el-button type="primary" @click="addOreEditCate"> </el-button>
</el-form-item> </span>
</el-row> </el-dialog>
</el-form> <!-- <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList" @showchooseBookf = "showchooseBookf"></add-or-update>
<span slot="footer" class="dialog-footer">
<el-button @click="cancleClose"> </el-button>
<el-button type="primary" @click="addOreEditCate"> </el-button>
</span>
</el-dialog>
<!-- <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList" @showchooseBookf = "showchooseBookf"></add-or-update>
<choose-book v-if="chooseBookVisible" :bookIds = bookIds ref="chooseBook" :chooseBookVisible = chooseBookVisible @closeBookf = "closeBookf"></choose-book> --> <choose-book v-if="chooseBookVisible" :bookIds = bookIds ref="chooseBook" :chooseBookVisible = chooseBookVisible @closeBookf = "closeBookf"></choose-book> -->
</div> </div>
</template> </template>
<script> <script>
import global from '../../common/common.vue' //引入共用组间 import global from '../../common/common.vue' //引入共用组间
export default { export default {
data () { data() {
return { return {
baseUrl: global.baseUrl, baseUrl: global.baseUrl,
cityEntity: [], cityEntity: [],
provinceEntity: [], //省地址 provinceEntity: [], //省地址
typeList: [], //类型列表 typeList: [], //类型列表
booknameList: [], booknameList: [],
dataForm: { dataForm: {
dictType: '',//分类 dictType: '', //分类
bookName: '',//书名 bookName: '', //书名
}, },
fileList: [], fileList: [],
addForm: { addForm: {
id: '',//新增不传 id: '', //新增不传
name: '', //姓名 name: '', //姓名
typeId: '',//分类 typeId: '', //分类
url: '', url: '',
content: '', content: '',
cityId: '', cityId: '',
provId: '', provId: '',
productImages: '' sort: 0
}, },
editId: '', editId: '',
addFormRule: { addFormRule: {
typeId: [{required: true, message: "请选择分类" }], typeId: [{
name: [{required: true, message: "请输入姓名"}] required: true,
}, message: "请选择分类"
dataList: [], }],
// publishStatus: false, name: [{
pageIndex: 1, required: true,
pageSize: 10, message: "请输入姓名"
totalPage: 0, }]
dataListLoading: false, },
dataListSelections: [], dataList: [],
addOrUpdateVisible: false, // publishStatus: false,
bookIds:[], pageIndex: 1,
titlesub: '新增', pageSize: 10,
dialogVisible: false totalPage: 0,
} dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false,
bookIds: [],
titlesub: '新增',
dialogVisible: false
}
}, },
components: { components: {
// AddOrUpdate, // AddOrUpdate,
// chooseBook // chooseBook
}, },
created() { created() {
this.gettypeList() this.gettypeList()
this.getprovinceEntity() this.getprovinceEntity()
}, },
activated () { activated() {
this.getDataList() this.getDataList()
this.gettypeList() this.gettypeList()
this.getprovinceEntity() this.getprovinceEntity()
}, },
methods: { methods: {
gettypeList () { gettypeList() {
this.$http({ this.$http({
url: this.$http.adornUrl('/book/medicaldes/typeList?label=inheritType'), url: this.$http.adornUrl('/book/medicaldes/typeList?label=inheritType'),
method: 'post', method: 'post',
}).then(({data}) => { }).then(({
if (data && data.code === 0) { data
this.typeList = data.result }) => {
if (data && data.code === 0) {
} else { this.typeList = data.result
this.typeList = []
}
})
},
// 获取数据列表
getDataList () {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/book/medicaldes/inheritListByPage'),
method: 'post',
data: this.$http.adornData({
"dictType": this.dataForm.dictType,
"name": this.dataForm.bookName,
"current": this.pageIndex,
"limit": this.pageSize
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.result.records
this.totalPage = data.result.total
} else {
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
})
},
provinceChange() {
this.addForm.cityId = ''
this.cityEntity = []
console.log('addForm.provinceCode', this.addForm.provId);
this.$http({
url: this.$http.adornUrl(`/api/province/getCityList?provId=${this.addForm.provId}`),
method: 'post',
}).then(({data}) => {
if (data && data.code === 0) {
this.cityEntity = data.prov
console.log('data67y8ui9', data);
} else {
}
})
}, } else {
// 每页数 this.typeList = []
sizeChangeHandle (val) { }
this.pageSize = val })
this.pageIndex = 1 },
this.getDataList() // 获取数据列表
}, getDataList() {
// 当前页 this.dataListLoading = true
currentChangeHandle (val) { this.$http({
this.pageIndex = val url: this.$http.adornUrl('/book/medicaldes/inheritListByPage'),
this.getDataList() method: 'post',
}, data: this.$http.adornData({
// 多选 "dictType": this.dataForm.dictType,
selectionChangeHandle (val) { "name": this.dataForm.bookName,
this.dataListSelections = val "current": this.pageIndex,
}, "limit": this.pageSize
// 新增 / 修改 })
editOrUpdateHandle (row) { }).then(({
console.log('rowzz', row.img); data
this.titlesub = '修改' }) => {
this.editId = row.id if (data && data.code === 0) {
this.addForm.name = row.name this.dataList = data.result.records
this.addForm.url = row.url for (let i = 0; i < this.dataList.length; i++) {
this.addForm.productImages = row.img let imgList = []
this.addForm.content = row.content if (this.dataList[i].img != '') {
this.addForm.typeId = row.type.toString() let arr = this.dataList[i].img.split(';');
this.fileList = [] arr.forEach((item, index) => {
var img = { imgList.push({
name: '', name: index,
url: row.img url: item
} })
var attr = []
attr.push(img)
this.fileList = attr
console.log('this.fileList', this.fileList);
for(var i = 0; i< this.provinceEntity.length; i++) {
for(var j = 0; j< this.provinceEntity[i].cityList.length; j++) {
if(this.provinceEntity[i].cityList[j].cityId == row.cityId) {
this.addForm.provId = this.provinceEntity[i].cityList[j].provId
}
}
}
this.provinceChange()
console.log('this.addForm.provId', this.addForm.provId);
this.addForm.cityId = row.cityId
this.addOrUpdateVisible = true
},
addOrUpdateHandle() {
this.editId = ''
this.titlesub = '新增'
this.addOrUpdateVisible = true
},
cancleClose() {
this.addOrUpdateVisible = false
this.$refs["addFormRef"].resetFields();
this.addForm = {
id: '',//新增不传
name: '', //姓名
typeId: '',//分类
url: '',
content: '',
cityId: '',
provId: '',
productImages: ''
}
this.fileList = []
},
getprovinceEntity() {
this.$http({
url: this.$http.adornUrl('/api/province/getProvince'),
method: 'get',
}).then(({ data }) => {
if (data && data.code === 0) {
this.provinceEntity = data.provinceEntity
console.log('this.provinceEntit', this.provinceEntity);
} else {
this.provinceEntity = []
}
})
},
// 删除
deleteHandle (id) {
this.$confirm('请确认是否删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl(`/book/medicaldes/delInherit?id=${id}`),
method: 'post',
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList()
}
}) })
} else { }
this.$message.error(data.msg) this.dataList[i].imgList = imgList
}
})
})
},
addOreEditCate() {
this.$refs["addFormRef"].validate(valid => {
if(valid) {
this.$http({
url: this.$http.adornUrl('/book/medicaldes/saveOrUpdateInherit'),
method: 'post',
data: this.$http.adornData({
"id": this.editId, //新增不传
"name": this.addForm.name,
"url": this.addForm.url,
"img": this.addForm.productImages,
"content": this.addForm.content,
"type": this.addForm.typeId,
"cityId": this.addForm.cityId
})
}).then(({data}) => {
if (data && data.code === 0) {
this.$message.success("成功");
this.addOrUpdateVisible = false
this.getDataList()
} else {
this.$message.error("失败");
}
})
}
})
},
handlePictureCardPreview(file) {
this.addForm.productImages = file.url;
this.dialogVisible = true;
},
handlePicSuccess(res, file) {
// console.log(res,'res')
if (res.msg == "success") {
this.addForm.productImages = res.url;
this.fileList.push({
name: file.name,
url: res.url
})
console.log(this.dataForm.productImages,'productImages')
this.$message.success("上传成功");
} else {
this.$message.error("上传失败");
} }
},
handleRemove(file, fileList) { this.totalPage = data.result.total
this.addForm.productImages = ''; } else {
this.fileList = fileList this.dataList = []
// this.addForm.noneBtnImg = fileList.length >= this.addForm.limitCountImg; this.totalPage = 0
}, }
filterAA(val){ this.dataListLoading = false
var aa = this.typeList.filter(obj => obj.dictType == val) })
return aa[0].dictValue },
// return aa provinceChange() {
}, this.addForm.cityId = ''
translateaddr(code) { this.cityEntity = []
for(var i = 0; i< this.provinceEntity.length; i++) { console.log('addForm.provinceCode', this.addForm.provId);
for(var j = 0; j< this.provinceEntity[i].cityList.length; j++) { this.$http({
if(this.provinceEntity[i].cityList[j].cityId == code) { url: this.$http.adornUrl(`/api/province/getCityList?provId=${this.addForm.provId}`),
return this.provinceEntity[i].cityList[j].cityName method: 'post',
} }).then(({
} data
} }) => {
if (data && data.code === 0) {
this.cityEntity = data.prov
console.log('data67y8ui9', data);
} else {}
})
},
// 每页数
sizeChangeHandle(val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
// 当前页
currentChangeHandle(val) {
this.pageIndex = val
this.getDataList()
},
// 多选
selectionChangeHandle(val) {
this.dataListSelections = val
},
// 新增 / 修改
editOrUpdateHandle(row) {
console.log('rowzz', row.img);
this.titlesub = '修改'
this.editId = row.id
this.addForm.name = row.name
this.addForm.url = row.url
this.addForm.content = row.content
this.addForm.typeId = row.type.toString()
this.addForm.sort = row.sort
this.fileList = row.imgList
for (var i = 0; i < this.provinceEntity.length; i++) {
for (var j = 0; j < this.provinceEntity[i].cityList.length; j++) {
if (this.provinceEntity[i].cityList[j].cityId == row.cityId) {
this.addForm.provId = this.provinceEntity[i].cityList[j].provId
}
}
} }
this.provinceChange()
console.log('this.addForm.provId', this.addForm.provId);
this.addForm.cityId = row.cityId
this.addOrUpdateVisible = true
},
addOrUpdateHandle() {
this.editId = ''
this.titlesub = '新增'
this.addOrUpdateVisible = true
},
cancleClose() {
this.addOrUpdateVisible = false
this.$refs["addFormRef"].resetFields();
this.addForm = {
id: '', //新增不传
name: '', //姓名
typeId: '', //分类
url: '',
content: '',
cityId: '',
provId: '',
sort: 0
}
this.fileList = []
},
getprovinceEntity() {
this.$http({
url: this.$http.adornUrl('/api/province/getProvince'),
method: 'get',
}).then(({
data
}) => {
if (data && data.code === 0) {
this.provinceEntity = data.provinceEntity
console.log('this.provinceEntit', this.provinceEntity);
} else {
this.provinceEntity = []
}
})
},
// 删除
deleteHandle(id) {
this.$confirm('请确认是否删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl(`/book/medicaldes/delInherit?id=${id}`),
method: 'post',
}).then(({
data
}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList()
}
})
} else {
this.$message.error(data.msg)
}
})
})
},
addOreEditCate() {
this.$refs["addFormRef"].validate(valid => {
if (valid) {
var imageslist = []
var arr = []
if (this.fileList.length > 0) {
arr = this.fileList.map(item => {
return item.url
})
}
imageslist = arr.join(";");
this.$http({
url: this.$http.adornUrl('/book/medicaldes/saveOrUpdateInherit'),
method: 'post',
data: this.$http.adornData({
"id": this.editId, //新增不传
"name": this.addForm.name,
"url": this.addForm.url,
"img": imageslist,
"content": this.addForm.content,
"type": this.addForm.typeId,
"cityId": this.addForm.cityId,
"sort": this.addForm.sort
})
}).then(({
data
}) => {
if (data && data.code === 0) {
this.$message.success("成功");
this.addOrUpdateVisible = false
this.getDataList()
} else {
this.$message.error("失败");
}
})
}
})
},
handlePicSuccess(res, file) {
// console.log(res,'res')
if (res.msg == "success") {
this.fileList.push({
name: file.name,
url: res.url
})
this.$message.success("上传成功");
} else {
this.$message.error("上传失败");
}
},
handleRemove(file, fileList) {
this.fileList = fileList
// this.addForm.noneBtnImg = fileList.length >= this.addForm.limitCountImg;
},
filterAA(val) {
var aa = this.typeList.filter(obj => obj.dictType == val)
return aa[0].dictValue
// return aa
},
translateaddr(code) {
for (var i = 0; i < this.provinceEntity.length; i++) {
for (var j = 0; j < this.provinceEntity[i].cityList.length; j++) {
if (this.provinceEntity[i].cityList[j].cityId == code) {
return this.provinceEntity[i].cityList[j].cityName
}
}
}
}
} }
} }
</script> </script>

View File

@@ -1,361 +1,371 @@
<template> <template>
<div class="mod-config-wmzg"> <div class="mod-config-wmzg">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()"> <el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item label="分类"> <el-form-item label="分类">
<el-select v-model="dataForm.dictType" placeholder="请选择分类" clearable @clear="clearValue"> <el-select v-model="dataForm.dictType" placeholder="请选择分类" clearable @clear="clearValue">
<el-option v-for="(item,index) in typeList" :key="index" :label="item.dictValue" :value="item.dictType"> <el-option v-for="(item,index) in typeList" :key="index" :label="item.dictValue" :value="item.dictType">
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<!-- <el-form-item label="名称"> <!-- <el-form-item label="名称">
<el-input v-model="dataForm.ligthname" placeholder="请输入名称" clearable></el-input> <el-input v-model="dataForm.ligthname" placeholder="请输入名称" clearable></el-input>
</el-form-item> --> </el-form-item> -->
<el-form-item> <el-form-item>
<el-button @click="pageIndex = 1;getDataList()">查询</el-button> <el-button @click="pageIndex = 1;getDataList()">查询</el-button>
<el-button v-if="isAuth('book:shopproduct:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button> <el-button v-if="isAuth('book:shopproduct:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-table <el-table :data="dataList" border v-loading="dataListLoading" style="width: 100%;">
:data="dataList" <el-table-column header-align="center" align="center" label="分类">
border <template slot-scope="scope">
v-loading="dataListLoading" {{ filterAA(scope.row.type) }}
style="width: 100%;"> </template>
<el-table-column </el-table-column>
header-align="center" <el-table-column label="名称" align="center">
align="center" <template slot-scope="scope">
label="分类"> <div v-if="scope.row.type == 1 || scope.row.type == 2">{{ scope.row.name }}</div>
<template slot-scope="scope"> <div v-if="scope.row.type == 3">{{ scope.row.name }}</div>
{{ filterAA(scope.row.type) }} <!-- <img v-if="scope.row.type == 3" :src="scope.row.url" alt="" style="width:70px;height:100px" /> -->
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="名称" align="center"> <el-table-column label="资源url" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<div v-if="scope.row.type == 1 || scope.row.type == 2">{{ scope.row.name }}</div> <a v-if="scope.row.type == 1 || scope.row.type == 2" :href="scope.row.url"
<div v-if="scope.row.type == 3">{{ scope.row.name }}</div> target="_blank">{{ scope.row.url }}</a>
<!-- <img v-if="scope.row.type == 3" :src="scope.row.url" alt="" style="width:70px;height:100px" /> --> <a v-if="scope.row.type == 3" :href="scope.row.url" target="_blank">{{ scope.row.url }}</a>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="资源url" align="center"> <el-table-column label="排序" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<a v-if="scope.row.type == 1 || scope.row.type == 2" :href="scope.row.url" target="_blank">{{ scope.row.url }}</a> {{ scope.row.sort }}
<a v-if="scope.row.type == 3" :href="scope.row.url" target="_blank">{{ scope.row.url }}</a> </template>
</template> </el-table-column>
</el-table-column> <el-table-column fixed="right" header-align="center" align="center" width="150" label="操作">
<el-table-column <template slot-scope="scope">
fixed="right" <el-button type="text" size="small" @click="editOrUpdateHandle(scope.row)">修改</el-button>
header-align="center" <el-button type="text" size="small" @click="deleteHandle(scope.row.id)">删除</el-button>
align="center" </template>
width="150" </el-table-column>
label="操作"> </el-table>
<template slot-scope="scope"> <el-pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" :current-page="pageIndex"
<el-button type="text" size="small" @click="editOrUpdateHandle(scope.row)">修改</el-button> :page-sizes="[10, 20, 50, 100]" :page-size="pageSize" :total="totalPage"
<el-button type="text" size="small" @click="deleteHandle(scope.row.id)">删除</el-button> layout="total, sizes, prev, pager, next, jumper">
</template> </el-pagination>
</el-table-column> <!-- 弹窗, 新增 / 修改 -->
</el-table> <el-dialog :visible.sync="addOrUpdateVisible" :close-on-click-modal="false" :append-to-body="true" :title="titlesub" width="50%"
<el-pagination @close="cancleClose">
@size-change="sizeChangeHandle" <el-form :inline="true" :model="addForm" ref="addFormRef" :rules="addFormRule" class="dialog-wmzg">
@current-change="currentChangeHandle" <el-row type="flex" justify="center">
:current-page="pageIndex" <el-form-item label="分类" prop="type" label-width="100px">
:page-sizes="[10, 20, 50, 100]" <el-select v-model="addForm.type" placeholder="请选择分类" style="width: 500px;">
:page-size="pageSize" <el-option v-for="(item,index) in typeList" :key="index" :label="item.dictValue" :value="item.dictType">
:total="totalPage" </el-option>
layout="total, sizes, prev, pager, next, jumper"> </el-select>
</el-pagination> </el-form-item>
<!-- 弹窗, 新增 / 修改 --> </el-row>
<el-dialog :visible.sync="addOrUpdateVisible" :append-to-body="true" :title="titlesub" width="50%" @close="cancleClose"> <el-row type="flex" justify="center">
<el-form :inline="true" :model="addForm" ref="addFormRef" :rules="addFormRule" class="dialog-wmzg"> <el-form-item label="名称" prop="name" label-width="100px">
<el-row type="flex" justify="center"> <el-input style="width:500px" v-model="addForm.name"></el-input>
<el-form-item label="分类" prop="type" label-width="100px"> </el-form-item>
<el-select v-model="addForm.type" placeholder="请选择分类" style="width: 500px;"> </el-row>
<el-option v-for="(item,index) in typeList" :key="index" :label="item.dictValue" :value="item.dictType"> <!-- <el-row type="flex" justify="center">
</el-option>
</el-select>
</el-form-item>
</el-row>
<el-row type="flex" justify="center">
<el-form-item label="名称" prop="name" label-width="100px">
<el-input style="width:500px" v-model="addForm.name"></el-input>
</el-form-item>
</el-row>
<!-- <el-row type="flex" justify="center">
<el-form-item label="资源url" label-width="100px"> <el-form-item label="资源url" label-width="100px">
<el-input style="width:500px" v-model="addForm.url"></el-input> <el-input style="width:500px" v-model="addForm.url"></el-input>
</el-form-item> </el-form-item>
</el-row> --> </el-row> -->
<el-row type="flex" justify="center"> <el-row type="flex" justify="center">
<el-form-item label="资源文件" label-width="100px"> <el-form-item label="资源文件" label-width="100px">
<el-upload :limit="1" class="el-uploadfeng " <el-upload :limit="1" class="el-uploadfeng " ref="files" :action="baseUrl + '/oss/fileoss'"
ref="files" :on-preview="handlePictureCardPreview" :file-list="fileList" :on-success="handlePicSuccess"
:action="baseUrl + '/oss/fileoss'" :on-preview="handlePictureCardPreview" accept=".mp3,.mp4,.gif,.mpeg,.mpg" :on-remove="handleRemove">
:file-list="fileList" :on-success="handlePicSuccess" accept=".mp3,.mp4,.gif,.mpeg,.mpg" :on-remove="handleRemove"> <i class="el-icon-plus"></i>
<i class="el-icon-plus"></i> </el-upload>
</el-upload> <!-- <el-dialog :visible.sync="dialogVisible" :append-to-body="true">
<!-- <el-dialog :visible.sync="dialogVisible" :append-to-body="true">
<video width="100%" :src="addForm.url" alt=""> <video width="100%" :src="addForm.url" alt="">
<video controls width="250" v-if="dataForm.video != ''"> <video controls width="250" v-if="dataForm.video != ''">
<source :src="dataForm.video" type="video/mp4" /> <source :src="dataForm.video" type="video/mp4" />
</video> </video>
</el-dialog> --> </el-dialog> -->
</el-form-item> </el-form-item>
</el-row> </el-row>
</el-form> <el-row type="flex" justify="center">
<span slot="footer" class="dialog-footer"> <el-form-item label="排序" label-width="48px">
<el-button @click="cancleClose"> </el-button> <el-input style="width:500px" v-model="addForm.sort"></el-input>
<el-button type="primary" @click="addOreEditCate"> </el-button> </el-form-item>
</span> </el-row>
</el-dialog> </el-form>
<!-- <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList" @showchooseBookf = "showchooseBookf"></add-or-update>
<span slot="footer" class="dialog-footer">
<el-button @click="cancleClose"> </el-button>
<el-button type="primary" @click="addOreEditCate"> </el-button>
</span>
</el-dialog>
<!-- <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList" @showchooseBookf = "showchooseBookf"></add-or-update>
<choose-book v-if="chooseBookVisible" :bookIds = bookIds ref="chooseBook" :chooseBookVisible = chooseBookVisible @closeBookf = "closeBookf"></choose-book> --> <choose-book v-if="chooseBookVisible" :bookIds = bookIds ref="chooseBook" :chooseBookVisible = chooseBookVisible @closeBookf = "closeBookf"></choose-book> -->
</div> </div>
</template> </template>
<script> <script>
import global from '../../common/common.vue' //引入共用组间 import global from '../../common/common.vue' //引入共用组间
export default { export default {
data () { data() {
return { return {
baseUrl: global.baseUrl, baseUrl: global.baseUrl,
typeList: [ typeList: [{
{ dictValue: '吴门之歌',
dictValue:'吴门之歌', dictType: '1',
dictType: '1', }, {
},{ dictValue: '巴山夜雨',
dictValue:'巴山夜雨', dictType: '2',
dictType: '2', }, {
},{ dictValue: '吴门之徽',
dictValue:'吴门之徽', dictType: '3',
dictType: '3', }], //类型列表
} booknameList: [],
], //类型列表 dataForm: {
booknameList: [], dictType: '', //分类
dataForm: { // ligthname: '',//书名
dictType: '',//分类 },
// ligthname: '',//书名 addForm: {
}, "id": '', //新增不传
addForm: { "name": '',
"id": '',//新增不传 "type": '',
"name": '', "url": '',
"type": '', "sort": 0
url:'' },
}, editId: '',
editId: '', addFormRule: {
addFormRule: { typeId: [{
typeId: [{required: true, message: "请选择分类" }], required: true,
bookId: [{required: true, message: "请选择书名"}] message: "请选择分类"
}, }],
dataList: [], bookId: [{
// publishStatus: false, required: true,
pageIndex: 1, message: "请选择书名"
pageSize: 10, }]
totalPage: 0, },
dataListLoading: false, dataList: [],
dataListSelections: [], // publishStatus: false,
addOrUpdateVisible: false, pageIndex: 1,
bookIds:[], pageSize: 10,
titlesub: '新增', totalPage: 0,
fileList: [], dataListLoading: false,
} dataListSelections: [],
addOrUpdateVisible: false,
bookIds: [],
titlesub: '新增',
fileList: [],
}
}, },
components: { components: {
// AddOrUpdate, // AddOrUpdate,
// chooseBook // chooseBook
}, },
activated () { activated() {
// this.gettypeList() // this.gettypeList()
this.getDataList() this.getDataList()
}, },
methods: { methods: {
clearValue(val) { clearValue(val) {
this.dataForm.dictType = ''; this.dataForm.dictType = '';
}, },
// 获取数据列表 // 获取数据列表
getDataList () { getDataList() {
this.dataListLoading = true this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/book/medicaldes/lightListByPage'),
method: 'post',
data: this.$http.adornData({
"type": this.dataForm.dictType,
"name": this.dataForm.ligthname,
"current": this.pageIndex,
"limit": this.pageSize
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.result.records
this.totalPage = data.result.total
} else {
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
})
},
getbookname() {
// 获取数据列表
this.$http({ this.$http({
url: this.$http.adornUrl('/book/book/list'), url: this.$http.adornUrl('/book/medicaldes/lightListByPage'),
method: 'get', method: 'post',
params: this.$http.adornParams({ data: this.$http.adornData({
"type": this.dataForm.dictType,
"name": this.dataForm.ligthname,
"current": this.pageIndex,
"limit": this.pageSize
})
}).then(({
data
}) => {
if (data && data.code === 0) {
this.dataList = data.result.records
this.totalPage = data.result.total
} else {
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
})
},
getbookname() {
// 获取数据列表
this.$http({
url: this.$http.adornUrl('/book/book/list'),
method: 'get',
params: this.$http.adornParams({
'page': 1, 'page': 1,
'limit': 1000000, 'limit': 1000000,
'bookName': '', 'bookName': '',
'publisherName' : '', 'publisherName': '',
'authorName' : '' 'authorName': ''
}) })
}).then(({ data }) => { }).then(({
if (data && data.code === 0) { data
this.booknameList = data.page.list }) => {
} else { if (data && data.code === 0) {
this.booknameList = [] this.booknameList = data.page.list
} else {
this.booknameList = []
}
})
},
filterAA(val) {
if (val == 1) {
return '吴门之歌'
} else if (val == 2) {
return '巴山夜雨'
} else {
return '吴门之徽'
}
},
// 每页数
sizeChangeHandle(val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
// 当前页
currentChangeHandle(val) {
this.pageIndex = val
this.getDataList()
},
// 多选
selectionChangeHandle(val) {
this.dataListSelections = val
},
// 新增 / 修改
editOrUpdateHandle(row) {
this.titlesub = '修改'
// this.getbookname()
this.editId = row.id
this.addForm.name = row.name
this.addForm.type = row.type.toString()
this.addForm.url = row.url
this.addForm.sort = row.sort
this.fileList = []
var img = {
name: row.url,
url: row.url
}
var attr = []
attr.push(img)
this.fileList = attr
console.log('this.fileList', this.fileList);
this.addOrUpdateVisible = true
},
addOrUpdateHandle() {
// this.getbookname()
this.editId = ''
this.titlesub = '新增'
this.addOrUpdateVisible = true
},
cancleClose() {
this.addOrUpdateVisible = false
this.$refs["addFormRef"].resetFields();
this.addForm = {
"id": '', //新增不传
"name": '',
"type": '',
"url": '',
"sort": 0
}
this.fileList = []
},
// 删除
deleteHandle(id) {
this.$confirm('请确认是否删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl(`/book/medicaldes/delLight?id=${id}`),
method: 'post',
}).then(({
data
}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList()
} }
}) })
},
filterAA(val){
if(val == 1) {
return '吴门之歌'
} else if(val == 2) {
return '巴山夜雨'
} else { } else {
return '吴门之徽' this.$message.error(data.msg)
} }
}, })
// 每页数 })
sizeChangeHandle (val) { },
this.pageSize = val addOreEditCate() {
this.pageIndex = 1 this.$refs["addFormRef"].validate(valid => {
this.getDataList() if (valid) {
},
// 当前页
currentChangeHandle (val) {
this.pageIndex = val
this.getDataList()
},
// 多选
selectionChangeHandle (val) {
this.dataListSelections = val
},
// 新增 / 修改
editOrUpdateHandle (row) {
this.titlesub = '修改'
// this.getbookname()
this.editId = row.id
this.addForm.name = row.name
this.addForm.type = row.type.toString()
this.addForm.url = row.url
this.fileList = []
var img = {
name: row.url,
url: row.url
}
var attr = []
attr.push(img)
this.fileList = attr
console.log('this.fileList', this.fileList);
this.addOrUpdateVisible = true
},
addOrUpdateHandle() {
// this.getbookname()
this.editId = ''
this.titlesub = '新增'
this.addOrUpdateVisible = true
},
cancleClose() {
this.addOrUpdateVisible = false
this.$refs["addFormRef"].resetFields();
this.addForm = {
"id": '',//新增不传
"name": '',
"type": '',
"url": ''
}
this.fileList = []
},
// 删除
deleteHandle (id) {
this.$confirm('请确认是否删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({ this.$http({
url: this.$http.adornUrl(`/book/medicaldes/delLight?id=${id}`), url: this.$http.adornUrl('/book/medicaldes/saveOrUpdateLight'),
method: 'post', method: 'post',
}).then(({data}) => { data: this.$http.adornData({
if (data && data.code === 0) { "id": this.editId, //新增不传
this.$message({ "name": this.addForm.name,
message: '操作成功', "type": this.addForm.type,
type: 'success', "url": this.addForm.url,
duration: 1500, "sort": this.addForm.sort
onClose: () => { })
this.getDataList() }).then(({
} data
}) }) => {
} else { if (data && data.code === 0) {
this.$message.error(data.msg) this.$message.success("成功");
} this.addOrUpdateVisible = false
this.getDataList()
} else {
this.$message.error("失败");
}
}) })
}) }
}, })
addOreEditCate() { },
this.$refs["addFormRef"].validate(valid => { handlePictureCardPreview(file) {
if(valid) { this.addForm.url = file.url;
this.$http({ this.dialogVisible = true;
url: this.$http.adornUrl('/book/medicaldes/saveOrUpdateLight'), },
method: 'post', handlePicSuccess(res, file) {
data: this.$http.adornData({
"id": this.editId, //新增不传
"name": this.addForm.name,
"type": this.addForm.type,
"url": this.addForm.url
})
}).then(({data}) => {
if (data && data.code === 0) {
this.$message.success("成功");
this.addOrUpdateVisible = false
this.getDataList()
} else {
this.$message.error("失败");
}
})
}
})
},
handlePictureCardPreview(file) {
this.addForm.url = file.url;
this.dialogVisible = true;
},
handlePicSuccess(res, file) {
// console.log(res,'res') // console.log(res,'res')
if (res.msg == "success") { if (res.msg == "success") {
this.addForm.url = res.url; this.addForm.url = res.url;
this.fileList.push({ this.fileList.push({
name: file.name, name: file.name,
url: res.url url: res.url
}) })
console.log(this.dataForm.url,'url') console.log(this.dataForm.url, 'url')
this.$message.success("上传成功"); this.$message.success("上传成功");
} else { } else {
this.$message.error("上传失败"); this.$message.error("上传失败");
} }
}, },
handleRemove(file, fileList) { handleRemove(file, fileList) {
this.addForm.url = ''; this.addForm.url = '';
this.fileList = fileList this.fileList = fileList
// this.addForm.noneBtnImg = fileList.length >= this.addForm.limitCountImg; // this.addForm.noneBtnImg = fileList.length >= this.addForm.limitCountImg;
}, },
} }
} }
</script> </script>
<style lang="less"> <style lang="less">
.dialog-wmzg{ .dialog-wmzg {
.el-upload-list__item-name{ .el-upload-list__item-name {
max-width: 450px; max-width: 450px;
} }
} }
</style> </style>

View File

@@ -176,7 +176,7 @@
data data
}) => { }) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.booknameList = data.page.list this.booknameList = data.page.result
} else { } else {
this.booknameList = [] this.booknameList = []
} }
@@ -285,4 +285,4 @@
} }
} }
} }
</script> </script>