| | |
| | | import pick from 'lodash.pick' |
| | | export default { |
| | | name: 'Basecurrency', |
| | | data() { |
| | | data () { |
| | | return { |
| | | columns: [ |
| | | { |
| | | title: '公告id', |
| | | dataIndex: 'id', |
| | | align: 'center', |
| | | align: 'center' |
| | | }, |
| | | { |
| | | title: '图片', |
| | | dataIndex: 'artImg', |
| | | align: 'center', |
| | | scopedSlots: { customRender: 'artImg' }, |
| | | scopedSlots: { customRender: 'artImg' } |
| | | }, |
| | | { |
| | | title: '公告标题', |
| | | dataIndex: 'artTitle', |
| | | align: 'center', |
| | | align: 'center' |
| | | }, |
| | | { |
| | | title: '来源', |
| | | dataIndex: 'author', |
| | | align: 'center', |
| | | align: 'center' |
| | | }, |
| | | { |
| | | title: '是否显示', |
| | | dataIndex: 'isShow', |
| | | align: 'center', |
| | | scopedSlots: { customRender: 'isShow' }, |
| | | scopedSlots: { customRender: 'isShow' } |
| | | }, |
| | | { |
| | | title: '添加时间', |
| | |
| | | width: 180, |
| | | customRender: (text, row, index) => { |
| | | return text ? moment(text).format('YYYY-MM-DD HH:mm:ss') : '' |
| | | }, |
| | | } |
| | | }, |
| | | { |
| | | title: '操作', |
| | |
| | | align: 'center', |
| | | fixed: 'right', |
| | | width: 180, |
| | | scopedSlots: { customRender: 'action' }, |
| | | }, |
| | | scopedSlots: { customRender: 'action' } |
| | | } |
| | | ], |
| | | // 表头 |
| | | pagination: { |
| | |
| | | pageSizeOptions: ['10', '20', '50', '100'], // 每页中显示的数据 |
| | | onShowSizeChange: (current, pageSize) => this.onSizeChange(current, pageSize), // 改变每页数量时更新显示 |
| | | onChange: (page, pageSize) => this.onPageChange(page, pageSize), // 点击页码事件 |
| | | showTotal: (total) => `共有 ${total} 条数据`, // 分页中显示总的数据 |
| | | showTotal: (total) => `共有 ${total} 条数据` // 分页中显示总的数据 |
| | | }, |
| | | loading: false, |
| | | queryParam: { |
| | | pageNum: 1, |
| | | pageSize: 10, |
| | | pageSize: 10 |
| | | }, |
| | | datalist: [], |
| | | |
| | |
| | | addUserform: this.$form.createForm(this), |
| | | labelCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 5 }, |
| | | sm: { span: 5 } |
| | | }, |
| | | wrapperCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 18 }, |
| | | sm: { span: 18 } |
| | | }, |
| | | fields: ['artTitle', 'artType', 'author', 'artSummary', 'artCnt', 'spiderUrl', 'isShow', 'artImg'], |
| | | currentDetails: '', |
| | | artImg: '', |
| | | imgloading: false, |
| | | imgloading: false |
| | | } |
| | | }, |
| | | created() { |
| | | created () { |
| | | this.getlist() |
| | | }, |
| | | methods: { |
| | | deletebaseCurrency(val) { |
| | | deletebaseCurrency (val) { |
| | | var that = this |
| | | this.$confirm({ |
| | | title: '提示', |
| | | content: '确认删除公告?此操作不可恢复', |
| | | onOk() { |
| | | onOk () { |
| | | var data = { |
| | | artId: val, |
| | | artId: val |
| | | } |
| | | artdelArt(data).then((res) => { |
| | | if (res.status == 0) { |
| | |
| | | } |
| | | }) |
| | | }, |
| | | onCancel() { |
| | | onCancel () { |
| | | console.log('Cancel') |
| | | }, |
| | | } |
| | | }) |
| | | }, |
| | | customRequest(data) { |
| | | customRequest (data) { |
| | | this.imgloading = true |
| | | var formData = new FormData() |
| | | formData.append('upload_file', data.file) |
| | |
| | | if (res.status == 0) { |
| | | this.artImg = res.data.url |
| | | this.addUserform.setFieldsValue({ |
| | | artImg: res.data.url, |
| | | artImg: res.data.url |
| | | }) |
| | | } else { |
| | | this.$message.error({ content: '上传失败请检查图片类型!' }) |
| | |
| | | this.imgloading = false |
| | | }) |
| | | }, |
| | | geteditbaseCurrency(val) { |
| | | geteditbaseCurrency (val) { |
| | | this.currentDetails = val |
| | | this.artImg = val.artImg |
| | | this.addUserdialog = true |
| | | this.fields.forEach((v) => this.addUserform.getFieldDecorator(v)) |
| | | this.addUserform.setFieldsValue(pick(val, this.fields)) |
| | | }, |
| | | CanceladdUserdialog() { |
| | | CanceladdUserdialog () { |
| | | this.addUserdialog = false |
| | | const form = this.$refs.addUserform.form |
| | | form.resetFields() |
| | | this.artImg = '' |
| | | }, |
| | | OkaddUserdialog() { |
| | | OkaddUserdialog () { |
| | | const form = this.$refs.addUserform.form |
| | | form.validateFields((errors, values) => { |
| | | if (!errors) { |
| | |
| | | } |
| | | }) |
| | | }, |
| | | getlist() { |
| | | getlist () { |
| | | this.loading = true |
| | | artlist(this.queryParam).then((res) => { |
| | | this.datalist = res.data.list |
| | |
| | | this.loading = false |
| | | }) |
| | | }, |
| | | onPageChange(page, pageSize) { |
| | | onPageChange (page, pageSize) { |
| | | this.queryParam.pageNum = page |
| | | this.getlist() |
| | | }, |
| | | onSizeChange(current, pageSize) { |
| | | onSizeChange (current, pageSize) { |
| | | this.queryParam.pageNum = current |
| | | this.queryParam.pageSize = pageSize |
| | | this.getlist() |
| | | }, |
| | | }, |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | <style lang="less" scoped> |