responsibleList.vue 8.9 KB

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