123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430 |
- <template>
- <view class="content">
- <view class="search-keyword">
- <view class="padding">
- <uni-easyinput prefixIcon="search" v-model="key" :clearable="false" placeholder="请输入" @input="searchKey">
- </uni-easyinput>
- </view>
- <scroll-view class="keyword-list-box" scroll-y>
- <label v-for="(row, index) in dataList" :key="row.id" @click="itemClick(row)"
- >
- <view class="keyword-entry" :class="selectId == row.id ? 'selectStyle' : ''">
- <view class="keyword-text">
- {{row.dept}}
- </view>
- </view>
- </label>
- </scroll-view>
- </view>
- <view class="toolbar">
- <view class="btn cancel" @click="determine('back')" hover-class="seimin-btn-hover">
- 取消
- </view>
- <view class="btn affirm" @click="determine('submit')" hover-class="seimin-btn-hover">
- 确定
- </view>
- </view>
- </view>
- </template>
- <script>
- import {
- post,
- webHandle
- } from "../../http/http.js";
- import debounce from 'lodash-es/debounce'
- export default {
- data() {
- return {
- key:null,
- type: "", //进入该页面的类型
- hosId: "",
- dataList: [],
- selectData: [],
- allData:[],
- gdId:null,
- startTarget:null,
- endTarget:null,
- selectId:null,
- taskTypeData:null,
- taskTypeId:null,
- taskName:null
- };
- },
- onLoad(options) {
- this.hosId = uni.getStorageSync("userData").user.currentHospital.id;
- this.taskTypeData = JSON.parse(options.taskTypeData)
- console.log(this.options, '777');
- console.log(this.taskTypeData, '123');
- this.taskTypeId = options.taskTypeId
- this.taskName = options.taskName
- this.type = options.type
- // 科室类型:201:默认发起科室
- // 科室类型:202:固定科室范围
- // 科室类型:203:固定科室
- // 科室类型:204:自主填写
- // 科室类型:205:固定科室类型
- this.startTarget = this.taskTypeData.startStatus
- this.endTarget = this.taskTypeData.endStatus
- this.gdId = options.id
- if(options.type=='applyDept'){
- this.getapplyDept()
- }else if (options.type=='startDept'){
- this.getStartDept()
- }else if (options.type=='endDept'){
- this.getEndDept()
- }
- },
- methods: {
- searchKey(e){
- if(this.type=='applyDept'){
- this.handleSearch1()
- }else if (this.type=='startDept'){
- this.handleSearch2()
- }else if (this.type=='endDept'){
- this.handleSearch3()
- }
- },
- handleSearch1: debounce(function() {
- this.getapplyDept();
- }, 500),
- handleSearch2: debounce(function() {
- this.getStartDept();
- }, 500),
- handleSearch3: debounce(function() {
- this.getEndDept();
- }, 500),
- //获取申请科室
- getapplyDept() {
- let postData = {
- idx: 0,
- sum: 20,
- department:{
- searchType: 1,
- hospital: {
- id: this.hosId
- },
- dept: this.key
- }
- }
- post("/simple/data/fetchDataList/department", postData).then((res) => {
- this.dataList = res.list
- })
- },
- //获取起点科室
- getStartDept() {
- // 科室类型:201:默认发起科室
- // 科室类型:202:固定科室范围
- // 科室类型:203:固定科室
- // 科室类型:204:自主填写
- // 科室类型:205:固定科室类型
- if(this.startTarget == 204 || this.startTarget== 205){
- let postData = {
- idx: 0,
- sum: 20,
- department:{
- searchType: 1,
- cascadeHosId: this.hosId,
- type:{
- id: null
- },
- dept: this.key
- }
- }
- if(this.startTarget == 204){
- delete postData.department.type
- }else{
- postData.department.type.id = this.taskTypeData.startTypeId
- }
- post("/simple/data/fetchDataList/department", postData).then((res) => {
- this.dataList = res.list
- })
- }else if(this.startTarget== 202){
- if(this.key){
- this.dataList = this.taskTypeData.startDept.filter(i=>i.dept.indexOf(this.key)!=-1)
- }else{
- this.dataList = this.taskTypeData.startDept
- }
- }else{
- this.dataList = this.taskTypeData.startDept
- }
- },
- // 获取终点科室
- getEndDept(){
- // 科室类型:201:默认发起科室
- // 科室类型:202:固定科室范围
- // 科室类型:203:固定科室
- // 科室类型:204:自主填写
- // 科室类型:205:固定科室类型
- if(this.endTarget == 204 || this.endTarget== 205){
- let postData = {
- idx: 0,
- sum: 20,
- department:{
- searchType: 1,
- cascadeHosId: this.hosId,
- type:{
- id: null
- },
- dept: this.key
- }
- }
- if(this.endTarget == 204){
- delete postData.department.type
- }else{
- postData.department.type.id = this.taskTypeData.endTypeId
- }
- post("/simple/data/fetchDataList/department", postData).then((res) => {
- this.dataList = res.list
- })
- }else if(this.endTarget== 202){
- if(this.key){
- this.dataList = this.taskTypeData.endDept.filter(i=>i.dept.indexOf(this.key)!=-1)
- }else{
- this.dataList = this.taskTypeData.endDept
- }
- }else{
- this.dataList = this.taskTypeData.endDept
- }
- },
- // 确认
- determine(type) {
- this.allData = this.selectData
- if (type == 'back') {
- uni.navigateBack({
- delta: 1,
- })
- } else {
- if(this.type=='applyDept'){
- uni.setStorageSync('applyDept', JSON.stringify(this.allData))
- }else if (this.type=='startDept'){
- uni.setStorageSync('taskStartDept', JSON.stringify(this.allData))
- }else if (this.type=='endDept'){
- uni.setStorageSync('taskEndDept', JSON.stringify(this.allData))
- }
- uni.redirectTo ({
- url: `../sponsorTaskBuild/sponsorTaskBuild?type=${this.type}&startTarget=${this.startTarget}&endTarget=${this.endTarget}&taskTypeId=${this.taskTypeId}&taskName=${this.taskName}`
- });
- }
- },
- // 选择楼栋
- itemClick(item) {
- this.selectData = item
- this.selectId = item.id
- }
- },
- };
- </script>
- <style scoped>
- .is-input-border{
- border-color: #eee !important
- }
- </style>
- <style scoped lang="less">
- view {
- display: block;
- }
- .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;
- display: flex;
- justify-content: space-between;
- align-items: center;
- box-sizing: border-box;
- .btn {
- width: 48%;
- height: 88rpx;
- line-height: 88rpx;
- text-align: center;
- border-radius: 10rpx;
- }
- .affirm {
- background-color: #49B856;
- color: #fff;
- }
- .cancel {
- background-color: #AFAFAF;
- color: #fff;
- }
- }
- .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: center;
- 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);
- }
-
- .padding{
- // padding: 0 20rpx;
- }
-
- .keyword-list-box {
- height: calc(100vh - 220rpx);
- padding-top: 10upx;
- border-radius: 20upx 20upx 0 0;
- background-color: #fff;
- }
- .selectStyle {
- color: #49B856 !important;
- }
- .keyword-entry-tap {
- background-color: #eee;
- }
- .keyword-entry {
- width: 94%;
- height: 80rpx;
- margin: 0 3%;
- font-size: 30rpx;
- color: #333;
- display: flex;
- justify-content: center;
- 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;
- }
- .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>
|