Commit 6be2a9eb authored by 小费同学阿's avatar 小费同学阿 💬

进度信息模块封装ui代码优化2

parent f0a282d5
...@@ -80,7 +80,7 @@ ...@@ -80,7 +80,7 @@
class="fourWordsBtn" class="fourWordsBtn"
icon="el-icon-right" icon="el-icon-right"
size="mini" size="mini"
@click="selectAll" @click="checkAll"
>选择全部 >选择全部
</el-button> </el-button>
<!--反向选择--> <!--反向选择-->
...@@ -89,7 +89,7 @@ ...@@ -89,7 +89,7 @@
class="fourWordsBtn" class="fourWordsBtn"
icon="el-icon-back" icon="el-icon-back"
size="mini" size="mini"
@click="reverseSelect" @click="reverseSelection"
>反向选择 >反向选择
</el-button> </el-button>
<!--批量导出--> <!--批量导出-->
...@@ -182,7 +182,6 @@ ...@@ -182,7 +182,6 @@
</template> </template>
<script> <script>
import { listAllArticle } from '@/api/business/article'
import { listRecord } from '@/api/business/record' import { listRecord } from '@/api/business/record'
export default { export default {
...@@ -192,11 +191,11 @@ export default { ...@@ -192,11 +191,11 @@ export default {
data() { data() {
return { return {
// 所有挂号信息ID(选择全部-临时表) // 所有挂号信息ID(选择全部-临时表)
registerIds: [], recordIds: [],
// 所有挂号信息ID(在不点击选择全部时-临时表) // 所有挂号信息ID(在不点击选择全部时-临时表)
registerEmptyIds: [], registerEmptyIds: [],
// 所有挂号信息ID(用于辅助, 里面的数据永远不变, 除了 新增/删除 数据时) // 所有挂号信息ID(用于辅助, 里面的数据永远不变, 除了 新增/删除 数据时)
registerIdsForever: [], recordIdsForever: [],
doctorNameList: [], doctorNameList: [],
deptIdList: [], deptIdList: [],
departIdList: [], departIdList: [],
...@@ -279,7 +278,7 @@ export default { ...@@ -279,7 +278,7 @@ export default {
// 选择全部 // 选择全部
checkAll() { checkAll() {
this.registerIds = this.registerIdsForever this.recordIds = this.recordIdsForever
// 标志位, 使得@select回调函数判断往哪个临时集合里添加 // 标志位, 使得@select回调函数判断往哪个临时集合里添加
this.isCheckAll = true this.isCheckAll = true
// 调用手动勾选 // 调用手动勾选
...@@ -291,9 +290,9 @@ export default { ...@@ -291,9 +290,9 @@ export default {
// 在下一个dom触发 // 在下一个dom触发
this.$nextTick().then(() => { this.$nextTick().then(() => {
// 当前页结合数据的id只要在临时集合里,就使得复选框勾选 // 当前页结合数据的id只要在临时集合里,就使得复选框勾选
this.registerList.forEach(item => { this.recordList.forEach(item => {
if (this.isCheckAll) { if (this.isCheckAll) {
if (this.registerIds.includes(item.id)) { if (this.recordIds.includes(item.id)) {
this.$refs.table.toggleRowSelection(item, true) this.$refs.table.toggleRowSelection(item, true)
} }
} else { } else {
...@@ -306,12 +305,12 @@ export default { ...@@ -306,12 +305,12 @@ export default {
}, },
// 反向选择(把永久临时集合和变化的临时集合做减法重新赋给变化的临时集合赋给) // 反向选择(把永久临时集合和变化的临时集合做减法重新赋给变化的临时集合赋给)
reverseSelection() { reverseSelection() {
console.log('永久的集合', this.registerIdsForever) console.log('永久的集合', this.recordIdsForever)
console.log('临时集合', this.registerEmptyIds) console.log('临时集合', this.registerEmptyIds)
if (this.isCheckAll) { if (this.isCheckAll) {
this.registerEmptyIds = this.registerIdsForever.filter(id => !this.registerIds.includes(id)) this.registerEmptyIds = this.recordIdsForever.filter(id => !this.recordIds.includes(id))
} else { } else {
this.registerEmptyIds = this.registerIdsForever.filter(id => !this.registerEmptyIds.includes(id)) this.registerEmptyIds = this.recordIdsForever.filter(id => !this.registerEmptyIds.includes(id))
} }
this.isCheckAll = false this.isCheckAll = false
this.getList() this.getList()
...@@ -321,11 +320,11 @@ export default { ...@@ -321,11 +320,11 @@ export default {
console.log('selectChange', selection, '----', row) console.log('selectChange', selection, '----', row)
if (this.isCheckAll) { if (this.isCheckAll) {
// 判断当前选中的存不存在,存在删除;不存在添加 // 判断当前选中的存不存在,存在删除;不存在添加
if (this.registerIds.includes(row.id)) { if (this.recordIds.includes(row.id)) {
this.registerIds = this.registerIds.filter(id => id !== row.id) this.recordIds = this.recordIds.filter(id => id !== row.id)
console.log('filter', this.registerIds.filter(id => id !== row.id)) console.log('filter', this.recordIds.filter(id => id !== row.id))
} else { } else {
this.registerIds.push(row.id) this.recordIds.push(row.id)
} }
} else { } else {
if (this.registerEmptyIds.includes(row.id)) { if (this.registerEmptyIds.includes(row.id)) {
...@@ -367,8 +366,8 @@ export default { ...@@ -367,8 +366,8 @@ export default {
this.recordList = response.rows.rows this.recordList = response.rows.rows
console.log('这是病历,我要开始取字段了!', this.recordList) console.log('这是病历,我要开始取字段了!', this.recordList)
// 获取全部挂号的id // 获取全部挂号的id
this.registerIds = response.rows.idList this.recordIds = response.rows.idList
this.registerIdsForever = response.rows.idList this.recordIdsForever = response.rows.idList
this.total = response.total this.total = response.total
this.loading = false this.loading = false
this.manualCheck() this.manualCheck()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment