123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402 |
- <template>
- <!-- 业务模块 -->
- <div class="set-background">
- <div class="block">
- <el-form :model="moduleForm">
- <div class="set-head">
- 业务模块<el-input v-model="moduleForm.bizModuleName" clearable placeholder="请填写" style="margin-left:10px;width:18%;" />
- 业务线<el-select v-model="moduleForm.bizId" placeholder="请选择" filterable clearable style="margin-left:10px;width:18%;" @change="choosePlatType()">
- <el-option v-for="item in bizData" :key="item.id" :label="item.bizName" :value="item.id" />
- </el-select>
- 平台类型<el-select v-model="moduleForm.platId" placeholder="请选择" filterable clearable style="margin-left:10px;width:18%;">
- <el-option v-for="item in platData1" :key="item.id" :label="item.platName" :value="item.id" />
- </el-select>
- <div style="float:right">
- <el-button type="primary" @click="queryModuleList(moduleForm)">查询</el-button>
- <el-button type="primary" plain @click="handleaddModule()">新增</el-button>
- </div>
- </div>
- </el-form>
- <div class="set-locate">
- <el-table :key="tableKey" :data="moduletData" fit highlight-current-row style="width: 100%;" border :header-cell-style="{background:'#F0F2F4',color:'#606266'}">
- <el-table-column label="序号" prop="id" min-width="40px" align="center"><template slot-scope="scope"><span>{{ scope.row.id }}</span></template> </el-table-column>
- <el-table-column label="业务模块" prop="bizModuleName" align="center" min-width="100">
- <template slot-scope="scope"><a href="javascript:void(0)" style="color:#20a0ff">{{ scope.row.bizModuleName }}</a></template>
- </el-table-column>
- <el-table-column label="平台类型" prop="platName" min-width="70px" align="center"><template slot-scope="scope"><span>{{ scope.row.platName }}</span></template> </el-table-column>
- <el-table-column label="业务线" prop="bizName" min-width="70px" align="center"><template slot-scope="scope"><span>{{ scope.row.bizName }}</span></template> </el-table-column>
- <el-table-column label="端类型" prop="clientType" min-width="120px" align="center"><template slot-scope="{row}"><span>{{ statusMaps.get(row.clientType) }}</span></template> </el-table-column>
- <el-table-column label="操作人" prop="modifier" min-width="70px" align="center"><template slot-scope="scope"><span>{{ scope.row.modifier }}</span></template> </el-table-column>
- <el-table-column label="操作" align="center" min-width="150px" class-name="small-padding fixed-width">
- <template slot-scope="{row}">
- <el-button type="primary" size="mini" @click="handelEditModule(row)">编辑</el-button>
- <el-button type="danger" size="mini" @click="handelDeleteModule(row)">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- <el-dialog :title="titleName" width="40%" :visible.sync="dialogFormVisible">
- <div style="margin-left:30px">
- <el-form ref="addModuleForms" :rules="addModuleDataRules" :model="addModuleForm">
- <el-form-item label="业务模块" prop="bizModuleName">
- <el-input v-model="addModuleForm.bizModuleName" placeholder="请填写" style="margin-left:7px;width:60%;" />
- </el-form-item>
- <el-form-item label="业务线" prop="bizId">
- <el-select v-model="addModuleForm.bizId" placeholder="请选择" filterable clearable style="margin-left:20px;width:60%;" @change="getPlatType()">
- <el-option v-for="item in bizData" :key="item.id" :label="item.bizName" :value="item.id" />
- </el-select>
- </el-form-item>
- <el-form-item label="平台类型" prop="platId">
- <el-select v-model="addModuleForm.platId" placeholder="请选择" filterable clearable style="margin-left:7px;width:60%;" @change="changePlat()">
- <el-option v-for="item in platData" :key="item.id" :label="item.platName" :value="item.id" />
- </el-select>
- </el-form-item>
- </el-form>
- </div>
- <div align="center" style="margin-top:18px">
- <el-button type="info" plain size="mini" @click="dialogFormVisible=false">取消</el-button>
- <el-button type="primary" size="mini" @click="titleName === '新增' ? addModuleType(addModuleForm) :editModuleType(addModuleForm)">确定</el-button>
- </div>
- <div style="margin-top:6%" />
- </el-dialog>
- <el-dialog :visible.sync="dialogDeleteVisible" width="30%">
- <div align="center" style="margin-top:-6%">
- <b>确定要删除该业务模块吗?</b>
- </div>
- <div align="center" style="margin-top:38px">
- <el-button type="primary" size="mini" @click="deleteModuleType()">确定</el-button>
- <el-button type="danger" size="mini" @click="dialogDeleteVisible=false">取消</el-button>
- </div>
- <div style="margin-top:4%" />
- </el-dialog>
- <div>
- <el-pagination style="margin-top:30px;" align="center" :current-page="curIndex" :page-sizes="[5, 10, 20]" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper" :total="total" @size-change="handleSizeChange" @current-change="handleCurrentChange" />
- </div>
- </div>
- </div>
- </div></template>
- <script>
- import { addBizModule, updateBizModule, deleteBizModule, queryBizModuleList, queryBizTypeList, queryPlatFormTypeList } from '@/api/modulePage'
- import waves from '@/directive/waves' // waves directive
- var envSelections = []
- var consumerSelections = []
- export default {
- name: 'ModulePage',
- // components: { Pagination },
- directives: { waves },
- filters: {
- statusFilter(status) {
- const statusMap = {
- 1: 'success',
- draft: 'info',
- 0: 'danger'
- }
- return statusMap[status]
- }
- },
- data() {
- return {
- userInformation: localStorage.getItem('username'),
- userName: localStorage.getItem('realname'),
- statusMaps: new Map([[1, '服务端 '], [2, '客户端']]),
- clientOptions: [{
- value: 1,
- label: '服务端'
- }, {
- value: 2,
- label: '客户端'
- }, {
- value: 0,
- label: '默认选项'
- }],
- userData: '',
- envSelections,
- addModuleForm: {},
- consumerSelections,
- bizData: [],
- total: 0,
- titleName: '',
- bizForm: {
- bizName: ''
- },
- moduleForm: {
- platId: '',
- bizId: '',
- bizModuleName: ''
- },
- platData: [],
- platData1: [],
- platType: {},
- deleteData: {},
- moduletData: [],
- addModuleData: {},
- currentBizData: [],
- tableKey: 0,
- curIndex: 0,
- pageSize: 10,
- listLoading: true,
- dialogFormVisible: false,
- dialogDeleteVisible: false,
- // dialogName: '业务线名称',
- addModuleDataRules: {
- bizModuleName: [{ required: true, message: '业务类型不能为空', trigger: 'change' }],
- platId: [{ required: true, message: '平台类型不能为空', trigger: 'change' }],
- bizId: [{ required: true, message: '业务线不能为空', trigger: 'change' }]
- }
- }
- },
- created() {
- this.getBizList()
- // this.getPlatList()
- this.getList()
- },
- methods: {
- // 获得biztype
- getBizList() {
- this.bizForm.bizName = ''
- this.bizForm.curIndex = this.curIndex - 1
- queryBizTypeList(this.bizForm).then(response => {
- if (response.code === 200) {
- this.bizData = response.data.list
- } else {
- this.errorFun()
- }
- })
- },
- // 获取平台类型
- choosePlatType() {
- // this.listLoading = true
- this.indexPage = {
- bizId: this.moduleForm.bizId,
- pageSize: this.pageSize,
- curIndex: this.curIndex - 1
- }
- queryPlatFormTypeList(this.indexPage).then(response => {
- this.platData1 = response.data.list
- this.$set(this.moduleForm, 'platId', '')
- this.total = response.data.total
- this.listLoading = false
- })
- },
- // 新增获取平台类型
- getPlatType() {
- // this.listLoading = true
- this.indexPage = {
- bizId: this.addModuleForm.bizId,
- pageSize: this.pageSize,
- curIndex: this.curIndex - 1
- }
- queryPlatFormTypeList(this.indexPage).then(response => {
- this.platData = response.data.list
- // this.$set(this.addModuleForm, 'platId', '')
- // this.total = response.data.total
- this.listLoading = false
- })
- },
- changePlat() {
- this.addData = { id: this.addModuleForm.platId }
- queryPlatFormTypeList(this.addData).then(response => {
- this.platType = response.data.list
- console.log(this.platType)
- console.log(this.platType[0].bizId)
- this.total = 30
- this.listLoading = false
- })
- },
- // 新增平台类型
- handleaddModule() {
- this.titleName = '新增'
- this.dialogFormVisible = true
- this.$refs.addModuleForms.resetFields()
- this.$set(this.addModuleForm, 'bizModuleName', '')
- this.$set(this.addModuleForm, 'platId', '')
- this.$set(this.addModuleForm, 'bizId', '')
- this.addModuleForm = {}
- },
- addModuleType(ele) {
- this.$refs['addModuleForms'].validate((valid) => {
- if (valid) {
- this.addModuleForm = ele
- this.addModuleForm.bizModuleName = ele.bizModuleName
- this.addModuleForm.platId = ele.platId
- this.addModuleForm.bizId = ele.bizId
- this.addModuleForm.clientType = this.platType[0].clientType
- this.addModuleForm.creator = this.userInformation
- this.addModuleForm.modifier = this.userInformation
- addBizModule(this.addModuleForm).then(response => {
- console.log(response)
- if (response.code === 200) {
- this.getList()
- this.successFun()
- this.dialogFormVisible = false
- } else {
- this.errorFun()
- }
- })
- }
- })
- },
- // 进首页
- getList() {
- // this.listLoading = true
- this.indexPage = {
- pageSize: this.pageSize,
- curIndex: this.curIndex - 1
- }
- queryBizModuleList(this.indexPage).then(response => {
- this.moduletData = response.data.list
- this.total = response.data.total
- this.listLoading = false
- })
- },
- // 查看
- queryModuleList(ele) {
- this.moduleForm.bizModuleName = ele.bizModuleName
- this.moduleForm.bizId = ele.bizId
- this.moduleForm.platId = ele.platId
- // this.bizForm.pageSize = this.pageSize
- // this.platForm.curIndex = this.curIndex - 1
- // this.listLoading = true
- queryBizModuleList(this.moduleForm).then(response => {
- if (response.code === 200) {
- // this.getMyDevicesList()
- this.moduletData = response.data.list
- this.total = response.data.total
- this.dialogFormVisible = false
- // this.listLoading = false
- } else {
- this.errorFun()
- }
- })
- },
- // 删除
- handelDeleteModule(ele) {
- this.dialogDeleteVisible = true
- this.addModuleForm = ele
- },
- deleteModuleType() {
- var bizModuleIds = [this.addModuleForm.id]
- this.deleteData.modifier = this.userInformation
- this.deleteData.bizModuleIds = bizModuleIds
- deleteBizModule(this.deleteData).then(response => {
- if (response.code === 200) {
- this.successFun()
- this.dialogDeleteVisible = false
- this.getList()
- this.bizData = response.data.list
- } else {
- this.errorFun()
- // this.dialogDeleteVisible = false
- }
- })
- },
- // 编辑
- handelEditModule(ele) {
- // 不能直接赋值变量,使用Object.assign复制一级属性(注意Object.assign不算完全的深拷贝)
- this.addModuleForm = Object.assign({}, ele)
- // this.addModuleForm = JSON.parse(JSON.stringify(ele))
- this.titleName = '编辑'
- this.getPlatType()
- this.dialogFormVisible = true
- this.$refs.addModuleForms.resetFields()
- this.$set(this.platData, [])
- console.log(ele)
- },
- editModuleType(ele) {
- this.$refs['addModuleForms'].validate((valid) => {
- if (valid) {
- var myDate = new Date()
- this.addModuleForm = ele
- this.addModuleForm.bizModuleName = ele.bizModuleName
- this.addModuleForm.platId = ele.platId
- // this.addModuleForm.platName = this.platData.filter((value) => value.code === ele.platId)
- this.addModuleForm.modifyTime = myDate
- this.addModuleForm.modifier = this.userInformation
- // this.bizTypeInfo = { bizTypeInfo: this.addBizData }
- updateBizModule(this.addModuleForm).then(response => {
- this.$set(this.platData, [])
- console.log(response)
- if (response.code === 200) {
- this.getList()
- this.successFun()
- this.dialogFormVisible = false
- } else {
- this.errorFun()
- }
- })
- }
- })
- },
- handleSizeChange(size) {
- this.pageSize = size
- this.getList()
- },
- handleCurrentChange(curIndex) {
- this.curIndex = curIndex
- this.getList()
- },
- clearValidate(formName) {
- this.$refs[formName].clearValidate()
- },
- successFun() {
- this.$notify({ title: 'Success', message: 'Created Successfully', type: 'success', duration: 5000 })
- },
- errorFun() {
- this.$notify({ title: 'Failed', message: 'Created Failed', type: 'error', duration: 5000 })
- }
- }
- }
- </script>
- <style lang="stylus" scoped>
- .set-background
- background-color #F1F4F7
- display flex
- justify-content center
- min-width 700px
- .setPercent >>> .el-dialog__body
- width 100%
- .block
- background-color rgba(255,255,255,1)
- box-shadow 0px 0px 11px 0px rgba(238,240,245,1)
- border-radius 7px
- width 93%
- margin 25px 0
- padding 20px
- min-height calc(100vh - 100px)
- .set-head
- font-size 13px
- width 100%
- color #333B4A
- white-space nowrap
- .set-dialogfont
- font-size 13px
- .set-dialogfont >>> .el-input
- width 70%
- // .set-between
- // display flex
- // .set-between >>> .el-button
- // height 40px
- .set-locate
- margin-top 25px
- // border-bottom 1px solid #BFC6DC
- // border-left 1px solid #BFC6DC
- // border-top 1px solid #BFC6DC
- // border-right 1px solid #BFC6DC
- </style>
|