patrolPlanAddMember.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  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="@/pages_safetyExamine/images/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="@/pages_safetyExamine/images/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.form.checkMemberDtoList=[];
  110. this.$set(this.form,'checkGroupId',this.seleteListMember[0].id)
  111. this.$set(this.form,'checkGroupName',this.seleteListMember[0].groupName)
  112. const {data} = await checkGroupDetail({id:id,selectEnable:'1'});
  113. if(data.code == 200){
  114. let obj={};
  115. for(let i=0;i<data.data.checkGroupMemberList.length;i++){
  116. obj={
  117. "deptId":data.data.checkGroupMemberList[i].deptId,
  118. "deptName":data.data.checkGroupMemberList[i].deptName,
  119. "enable":data.data.checkGroupMemberList[i].enable,
  120. "jobNum":data.data.checkGroupMemberList[i].jobNum,
  121. "name":data.data.checkGroupMemberList[i].name,
  122. "userId":data.data.checkGroupMemberList[i].userId,
  123. "userType":data.data.checkGroupMemberList[i].userType
  124. }
  125. this.form.checkMemberDtoList.push(obj)
  126. }
  127. if(this.pageType==1){
  128. uni.redirectTo({
  129. url: '/pages_safetyExamine/patrolPlan/patrolPlanAdd?form='+encodeURIComponent(JSON.stringify(this.form))
  130. });
  131. }else if(this.pageType==2){
  132. uni.redirectTo({
  133. url: '/pages_safetyExamine/patrolPlan/patrolPlanEdit?form='+encodeURIComponent(JSON.stringify(this.form))
  134. });
  135. }
  136. }
  137. },
  138. async getList(){
  139. let _this = this;
  140. const {data} = await checkGroupList(_this.getData);
  141. if(data.code==200){
  142. if(data.data){
  143. data.data.forEach(function(item){
  144. item.type=false
  145. })
  146. }
  147. this.dataList=[...this.dataList,...data.data]
  148. //如果有选中的数据
  149. if(this.seleteListMember.length>0){
  150. for(let i=0;i<this.dataList.length;i++){
  151. if(this.seleteListMember[0].id==this.dataList[i].id){
  152. this.dataList[i].type=true;
  153. }
  154. }
  155. }
  156. this.total=data.data.total;
  157. }
  158. }
  159. }
  160. }
  161. </script>
  162. <style lang="stylus" scoped>
  163. .examine{
  164. height:100%;
  165. display flex;
  166. .info-max-box{
  167. flex: 1;
  168. overflow: scroll;
  169. padding: 120rpx 0rpx 30rpx;
  170. box-sizing: border-box;
  171. }
  172. .lab_title{
  173. width: 750rpx;
  174. height: 100rpx;
  175. background: #FFFFFF;
  176. position: fixed;
  177. top: 0;
  178. padding: 10rpx 30rpx;
  179. box-sizing: border-box;
  180. .lab_title_n{
  181. width: 690rpx;
  182. height: 80rpx;
  183. position:relative;
  184. border-radius: 10rpx;
  185. border: 1rpx solid #E0E0E0;
  186. .lab_title_r_btn{
  187. width: 60rpx;
  188. height: 80rpx
  189. position: absolute;
  190. top: 0rpx;
  191. left:0rpx;
  192. >img{
  193. width: 20rpx;
  194. height: 20rpx;
  195. position: absolute;
  196. top: 30rpx;
  197. left: 24rpx;
  198. }
  199. }
  200. >input{
  201. width: 360rpx;
  202. height: 80rpx;
  203. position: absolute;
  204. top: 0rpx;
  205. left: 60rpx;
  206. }
  207. }
  208. }
  209. .list{
  210. background: #FFFFFF;
  211. border-radius: 20rpx 20rpx 0rpx 0rpx;
  212. padding: 0 30rpx;
  213. box-sizing: border-box;
  214. margin: 0 30rpx;
  215. .list_li{
  216. display: flex;
  217. justify-content:space-between;
  218. align-items: center;
  219. height: 80rpx;
  220. border-bottom: 1rpx solid #E0E0E0;
  221. >text{
  222. font-size: 28rpx;
  223. font-family: PingFang SC-Medium, PingFang SC;
  224. font-weight: 400;
  225. line-height: 80rpx;
  226. overflow: hidden;
  227. text-overflow:ellipsis;
  228. white-space: nowrap;
  229. }
  230. >img{
  231. width: 24rpx;
  232. height: 16rpx;
  233. margin-right: 14rpx;
  234. }
  235. }
  236. .list_li:last-child{
  237. border: none;
  238. }
  239. .color_A{
  240. color: #333333;
  241. }
  242. .color_B{
  243. color: #0183FA;
  244. }
  245. }
  246. .bottom_btn{
  247. position: fixed;
  248. bottom: 26rpx;
  249. left: 30rpx;
  250. font-size: 30rpx;
  251. font-family: PingFang SC-Medium, PingFang SC;
  252. font-weight: 400;
  253. color: #FFFFFF;
  254. line-height: 90rpx;
  255. width: 690rpx;
  256. height: 90rpx;
  257. background: #0183FA;
  258. border-radius: 20rpx;
  259. text-align: center;
  260. }
  261. }
  262. </style>