123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331 |
- <template>
- <view class="car">
- <view class="cartop">
- <!-- <view class="topa flexc">
- <image :src="reset" class="resetimg" @click="getReset"></image>
- <picker mode="date" @change='bindDateChangea'>
- <view class="chekt flexc">
- <view>{{cxrq|| "选择日期"}}</view>
- <image :src="up"></image>
- </view>
- </picker>
- <view class="search flexc">
- <image :src="search"></image>
- <input placeholder="请输入房号进行搜索" v-model="text"/>
- <view class="btn" @click="getConfirm">搜索</view>
- </view>
- </view> -->
- <view class="tabtop flexc">
- <view class="tabt" :class="tabval==ite.val?'act':''" v-for="(ite,idx) in tablist" :key="idx" @click="getTabFn(ite.val)">{{ite.tit}}</view>
- </view>
- </view>
- <!-- 列表 -->
- <view class="carlists">
- <car-list :datainfo="list" :bxlbList="bxlbList" :bxztList="bxztList" :wtdt="wtdt" type='warranty' @getDetail="getDetail" @getDelFn="getDelFn" @getAssignFn="getAssignFn" @getCheckFn="getCheckFn"></car-list>
- </view>
- <pop-up :type="type" @getClose='getClose' :bxlbList="bxlbList" :bxlb="maintenanceCategory" :vxsztList="vxsztList" :peolist="peolist" :finshtype='repairStatus' @getSure="getSure"></pop-up>
- <loading></loading>
- </view>
- </template>
- <script>
- import config from '@/config'
- const baseUrl = config.baseUrl
- import popUp from "@/service/components/popup/popup.vue"
- import carList from "@/service/components/car/list.vue"
- import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
- import {repairList,repairDel,repairPut,repairAssign} from "@/api/work/service.js"
- import {stafflistNoPage} from "@/api/work/people.js"
- import {getDictionaryFn} from "@/api/system/user.js"
- export default{
- components:{carList,popUp},
- data(){
- return{
- reset:require('@/car/static/car/reset.png'),
- search:require('@/car/static/car/search.png'),
- up:require('@/car/static/car/up.png'),
- cxrq:"",
- text:'',
- list:[],
- pageSize: 10,
- pageNum: 1,
- reachflag: true,
- wtdt:'',
- tabval:'-1',
- tablist:[{tit:'全部报修',val:-1}],
- bxztList:[],
- bxlbList:[],
- vxsztList:[],
- peolist:[],
- maintenanceCategory:'',
- type:'',
- repairId:'',
- staffId:'',
- staffUserId:'',
- repairStatus:'',//维修状态
- userId:this.$store.state.user.userId
- }
- },
- onUnload() {
- uni.$off('repairList')
- },
- onLoad: function() {
- uni.$on('repairList',(res)=>{
- this.getrefreshData()
- })
- this.init()
- this.getDataFn();
- this.getstafflistNoPage()
- },
- // 上拉触底加载更多触发事件
- onReachBottom() {
- if (this.reachflag) {
- this.pageNum++
- this.getDataFn()
- }
- },
- methods:{
- checkPermi, checkRole,
- getAssignFn(data){
- this.type='assign';
- var info=JSON.parse(JSON.stringify(data))
- this.repairId=info.repairId;
- this.maintenanceCategory=info.maintenanceCategory;
- },
- getCheckFn(data){
- this.type='assigncheck';
- var info=JSON.parse(JSON.stringify(data))
- this.repairId=info.repairId;
- this.staffId=info.staffId;
- this.repairStatus=info.repairStatus;
- },
- getClose(){
- this.type='';
- this.repairId='';
- this.maintenanceCategory='';
- },
- init(){
- // 报修状态
- getDictionaryFn('repair_status').then(res=>{
- if(res.code==200){
- this.bxztList = res.data.map(v => {
- var obj={
- tit: v.dictLabel,
- val: v.dictValue
- }
- this.tablist.push(obj)
- return {
- dictLabel: v.dictLabel,
- dictValue: v.dictValue
- }
- })
- }
- })
- // 报修类别
- getDictionaryFn('baoxiutype').then(res=>{
- if(res.code==200){
- this.bxlbList = res.data.map(v => {
- return {
- dictLabel: v.dictLabel,
- dictValue: v.dictValue
- }
- })
- }
- })
- // 维修师状态
- getDictionaryFn('technician_status').then(res=>{
- if(res.code==200){
- this.vxsztList = res.data.map(v => {
- return {
- dictLabel: v.dictLabel,
- dictValue: v.dictValue
- }
- })
- }
- })
- },
- getstafflistNoPage(){
- var patams={
- staffCategory:'repair'
- }
- stafflistNoPage(patams).then(res=>{
- if(res.code==200){
- this.peolist=res.rows;
- }
- })
- },
- time() {
- var date = new Date();
- var y = date.getFullYear();
- var m = date.getMonth() + 1;
- var d = date.getDate();
- var h = date.getHours();
- var min = date.getMinutes();
- var s = date.getSeconds();
- var yearStr = y + '-' + (m < 10 ? ('0' + m) : m) + '-' + (d < 10 ? ('0' + d) : d)
- var timeStr = (h < 10 ? ('0' + h) : h) + ':' + (min < 10 ? ('0' + min) : min) + ':' + (s < 10 ? (
- '0' + s) : s);
- var kaTime = yearStr + ' ' + timeStr;
- return kaTime
- },
- getSure(data){
- var type=this.type;
- var that=this;
- var ite=JSON.parse(JSON.stringify(data))
- if(type=='assign'){
- ite.repairId=this.repairId;
- repairAssign(ite).then(res=>{
- if(res.code==200){
- that.$toast("指派成功")
- setTimeout(function(){
- that.type='';
- that.getrefreshData()
- },1500)
- }
- })
- }else if(type=='assigncheck'){
- var params={};
- params.repairId=this.repairId;
- params.staffId=this.staffId;
- if(this.repairStatus==2){//上门拍照
- params.repairStatus=3;
- params.visitPhoto=ite.imgurl;
- params.visitTime=this.time();
-
- }else{//结束拍照
- params.repairStatus=4;
- params.completionTime=this.time();
- params.completionPhoto=ite.imgurl;
- }
- repairPut(params).then(res=>{
- if(res.code==200){
- that.$toast("操作成功")
- setTimeout(function(){
- that.type='';
- that.getrefreshData()
- },1500)
- }
- })
- }
- },
- getDelFn(data){
- var that=this;
- repairDel(data).then(res=>{
- if(res.code==200){
- this.$toast("删除成功");
- setTimeout(function(){
- that.getrefreshData()
- },1500)
- }
- })
- },
- getDetail(id){
- this.$tab.navigateTo("/service/pages/service/warrantydetail?id="+id)
- },
- getConfirm(){
- this.getrefreshData()
- },
- getReset(){
- this.cxrq='';
- this.text='';
- this.getrefreshData()
- },
- getrefreshData(){
- this.pageNum=1;
- this.list=[];
- this.reachflag=true;
- this.getDataFn()
- },
- getTabFn(val){
- this.tabval=val;
- this.getrefreshData()
- },
- bindDateChangea(e){
- var val=e.detail.value;
- this.cxrq=val;
- },
- getDataFn(){
- var params={
- pageSize:this.pageSize,
- pageNum: this.pageNum,
- }
- if(this.tabval!=-1){
- params.repairStatus=this.tabval
- }
- if(checkPermi(['wuYe:repair:repairlist'])){
- params.staffUserId=this.userId
- }
- repairList(params).then(res=>{
- if(res.code==200){
- if (res.rows.length < this.pageSize) {
- this.reachflag = false
- this.wtdt = '到底了~';
- } else {
- var num = parseInt(res.rows.length) + parseInt(this.pageSize) * parseInt(this.pageNum - 1)
- if (num < res.total) {
- this.reachflag = true
- this.wtdt = ''
- } else {
- this.reachflag = false
- this.wtdt = '到底了~';
- }
- }
- var newArr=JSON.parse(JSON.stringify(res.rows))
- if(newArr&&newArr.length){
- newArr.forEach(ite=>{
- if(ite.repairImages){
- ite.repairImages=ite.repairImages.split(',')
- }
- if(ite.visitPhoto){
- ite.visitPhoto=ite.visitPhoto.split(',')
- }
- if(ite.completionPhoto){
- ite.completionPhoto=ite.completionPhoto.split(',')
- }
- })
- }
- console.log(newArr)
- if (this.pageNum == 1) {
- this.list = newArr;
- } else {
- this.list = this.list.concat(newArr)
- }
- }else{
- this.$toast(res.msg)
- }
- })
-
- },
- }
- }
- </script>
- <style>
- page{background: #F3F3F0;}
- </style>
- <style lang="scss" scoped>
- .car{padding: 146rpx 0 0rpx;}
- .cartop{position: fixed;left: 0;right: 0;top: 0;background-color: #ffffff;z-index: 2;
- .topa{padding: 20rpx ;
- .resetimg{width: 36rpx;height: 36rpx;margin-right: 24rpx;flex: 0 0 auto;}
- .chekt{min-width: 180rpx;
- view{font-weight: 500;font-size: 26rpx;color: #272727;flex: 1;}
- image{width: 24rpx;height: 16rpx;margin-left: 18rpx;flex: 0 0 auto;}
- }
- .search{flex: 1;margin-left: 16rpx;height: 64rpx;background: #EEEEEE;border-radius: 32rpx;border: 2rpx solid #E6E6E6;padding-left: 24rpx;box-sizing: border-box;
- image{width: 32rpx;height: 34rpx;margin-right: 22rpx;flex: 0 0 auto;}
- input{flex: 1;font-size: 26rpx;color: #272727;}
- .btn{width: 100rpx;height: 64rpx;background: #3565ED;border-radius: 32rpx;flex: 0 0 auto;font-weight: bold;text-align: center;line-height: 64rpx;
- font-size: 26rpx;
- color: #FFFFFF;}
- }
- }
- .tabtop{padding-bottom: 40rpx;padding-top: 26rpx;
- .tabt{font-weight: 500;font-size: 32rpx;color: #666666;position: relative;line-height: 56rpx; flex:1;text-align: center;
- &.act{font-weight: bold;font-size: 32rpx;color: #272727;
- &::after{content: '';width: 40rpx;height: 10rpx;background: #0156FE;border-radius: 6rpx;position: absolute;left: 50%;margin-left: -20rpx;bottom: -10rpx;}
- }
- }
- }
- }
- .carlists{padding: 0 18rpx;}
- </style>
|