patrolPlanAddMember.vue 6.4 KB

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