dzjelist.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. <template>
  2. <view class="allpage">
  3. <view class="zhanline"></view>
  4. <view class="alllist">
  5. <!-- l列表 -->
  6. <project-list type='skdwzj' :datalist="list" :wtdt='wtdt' @getDetail="getDetail"></project-list>
  7. </view>
  8. <skdwzi-pop :iteminfo="dwzjinfo" :isSh="isSh" :status="status" @getldDelFn="getldDelFn" @proSure="proSure" @getClose="getClose" :addzjdwflag='addzjdwflag'></skdwzi-pop>
  9. <!-- 新增 -->
  10. <block v-if="checkPermi(['projectV2:dzje:add'])&&isSh==2">
  11. <view style="height: 100rpx;"></view>
  12. <view class="cluebtn btn2" @click="getAdddwzi">添加到位资金</view?>
  13. </block>
  14. </view>
  15. </template>
  16. <script>
  17. import projectList from "@/components/projectlist/list.vue"
  18. import {getdzjeList,getputdzjeFn,getdeldzjeFn,getadddzjeFn} from "@/api/work/addsk.js"
  19. import skdwziPop from "@/components/popup/skdwzjpop.vue"
  20. import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
  21. export default{
  22. data(){
  23. return{
  24. pageSize: 10,
  25. pageNum: 1,
  26. reachflag:true,
  27. itemslist:[],
  28. wtdt:'',
  29. tabidx:0,
  30. date:'',
  31. list:[],
  32. year:'',
  33. name:'',
  34. census:'',
  35. type:0,
  36. status:'update',
  37. deptId:this.$store.state.user.deptId,
  38. id:"",
  39. dwzjinfo:{},
  40. addzjdwflag:false,
  41. isSh:''
  42. }
  43. },
  44. components:{
  45. projectList,skdwziPop
  46. },
  47. onUnload(){
  48. },
  49. onLoad(e) {
  50. if(e.data){
  51. var newobj=JSON.parse(decodeURIComponent(e.data));
  52. this.id=newobj.id;
  53. this.isSh=newobj.isSh||'1';
  54. this.xmmc=newobj.xmmc||''
  55. this.getDataFn();
  56. }
  57. },
  58. onReachBottom() {
  59. if (this.reachflag) {
  60. this.pageNum++
  61. this.getDataFn()
  62. }
  63. },
  64. methods:{
  65. checkPermi, checkRole,
  66. getClose(){
  67. this.type=0;
  68. },
  69. getDetail(data){
  70. //判断权限
  71. if(checkPermi(['projectV2:dzje:edit','projectV2:dzje:remove'])){
  72. this.status='update'
  73. this.addzjdwflag=true;
  74. this.dwzjinfo=data;
  75. }
  76. },
  77. getClose(){
  78. this.addzjdwflag=false;
  79. this.dwzjinfo={};
  80. },
  81. getAdddwzi(){
  82. this.status='add'
  83. this.dwzjinfo={
  84. "dwmc":'',//单位名称
  85. "zzje":'',//注资金额
  86. "dwrq":'',//到位日期
  87. };
  88. this.addzjdwflag=true
  89. },
  90. proSure(data){
  91. var that=this;
  92. var params=JSON.parse(JSON.stringify(data));
  93. // params.skId=this.datainfo.skId;
  94. // params.xmmc=this.datainfo.xmmc;
  95. // params.id=this.dwzjinfo.id
  96. // 修改
  97. if(this.status=='add'){
  98. params.skId=this.id;
  99. params.xmmc=this.xmmc;
  100. getadddzjeFn(params).then(res=>{
  101. if(res.code==200){
  102. that.$toast("添加到位资金成功")
  103. setTimeout(function(){
  104. uni.$emit('refreshdata','dwzj');
  105. that.dwzjinfo={};
  106. that.pageNum=1;
  107. that.reachflag=true;
  108. that.list=[];
  109. that.getDataFn();
  110. that.addzjdwflag=false;
  111. },1500)
  112. }else{
  113. this.$toast(res.msg)
  114. }
  115. })
  116. }else{
  117. getputdzjeFn(params).then(res=>{
  118. if(res.code==200){
  119. that.$toast("到位资金修改成功")
  120. setTimeout(function(){
  121. uni.$emit('refreshdata','dwzj');
  122. that.pageNum=1;
  123. that.reachflag=true;
  124. that.list=[];
  125. that.getDataFn();
  126. that.addzjdwflag=false;
  127. },1500)
  128. }else{
  129. this.$toast(res.msg)
  130. }
  131. })
  132. }
  133. // 新增
  134. },
  135. getldDelFn(){
  136. var params={};
  137. var that=this;
  138. // params.id=this.dwzjinfo.id;
  139. // params.skId=this.id;
  140. // var s=[]
  141. // s[0]=this.id
  142. getdeldzjeFn(this.dwzjinfo.id).then(res=>{
  143. if(res.code==200){
  144. that.$toast('到位资金删除成功')
  145. setTimeout(function(){
  146. uni.$emit('refreshdata','dwzj');
  147. that.pageNum=1;
  148. that.reachflag=true;
  149. that.list=[];
  150. that.getDataFn()
  151. that.addzjdwflag=false;
  152. },1500)
  153. }else{
  154. this.$toast(res.msg)
  155. }
  156. })
  157. },
  158. getDataFn(){
  159. var params={
  160. pageSize:this.pageSize,
  161. pageNum: this.pageNum,
  162. skId:this.id,
  163. }
  164. getdzjeList(params).then(res=>{
  165. if(res.code==200){
  166. if (res.rows.length < this.pageSize) {
  167. this.reachflag = false
  168. this.wtdt = '到底了~';
  169. } else {
  170. var num = parseInt(res.rows.length) + parseInt(this.pageSize) * parseInt(this.pageNum - 1)
  171. if (num < res.total) {
  172. this.reachflag = true
  173. this.wtdt = '上拉加载更多'
  174. } else {
  175. this.reachflag = false
  176. this.wtdt = '到底了~';
  177. }
  178. }
  179. if (this.pageNum == 1) {
  180. this.list = res.rows;
  181. } else {
  182. this.list = this.list.concat(res.rows)
  183. }
  184. }else{
  185. this.$toast(res.msg)
  186. }
  187. })
  188. },
  189. }
  190. }
  191. </script>
  192. <style lang="scss" scoped>
  193. .allpage{min-height: 100vh;background: #ffffff;box-sizing: border-box;}
  194. .listtopa{border: 6rpx solid #FD5001;border-radius: 36rpx;height:72rpx;box-sizing: border-box;padding:0 140rpx 0 32rpx ;position: relative;
  195. input{}
  196. image{width: 30rpx;height: 30rpx;margin-right: 24rpx;}
  197. .btn{background: #FA5F03;border-radius: 36rpx;width: 140rpx;position: absolute;right: -2rpx;top: -2rpx;bottom:-2rpx;}
  198. }
  199. .listtopb{
  200. .tit{flex: 1;height: 130rpx;display: flex;flex-direction: column;justify-content: center;position: relative;
  201. view{text-align: center;}
  202. .tits{color: #666666;}
  203. .txt{color: #aaaaaa;}
  204. &.act{
  205. &::after{content: '';width: 100rpx;height: 6rpx;background:#FE5706 ;position: absolute;left: 50%;margin-left: -50rpx;bottom: 0;}
  206. .tits{color: #343434;}
  207. .txt{color: #FE5706;}
  208. }
  209. }
  210. }
  211. .alllist{padding-top:10rpx ;}
  212. // 操作按钮
  213. .cluebtn{
  214. display: flex;align-items: center;justify-content: center;font-weight: bold;font-size: 32rpx;color: #ffff;height: 100rpx;position: fixed;left: 0;right: 0;bottom: 0;z-index: 3;
  215. &.btn1{background-color: #1FB9F7;flex: 1;}
  216. &.btn2{background-color:#FF6400;flex: 1;}
  217. }
  218. </style>