城阳pc工作端前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

384 lines
9.2 KiB

3 years ago
<template>
3 years ago
<div class="div_main">
<div class="div_search">
3 years ago
<el-form :inline="true"
3 years ago
:model="formData"
ref="ref_searchform"
:label-width="'110px'">
<el-form-item label="角色名称"
prop="name">
<el-input v-model="formData.name"
size="small"
class="list_item_width_1"
clearable
placeholder="请输入角色名称">
</el-input>
3 years ago
</el-form-item>
3 years ago
<!-- <el-form-item label="创建时间"
3 years ago
label-width="110px"
prop="createdTime">
<el-date-picker v-model="formData.createdTime"
size="small"
type="datetime"
@change="handleTimeChange"
format="yyyy-MM-dd HH:mm"
value-format="yyyy-MM-dd HH:mm"
placeholder="创建时间">
</el-date-picker>
3 years ago
</el-form-item> -->
3 years ago
<el-button style="margin-left:30px"
size="small"
class="diy-button--search"
@click="handleSearch">查询</el-button>
<el-button style="margin-left:10px"
size="small"
class="diy-button--reset"
@click="resetSearch">重置</el-button>
3 years ago
</el-form>
3 years ago
</div>
<div class="div_table">
<div class="div_btn">
<el-button class="diy-button--add"
size="small"
@click="handleAdd">新增</el-button>
</div>
<el-table class="table"
ref="ref_table"
:data="tableData"
3 years ago
border
3 years ago
:height="tableHeight"
v-loading="tableLoading"
:header-cell-style="{background:'#2195FE',color:'#FFFFFF'}"
style="width: 100%">
<el-table-column label="序号"
3 years ago
header-align="center"
align="center"
3 years ago
type="index"
3 years ago
width="50"></el-table-column>
3 years ago
3 years ago
<el-table-column prop="name"
header-align="center"
3 years ago
align="center"
label="角色名称"
min-width="100">
</el-table-column>
3 years ago
<el-table-column prop="remark"
header-align="center"
3 years ago
align="center"
label="备注"
min-width="110">
</el-table-column>
<el-table-column prop="createdTime"
3 years ago
header-align="center"
align="center"
3 years ago
label="创建时间"
min-width="170">
</el-table-column>
<el-table-column label="操作"
3 years ago
fixed="right"
3 years ago
width="140"
3 years ago
header-align="center"
align="center"
3 years ago
class="operate">
3 years ago
<template slot-scope="scope">
3 years ago
<el-button v-if="true"
type="text"
3 years ago
class="div-table-button--detail"
size="small"
@click="handleDetail(scope.row)">查看</el-button>
<el-button type="text"
3 years ago
class="div-table-button--edit"
3 years ago
size="small"
3 years ago
@click="handleEdit(scope.row)">修改</el-button>
3 years ago
<el-button type="text"
3 years ago
class="div-table-button--delete "
3 years ago
size="small"
3 years ago
@click="handleDelete(scope.row)">删除</el-button>
3 years ago
</template>
</el-table-column>
</el-table>
3 years ago
<div>
<el-pagination @size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page.sync="pageNo"
:page-sizes="[20, 50, 100, 200]"
:page-size="pageSize"
layout="sizes, prev, pager, next, total"
:total="total">
</el-pagination>
</div>
3 years ago
</div>
3 years ago
<!-- 修改弹出框 -->
<el-dialog :visible.sync="formShow"
:close-on-click-modal="false"
:close-on-press-escape="false"
:title="formTitle"
width="850px"
top="5vh"
class="dialog-h"
@closed="diaClose">
<role-form ref="ref_form"
@dialogCancle="diaClose"
@dialogOk="addFormOk"></role-form>
</el-dialog>
</div>
3 years ago
</template>
<script>
3 years ago
import roleForm from './roleForm'
import { requestPost, requestGet } from '@/js/dai/request'
import { mapGetters } from 'vuex'
import { Loading } from 'element-ui' // 引入Loading服务
let loading // 加载动画
3 years ago
export default {
data () {
return {
3 years ago
loading: false,
total: 0,
pageSize: 20,
pageNo: 0,
tableLoading: false,
isResiUser: true,
agencyId: '',
timeRange: [],
formData: {
name: '',//名称
3 years ago
// createdTime: '',//时间
3 years ago
3 years ago
},
3 years ago
tableData: [],
//form相关
formShow: false,
formTitle: '新增',
3 years ago
}
},
components: {
3 years ago
roleForm
},
async created () {
},
async mounted () {
const { user } = this.$store.state
this.agencyId = user.agencyId
await this.loadTable()
},
activated () {
this.$refs['ref_table'].doLayout()
},
methods: {
async handleSearch () {
this.isResiUser = this.formData.orgType === 'current'
await this.loadTable()
this.$nextTick(() => {
this.$refs.ref_table.doLayout() // 解决表格错位
})
},
async loadTable () {
this.tableLoading = true
const url = "/gov/access/govrole/page"
let params = {
pageSize: this.pageSize,
pageNo: this.pageNo,
...this.formData
}
const { data, code, msg } = await requestGet(url, params)
if (code === 0) {
this.total = data.total
this.tableData = data.list
} else {
this.$message.error(msg)
}
this.tableLoading = false
},
handleTimeChange (time) {
if (time) {
this.formData.startTime = time[0]
this.formData.endTime = time[1]
} else {
this.formData.startTime = ''
this.formData.endTime = ''
}
},
diaClose () {
3 years ago
3 years ago
this.formShow = false
},
handleAdd () {
this.formTitle = '新增'
this.formShow = true
this.$nextTick(() => {
this.$refs.ref_form.initForm('add', null)
})
},
handleEdit (row) {
this.formTitle = '修改'
this.formShow = true
this.$nextTick(() => {
this.$refs.ref_form.initForm('edit', row.id)
})
},
3 years ago
handleDetail (row) {
this.formTitle = '详情'
this.formShow = true
this.$nextTick(() => {
this.$refs.ref_form.initForm('detail', row.id)
})
},
3 years ago
addFormOk () {
this.formShow = false
this.loadTable()
},
async handleDelete (row) {
let message = '确认删除?'
this.$confirm(message, "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
})
.then(() => {
this.deleteRole(row)
})
.catch(err => {
});
},
async deleteRole (row) {
3 years ago
const url = "/gov/access/govrole/del"
3 years ago
3 years ago
let params = [row.id]
3 years ago
const { data, code, msg } = await requestPost(url, params)
if (code === 0) {
this.$message({
type: "success",
message: "操作成功"
});
this.loadTable()
} else {
this.$message.error(msg)
}
},
//重置搜索条件
resetSearch () {
this.formData = {
orgType: 'current',//当前组织:current 根组织:all
name: '',//姓名
mobile: '',//手机号
idCard: '',//身份证号码
startTime: '',//检测开始时间yyyy-MM-dd HH:mm
endTime: '',//检测结束时间yyyy-MM-dd HH:mm
}
this.timeRange = []
this.pageNo = 0
// this.loadTable()
},
handleSizeChange (val) {
this.pageSize = val
this.pageNo = 1
this.loadTable()
},
handleCurrentChange (val) {
this.pageNo = val
this.loadTable()
},
// 开启加载动画
startLoading () {
loading = Loading.service({
lock: true, // 是否锁定
text: '正在加载……', // 加载中需要显示的文字
background: 'rgba(0,0,0,.7)' // 背景颜色
})
},
// 结束加载动画
endLoading () {
// clearTimeout(timer);
if (loading) {
loading.close()
}
}
},
computed: {
tableHeight () {
return this.$store.state.inIframe ? this.clientHeight - 360 + this.iframeHeight : this.clientHeight - 360
},
...mapGetters(['clientHeight', 'iframeHeight'])
},
watch: {
},
props: {
3 years ago
}
}
</script>
3 years ago
<style lang="scss" scoped >
@import "@/assets/scss/modules/management/epidemic.scss";
</style>