responsibleList.vue 9.8 KB

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