responsibleList.vue 9.7 KB

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