responsibleList.vue 9.8 KB

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