Commit 17d99974 by Lyan

后台bug修改

parent 46bf04e0
...@@ -148,113 +148,113 @@ ...@@ -148,113 +148,113 @@
<script> <script>
import { piclevelList } from '@/utils' import { piclevelList } from '@/utils'
import Ueditor from "../temps/ueditor"; import Ueditor from '../temps/ueditor'
export default { export default {
components: { components: {
Ueditor, Ueditor
}, },
props: ['classidList'], props: ['classidList'],
data() { data () {
return { return {
loading: false, loading: false,
showInfo: false, showInfo: false,
visible: false, visible: false,
defaultProps: { defaultProps: {
children: "children", children: 'children',
label: "label", label: 'label'
}, },
dataForm: { dataForm: {
id: 0, id: 0,
title: "", title: '',
titleOld: "", titleOld: '',
keyword: "", keyword: '',
brief: "", brief: '',
author: "", author: '',
source: "", source: '',
levels: "", levels: '',
directpath: "", directpath: '',
pic: "", pic: '',
content: "", content: '',
showtime: "", showtime: '',
classid: "", classid: ''
}, },
dataRule: { dataRule: {
title: [{ required: true, message: "不能为空", trigger: "blur" }], title: [{ required: true, message: '不能为空', trigger: 'blur' }],
titleOld: [{ required: true, message: "不能为空", trigger: "blur" }], titleOld: [{ required: true, message: '不能为空', trigger: 'blur' }],
keyword: [{ required: true, message: "不能为空", trigger: "blur" }], keyword: [{ required: true, message: '不能为空', trigger: 'blur' }],
brief: [{ required: true, message: "不能为空", trigger: "blur" }], brief: [{ required: true, message: '不能为空', trigger: 'blur' }],
author: [{ required: true, message: "不能为空", trigger: "blur" }], author: [{ required: true, message: '不能为空', trigger: 'blur' }],
source: [{ required: true, message: "不能为空", trigger: "blur" }], source: [{ required: true, message: '不能为空', trigger: 'blur' }],
levels: [{ required: true, message: "不能为空", trigger: "blur" }], levels: [{ required: true, message: '不能为空', trigger: 'blur' }],
directpath: [{ required: true, message: "不能为空", trigger: "blur" }], directpath: [{ required: true, message: '不能为空', trigger: 'blur' }],
pic: [{ required: true, message: "不能为空", trigger: "blur" }], pic: [{ required: true, message: '不能为空', trigger: 'blur' }],
// content: [ // content: [
// { required: true, message: '不能为空', trigger: 'blur' } // { required: true, message: '不能为空', trigger: 'blur' }
// ], // ],
classid: [{ required: true, message: "不能为空", trigger: "blur" }], classid: [{ required: true, message: '不能为空', trigger: 'blur' }],
showtime: [{ required: true, message: "不能为空", trigger: "blur" }], showtime: [{ required: true, message: '不能为空', trigger: 'blur' }]
}, },
imgUrl: new FormData(), imgUrl: new FormData(),
imgUrlStr: "", imgUrlStr: '',
dialogVisible: false, dialogVisible: false,
ueditor: { ueditor: {
value: "", value: '',
config: {}, config: {}
}, },
piclevelList, piclevelList,
id: [], id: [],
classidList: [], classidList: [],
title: "", title: '',
className: "", className: '',
cclassName: "", cclassName: ''
}; }
}, },
mounted() { mounted () {
console.log(this.classidList); console.log(this.classidList)
}, },
methods: { methods: {
getSelectName(list, id) { getSelectName (list, id) {
let arr = list.filter((item) => { let arr = list.filter((item) => {
return item.id === id; return item.id === id
}); })
return arr[0].name; return arr[0].name
}, },
init(id, showInfo) { init (id, showInfo) {
console.log(id, 'id'); console.log(id, 'id')
this.dataForm.id = id || 0; this.dataForm.id = id || 0
this.visible = true; this.visible = true
this.showInfo = showInfo; this.showInfo = showInfo
this.$nextTick(() => { this.$nextTick(() => {
this.clearInp(); this.clearInp()
if (this.dataForm.id) { if (this.dataForm.id) {
this.loading = true; this.loading = true
this.$http({ this.$http({
url: this.$http.adornUrl(`/office/news/info/${this.dataForm.id}`), url: this.$http.adornUrl(`/office/news/info/${this.dataForm.id}`),
method: "get", method: 'get',
params: this.$http.adornParams(), params: this.$http.adornParams()
}).then(({ data }) => { }).then(({ data }) => {
this.loading = false; this.loading = false
if (data && data.code === 0) { if (data && data.code === 0) {
this.dataForm = data.news; this.dataForm = data.news
this.imgUrlStr = data.news.pic; this.imgUrlStr = data.news.pic
this.dialogVisible = true; this.dialogVisible = true
this.ueditor.value = this.dataForm.content; this.ueditor.value = this.dataForm.content
} }
}); })
} }
}); })
}, },
// 表单提交 // 表单提交
dataFormSubmit() { dataFormSubmit () {
this.$refs["dataForm"].validate((valid) => { this.$refs['dataForm'].validate((valid) => {
if (valid) { if (valid) {
this.loading = true; this.loading = true
this.$http({ this.$http({
url: this.$http.adornUrl( url: this.$http.adornUrl(
`/office/news/${!this.dataForm.id ? "save" : "update"}` `/office/news/${!this.dataForm.id ? 'save' : 'update'}`
), ),
method: "post", method: 'post',
data: this.$http.adornData({ data: this.$http.adornData({
id: this.dataForm.id || undefined, id: this.dataForm.id || undefined,
title: this.dataForm.title, title: this.dataForm.title,
...@@ -268,79 +268,79 @@ export default { ...@@ -268,79 +268,79 @@ export default {
pic: this.dataForm.pic, pic: this.dataForm.pic,
content: this.dataForm.content, content: this.dataForm.content,
classid: this.dataForm.classid, classid: this.dataForm.classid,
showtime: this.dataForm.showtime, showtime: this.dataForm.showtime
}), })
}).then(({ data }) => { }).then(({ data }) => {
this.loading = false; this.loading = false
if (data && data.code === 0) { if (data && data.code === 0) {
this.$message({ this.$message({
message: "操作成功", message: '操作成功',
type: "success", type: 'success',
duration: 1500, duration: 1500,
onClose: () => { onClose: () => {
this.visible = false; this.visible = false
this.$emit("refreshDataList"); this.$emit('refreshDataList')
}, }
}); })
} else { } else {
this.$message.error(data.msg); this.$message.error(data.msg)
} }
}); })
} }
}); })
}, },
// 上传之前校验 // 上传之前校验
beforeAvatarUpload(file) { beforeAvatarUpload (file) {
const isJPG = file.type === "image/jpeg"; const isJPG = file.type === 'image/jpeg'
const isPNG = file.type === "image/png"; const isPNG = file.type === 'image/png'
const isLt2M = file.size / 1024 / 1024 < 2; const isLt2M = file.size / 1024 / 1024 < 2
if (!isJPG) { if (!isJPG) {
if (!isPNG) { if (!isPNG) {
this.$message.error("上传图片只能是 JPG, PNG 格式!"); this.$message.error('上传图片只能是 JPG, PNG 格式!')
} }
} }
if (!isLt2M) { if (!isLt2M) {
this.$message.error("上传头像图片大小不能超过 2MB!"); this.$message.error('上传头像图片大小不能超过 2MB!')
} }
if (file) { if (file) {
var windowURL = window.URL || window.webkitURL; var windowURL = window.URL || window.webkitURL
this.imgUrlStr = windowURL.createObjectURL(file); this.imgUrlStr = windowURL.createObjectURL(file)
this.dialogVisible = true; this.dialogVisible = true
this.imgUrl.append("file", file); this.imgUrl.append('file', file)
} }
}, },
Upload() { Upload () {
this.$http({ this.$http({
url: this.$http.adornUrl("/office/file/uploadFile"), url: this.$http.adornUrl('/office/file/uploadFile'),
method: "post", method: 'post',
data: this.imgUrl, data: this.imgUrl,
headers: { headers: {
"Content-Type": "multipart/form-data", 'Content-Type': 'multipart/form-data'
}, }
}) })
.then((res) => { .then((res) => {
console.log(res); console.log(res)
this.dataForm.pic = res.data.data; this.dataForm.pic = res.data.data
}) })
.catch((err) => { .catch((err) => {
console.log(err); console.log(err)
}); })
}, },
clearInp() { clearInp () {
this.$refs["dataForm"].resetFields(); this.$refs['dataForm'].resetFields()
this.imgUrlStr = ""; this.imgUrlStr = ''
this.dialogVisible = false; this.dialogVisible = false
this.ueditor.value = ""; this.ueditor.value = ''
}, },
// 更新父子组件内容 // 更新父子组件内容
editorReady(instance) { editorReady (instance) {
instance.setContent(this.dataForm.content); instance.setContent(this.dataForm.content)
instance.addListener("contentChange", () => { instance.addListener('contentChange', () => {
this.dataForm.content = instance.getContent(); this.dataForm.content = instance.getContent()
}); })
}, }
}, }
}; }
</script> </script>
<style scoped> <style scoped>
/* .form-list{ /* .form-list{
......
...@@ -142,7 +142,7 @@ ...@@ -142,7 +142,7 @@
value: '', value: '',
config: {} config: {}
}, },
piclevelList: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], piclevelList: [1, 2, 3, 4, 5, 6, 7, 8, 9],
id: [], id: [],
classidList: [], classidList: [],
cclassidList: [], cclassidList: [],
......
...@@ -138,7 +138,7 @@ ...@@ -138,7 +138,7 @@
classnum: '', classnum: '',
title: '', title: '',
brief: '', brief: '',
levels: 0, levels: '',
directpath: '', directpath: '',
picIndexPath: '', picIndexPath: '',
colorBackground: '', colorBackground: '',
...@@ -173,7 +173,7 @@ ...@@ -173,7 +173,7 @@
imgUrl: new FormData(), imgUrl: new FormData(),
imgUrlStr: '', imgUrlStr: '',
dialogVisible: false, dialogVisible: false,
levelList: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], levelList: [1, 2, 3, 4, 5, 6, 7, 8, 9],
colorBackgroundList: [ colorBackgroundList: [
{ {
label: '蓝色' label: '蓝色'
......
...@@ -191,7 +191,7 @@ ...@@ -191,7 +191,7 @@
value: '', value: '',
config: {} config: {}
}, },
piclevelList: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], piclevelList: [1, 2, 3, 4, 5, 6, 7, 8, 9],
id: [], id: [],
classidList: [], classidList: [],
cclassidList: [], cclassidList: [],
......
...@@ -177,7 +177,7 @@ ...@@ -177,7 +177,7 @@
value: '', value: '',
config: {} config: {}
}, },
levelList: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], levelList: [1, 2, 3, 4, 5, 6, 7, 8, 9],
clanguageList: ['中文'], clanguageList: ['中文'],
id: [], id: [],
title: '' title: ''
......
...@@ -161,7 +161,7 @@ ...@@ -161,7 +161,7 @@
value: '', value: '',
config: {} config: {}
}, },
piclevelList: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], piclevelList: [1, 2, 3, 4, 5, 6, 7, 8, 9],
id: [], id: [],
newtmList: [ newtmList: [
{ {
......
...@@ -17,10 +17,10 @@ ...@@ -17,10 +17,10 @@
<el-form-item label='级别' prop='levels'> <el-form-item label='级别' prop='levels'>
<el-select v-model="dataForm.levels" placeholder="请输入级别" clearable> <el-select v-model="dataForm.levels" placeholder="请输入级别" clearable>
<el-option <el-option
v-for="item in levelList" v-for="item in piclevelList"
:key="item" :key="item.value"
:label="item" :label="item.name"
:value="item"> :value="item.value">
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
...@@ -144,172 +144,173 @@ ...@@ -144,172 +144,173 @@
</template> </template>
<script> <script>
import AddOrUpdate from './news-add-or-update' import { piclevelList } from '@/utils'
export default { import AddOrUpdate from './news-add-or-update'
components: { export default {
AddOrUpdate components: {
}, AddOrUpdate
data () { },
return { data () {
addOrUpdateVisible: false, return {
dataForm: { addOrUpdateVisible: false,
title: '', dataForm: {
levels: null, title: '',
status: '', levels: null,
classnum: '', status: '',
inputdate: '' classnum: '',
}, inputdate: ''
dataList: [], },
pageIndex: 1, dataList: [],
pageSize: 10, pageIndex: 1,
totalPage: 0, pageSize: 10,
dataListLoading: false, totalPage: 0,
dataListSelections: [], dataListLoading: false,
statusList: [ dataListSelections: [],
{ statusList: [
value: '0', {
label: '待审核' value: '0',
}, label: '待审核'
{ },
value: '-1', {
label: '失败' value: '-1',
}, label: '失败'
{ },
value: '1', {
label: '成功' value: '1',
} label: '成功'
], }
levelList: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], ],
releaseDate: [] piclevelList,
} releaseDate: []
}, }
activated () { },
this.getDataList() activated () {
}, this.getDataList()
methods: { },
methods: {
// 获取数据列表 // 获取数据列表
getDataList () { getDataList () {
this.dataListLoading = true this.dataListLoading = true
this.$http({ this.$http({
url: this.$http.adornUrl('/office/newtopic/list'), url: this.$http.adornUrl('/office/newtopic/list'),
method: 'post', method: 'post',
data: this.$http.adornParams({ data: this.$http.adornParams({
'page': this.pageIndex + '', 'page': this.pageIndex + '',
'limit': this.pageSize + '', 'limit': this.pageSize + '',
'title': this.dataForm.title, 'title': this.dataForm.title,
'status': this.dataForm.status, 'status': this.dataForm.status,
'levels': this.dataForm.levels, 'levels': this.dataForm.levels,
'inputDataStart': this.releaseDate === null ? '' : this.releaseDate[0], 'inputDataStart': this.releaseDate === null ? '' : this.releaseDate[0],
'inputDataEnd': this.releaseDate === null ? '' : this.releaseDate[1] 'inputDataEnd': this.releaseDate === null ? '' : this.releaseDate[1]
}) })
}).then(({data}) => { }).then(({data}) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.dataList = data.page.list this.dataList = data.page.list
this.totalPage = data.page.totalCount this.totalPage = data.page.totalCount
} else { } else {
this.dataList = [] this.dataList = []
this.totalPage = 0 this.totalPage = 0
} }
this.dataListLoading = false this.dataListLoading = false
}) })
}, },
// 每页数 // 每页数
sizeChangeHandle (val) { sizeChangeHandle (val) {
this.pageSize = val this.pageSize = val
this.pageIndex = 1 this.pageIndex = 1
this.getDataList() this.getDataList()
}, },
// 当前页 // 当前页
currentChangeHandle (val) { currentChangeHandle (val) {
this.pageIndex = val this.pageIndex = val
this.getDataList() this.getDataList()
}, },
// 多选 // 多选
selectionChangeHandle (val) { selectionChangeHandle (val) {
this.dataListSelections = val this.dataListSelections = val
}, },
// 新增 / 修改 // 新增 / 修改
addOrUpdateHandle (id, showInfo) { addOrUpdateHandle (id, showInfo) {
this.addOrUpdateVisible = true this.addOrUpdateVisible = true
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.addOrUpdate.init(id, showInfo) this.$refs.addOrUpdate.init(id, showInfo)
}) })
}, },
showMsg (data) { showMsg (data) {
if (!data.directpath || data.directpath === null) { if (!data.directpath || data.directpath === null) {
window.open(this.$store.state.config.urls + '/News/viewsub?id=' + data.id, '_blank') window.open(this.$store.state.config.urls + '/News/viewsub?id=' + data.id, '_blank')
} else if (/^\//.test(data.directpath)) { } else if (/^\//.test(data.directpath)) {
window.open(this.$store.state.config.urls + data.directpath, '_blank') window.open(this.$store.state.config.urls + data.directpath, '_blank')
} else { } else {
window.open(data.directpath, '_blank') window.open(data.directpath, '_blank')
} }
}, },
// 删除 // 删除
deleteHandle (id) { deleteHandle (id) {
var ids = id ? [id] : this.dataListSelections.map(item => { var ids = id ? [id] : this.dataListSelections.map(item => {
return item.classid return item.classid
}) })
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', { this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
this.$http({ this.$http({
url: this.$http.adornUrl('/office/newtopic/delete'), url: this.$http.adornUrl('/office/newtopic/delete'),
method: 'post', method: 'post',
data: this.$http.adornData(ids, false) data: this.$http.adornData(ids, false)
}).then(({data}) => { }).then(({data}) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.$message({ this.$message({
message: '操作成功', message: '操作成功',
type: 'success', type: 'success',
duration: 1500, duration: 1500,
onClose: () => { onClose: () => {
this.getDataList() this.getDataList()
} }
}) })
} else { } else {
this.$message.error(data.msg) this.$message.error(data.msg)
} }
}) })
}).catch(() => {}) }).catch(() => {})
}, },
// 审核 // 审核
checkHandle (id, status) { checkHandle (id, status) {
let str = '' let str = ''
if (status === 1) { if (status === 1) {
str = '成功' str = '成功'
} else { } else {
str = '失败' str = '失败'
} }
this.$confirm(`确定对[id=${id}]进行['审核${str}']操作?`, '提示', { this.$confirm(`确定对[id=${id}]进行['审核${str}']操作?`, '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
this.$http({ this.$http({
url: this.$http.adornUrl('/office/newtopic/verify'), url: this.$http.adornUrl('/office/newtopic/verify'),
method: 'post', method: 'post',
data: this.$http.adornData({ data: this.$http.adornData({
'id': id, 'id': id,
'status': status 'status': status
}) })
}).then(({data}) => { }).then(({data}) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.$message({ this.$message({
message: '操作成功', message: '操作成功',
type: 'success', type: 'success',
duration: 1500, duration: 1500,
onClose: () => { onClose: () => {
this.getDataList() this.getDataList()
} }
}) })
} else { } else {
this.$message.error(data.msg) this.$message.error(data.msg)
} }
}) })
}).catch(() => {}) }).catch(() => {})
} }
} }
} }
</script> </script>
...@@ -106,7 +106,7 @@ export default { ...@@ -106,7 +106,7 @@ export default {
jumppath: '', jumppath: '',
showtime: '' showtime: ''
}, },
piclevelList: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], piclevelList: [1, 2, 3, 4, 5, 6, 7, 8, 9],
pictureTypeList: [ pictureTypeList: [
{ {
value: '1', value: '1',
......
...@@ -161,7 +161,7 @@ ...@@ -161,7 +161,7 @@
value: '', value: '',
config: {} config: {}
}, },
levelList: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], levelList: [1, 2, 3, 4, 5, 6, 7, 8, 9],
id: [], id: [],
typeList: [ typeList: [
{ {
......
...@@ -153,7 +153,7 @@ ...@@ -153,7 +153,7 @@
value: '', value: '',
config: {} config: {}
}, },
levelList: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], levelList: [1, 2, 3, 4, 5, 6, 7, 8, 9],
id: [], id: [],
typeList: [], typeList: [],
title: '' title: ''
......
...@@ -154,7 +154,7 @@ ...@@ -154,7 +154,7 @@
value: '', value: '',
config: {} config: {}
}, },
levelList: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], levelList: [1, 2, 3, 4, 5, 6, 7, 8, 9],
id: [], id: [],
classidList: [], classidList: [],
cclassidList: [], cclassidList: [],
......
...@@ -153,7 +153,7 @@ ...@@ -153,7 +153,7 @@
value: '', value: '',
config: {} config: {}
}, },
levelList: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], levelList: [1, 2, 3, 4, 5, 6, 7, 8, 9],
id: [], id: [],
title: '' title: ''
} }
......
...@@ -154,7 +154,7 @@ ...@@ -154,7 +154,7 @@
value: '', value: '',
config: {} config: {}
}, },
levelList: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], levelList: [1, 2, 3, 4, 5, 6, 7, 8, 9],
id: [], id: [],
classidList: [], classidList: [],
cclassidList: [], cclassidList: [],
......
...@@ -154,7 +154,7 @@ ...@@ -154,7 +154,7 @@
value: '', value: '',
config: {} config: {}
}, },
levelList: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], levelList: [1, 2, 3, 4, 5, 6, 7, 8, 9],
id: [], id: [],
classidList: [], classidList: [],
cclassidList: [], cclassidList: [],
......
...@@ -162,7 +162,7 @@ ...@@ -162,7 +162,7 @@
value: '', value: '',
config: {} config: {}
}, },
levelList: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], levelList: [1, 2, 3, 4, 5, 6, 7, 8, 9],
id: [], id: [],
typeList: [ typeList: [
{ {
......
...@@ -96,7 +96,7 @@ ...@@ -96,7 +96,7 @@
fileUrl: new FormData(), fileUrl: new FormData(),
fileUrlStr: '', fileUrlStr: '',
dialogVisible: false, dialogVisible: false,
levelList: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], levelList: [1, 2, 3, 4, 5, 6, 7, 8, 9],
typeList: [ typeList: [
{ {
value: 1, value: 1,
......
...@@ -7,10 +7,10 @@ ...@@ -7,10 +7,10 @@
<el-form-item label='级别' prop='levels' > <el-form-item label='级别' prop='levels' >
<el-select v-model="dataForm.levels" placeholder="请输入级别" clearable> <el-select v-model="dataForm.levels" placeholder="请输入级别" clearable>
<el-option <el-option
v-for="item in levelList" v-for="item in piclevelList"
:key="item" :key="item.value"
:label="item" :label="item.name"
:value="item"> :value="item.value">
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
...@@ -107,158 +107,159 @@ ...@@ -107,158 +107,159 @@
</template> </template>
<script> <script>
import AddOrUpdate from './doc-add-or-update' import { piclevelList } from '@/utils'
export default { import AddOrUpdate from './doc-add-or-update'
components: { export default {
AddOrUpdate components: {
}, AddOrUpdate
data () { },
return { data () {
addOrUpdateVisible: false, return {
dataForm: { addOrUpdateVisible: false,
'title': '', dataForm: {
'category': '', 'title': '',
'levels': '' 'category': '',
}, 'levels': ''
dataList: [], },
pageIndex: 1, dataList: [],
pageSize: 10, pageIndex: 1,
totalPage: 0, pageSize: 10,
dataListLoading: false, totalPage: 0,
dataListSelections: [], dataListLoading: false,
typeList: [ dataListSelections: [],
{ typeList: [
value: '1', {
label: '表格下载' value: '1',
}, label: '表格下载'
{ },
value: '2', {
label: '分支机构培训计划' value: '2',
} label: '分支机构培训计划'
], }
levelList: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] ],
} piclevelList
}, }
activated () { },
this.getDataList() activated () {
}, this.getDataList()
methods: { },
methods: {
// 获取数据列表 // 获取数据列表
getDataList () { getDataList () {
this.dataListLoading = true this.dataListLoading = true
this.$http({ this.$http({
url: this.$http.adornUrl('/office/doc/list'), url: this.$http.adornUrl('/office/doc/list'),
method: 'post', method: 'post',
data: this.$http.adornParams({ data: this.$http.adornParams({
'page': this.pageIndex, 'page': this.pageIndex,
'limit': this.pageSize, 'limit': this.pageSize,
'title': this.dataForm.title, 'title': this.dataForm.title,
'levels': this.dataForm.levels, 'levels': this.dataForm.levels,
'type': this.dataForm.type 'type': this.dataForm.type
}) })
}).then(({data}) => { }).then(({data}) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.dataList = data.page.list this.dataList = data.page.list
this.totalPage = data.page.totalCount this.totalPage = data.page.totalCount
} else { } else {
this.dataList = [] this.dataList = []
this.totalPage = 0 this.totalPage = 0
} }
this.dataListLoading = false this.dataListLoading = false
}) })
}, },
// 每页数 // 每页数
sizeChangeHandle (val) { sizeChangeHandle (val) {
this.pageSize = val this.pageSize = val
this.pageIndex = 1 this.pageIndex = 1
this.getDataList() this.getDataList()
}, },
// 当前页 // 当前页
currentChangeHandle (val) { currentChangeHandle (val) {
this.pageIndex = val this.pageIndex = val
this.getDataList() this.getDataList()
}, },
// 多选 // 多选
selectionChangeHandle (val) { selectionChangeHandle (val) {
this.dataListSelections = val this.dataListSelections = val
}, },
// 新增 / 修改 // 新增 / 修改
addOrUpdateHandle (id, showInfo) { addOrUpdateHandle (id, showInfo) {
this.addOrUpdateVisible = true this.addOrUpdateVisible = true
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.addOrUpdate.init(id, showInfo) this.$refs.addOrUpdate.init(id, showInfo)
}) })
}, },
// 删除 // 删除
deleteHandle (id) { deleteHandle (id) {
var ids = id ? [id] : this.dataListSelections.map(item => { var ids = id ? [id] : this.dataListSelections.map(item => {
return item.id return item.id
}) })
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', { this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
this.$http({ this.$http({
url: this.$http.adornUrl('/office/doc/delete'), url: this.$http.adornUrl('/office/doc/delete'),
method: 'post', method: 'post',
data: this.$http.adornData(ids, false) data: this.$http.adornData(ids, false)
}).then(({data}) => { }).then(({data}) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.$message({ this.$message({
message: '操作成功', message: '操作成功',
type: 'success', type: 'success',
duration: 1500, duration: 1500,
onClose: () => { onClose: () => {
this.getDataList() this.getDataList()
} }
}) })
} else { } else {
this.$message.error(data.msg) this.$message.error(data.msg)
} }
}) })
}) })
}, },
// 审核 // 审核
checkHandle (id, status) { checkHandle (id, status) {
let str = '' let str = ''
if (status === 1) { if (status === 1) {
str = '成功' str = '成功'
} else { } else {
str = '失败' str = '失败'
} }
this.$confirm(`确定对[id=${id}]进行['审核${str}']操作?`, '提示', { this.$confirm(`确定对[id=${id}]进行['审核${str}']操作?`, '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
this.$http({ this.$http({
url: this.$http.adornUrl('/office/doc/verify'), url: this.$http.adornUrl('/office/doc/verify'),
method: 'post', method: 'post',
data: this.$http.adornData({ data: this.$http.adornData({
'id': id, 'id': id,
'status': status 'status': status
}) })
}).then(({data}) => { }).then(({data}) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.$message({ this.$message({
message: '操作成功', message: '操作成功',
type: 'success', type: 'success',
duration: 1500, duration: 1500,
onClose: () => { onClose: () => {
this.getDataList() this.getDataList()
} }
}) })
} else { } else {
this.$message.error(data.msg) this.$message.error(data.msg)
} }
}) })
}) })
}, },
downFile (file) { downFile (file) {
window.open(file, '_blank') window.open(file, '_blank')
} }
} }
} }
</script> </script>
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