responsibleList.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358
  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:1,
  35. checkedResponsibleListTemp:[],
  36. checkedResponsibleListTemp_all:[],
  37. checkedResponsibleListTemp_dept:[],
  38. checkedResponsibleList:[],//已选择的当事人列表
  39. list:[],
  40. checkId:'',
  41. padding:0,
  42. deptId:'',
  43. keywords:'',
  44. deptIdTemp:'',
  45. selectAll:false,
  46. isFromCheckMainPoints:false,
  47. };
  48. },
  49. onLoad({deptId,isFromCheckMainPoints,checkId}) {
  50. this.deptIdTemp = deptId;
  51. this.isFromCheckMainPoints = isFromCheckMainPoints;
  52. if(checkId)this.checkId = checkId
  53. this.tabClick(this.currentTabIndex);
  54. },
  55. onShow() {
  56. const {responsibleList} = this.$store.state;
  57. // console.log({responsibleList});
  58. this.checkedResponsibleList = responsibleList.checkedResponsibleList;
  59. },
  60. computed:{
  61. },
  62. mounted(){
  63. this.getResponsibleList();
  64. //设置当事人页面滚动距离顶部距离
  65. uni
  66. .createSelectorQuery()
  67. .in(this)
  68. .select('.top')
  69. .boundingClientRect()
  70. .exec(res => {
  71. if (res[0]) {
  72. this.padding = res[0].height;
  73. // resolve(res[0].top);
  74. } else {
  75. that.$nextTick(() => {
  76. ++count <= 8 ? getHeight() : this.padding = 0;
  77. });
  78. }
  79. });
  80. },
  81. onUnload(){
  82. this.checkedResponsibleList=[];
  83. },
  84. methods:{
  85. bindClick(){
  86. },
  87. selectAllHandle(){
  88. if(!this.selectAll){
  89. this.selectAll = true;
  90. const getResponsibleListIds = (arr,index)=>{
  91. if(index == arr.length-1){
  92. return arr[index].data
  93. }
  94. return arr[index].data.concat(getResponsibleListIds(arr,index+1))
  95. }
  96. this.checkedResponsibleList = getResponsibleListIds(this.list,0);
  97. }else {
  98. this.selectAll = false;
  99. this.checkedResponsibleList = [];
  100. }
  101. // console.log('selectAllHandle',this.checkedResponsibleList);
  102. },
  103. keywordsHandle(e){
  104. this.keywords = e.target.value;
  105. this.getResponsibleList();
  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(this.currentTabIndex,this.checkedResponsibleListTemp_all,this.checkedResponsibleListTemp_dept)
  141. // console.log({responsibleUserIds,responsibleUserNames});
  142. // return;
  143. if(this.isFromCheckMainPoints){
  144. //批量保存当事人
  145. const {checkMainPoints:{detailList}} = this.$store.state;
  146. const detailListFlat = (arr,index)=>{
  147. if(index == arr.length-1){
  148. return arr[index].responseList
  149. }
  150. return arr[index].responseList.concat(detailListFlat(arr,index+1))
  151. }
  152. const tempCheckIds = detailListFlat(detailList,0);
  153. const checkIds = tempCheckIds.map(item=>item.id);
  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. //更新查核要点页数据
  172. this.$store.commit('checkMainPoints/comChangeState',{key:'ifUpdate',data:true});
  173. uni.navigateBack({
  174. delta: 1
  175. });
  176. }
  177. }
  178. });
  179. })
  180. }else {
  181. this.$store.dispatch({
  182. type: "responsibleList/commActions",
  183. payload: {
  184. key: "bindCheckDetailResponsibleUser",
  185. data: {
  186. responsibleUserId:responsibleUserIds.join(','),
  187. responsibleUserName:responsibleUserNames.join(','),
  188. checkIds:[parseInt(this.checkId)],
  189. },
  190. }
  191. });
  192. this.$store.commit('responsibleList/updateCheckedResponsibleList',this.currentTabIndex == 0?this.checkedResponsibleListTemp_all:this.checkedResponsibleListTemp_dept);
  193. uni.navigateBack({
  194. delta: 1
  195. });
  196. }
  197. },
  198. cancelCheck(){
  199. uni.navigateBack({
  200. delta: 1
  201. });
  202. },
  203. tabClick(index){
  204. if(index==1){
  205. this.deptId = this.deptIdTemp;
  206. }else {
  207. this.deptId ='';
  208. }
  209. // this.checkedResponsibleListTemp = [],
  210. // this.checkedResponsibleList = [],
  211. this.getResponsibleList();
  212. this.currentTabIndex = index;
  213. }
  214. }
  215. }
  216. </script>
  217. <style lang="less">
  218. .container {
  219. display: flex;
  220. height: 100%;
  221. flex-direction: column;
  222. .top { position: relative;
  223. z-index: 10;
  224. height:170rpx;
  225. padding: 0 25rpx;
  226. padding-top: 18.75rpx;
  227. background-color: #FFFFFF;
  228. box-sizing: border-box;
  229. box-shadow: 0px 3.75rpx 12.5rpx 0px rgba(0, 13, 51, 0.1);
  230. .searchBar {
  231. display: flex;
  232. flex-direction: row;
  233. justify-content: space-evenly;
  234. align-items: center;
  235. height: 55rpx;
  236. background: #F0F2F7;
  237. border-radius: 5rpx;
  238. padding-left: 25rpx;
  239. .inputArea {
  240. flex-grow:0.9;
  241. font-size: 22.5rpx;
  242. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  243. font-weight: 400;
  244. }
  245. .placeholder {
  246. font-size: 22.5rpx;
  247. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  248. font-weight: 400;
  249. color: #A1A7B3;
  250. }
  251. .searchActiver {
  252. display: flex;
  253. justify-content: center;
  254. align-items: center;
  255. flex-grow: 0.1;
  256. height:100%;
  257. .searchIcon {
  258. width: 21.25rpx;
  259. height: 21.25rpx;
  260. }
  261. }
  262. }
  263. .tabWrap {
  264. display: flex;
  265. flex-direction: row;
  266. justify-content: space-around;
  267. align-items: center;
  268. margin-top: 25rpx;
  269. .tab {
  270. display: flex;
  271. justify-content: center;
  272. align-items: center;
  273. width: 325rpx;
  274. height: 50rpx;
  275. font-size: 22.5rpx;
  276. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  277. font-weight: 400;
  278. color: #292C33;
  279. background: #EBEFF7;
  280. border-radius: 25rpx;
  281. &.on {
  282. color: #FFFFFF;
  283. background: #3377FF;
  284. }
  285. }
  286. }
  287. }
  288. .content {
  289. flex: 1;
  290. overflow: hidden;
  291. }
  292. .bottom {
  293. display: flex;
  294. flex-direction: row;
  295. height:75rpx;
  296. border-top: 0.62rpx solid #DADEE6;
  297. background-color: #FFFFFF;
  298. .selectAll {
  299. display: flex;
  300. width: 20%;
  301. flex-direction: row;
  302. justify-content: center;
  303. align-items: center;
  304. .icon {
  305. width: 25rpx;
  306. height: 24.37rpx;
  307. margin-right: 15rpx;
  308. }
  309. .text {
  310. font-size: 22.5rpx;
  311. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  312. font-weight: 400;
  313. color: #8F9BB3;
  314. &.on {
  315. color:#3377FF;
  316. }
  317. }
  318. }
  319. .cancelBtn {
  320. display: flex;
  321. width: 40%;
  322. height: 100%;
  323. justify-content: center;
  324. align-items: center;
  325. font-size: 22.5rpx;
  326. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  327. font-weight: 400;
  328. color: #3377FF;
  329. border-left: 0.62rpx solid #DADEE6;
  330. }
  331. .comfirm {
  332. display: flex;
  333. width: 40%;
  334. height: 100%;
  335. font-size: 22.5rpx;
  336. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  337. font-weight: 400;
  338. color: #FFFFFF;
  339. justify-content: center;
  340. align-items: center;
  341. background: #3377FF;
  342. }
  343. }
  344. }
  345. </style>