123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303 |
- <template>
- <div class="app-container">
- <div class="search">
- <el-input v-model="table.getdataListParm.parammaps.rolename" placeholder="标题" style="width: 180px;" class="filter-item" clearable />
- <el-input v-model="table.getdataListParm.parammaps.rolename" placeholder="创建人" style="width: 180px;" class="filter-item" clearable />
- <el-date-picker ref="inputDatetime" v-model="table.getdataListParm.parammaps.inputDatetime" class="inputDatetime filter-item" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" style="width: 250px;" />
- <el-button class="successBorder" @click="handleSearch('table')">查询</el-button>
- <el-button class="successBorder" @click="handleRefresh('table')">重置</el-button>
- </div>
- <div class="operation">
- <el-button class="success" icon="el-icon-plus" @click="handleCreate">新增</el-button>
- <el-button class="danger" icon="el-icon-delete" @click="handleDelete">删除</el-button>
- </div>
- <div class="table">
- <el-table
- :key="table.tableKey"
- v-loading="table.listLoading"
- element-loading-text="给我一点时间"
- :data="table.list"
- border
- fit
- highlight-current-row
- style="width: 100%;"
- :row-style="rowStyle"
- :cell-style="cellStyle"
- class="elTable table-fixed"
- @selection-change="handleSelectionChange"
- >
- <el-table-column type="selection" align="center" width="50" />
- <el-table-column label="序号" align="center" type="index" width="50px">
- <template slot-scope="scope">
- <span>{{ scope.$index + (table.pageNum-1) * table.pageSize + 1 }}</span>
- </template>
- </el-table-column>
- <el-table-column label="标题" min-width="100px" align="center" prop="rolename" />
- <el-table-column label="时间范围" min-width="100px" align="center" prop="rolename" />
- <el-table-column label="创建时间" min-width="100px" align="center" prop="createdtime" />
- <el-table-column label="创建人" min-width="100px" align="center" prop="createmp" />
- <el-table-column label="操作" align="center" width="180" class-name="small-padding fixed-width" fixed="right">
- <template slot-scope="{row}">
- <el-button class="miniSuccess" icon="el-icon-search" @click="handleSee(row)" />
- <span class="centerSpan">|</span>
- <el-button class="miniSuccess" icon="el-icon-edit-outline" @click="handleUpdate(row)" />
- <span class="centerSpan">|</span>
- <el-button class="miniDanger" icon="el-icon-delete" @click="handleRowDelete(row)" />
- <span class="centerSpan">|</span>
- <a class="correcting" @click="handleStatisticsRead(row)">已读统计</a>
- </template>
- </el-table-column>
- </el-table>
- <pagination v-show="table.total>=0" :total="table.total" :page.sync="table.getdataListParm.offset" :limit.sync="table.getdataListParm.pagecount" @pagination="getList" />
- </div>
- <el-dialog :title="textMap[statisticsRead.dialogStatus]" :visible.sync="statisticsRead.dialogFormVisible" :close-on-click-modal="false" width="70%">
- <div class="search">
- <el-select v-model="statisticsRead.getdataListParm.parammaps.enable" placeholder="牧场" class="filter-item" style="width: 120px;" clearable>
- <el-option v-for="item in pastureList" :key="item.id" :label="item.name" :value="item.id" />
- </el-select>
- <el-input v-model="statisticsRead.getdataListParm.parammaps.rolename" placeholder="用户" style="width: 180px;" class="filter-item" clearable />
- <el-date-picker ref="inputDatetime" v-model="statisticsRead.getdataListParm.parammaps.inputDatetime" class="inputDatetime filter-item" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" style="width: 250px;" />
- <el-button class="successBorder" @click="handleSearch('statisticsRead')">查询</el-button>
- <el-button class="successBorder" @click="handleRefresh('statisticsRead')">重置</el-button>
- </div>
- <div class="table">
- <el-table
- :key="statisticsRead.tableKey"
- v-loading="statisticsRead.listLoading"
- element-loading-text="给我一点时间"
- :data="statisticsRead.list"
- border
- fit
- highlight-current-row
- style="width: 100%;"
- :row-style="rowStyle"
- :cell-style="cellStyle"
- class="elTable table-fixed"
- >
- <el-table-column label="序号" align="center" type="index" width="50px">
- <template slot-scope="scope">
- <span>{{ scope.$index + (statisticsRead.pageNum-1) * statisticsRead.pageSize + 1 }}</span>
- </template>
- </el-table-column>
- <el-table-column label="牧场" min-width="100px" align="center" prop="rolename" />
- <el-table-column label="用户" min-width="100px" align="center" prop="rolename" />
- <el-table-column label="已读时间" min-width="100px" align="center" prop="createdtime" />
- </el-table>
- <pagination v-show="statisticsRead.total>=0" :total="statisticsRead.total" :page.sync="statisticsRead.getdataListParm.offset" :limit.sync="statisticsRead.getdataListParm.pagecount" @pagination="getStatisticsReadList" />
- </div>
- <div slot="footer" class="dialog-footer" style="right:30px;position:absolute;bottom:5px">
- <el-button class="cancelClose" @click="statisticsRead.dialogFormVisible = false;getList(); ">关闭</el-button>
- </div>
- </el-dialog>
- </div>
- </template>
- <script>
- import { GetDataByName, PostDataByName, failproccess, GetDataByNames, ExecDataByConfig, checkButtons } from '@/api/common'
- import Cookies from 'js-cookie'
- import { parseTime } from '@/utils/index.js'
- import { MessageBox } from 'element-ui'
- import Pagination from '@/components/Pagination'
- export default {
- name: 'NotificationManagement',
- components: { Pagination },
- data() {
- return {
- requestParams: [
- { name: 'getPastureListJT', offset: 0, pagecount: 0, parammaps: { pastureid: Cookies.get('pastureid'), pasturename: '' }}
- ],
- pastureList: [], // 牧场
- table: {
- getdataListParm: {
- name: 'getRoleList',
- page: 1,
- offset: 1,
- pagecount: 10,
- returntype: 'Map',
- parammaps: {
- pastureid: Cookies.get('pastureid'),
- rolename: '',
- createmp: '',
- enable: '',
- startTime: '',
- stopTime: '',
- inputDatetime: ''
- }
- },
- tableKey: 0,
- list: [],
- total: 0,
- listLoading: true,
- temp: {}
- },
- statisticsRead: {
- getdataListParm: {
- name: 'getRoleList',
- page: 1,
- offset: 1,
- pagecount: 10,
- returntype: 'Map',
- parammaps: {
- pastureid: Cookies.get('pastureid'),
- rolename: '',
- createmp: '',
- enable: '',
- startTime: '',
- stopTime: '',
- inputDatetime: ''
- }
- },
- tableKey: 0,
- list: [],
- total: 0,
- listLoading: true,
- temp: {},
- dialogFormVisible: false
- },
- dialogStatus: '',
- isokDisable: false,
- textMap: {
- statisticsRead: '已读统计'
- },
- selectList: {},
- requestParam: {},
- rowStyle: { maxHeight: 30 + 'px', height: 30 + 'px' },
- cellStyle: { padding: 0 + 'px' }
- }
- },
- created() {
- this.getDownList()
- this.getList()
- },
- methods: {
- getDownList() {
- GetDataByNames(this.requestParams).then(response => {
- this.pastureList = response.data.getPastureListJT.list
- })
- },
- getList() {
- this.table.listLoading = true
- GetDataByName(this.table.getdataListParm).then(response => {
- console.log('table数据', response.data.list)
- if (response.data.list !== null) {
- this.table.list = response.data.list
- this.table.pageNum = response.data.pageNum
- this.table.pageSize = response.data.pageSize
- this.table.total = response.data.total
- } else {
- this.table.list = []
- }
- setTimeout(() => {
- this.table.listLoading = false
- }, 100)
- })
- },
- handleSearch(item) {
- if (item == 'table') {
- if (this.table.getdataListParm.parammaps.inputDatetime !== '' && this.table.getdataListParm.parammaps.inputDatetime !== null) {
- this.table.getdataListParm.parammaps.startTime = parseTime(this.table.getdataListParm.parammaps.inputDatetime[0], '{y}-{m}-{d}')
- this.table.getdataListParm.parammaps.stopTime = parseTime(this.table.getdataListParm.parammaps.inputDatetime[1], '{y}-{m}-{d}')
- } else {
- this.table.getdataListParm.parammaps.inputDatetime = ''
- this.table.getdataListParm.parammaps.startTime = ''
- this.table.getdataListParm.parammaps.stopTime = ''
- }
- this.table.getdataListParm.offset = 1
- this.getList()
- } else if (item == 'statisticsRead') {
- if (this.statisticsRead.getdataListParm.parammaps.inputDatetime !== '' && this.statisticsRead.getdataListParm.parammaps.inputDatetime !== null) {
- this.statisticsRead.getdataListParm.parammaps.startTime = parseTime(this.statisticsRead.getdataListParm.parammaps.inputDatetime[0], '{y}-{m}-{d}')
- this.statisticsRead.getdataListParm.parammaps.stopTime = parseTime(this.statisticsRead.getdataListParm.parammaps.inputDatetime[1], '{y}-{m}-{d}')
- } else {
- this.statisticsRead.getdataListParm.parammaps.inputDatetime = ''
- this.statisticsRead.getdataListParm.parammaps.startTime = ''
- this.statisticsRead.getdataListParm.parammaps.stopTime = ''
- }
- this.statisticsRead.getdataListParm.offset = 1
- this.getList()
- }
- },
- handleRefresh(item) {
- console.log('点击了重置')
- if (item == 'table') {
- // table
- } else if (item == 'statisticsRead') {
- // 已读统计
- }
- },
- handleCreate() {},
- handleSee(row) {},
- handleUpdate(row) {},
- handleRowDelete(row) {},
- handleStatisticsRead(row) {
- this.statisticsRead.temp = Object.assign({}, row)
- this.statisticsRead.dialogStatus = 'statisticsRead'
- this.statisticsRead.dialogFormVisible = true
- this.getStatisticsReadList()
- },
- getStatisticsReadList() {
- this.statisticsRead.listLoading = true
- GetDataByName(this.statisticsRead.getdataListParm).then(response => {
- if (response.data.list !== null) {
- this.statisticsRead.list = response.data.list
- this.statisticsRead.pageNum = response.data.pageNum
- this.statisticsRead.pageSize = response.data.pageSize
- this.statisticsRead.total = response.data.total
- } else {
- this.statisticsRead.list = []
- }
- setTimeout(() => {
- this.statisticsRead.listLoading = false
- }, 100)
- })
- },
- handleSelectionChange(val) {
- console.log('勾选数据', val)
- this.selectList = val
- },
- handleDelete() {
- console.log('点击了删除')
- if (this.selectList.length == 0) {
- this.$message({ type: 'error', message: '请选择角色信息', duration: 2000 })
- } else {
- MessageBox.confirm('是否确认删除此信息?', {
- confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
- }).then(() => {
- console.log(this.selectList)
- this.requestParam.common = { 'returnmap': '0' }
- this.requestParam.data = []
- for (let i = 0; i < this.selectList.length; i++) {
- this.requestParam.data[i] = { 'name': 'checkDeleteRole', 'type': 'v', 'parammaps': {
- 'pastureid': this.selectList[i].pastureid,
- 'id': this.selectList[i].id
- }}
- }
- this.requestParam.data[this.selectList.length] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.selectList }}
- this.requestParam.data[this.selectList.length].children = []
- this.requestParam.data[this.selectList.length].children[0] = { 'name': 'deleteRole', 'type': 'e', 'parammaps': {
- 'pastureid': '@insertSpotList.pastureid',
- 'id': '@insertSpotList.id'
- }}
- ExecDataByConfig(this.requestParam).then(response => {
- console.log('删除保存发送参数', this.requestParam)
- if (response.msg === 'fail') {
- this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
- } else {
- this.$notify({ title: '', message: '删除成功', type: 'success', duration: 2000 })
- this.getList()
- }
- })
- })
- }
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .search{margin-top:10px;}
- .table{margin-top:10px;}
- </style>
|