提交 606935c7 authored 作者: 王鹏飞's avatar 王鹏飞

add tableList components

上级 b6b82ec0
This source diff could not be displayed because it is too large. You can view the blob instead.
<template>
<div class="table-list">
<div class="table-list-hd">
<!-- 筛选 -->
</div>
<div class="table-list-bd">
<el-table :data="data" v-bind="$attrs" v-if="data.length">
<el-table-column v-for="(column, index) in columns" :label="column.label" :key="index">
<template slot-scope="scope">
<template
v-if="column.isShow ? column.isShow(get(scope.row, column.prop), scope.row) : true "
>
<template v-if="column.buttons">
<!-- 操作按钮 -->
<template v-for="(button, index) in column.buttons">
<el-button
type="text"
size="mini"
:key="index"
v-bind="button.attrs"
@click="button.onClick(scope.row)"
v-if="button.isShow ? button.isShow(scope.row) : true "
>{{button.label}}</el-button>
</template>
</template>
<template v-else-if="column.computed">
<!-- 处理过的数据 -->
<div
v-html="column.computed(get(scope.row, column.prop), scope.row)"
>{{ get(scope.row, column.prop) }}</div>
</template>
<template v-else>
<!-- 默认数据 -->
<div>{{ get(scope.row, column.prop) }}</div>
</template>
</template>
</template>
</el-table-column>
</el-table>
</div>
<div class="table-list-ft"></div>
</div>
</template>
<script>
import _ from 'lodash'
export default {
props: {
// 表头
columns: {
type: Array,
default() {
return []
}
},
// 数据
data: {
type: Array,
default() {
return []
}
},
remote: {
type: Object
}
},
data() {
return {}
},
methods: {
get: _.get,
// 获取列表数据
fetchListData() {
if (!this.remote || !this.remote.fetch) {
return
}
this.remote.fetch(this.remote.params).then(response => {})
}
},
beforeMount() {
console.log(this)
}
}
</script>
<style lang="scss" scoped>
.tabl-list {
}
.tabl-list-hd {
}
.tabl-list-bd {
}
.tabl-list-ft {
}
</style>
...@@ -3,28 +3,15 @@ ...@@ -3,28 +3,15 @@
<div class="con-title"> <div class="con-title">
<div>办事大厅</div> <div>办事大厅</div>
</div> </div>
<Tap :tapParam='tapParam' @tapParam='tapIndexs'></Tap> <Tap :tapParam="tapParam" @tapParam="tapIndexs"></Tap>
<div class="con-box"> <div class="con-box">
<el-button type="primary" v-show="tapIndex==0" @click="golearningAdd(0)">申请新的活动</el-button> <el-button type="primary" v-show="tapIndex==0" @click="golearningAdd(0)">申请新的活动</el-button>
<el-button type="primary" v-show="tapIndex==1" @click="golearningAdd(1)">申请新乐分享</el-button> <el-button type="primary" v-show="tapIndex==1" @click="golearningAdd(1)">申请新乐分享</el-button>
<el-button type="primary" v-show="tapIndex==2" @click="golearningAdd(2)">申请重修</el-button> <el-button type="primary" v-show="tapIndex==2" @click="golearningAdd(2)">申请重修</el-button>
<!-- <el-button style="float:right;" type="text" @click='gobackReportList'>返回报告列表</el-button> -->
<div style="width: 100%; height: 0.2rem;"></div> <div style="width: 100%; height: 0.2rem;"></div>
<template v-if="ismPageFlag"> <table-list :data="tableData" :columns="columns"></table-list>
<m-page
:tableHead="tableHead"
:tableData="tableData"
:params="params"
:objFn="objFn"
:tableConfig="tableConfig"
/>
</template>
</div> </div>
<el-dialog <el-dialog title="提示" :visible.sync="dialogVisible" width="30%">
title="提示"
:visible.sync="dialogVisible"
width="30%"
>
<span>确定删除?</span> <span>确定删除?</span>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false">取 消</el-button> <el-button @click="dialogVisible = false">取 消</el-button>
...@@ -37,213 +24,242 @@ ...@@ -37,213 +24,242 @@
<script> <script>
import Tap from '../../components/comTable/tap.vue' import Tap from '../../components/comTable/tap.vue'
import mPage from '../../components/comTable/mPage.vue' import mPage from '../../components/comTable/mPage.vue'
import TableList from '../../components/comTable/tableList.vue'
import cAction from '@action' import cAction from '@action'
const status = {
'-1': '待审核',
0: '未通过',
1: '通过',
2: '通过',
3: '未通过',
4: '通过'
}
export default { export default {
components: { components: {
Tap, Tap,
mPage mPage,
TableList
}, },
data () { data() {
return { return {
dialogVisible: false, dialogVisible: false,
ismPageFlag: false, loading: false,
tapIndex: 0, tapIndex: 0,
// tap切换 // tap切换
tapParam: [{ tapParam: [
name: '分类', {
isShow: false, name: '分类',
selectIndex: 0, isShow: false,
key: 'cc', selectIndex: 0,
arrItem: [ key: 'cc',
// { val: '1', name: '学术活动' }, arrItem: []
// { val: '2', name: '乐分享' }, }
// { val: '3', name: '重修' } ],
] // table 配置
}], tableOptions: {
// 学术活动 // 学术活动
tableConfig: { border: '', size: '', selection: { has: false, sels: [], width: '50px', fix: 'left', align: '' } }, // 增加选择框,has设置为true symposium: {
tableHead: [], columns: [
{ prop: 'form.symposium_name', label: '活动名称' },
{ prop: 'form.symposium_time', label: '活动时间' },
{ prop: 'form.symposium_lecturer', label: '主讲人' },
{
prop: 'status',
label: '审核状态',
computed(value) {
return status[value]
}
},
{ prop: 'approve_time1', label: '审核时间' },
{
label: '操作',
buttons: [
{
label: '查看报告',
isShow(row) {
return row.form.reportscount !== '0'
},
onClick: row => {
this.$router.push({
path: `/app/affairs-hall/view-report/${row.form.id}`
})
}
},
{
label: '上传报告',
isShow(row) {
const isPass = [1, 2, 4].includes(row.status)
return isPass && row.form.reportscount === '0'
},
onClick: row => {
this.$router.push({
path: `/app/affairs-hall/upload-report/${row.form.id}/-1`
})
}
},
{
label: '查看',
onClick: row => {
this.$router.push({
path: `/app/affairs-hall/learning-add/${row.id}`,
query: { id: row.affair_id, is_view: true }
})
}
},
{
label: '编辑',
isShow(row) {
return [-1, 0].includes(row.status)
},
onClick: row => {
this.$router.push({
path: `/app/affairs-hall/learning-add/${row.id}`,
query: { id: row.affair_id }
})
}
},
{
label: '删除',
isShow(row) {
return row.status === -1
},
onClick: row => {
this.confirmDeletion(row)
}
}
]
}
]
},
// 乐分享
sharing: {
columns: [
{ prop: 'form.sharing_theme', label: '分享主题' },
{ prop: 'form.class_name', label: '班级' },
{ prop: 'form.personal_name', label: '申请人' },
{ prop: 'form.telephone', label: '电话' },
{ prop: 'approve_status', label: '审核状态' },
{ prop: 'approve_time', label: '审核时间' },
{ prop: 'remark1', label: '备注' }
]
},
// 重修
retake: {
columns: [
{ prop: 'form.semester_name', label: '学期' },
{ prop: 'form.class_name', label: '班级' },
{ prop: 'form.course_name', label: '课程' },
{ prop: 'approve_status', label: '审核状态' },
{ prop: 'approve_time', label: '审核时间' },
{ prop: 'remark1', label: '备注' }
]
}
},
tableData: [], tableData: [],
dataParam: 1, affairList: [],
params: {}, affairId: null
// params: { keywords: '', curPage: 1, pageSize: 5, total: '' },
objFn: {},
_obj: null
// 音分享
} }
}, },
beforeDestroy () { computed: {
this.VueEvent.$off('command-tablelist-x') columns() {
const found = this.affairList.find(item => item.id === this.affairId)
if (found) {
return this.tableOptions[found.form_name].columns
} else {
return []
}
}
}, },
mounted () { mounted() {
this.getTapData() this.getTapData()
this.VueEvent.$on('command-tablelist-x', (_obj) => {
if (_obj.command.command === 'activelist-show') {
const rid = _obj.tableData[_obj.index - 1].formId
this.$router.push({ path: `/app/affairs-hall/view-report/${rid}` })
}
if (_obj.command.command === 'activereport-add') {
const syid = _obj.tableData[_obj.index - 1].formId
this.$router.push({ path: `/app/affairs-hall/upload-report/${syid}/-1` })
}
if (_obj.command.command === 'activelist-edit') {
const rid = _obj.tableData[_obj.index - 1].id
this.$router.push({ path: `/app/affairs-hall/learning-add/${rid}`, query: { id: this.tapParam[0].arrItem[this.tapIndex].val } })
}
if (_obj.command.command === 'activelist-delete') {
this.dialogVisible = true
}
this._obj = _obj
})
}, },
methods: { methods: {
confirmDeletion () { confirmDeletion(row) {
const _obj = this._obj
const rid = _obj.tableData[_obj.index - 1].id
/* 删除 */ /* 删除 */
const loading = this.$loading({ lock: true, text: '', spinner: '', background: 'rgba(255, 255, 255, 0.9)' }) const loading = this.$loading({
cAction.Affairs.deleteAffairs(rid).then(data => { lock: true,
if (data.success) { text: '',
this.$message({ type: 'success', message: '删除成功' }) spinner: '',
this.setmPage() background: 'rgba(255, 255, 255, 0.9)'
} })
}).catch(e => { this.$message.error(e.message) }).finally(() => { loading.close() }) cAction.Affairs.deleteAffairs(row.id)
.then(data => {
if (data.success) {
this.$message({ type: 'success', message: '删除成功' })
this.setmPage()
}
})
.catch(e => {
this.$message.error(e.message)
})
.finally(() => {
loading.close()
})
this.dialogVisible = false this.dialogVisible = false
}, },
setmPage () { tapIndexs(data) {
this.objFn = {
paramsFn: (_this) => { return { affair_id: this.dataParam } },
nameAPI: 'getAffairsData',
actionClass: 'Affairs',
// nameExcel: 'getStatSummaryExcel',
nameExcel: 'getExportExcel3_4_14',
callback: (_this, data) => {
// _this.params.total = data.length
data.forEach((elem, i) => {
const datas = {}
datas.approve_status = '未通过'
datas.approve_status = elem.status = elem.status === 1 || elem.status === 2 || elem.status === 4 ? '通过' : (elem.status === 0 || elem.status === 3 ? '未通过' : '未审核') // 0 未通过;1 通过;2 未审核
// datas.index = elem.index = i + 1 + (_this.params.curPage - 1) * _this.params.pageSize
datas.index = i + 1
datas.approve_time = elem.apply_time
datas.isPage = 0
if (parseInt(this.tapIndex) === 0) {
datas.symposium_attachments = elem.form.symposium_attachments
datas.reportscount = elem.form.reportscount
// datas.approve_status = elem.approve_status = elem.approve_status === 1 ? '通过' : (elem.approve_status === 0 ? '未通过' : '未审核') // 0 未通过;1 通过;2 未审核
// datas.index = elem.index = i + 1 + (_this.params.curPage - 1) * _this.params.pageSize
// datas.reportscount = elem.reportscount = Number(elem.reportscount || '0')
datas.symposium_name = elem.form.symposium_name
datas.symposium_time = elem.form.symposium_time
datas.symposium_lecturer = elem.form.symposium_lecturer
datas.id = elem.id
datas.formId = elem.form.id
} else if (parseInt(this.tapIndex) === 1) {
datas.personal_name = elem.form.personal_name
datas.trade_name = elem.form.trade_name
datas.age = elem.form.age
datas.class_name = elem.form.class_name
datas.telephone = elem.form.telephone
datas.sharing_theme = elem.form.sharing_theme
datas.remark1 = elem.remark1
} else {
datas.personal_name = elem.form.personal_name
datas.payment_instrument = elem.form.payment_instrument
datas.semester_name = elem.form.semester_name
datas.class_name = elem.form.class_name
datas.course_name = elem.form.course_name
datas.remark1 = elem.remark1
}
_this.tableData.push(datas)
})
}
}
this.ismPageFlag = true
},
tapIndexs (data) {
this.tapIndex = data.index this.tapIndex = data.index
this.getData(data) this.affairId = data.id
}, this.getData()
getData (data) {
const n = parseInt(data.index)
this.dataParam = data.id
switch (n) {
case 0:
this.tableHead = [
{ prop: 'index', label: '序号', minWidth: '80', fix: false },
{ prop: 'symposium_name', label: '活动名称', minWidth: '150', fix: false },
{ prop: 'symposium_time', label: '活动时间', minWidth: '120', fix: false },
{ prop: 'symposium_lecturer', label: '主讲人', minWidth: '120', fix: false },
{ prop: 'approve_status', label: '审核状态', minWidth: '80', fix: false },
{ prop: 'approve_time', label: '审核时间', minWidth: '120', fix: false },
// { prop: '', label: '', minWidth: '', fix: false, goObj: { routerName: '', params: {} } }, // 点击跳转页面并传参数
{ prop: 'operate-x', label: '操作', width: '200px', fix: false, commandArr: [{ command: 'activelist-show', name: '查看报告' }, { command: 'activereport-add', name: '上传报告' }, { command: 'activelist-edit', name: '编辑' }, { command: 'activelist-delete', name: '删除' }] }
]
break
case 1:
this.tableHead = [
{ prop: 'index', label: '序号', minWidth: '80', fix: true },
{ prop: 'sharing_theme', label: '分享主题', minWidth: '150', fix: false },
{ prop: 'class_name', label: '班级', minWidth: '80', fix: false },
{ prop: 'personal_name', label: '申请人', minWidth: '80', fix: false },
{ prop: 'telephone', label: '电话', minWidth: '120', fix: false },
{ prop: 'approve_status', label: '审核状态', minWidth: '80', fix: false },
{ prop: 'approve_time', label: '审核时间', minWidth: '200', fix: false },
{ prop: 'remark1', label: '备注', minWidth: '120', fix: false }
]
break
case 2:
this.tableHead = [
{ prop: 'index', label: '序号', minWidth: '80', fix: false },
{ prop: 'semester_name', label: '学期', minWidth: '150', fix: false },
{ prop: 'class_name', label: '班级', minWidth: '80', fix: false },
{ prop: 'course_name', label: '课程', minWidth: '80', fix: false },
{ prop: 'approve_status', label: '审核状态', minWidth: '80', fix: false },
{ prop: 'approve_time', label: '审核时间', minWidth: '120', fix: false },
{ prop: 'remark1', label: '备注', minWidth: '120', fix: false }
]
break
}
this.setmPage()
}, },
getTapData () { getData() {
const affairId = this.$route.query.id || '' cAction.Affairs.getAffairsData({ affair_id: this.affairId }).then(
console.log(affairId, '=======') response => {
// 获取事务类型 tap切换 this.tableData = response
cAction.Affairs.getAffairsType().then(data => {
for (let i = 0; i < data.length; i++) {
this.tapParam[0].arrItem.push(
{ val: data[i].id, name: data[i].affair_name }
)
} }
const param = { )
id: this.tapParam[0].arrItem[0].val,
index: 0
}
this.getData(param)
}).catch(e => {
this.$message.error(e.message)
})
}, },
golearningAdd (n) { getTapData() {
// 获取事务类型
cAction.Affairs.getAffairsType()
.then(data => {
this.tapParam[0].arrItem = data.map(item => {
return { val: item.id, name: item.affair_name }
})
const [first] = data
this.affairId = first.id
this.affairList = data
this.getData()
})
.catch(e => {
this.$message.error(e.message)
})
},
golearningAdd(n) {
if (n === 0) { if (n === 0) {
this.$router.push({ path: '/app/affairs-hall/learning-add/-1', query: { id: this.tapParam[0].arrItem[this.tapIndex].val } }) this.$router.push({
path: '/app/affairs-hall/learning-add/-1',
query: { id: this.tapParam[0].arrItem[this.tapIndex].val }
})
} else if (n === 1) { } else if (n === 1) {
this.$router.push({ path: '/app/affairs-hall/share-add/-1', query: { id: this.tapParam[0].arrItem[this.tapIndex].val } }) this.$router.push({
path: '/app/affairs-hall/share-add/-1',
query: { id: this.tapParam[0].arrItem[this.tapIndex].val }
})
} else { } else {
this.$router.push({ path: '/app/affairs-hall/again-add/-1', query: { id: this.tapParam[0].arrItem[this.tapIndex].val } }) this.$router.push({
path: '/app/affairs-hall/again-add/-1',
query: { id: this.tapParam[0].arrItem[this.tapIndex].val }
})
} }
}, },
goMyApply () { goMyApply() {
this.$router.push({ path: '/app/affairs-hall/my-apply', query: { id1: this.tapParam[0].arrItem[0].val, id2: this.tapParam[0].arrItem[1].val, id3: this.tapParam[0].arrItem[2].val } }) this.$router.push({
path: '/app/affairs-hall/my-apply',
query: {
id1: this.tapParam[0].arrItem[0].val,
id2: this.tapParam[0].arrItem[1].val,
id3: this.tapParam[0].arrItem[2].val
}
})
} }
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.con-title{ .con-title {
display: flex; display: flex;
justify-content:space-between justify-content: space-between;
} }
</style> </style>
...@@ -110,8 +110,10 @@ const agentProcessor = () => { ...@@ -110,8 +110,10 @@ const agentProcessor = () => {
/* getInfo 时,则写入 用户基本信息 */ /* getInfo 时,则写入 用户基本信息 */
if (/user_center\/get_user_info/gi.test(options.url)) { if (/user_center\/get_user_info/gi.test(options.url)) {
/* check-access接口 */ /* check-access接口 */
headers['Host'] = 'lms-api.ezijing.com' // headers['Host'] = 'lms-api.ezijing.com'
headers['host'] = 'lms-api.ezijing.com' // headers['host'] = 'lms-api.ezijing.com'
headers['Host'] = 'lms-worklobby-api.ezijing.com'
headers['host'] = 'lms-worklobby-api.ezijing.com'
axios.defaults.headers = headers axios.defaults.headers = headers
axios({ axios({
timeout: 30 * 1000, timeout: 30 * 1000,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论