123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511 |
- <template>
- <view class="content">
- <view class="df-fl">
- <view class="df-all">
- <checkbox-group @change="allCheckChange">
- <checkbox value="all" color="#42b983" :checked="allCheck"/>
- <text class="text">全选</text>
- </checkbox-group>
- </view>
- <view class="title">{{name}}</view>
- <view class="top-right">{{num}}/{{allNum}}</view>
- </view>
- <view class="search-keyword">
- <scroll-view class="keyword-list-box" scroll-y>
- <checkbox-group @change="checkboxChange">
- <view v-for="(row, index) in dataList" :key="index" class="view-box">
- <checkbox @click="paClick(row)" class="top-check1" color="#42b983" :value="row.floor.id" :checked="row.checked" />
- <view class="right-ab">{{row.num}}/{{row.children.length}}</view>
- <uni-collapse ref="collapse" v-model="row.floor.collapseValue">
- <uni-collapse-item :title="row.floor.floorName + '楼'">
- <view v-for="(item, index) in row.children" :key="item.id">
- <view class="keyword-entry">
- <view class="keyword-text">
- <checkbox @click="chClick(item)" class="top-check2" color="#42b983" :value="item.id" :checked="item.checked" />
- <view class="title-2">{{item.dept}}</view>
- </view>
- </view>
- </view>
- </uni-collapse-item>
- </uni-collapse>
- </view>
- </checkbox-group>
- </scroll-view>
- </view>
- <view class="toolbar">
- <view class="back" @click="back()">返回</view>
- <view class="confirm" @click="confirm()">确定</view>
- </view>
- <!-- 弹窗 -->
- <showModel :title="models.title" :icon="models.icon" :disjunctor="models.disjunctor" :content="models.content" @know="know" :operate="models.operate"></showModel>
- </view>
- </template>
- <script>
- import {
- post,
- webHandle
- } from "../../http/http.js";
- export default {
- data() {
- return {
- type: "", //进入该页面的类型
- configName: "", //快速组合名称
- id: "", //快速组合id
- name:"",
- changedept: 0, //是否从列表过来的切换负责科室
- hosId: "",
- dataList: [],
- //系统设置的科室类型
- sysDeptType: 0,
- quickCombinationDeptType: 0,
- // 弹窗model
- models: {
- disjunctor: false,
- },
- valueColl:false,
- allCheck:false,
- buildIds:[],
- pid:[],
- cid:[],
- allNum:0,
- num:0
- };
- },
- onLoad(options) {
- this.hosId = uni.getStorageSync("userData").user.currentHospital.id;
- console.log(options, 'options');
- this.name = options.name
- this.id = options.id;
- this.configName = options.configName;
- this.changedept = options.changedept;
- this.getBuildings();
- // #ifdef APP-PLUS
- webHandle("no", "app");
- // #endif
- // #ifdef H5
- webHandle("no", "wx");
- // #endif
- },
- onShow(){
- // this.getBuildings();
- },
- methods: {
- // 全选
- allCheckChange(e){
- this.num = 0
- if(e.detail.value.length>0){
- this.dataList.forEach((item, index)=>{
- item.checked = true
- if(item.children && item.children.length>0){
- for(let i of item.children){
- i.checked = true
- this.buildIds.push(i)
- }
- }
- item.num = item.children.filter(x=>x.checked).length
- this.num += item.num
- })
- }else{
- this.dataList.forEach((item, index)=>{
- item.checked = false
- if(item.children && item.children.length>0){
- for(let i of item.children){
- i.checked = false
- this.buildIds = []
- }
- }
- item.num = item.children.filter(x=>x.checked).length
- this.num += item.num
- })
- }
- // this.buildIds = this.buildIds.filter(v => v.indexOf('parent')==-1);
- console.log(888,this.buildIds)
- },
- //知道了
- know() {
- this.models.disjunctor = false;
- },
- back(){
- uni.navigateBack({
- delta: 1,
- })
- },
- paClick(row){
- if(row.checked){
- row.checked = false
- }else{
- row.checked = true
- }
- for(let item of row.children){
- if (row.checked) {
- this.$set(item, 'checked', true)
- } else {
- this.$set(item, 'checked', false)
- }
- }
- this.num = 0
- for (let i of this.dataList) {
- i.num = i.children.filter(x=>x.checked).length
- this.num += i.num
- }
- console.log(44545454,this.dataList)
- },
- chClick(row){
- this.num = 0
- if(row.checked){
- row.checked = false
- }else{
- row.checked = true
- }
- for (let i of this.dataList) {
- i.num = i.children.filter(x=>x.checked).length
- this.num += i.num
- }
- },
- // 确认
- confirm() {
- let data = uni.getStorageSync("setDepts")
- let dataList = []
- this.dataList.forEach(i=>{
- for(let i of i.children){
- if(i.checked){
- dataList.push(i)
- }
- }
- })
- console.log(3333,dataList);
- if (dataList.length === 0) {
- this.models = {
- disjunctor: true,
- title: "提示",
- content: "请选择至少一个楼层",
- icon: "warn",
- operate: {
- know: "知道了",
- },
- };
- } else {
- let allData = null
- let data = uni.getStorageSync("setDepts")
- if(data){
- data.forEach(i=>{
- dataList.push(i)
- })
- allData = dataList
- }else{
- allData = dataList
- }
- let newList2 = []
- let newList3 = []
- allData.forEach((item) => {
- if (!newList2.includes(item.id)) {
- newList2.push(item.id)
- }
- })
- newList2.forEach(i=>{
- newList3.push(allData.find(x=> x.id == i))
- })
- // console.log(555,newList3)
- uni.setStorageSync("setDepts", newList3)
- uni.navigateTo({
- url: `../setDept/setDept?configName=${this.configName}&id=${this.id}&changedept=${this.changedept}`,
- });
- }
- },
- // 选择楼栋
- itemClick(item){
- },
- changeColl(){
-
- },
- // 选择楼栋
- checkboxChange: function(e) {
- },
- //获取楼栋列表
- getBuildings() {
- this.allNum = 0
- let data = uni.getStorageSync("floorList")
- data.forEach((item, index)=>{
- item.num = 0
- item.floor.collapseValue = []
- item.floor.id = item.floor.id.toString() + 'parent'
- item.checked = false
- this.allNum += item.children.length
- if(item.children && item.children.length>0){
- for(let i of item.children){
- i.checked = false
- i.id = i.id.toString()
- i.floor.id = i.floor.id.toString() + 'parent'
- }
- }
- })
- console.log(3232131,this.allNum)
- this.dataList = data || [];
- }
- },
- };
- </script>
- <style>
- uni-checkbox-group{
- /* display: flex;
- align-items: center;
- position: relative; */
- }
- /deep/ .uni-collapse-item__title-box{
- margin-left: 50rpx
- }
- </style>
- <style scoped lang="less">
- view {
- display: block;
- }
- .df-fl{
- display: flex;
- align-items: center;
- justify-content: center;
- position: relative;
- .top-right{
- position: absolute;
- right: 40rpx;
- }
- }
- .df-all{
- position: absolute;
- left: 16rpx;
- .text{
- margin-left: 8rpx;
- }
- }
- .view-box{
- position: relative;
- }
- .top-check1{
- position: absolute;
- left: 0;
- top: 20rpx;
- z-index: 999;
- }
- .top-check2{
- position: absolute;
- left: 0;
- top: 20rpx;
- z-index: 999;
- }
- .right-ab{
- position: absolute;
- right: 64rpx;
- top: 28rpx;
- z-index: 999;
- color: #303133;
- }
- .title{
- padding: 30rpx;
- font-size: 32rpx;
- text-align: center;
- font-weight: bold;
- }
- // 底部
- .toolbar {
- position: fixed;
- left: 0;
- right: 0;
- bottom: 30rpx;
- width: 96%;
- margin-left: 2%;
- z-index: 9999;
- height: 88rpx;
- display: flex;
- justify-content: space-between;
- align-items: center;
- box-sizing: border-box;
- color: #fff;
-
- .back{
- width: 48%;
- height: 88rpx;
- display: flex;
- justify-content: center;
- align-items: center;
- box-sizing: border-box;
- border-radius: 10rpx;
- background-color: #8F939C;
- }
- .confirm{
- width: 46%;
- height: 88rpx;
- display: flex;
- justify-content: center;
- align-items: center;
- box-sizing: border-box;
- border-radius: 10rpx;
- background-color: #49B856;
- }
- }
- .search-box {
- width: 95%;
- background-color: rgb(242, 242, 242);
- padding: 15upx 2.5%;
- display: flex;
- justify-content: space-between;
- position: sticky;
- top: 0;
- }
- .search-box .mSearch-input-box {
- width: 100%;
- }
- .search-box .input-box {
- width: 85%;
- flex-shrink: 1;
- display: flex;
- justify-content: center;
- align-items: center;
- }
- .search-box .search-btn {
- width: 15%;
- margin: 0 0 0 2%;
- display: flex;
- justify-content: flex-start;
- align-items: center;
- flex-shrink: 0;
- font-size: 28upx;
- color: #fff;
- background: linear-gradient(to right, #ff9801, #ff570a);
- border-radius: 60upx;
- }
- .search-box .input-box>input {
- width: 100%;
- height: 60upx;
- font-size: 32upx;
- border: 0;
- border-radius: 60upx;
- -webkit-appearance: none;
- -moz-appearance: none;
- appearance: none;
- padding: 0 3%;
- margin: 0;
- background-color: #ffffff;
- }
- .placeholder-class {
- color: #9e9e9e;
- }
- .search-keyword {
- width: 100%;
- background-color: rgb(242, 242, 242);
- }
- .keyword-list-box {
- height: calc(100vh - 230rpx);
- padding-top: 10upx;
- // padding: 0 20rpx;
- border-radius: 20upx 20upx 0 0;
- background-color: #fff;
- width: 96%;
- padding-left: 2%;
- }
- .keyword-entry-tap {
- background-color: #eee;
- }
- .keyword-entry {
- width: 94%;
- height: 80rpx;
- margin: 0 3%;
- font-size: 30rpx;
- color: #333;
- display: flex;
- justify-content: start;
- align-items: center;
- border-bottom: solid 1rpx #DEDEDE;
- }
- .keyword-entry image {
- width: 60upx;
- height: 60upx;
- }
- .keyword-entry .keyword-text,
- .keyword-entry .keyword-img {
- height: 80upx;
- display: flex;
- align-items: center;
- position: relative;
- }
-
- .title-2{
- padding-left: 76rpx;
- }
-
- .keyword-entry .keyword-text {
- // width: 90%;
- }
- .keyword-entry .keyword-img {
- width: 10%;
- justify-content: center;
- }
- .keyword-box {
- height: calc(100vh - 110upx);
- border-radius: 20upx 20upx 0 0;
- background-color: #fff;
- }
- .keyword-box .keyword-block {
- padding: 10upx 0;
- }
- .keyword-box .keyword-block .keyword-list-header {
- width: 94%;
- padding: 10upx 3%;
- font-size: 27upx;
- color: #333;
- display: flex;
- justify-content: space-between;
- }
- .keyword-box .keyword-block .keyword-list-header image {
- width: 40upx;
- height: 40upx;
- }
- .keyword-box .keyword-block .keyword {
- width: 94%;
- padding: 3px 3%;
- display: flex;
- flex-flow: wrap;
- justify-content: flex-start;
- }
- .keyword-box .keyword-block .hide-hot-tis {
- display: flex;
- justify-content: center;
- font-size: 28upx;
- color: #6b6b6b;
- }
- .keyword-box .keyword-block .keyword>view {
- display: flex;
- justify-content: center;
- align-items: center;
- border-radius: 60upx;
- padding: 0 20upx;
- margin: 10upx 20upx 10upx 0;
- height: 60upx;
- font-size: 28upx;
- background-color: rgb(242, 242, 242);
- color: #6b6b6b;
- }
- </style>
|