|
@@ -2,76 +2,80 @@
|
|
|
<div class='m-container'>
|
|
|
<!-- <h2>收费类型设置</h2> -->
|
|
|
<div class="m-core">
|
|
|
- <!-- <div class='newBand' @click="openTypes('create')">添加</div> -->
|
|
|
- <!-- 列表 -->
|
|
|
+ <div @click="onBranchOperation('create')" class='newBand'>添加</div>
|
|
|
<div class="tableWrap">
|
|
|
- <el-table :data='tableList' :header-cell-style="{background:'#EDEEF0',color:'#444'}">
|
|
|
- <el-table-column align='center' prop="name"
|
|
|
- label="收费类型">
|
|
|
+ <el-table :data="dataList"
|
|
|
+ :header-cell-style="{background:'#EDEEF0',color:'#444'}">
|
|
|
+ <el-table-column prop="price" label="收费标准" >
|
|
|
</el-table-column>
|
|
|
- <el-table-column align='center'
|
|
|
- label="声部组合">
|
|
|
+ <el-table-column prop="name" label="分部名称" >
|
|
|
<template slot-scope="scope">
|
|
|
- {{ scope.row.subjectName | joinArray(',') }}
|
|
|
+ {{ scope.row.branchNames | joinArray(',') }}
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column align='center'
|
|
|
- label="操作">
|
|
|
+ label="操作">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-button @click="openTypes('update', scope.row)" type="text">修改</el-button>
|
|
|
- <el-button @click="onTypesDel(scope.row)" type="text">删除</el-button>
|
|
|
+ <el-button @click="onBranchOperation('update', scope.row)" type="text">修改</el-button>
|
|
|
+ <el-button @click="onBranchDelete(scope.row)" type="text">删除</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
- <pagination :total="pageInfo.total"
|
|
|
- :page.sync="pageInfo.page"
|
|
|
- :limit.sync="pageInfo.limit"
|
|
|
- :page-sizes="pageInfo.page_size"
|
|
|
- @pagination="getList" />
|
|
|
</div>
|
|
|
- </div>
|
|
|
- <el-dialog :title="formTitle[formActionTitle]" :visible.sync="typeStatus"
|
|
|
- @close="onFormClose('ruleForm')" width="500px">
|
|
|
- <el-form :model="form" :rules="rules" ref="ruleForm">
|
|
|
- <el-form-item label="收费类型" prop="name" :label-width="formLabelWidth">
|
|
|
- <el-input v-model="form.name" autocomplete="off"></el-input>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="声部选择" v-if="form.classGroupType != 'MIX'"
|
|
|
- prop="subjectIds" :label-width="formLabelWidth">
|
|
|
- <el-select v-model="form.subjectIds" multiple>
|
|
|
- <el-option-group
|
|
|
- v-for="group in subjectList"
|
|
|
- :key="group.label"
|
|
|
- :label="group.label">
|
|
|
- <el-option
|
|
|
- v-for="item in group.options"
|
|
|
- :key="item.value"
|
|
|
- :label="item.label"
|
|
|
- :value="item.value">
|
|
|
- </el-option>
|
|
|
- </el-option-group>
|
|
|
+
|
|
|
+ <el-dialog :title="formTitle[formActionTitle]" :visible.sync="branchStatus" @close="onFormClose('ruleForm')" width="500px">
|
|
|
+ <el-form :model="form" :rules="rules" ref="ruleForm">
|
|
|
+ <el-form-item label="收费标准" prop="price" :label-width="formLabelWidth">
|
|
|
+ <el-input type="number" v-model="form.price" autocomplete="off"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="所选分部" prop="branchIds" :label-width="formLabelWidth">
|
|
|
+ <el-select v-model="form.branchIds" multiple>
|
|
|
+ <el-option
|
|
|
+ v-for="(item, index) in branchList"
|
|
|
+ :key="index"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
+ :disabled="item.disabled">
|
|
|
+ </el-option>
|
|
|
</el-select>
|
|
|
- </el-form-item>
|
|
|
- </el-form>
|
|
|
- <span slot="footer"
|
|
|
- class="dialog-footer">
|
|
|
- <el-button @click="typeStatus = false">取 消</el-button>
|
|
|
- <el-button type="primary" @click="onTypesSubmit('ruleForm')">确 定</el-button>
|
|
|
- </span>
|
|
|
- </el-dialog>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="branchStatus = false">取 消</el-button>
|
|
|
+ <el-button @click="onTypesSubmit('ruleForm')" type="primary">确 定</el-button>
|
|
|
+ </span>
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
import pagination from '@/components/Pagination/index'
|
|
|
import store from '@/store'
|
|
|
import { branchQueryPage } from '@/api/specialSetting'
|
|
|
+import { sysConfigList, sysConfigUpdate } from '@/api/generalSettings'
|
|
|
export default {
|
|
|
components: { pagination },
|
|
|
name: 'charges',
|
|
|
data () {
|
|
|
return {
|
|
|
- tableList: [],
|
|
|
-
|
|
|
+ id: null,
|
|
|
+ dataList: [],
|
|
|
+ branchList: [], // 分部列表
|
|
|
+ formActionTitle: 'create',
|
|
|
+ formTitle: {
|
|
|
+ create: '添加分部收费标准',
|
|
|
+ update: '修改分部收费标准'
|
|
|
+ },
|
|
|
+ branchStatus: false,
|
|
|
+ formLabelWidth: '100px',
|
|
|
+ form: {
|
|
|
+ branchIds: [],
|
|
|
+ price: null,
|
|
|
+ },
|
|
|
+ rules: {
|
|
|
+ price: [{ required: true, message: '请输入收费标准', trigger: 'blur' }],
|
|
|
+ branchIds: [{ required: true, message: '请选择分部', trigger: 'change' }]
|
|
|
+ },
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
@@ -81,37 +85,137 @@ export default {
|
|
|
onTypesSubmit (formName) { // 添加数据
|
|
|
this.$refs[formName].validate((valid) => {
|
|
|
if (valid) {
|
|
|
-
|
|
|
+ // 分部名称
|
|
|
+ let form = this.form
|
|
|
+ let params = JSON.parse(JSON.stringify(this.dataList))
|
|
|
+ let branchNames = []
|
|
|
+ this.branchList.forEach(item => {
|
|
|
+ if(form.branchIds.includes(item.value)) {
|
|
|
+ branchNames.push(item.label)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if(this.formActionTitle == 'create') {
|
|
|
+ params.push({
|
|
|
+ price: form.price,
|
|
|
+ branchIds: form.branchIds,
|
|
|
+ branchNames: branchNames
|
|
|
+ })
|
|
|
+ sysConfigUpdate({
|
|
|
+ id: this.id,
|
|
|
+ paranValue: JSON.stringify(params)
|
|
|
+ }).then(res => {
|
|
|
+ if(res.code == 200) {
|
|
|
+ this.$message.success('添加成功')
|
|
|
+ this.branchStatus = false
|
|
|
+ this.getList()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else if(this.formActionTitle == 'update') {
|
|
|
+ let tempUpdate = params.map(item => {
|
|
|
+ if(item.id == form.id) {
|
|
|
+ item = {
|
|
|
+ price: form.price,
|
|
|
+ branchIds: form.branchIds,
|
|
|
+ branchNames: branchNames
|
|
|
+ }
|
|
|
+ }
|
|
|
+ delete item.id
|
|
|
+ return item
|
|
|
+ })
|
|
|
+
|
|
|
+ sysConfigUpdate({
|
|
|
+ id: this.id,
|
|
|
+ paranValue: JSON.stringify(tempUpdate)
|
|
|
+ }).then(res => {
|
|
|
+ if(res.code == 200) {
|
|
|
+ this.$message.success('修改成功')
|
|
|
+ this.branchStatus = false
|
|
|
+ this.getList()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
} else {
|
|
|
return false;
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- messageTips(title, res) {
|
|
|
- if(res.code == 200) {
|
|
|
- this.$message.success(title + '成功')
|
|
|
- this.typeStatus = false
|
|
|
- this.getList()
|
|
|
- } else {
|
|
|
- this.$message.error(res.msg)
|
|
|
- }
|
|
|
- },
|
|
|
- getList () {
|
|
|
+ onBranchDelete(row) {
|
|
|
|
|
|
+ let tempBranch = JSON.parse(JSON.stringify(this.dataList))
|
|
|
+ tempBranch.splice(row.id, 1)
|
|
|
+
|
|
|
+ let temp = tempBranch.map(item => {
|
|
|
+ delete item.id
|
|
|
+ return item
|
|
|
+ })
|
|
|
+ sysConfigUpdate({
|
|
|
+ id: this.id,
|
|
|
+ paranValue: JSON.stringify(temp)
|
|
|
+ }).then(res => {
|
|
|
+ if(res.code == 200) {
|
|
|
+ this.$message.success('删除成功')
|
|
|
+ this.getList()
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
- openTypes(type, row) {
|
|
|
- this.typeStatus = true
|
|
|
+ onBranchOperation(type, row) {
|
|
|
+ this.branchStatus = true
|
|
|
this.formActionTitle = type
|
|
|
- // 修改的时候赋值
|
|
|
- if (type == 'update') {
|
|
|
- this.form = {
|
|
|
- id: row.id,
|
|
|
- name: row.name,
|
|
|
- subjectIds: row.subjectIds,
|
|
|
- organId: store.getters.organ
|
|
|
+ if(type == 'update') {
|
|
|
+ this.branchList.forEach(item => {
|
|
|
+ if(row.branchIds.includes(item.value)) {
|
|
|
+ item.disabled = false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.form = row
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async getList () {
|
|
|
+ // 获取所有分部
|
|
|
+ let branchList = await branchQueryPage({ rows: 9999, page: 1 })
|
|
|
+ if(branchList.code == 200) {
|
|
|
+ branchList = branchList.data.rows
|
|
|
+ }
|
|
|
+ // 获取对应配置
|
|
|
+ let sysConfig = await sysConfigList({ group: 'organ_course_fee' })
|
|
|
+ if(sysConfig.code == 200) {
|
|
|
+ this.id = sysConfig.data[0].id
|
|
|
+ sysConfig = sysConfig.data[0].paranValue ? JSON.parse(sysConfig.data[0].paranValue) : []
|
|
|
+ }
|
|
|
+
|
|
|
+ let tempList = []
|
|
|
+ let tempBranch = []
|
|
|
+ let sysBranchIds = []
|
|
|
+ sysConfig.forEach((item, index) => {
|
|
|
+ item.id = index
|
|
|
+ tempList.push(item)
|
|
|
+ sysBranchIds = sysBranchIds.concat(item.branchIds)
|
|
|
+ })
|
|
|
+
|
|
|
+ // 过滤数据
|
|
|
+ branchList.forEach((item, index) => {
|
|
|
+ // 判断是否有同意
|
|
|
+ let params = {
|
|
|
+ label: item.name,
|
|
|
+ value: item.id
|
|
|
}
|
|
|
+ if(sysBranchIds.includes(item.id)) {
|
|
|
+ params.disabled = true
|
|
|
+ } else {
|
|
|
+ params.disabled = false
|
|
|
+ }
|
|
|
+ tempBranch.push(params)
|
|
|
+ })
|
|
|
+ this.branchList = tempBranch
|
|
|
+ this.dataList = tempList
|
|
|
+ },
|
|
|
+ onFormClose (formName) { // 关闭弹窗重置验证
|
|
|
+ this.form = {
|
|
|
+ price: null,
|
|
|
+ branchIds: []
|
|
|
}
|
|
|
- }
|
|
|
+ this.$refs[formName].resetFields()
|
|
|
+ },
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
@@ -132,4 +236,8 @@ export default {
|
|
|
.el-select {
|
|
|
width: 98% !important;
|
|
|
}
|
|
|
+
|
|
|
+/deep/.el-table {
|
|
|
+ display: inline-block;
|
|
|
+}
|
|
|
</style>
|