patrolPlanAddMember.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. <!-- 安全检查-发起巡查计划-巡查组 -->
  2. <template>
  3. <view class="examine">
  4. <scroll-view scroll-y @scrolltolower="scrollGet" class="info-max-box">
  5. <view>
  6. <view class="lab_title">
  7. <view class="lab_title_n">
  8. <view class="lab_title_r_btn" @click="searchBtn">
  9. <img src="@/images/Version3.3.3/icon_aqjc_ss.png"/>
  10. </view>
  11. <input type="text" v-model="getData.groupName" placeholder="请输入巡查组名称" maxlength="50" placeholder-style="color: #CCCCCC;font-size:26rpx;">
  12. </view>
  13. </view>
  14. <view class="list">
  15. <view class="list_li" v-for="(item,index) in dataList" :key="index" @click="labSelete(index)">
  16. <text :class="item.type?'color_B':'color_A'">{{item.groupName}}</text>
  17. <img v-if="item.type" src="@/images/Version3.3.3/icon_xzwt_xz.png">
  18. </view>
  19. </view>
  20. </view>
  21. </scroll-view>
  22. <view class="bottom_btn" @click="submitForm">保存</view>
  23. </view>
  24. </template>
  25. <script>
  26. import { config } from '@/api/request/config.js'
  27. import { checkGroupList,checkGroupDetail} from '@/api/index.js'
  28. export default {
  29. name: "rectifyList",
  30. components: {
  31. },
  32. data() {
  33. return {
  34. pageType:0,
  35. //列表请求参数
  36. getData:{
  37. checkLevel:'0',
  38. groupName:'',
  39. },
  40. total:0,
  41. dataList:[],
  42. seleteListMember:[],//临时存储选中巡查组
  43. checkMemberDtoList:[],//临时存储选中的
  44. form:{},
  45. }
  46. },
  47. onLoad(option) {
  48. if(option.form){
  49. this.form=JSON.parse(decodeURIComponent(option.form));
  50. if(this.form.seleteListMember.length>0){
  51. this.seleteListMember=this.form.seleteListMember;
  52. }
  53. }
  54. if(option.pageType){//pageType=1添加页面进入2编辑页面进入
  55. this.pageType=option.pageType
  56. }
  57. },
  58. onShow() {
  59. this.getList();
  60. },
  61. mounted(){
  62. },
  63. methods: {
  64. //滚动事件
  65. scrollGet(){
  66. let self=this;
  67. if(self.total<=self.getData.pageNum){
  68. console.log('没有更多数据!')
  69. }else{
  70. setTimeout(function(){
  71. self.getData.pageNum += 1;
  72. self.getList();
  73. },1000)
  74. }
  75. },
  76. //点击选择实验室
  77. labSelete(index){
  78. let _this = this;
  79. this.dataList[index].type = !this.dataList[index].type
  80. if (_this.dataList[index].type == true) {
  81. _this.dataList.forEach(function(item2) {
  82. if (item2.id == _this.dataList[index].id) {
  83. item2.type = true
  84. } else {
  85. item2.type = false
  86. }
  87. })
  88. }
  89. if(this.dataList[index].type){//判断是选中还是取消
  90. this.seleteListMember.push(this.dataList[index])
  91. }else{
  92. this.seleteListMember=[];
  93. }
  94. },
  95. //实验室搜索
  96. searchBtn(){
  97. this.dataList=[];
  98. this.getList();
  99. },
  100. handleClick(doType){
  101. let self=this;
  102. if( doType=='subBtn'){//保存数据
  103. }
  104. },
  105. //巡查组-保存
  106. async submitForm(){
  107. let _this = this;
  108. let id=this.seleteListMember[0].id
  109. this.$set(this.form,'checkGroupId',this.seleteListMember[0].id)
  110. this.$set(this.form,'checkGroupName',this.seleteListMember[0].groupName)
  111. const {data} = await checkGroupDetail({id:id,selectEnable:'1'});
  112. if(data.code == 200){
  113. this.$set(this.form,'checkMemberDtoList',data.data.checkGroupMemberList)
  114. console.log(this.pageType)
  115. if(this.pageType==1){
  116. uni.redirectTo({
  117. url: '/pages/pages_safetyExamine/patrolPlan/patrolPlanAdd?form='+encodeURIComponent(JSON.stringify(this.form))
  118. });
  119. }else if(this.pageType==2){
  120. uni.redirectTo({
  121. url: '/pages/pages_safetyExamine/patrolPlan/patrolPlanEdit?form='+encodeURIComponent(JSON.stringify(this.form))
  122. });
  123. }
  124. }
  125. },
  126. async getList(){
  127. let _this = this;
  128. const {data} = await checkGroupList(_this.getData);
  129. if(data.code==200){
  130. if(data.data){
  131. data.data.forEach(function(item){
  132. item.type=false
  133. })
  134. }
  135. this.dataList=[...this.dataList,...data.data]
  136. //如果有选中的数据
  137. if(this.seleteListMember.length>0){
  138. for(let i=0;i<this.dataList.length;i++){
  139. if(this.seleteListMember[0].id==this.dataList[i].id){
  140. this.dataList[i].type=true;
  141. }
  142. }
  143. }
  144. this.total=data.data.total;
  145. }
  146. }
  147. }
  148. }
  149. </script>
  150. <style lang="stylus" scoped>
  151. .examine{
  152. height:100%;
  153. display flex;
  154. .info-max-box{
  155. flex: 1;
  156. overflow: scroll;
  157. padding: 120rpx 0rpx 30rpx;
  158. box-sizing: border-box;
  159. }
  160. .lab_title{
  161. width: 750rpx;
  162. height: 100rpx;
  163. background: #FFFFFF;
  164. position: fixed;
  165. top: 0;
  166. padding: 10rpx 30rpx;
  167. box-sizing: border-box;
  168. .lab_title_n{
  169. width: 690rpx;
  170. height: 80rpx;
  171. position:relative;
  172. border-radius: 10rpx;
  173. border: 1rpx solid #E0E0E0;
  174. .lab_title_r_btn{
  175. width: 60rpx;
  176. height: 80rpx
  177. position: absolute;
  178. top: 0rpx;
  179. left:0rpx;
  180. >img{
  181. width: 20rpx;
  182. height: 20rpx;
  183. position: absolute;
  184. top: 30rpx;
  185. left: 24rpx;
  186. }
  187. }
  188. >input{
  189. width: 360rpx;
  190. height: 80rpx;
  191. position: absolute;
  192. top: 0rpx;
  193. left: 60rpx;
  194. }
  195. }
  196. }
  197. .list{
  198. background: #FFFFFF;
  199. border-radius: 20rpx 20rpx 0rpx 0rpx;
  200. padding: 0 30rpx;
  201. box-sizing: border-box;
  202. margin: 0 30rpx;
  203. .list_li{
  204. display: flex;
  205. justify-content:space-between;
  206. align-items: center;
  207. height: 80rpx;
  208. border-bottom: 1rpx solid #E0E0E0;
  209. >text{
  210. font-size: 28rpx;
  211. font-family: PingFang SC-Medium, PingFang SC;
  212. font-weight: 400;
  213. line-height: 80rpx;
  214. overflow: hidden;
  215. text-overflow:ellipsis;
  216. white-space: nowrap;
  217. }
  218. >img{
  219. width: 24rpx;
  220. height: 16rpx;
  221. margin-right: 14rpx;
  222. }
  223. }
  224. .list_li:last-child{
  225. border: none;
  226. }
  227. .color_A{
  228. color: #333333;
  229. }
  230. .color_B{
  231. color: #0183FA;
  232. }
  233. }
  234. .bottom_btn{
  235. position: fixed;
  236. bottom: 26rpx;
  237. left: 30rpx;
  238. font-size: 30rpx;
  239. font-family: PingFang SC-Medium, PingFang SC;
  240. font-weight: 400;
  241. color: #FFFFFF;
  242. line-height: 90rpx;
  243. width: 690rpx;
  244. height: 90rpx;
  245. background: #0183FA;
  246. border-radius: 20rpx;
  247. text-align: center;
  248. }
  249. }
  250. </style>