responsibleList.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375
  1. <template>
  2. <view class="container">
  3. <view class="top">
  4. <view class="searchBar">
  5. <input class="inputArea" @input="keywordsHandle" type="text" v-model="keywords" placeholder="搜索当事人" placeholder-class="placeholder" />
  6. <view class="searchActiver" @click="searchHandle">
  7. <image class="searchIcon" src="../../static/search.png" mode=""></image>
  8. </view>
  9. </view>
  10. <view class="tabWrap">
  11. <view @click="tabClick(0)" :class="[currentTabIndex==0?'tab on':'tab']">全院</view>
  12. <view @click="tabClick(1)" :class="[currentTabIndex==1?'tab on':'tab']">当前病区</view>
  13. </view>
  14. </view>
  15. <view class="content">
  16. <index-list :padding='padding' v-on:listClick="listClickHandle" :checkedResponsibleList='checkedResponsibleList' :options="list"></index-list>
  17. </view>
  18. <view class="bottom">
  19. <view class="selectAll" @click="selectAllHandle">
  20. <image v-if="selectAll" class="icon" src="../../static/selectAll.png" mode=""></image>
  21. <image v-if="!selectAll" class="icon" src="../../static/selectAllnoclor.png" mode=""></image>
  22. <text :class="[selectAll?'text on':'text']">{{selectAll?'取消':'全选'}}</text>
  23. </view>
  24. <view class="cancelBtn" @click="cancelCheck">取消</view>
  25. <view class="comfirm" @click="sureCheck">确定</view>
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. import indexList from '../../components/index-list/index-list.vue';
  31. export default {
  32. data() {
  33. return {
  34. currentTabIndex:0,
  35. checkedResponsibleListTemp:[],
  36. checkedResponsibleListTemp_all:[],
  37. checkedResponsibleListTemp_dept:[],
  38. checkedResponsibleList:[],//已选择的当事人列表
  39. list:[],
  40. checkId:'',
  41. padding:0,
  42. // list:[{
  43. // "letter": "A",
  44. // "data": [
  45. // {id:0,main:"阿克苏机场",sub:'sub'},
  46. // {id:1,main:"阿拉山口机场",sub:'sub'},
  47. // {id:2,main:"阿勒泰机场",sub:'sub'},
  48. // {id:3,main:"阿里昆莎机场",sub:'sub'},
  49. // {id:4,main:"安庆天柱山机场",sub:'sub'},
  50. // {id:5,main:"澳门国际机场",sub:'sub'},
  51. // ]
  52. // }, {
  53. // "letter": "B",
  54. // "data": [
  55. // {id:6,main:"阿克苏机场",sub:'sub'},
  56. // {id:7,main:"阿拉山口机场",sub:'sub'},
  57. // {id:8,main:"阿勒泰机场",sub:'sub'},
  58. // {id:9,main:"阿里昆莎机场",sub:'sub'},
  59. // {id:10,main:"安庆天柱山机场",sub:'sub'},
  60. // {id:11,main:"澳门国际机场",sub:'sub'},
  61. // ]
  62. // }],
  63. deptId:'',
  64. keywords:'',
  65. deptIdTemp:'',
  66. selectAll:false,
  67. isFromCheckMainPoints:false,
  68. };
  69. },
  70. onLoad({deptId,isFromCheckMainPoints,checkId}) {
  71. this.deptIdTemp = deptId;
  72. this.isFromCheckMainPoints = isFromCheckMainPoints;
  73. if(checkId)this.checkId = checkId
  74. },
  75. onShow() {
  76. const {responsibleList} = this.$store.state;
  77. // console.log({responsibleList});
  78. this.checkedResponsibleList = responsibleList.checkedResponsibleList;
  79. },
  80. computed:{
  81. },
  82. mounted(){
  83. this.getResponsibleList();
  84. //设置当事人页面滚动距离顶部距离
  85. uni
  86. .createSelectorQuery()
  87. .in(this)
  88. .select('.top')
  89. .boundingClientRect()
  90. .exec(res => {
  91. if (res[0]) {
  92. this.padding = res[0].height;
  93. // resolve(res[0].top);
  94. } else {
  95. that.$nextTick(() => {
  96. ++count <= 8 ? getHeight() : this.padding = 0;
  97. });
  98. }
  99. });
  100. },
  101. methods:{
  102. bindClick(){
  103. },
  104. selectAllHandle(){
  105. if(!this.selectAll){
  106. this.selectAll = true;
  107. const getResponsibleListIds = (arr,index)=>{
  108. if(index == arr.length-1){
  109. return arr[index].data
  110. }
  111. return arr[index].data.concat(getResponsibleListIds(arr,index+1))
  112. }
  113. this.checkedResponsibleList = getResponsibleListIds(this.list,0);
  114. }else {
  115. this.selectAll = false;
  116. this.checkedResponsibleList = [];
  117. }
  118. // console.log('selectAllHandle',this.checkedResponsibleList);
  119. },
  120. keywordsHandle(e){
  121. if(e.target.value.length==0){
  122. this.getResponsibleList();
  123. }
  124. this.keywords = e.target.value;
  125. },
  126. searchHandle(){
  127. this.getResponsibleList();
  128. },
  129. //获取当时人列表
  130. getResponsibleList(){
  131. this.$store.dispatch({
  132. type: "responsibleList/commActions",
  133. payload: {
  134. key: "getResponsibleList",
  135. data: {
  136. deptId:this.deptId,
  137. keywords:this.keywords
  138. },
  139. }
  140. }).then((data)=>{
  141. this.list = data;
  142. })
  143. },
  144. //当事人列表点击handle
  145. listClickHandle(checkedList){
  146. if(this.currentTabIndex == 0){
  147. //全院
  148. this.checkedResponsibleListTemp_all = checkedList;
  149. }
  150. if(this.currentTabIndex == 1){
  151. //当前病区
  152. this.checkedResponsibleListTemp_dept = checkedList;
  153. }
  154. // console.log(this.currentTabIndex,this.checkedResponsibleListTemp_all,this.checkedResponsibleListTemp_dept)
  155. },
  156. sureCheck(){
  157. const responsibleUserIds = this.currentTabIndex == 0?this.checkedResponsibleListTemp_all.map(item=>item.id):this.checkedResponsibleListTemp_dept.map(item=>item.id);
  158. const responsibleUserNames = this.currentTabIndex == 0?this.checkedResponsibleListTemp_all.map(item=>item.main):this.checkedResponsibleListTemp_dept.map(item=>item.main);
  159. // console.log(this.currentTabIndex,this.checkedResponsibleListTemp_all,this.checkedResponsibleListTemp_dept)
  160. // console.log({responsibleUserIds,responsibleUserNames});
  161. // return;
  162. if(this.isFromCheckMainPoints){
  163. //批量保存当事人
  164. const {checkMainPoints:{detailList}} = this.$store.state;
  165. const detailListFlat = (arr,index)=>{
  166. if(index == arr.length-1){
  167. return arr[index].responseList
  168. }
  169. return arr[index].responseList.concat(detailListFlat(arr,index+1))
  170. }
  171. const tempCheckIds = detailListFlat(detailList,0);
  172. const checkIds = tempCheckIds.map(item=>item.id);
  173. this.$store.dispatch({
  174. type: "responsibleList/commActions",
  175. payload: {
  176. key: "bindCheckDetailResponsibleUser",
  177. data: {
  178. responsibleUserId:responsibleUserIds.join(','),
  179. responsibleUserName:responsibleUserNames.join(','),
  180. checkIds:checkIds,
  181. },
  182. }
  183. }).then((data)=>{
  184. uni.showModal({
  185. title: '提示',
  186. content: '批量分配当事人成功!',
  187. showCancel:false,
  188. success:(res)=>{
  189. if (res.confirm) {
  190. uni.navigateBack({
  191. delta: 1
  192. });
  193. }
  194. }
  195. });
  196. })
  197. }else {
  198. this.$store.dispatch({
  199. type: "responsibleList/commActions",
  200. payload: {
  201. key: "bindCheckDetailResponsibleUser",
  202. data: {
  203. responsibleUserId:responsibleUserIds.join(','),
  204. responsibleUserName:responsibleUserNames.join(','),
  205. checkIds:[parseInt(this.checkId)],
  206. },
  207. }
  208. });
  209. this.$store.commit('responsibleList/updateCheckedResponsibleList',this.currentTabIndex == 0?this.checkedResponsibleListTemp_all:this.checkedResponsibleListTemp_dept);
  210. uni.navigateBack({
  211. delta: 1
  212. });
  213. }
  214. },
  215. cancelCheck(){
  216. uni.navigateBack({
  217. delta: 1
  218. });
  219. },
  220. tabClick(index){
  221. if(index==1){
  222. this.deptId = this.deptIdTemp;
  223. }else {
  224. this.deptId ='';
  225. }
  226. // this.checkedResponsibleListTemp = [],
  227. // this.checkedResponsibleList = [],
  228. this.getResponsibleList();
  229. this.currentTabIndex = index;
  230. }
  231. }
  232. }
  233. </script>
  234. <style lang="less">
  235. .container {
  236. display: flex;
  237. height: 100%;
  238. flex-direction: column;
  239. .top { position: relative;
  240. z-index: 10;
  241. height:170rpx;
  242. padding: 0 25rpx;
  243. padding-top: 18.75rpx;
  244. background-color: #FFFFFF;
  245. box-sizing: border-box;
  246. box-shadow: 0px 3.75rpx 12.5rpx 0px rgba(0, 13, 51, 0.1);
  247. .searchBar {
  248. display: flex;
  249. flex-direction: row;
  250. justify-content: space-evenly;
  251. align-items: center;
  252. height: 55rpx;
  253. background: #F0F2F7;
  254. border-radius: 5rpx;
  255. padding-left: 25rpx;
  256. .inputArea {
  257. flex-grow:0.9;
  258. font-size: 22.5rpx;
  259. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  260. font-weight: 400;
  261. }
  262. .placeholder {
  263. font-size: 22.5rpx;
  264. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  265. font-weight: 400;
  266. color: #A1A7B3;
  267. }
  268. .searchActiver {
  269. display: flex;
  270. justify-content: center;
  271. align-items: center;
  272. flex-grow: 0.1;
  273. height:100%;
  274. .searchIcon {
  275. width: 21.25rpx;
  276. height: 21.25rpx;
  277. }
  278. }
  279. }
  280. .tabWrap {
  281. display: flex;
  282. flex-direction: row;
  283. justify-content: space-around;
  284. align-items: center;
  285. margin-top: 25rpx;
  286. .tab {
  287. display: flex;
  288. justify-content: center;
  289. align-items: center;
  290. width: 325rpx;
  291. height: 50rpx;
  292. font-size: 22.5rpx;
  293. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  294. font-weight: 400;
  295. color: #292C33;
  296. background: #EBEFF7;
  297. border-radius: 25rpx;
  298. &.on {
  299. color: #FFFFFF;
  300. background: #3377FF;
  301. }
  302. }
  303. }
  304. }
  305. .content {
  306. flex: 1;
  307. overflow: hidden;
  308. }
  309. .bottom {
  310. display: flex;
  311. flex-direction: row;
  312. height:75rpx;
  313. border-top: 0.62rpx solid #DADEE6;
  314. background-color: #FFFFFF;
  315. .selectAll {
  316. display: flex;
  317. width: 20%;
  318. flex-direction: row;
  319. justify-content: center;
  320. align-items: center;
  321. .icon {
  322. width: 25rpx;
  323. height: 24.37rpx;
  324. margin-right: 15rpx;
  325. }
  326. .text {
  327. font-size: 22.5rpx;
  328. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  329. font-weight: 400;
  330. color: #8F9BB3;
  331. &.on {
  332. color:#3377FF;
  333. }
  334. }
  335. }
  336. .cancelBtn {
  337. display: flex;
  338. width: 40%;
  339. height: 100%;
  340. justify-content: center;
  341. align-items: center;
  342. font-size: 22.5rpx;
  343. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  344. font-weight: 400;
  345. color: #3377FF;
  346. border-left: 0.62rpx solid #DADEE6;
  347. }
  348. .comfirm {
  349. display: flex;
  350. width: 40%;
  351. height: 100%;
  352. font-size: 22.5rpx;
  353. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  354. font-weight: 400;
  355. color: #FFFFFF;
  356. justify-content: center;
  357. align-items: center;
  358. background: #3377FF;
  359. }
  360. }
  361. }
  362. </style>