chenhaozhe
2025-07-14 25100ec3d663fdab00f6dacb9f427b772c2f806f
pages/shebeiweixiu/table.vue
@@ -39,20 +39,18 @@
               <input v-model="hform.ColContent" placeholder="输入内容" />
            </view>
         </view>
         <view class="buttons">
            <button class="btn-a" size="mini" type="default" @tap="clear">重置</button>
            <button class="btn-b" size="mini" type="default" @tap="creat">新增</button>
            <button class="btn-c" size="mini" type="default" @tap="search">查询</button>
         </view>
      </view>
      <view style="width: 100%;height: 16rpx;background-color: #e5e5e5;"></view>
      <view class="list" v-for="(item,index) in showList" :key="index">
         <!-- #ifndef MP-WEIXIN -->
         <uni-card :title="item.设备名称" :extra="item.单据号" style="margin: 10px;"
            @tap="showDetail = showDetail==index?-1:index">
         <uni-card :title="item.设备名称" :extra="item.单据号" style="margin: 10px;" @tap="showDetail = showDetail==index?-1:index">
            <view class="card-detail">
               <view class="detail" v-if="item.设备代码">
                  <text>设备代码:</text>{{item.设备代码}}
@@ -177,164 +175,34 @@
                  <text>表体备注:</text>{{item.表体备注}}
               </view>
            </view>
            <!-- #endif -->
            <!-- #ifdef MP-WEIXIN -->
            <uni-card style="margin: 10px;" @tap="showDetail = showDetail==index?-1:index">
               <view class="card-detail">
                  <view class="detail" v-if="item['设备代码']">
                     <text>设备代码:</text>{{item['设备代码']}}
                  </view>
                  <view class="detail" v-if="item['设备型号']">
                     <text>设备型号:</text>{{item['设备型号']}}
                  </view>
                  <view class="detail" v-if="item['设备规格']">
                     <text>设备规格:</text>{{item['设备规格']}}
                  </view>
                  <view class="detail" v-if="item.HMainSourceBillNo">
                     <text>源单单号:</text>{{item.HMainSourceBillNo}}
                  </view>
                  <view class="detail" v-if="item['维修项目']">
                     <text>维修项目:</text>{{item['维修项目']}}
                  </view>
                  <view class="detail" v-if="item['维修项目代码']">
                     <text>维修项目代码:</text>{{item['维修项目代码']}}
                  </view>
                  <view class="detail" v-if="item['维修开始日期']">
                     <text>维修开始:</text>{{item['维修开始日期'].substr(0,10)}}
                  </view>
                  <view class="detail" v-if="item['维修结束日期']">
                     <text>维修结束:</text>{{item['维修结束日期'].substr(0,10)}}
                  </view>
                  <view class="detail" v-if="item['维修人']">
                     <text>维修人:</text>{{item['维修人']}}
                  </view>
                  <view class="detail" v-if="item['维修人代码']">
                     <text>维修人代码:</text>{{item['维修人代码']}}
                  </view>
                  <view class="detail" v-if="item['负责人']">
                     <text>负责人:</text>{{item['负责人']}}
                  </view>
                  <view class="detail" v-if="item['负责人代码']">
                     <text>负责人代码:</text>{{item['负责人代码']}}
                  </view>
                  <view class="detail" v-if="item['维修内容']">
                     <text>维修内容:</text>{{item['维修内容']}}
                  </view>
            <view class="more" v-if="showDetail == index && operations != index">
               <view class="part" style="border-right: 1px solid #eee;">
                  <uni-icons type="top" style="color: #888;margin-right: 10rpx;" size="14"></uni-icons>收起
               </view>
               <view class="card-detail" v-if="showDetail == index">
                  <view class="detail" v-if="item['部门名称']">
                     <text>部门名称:</text>{{item['部门名称']}}
                  </view>
                  <view class="detail" v-if="item['部门代码']">
                     <text>部门代码:</text>{{item['部门代码']}}
                  </view>
                  <view class="detail" v-if="item['计划维修工时']">
                     <text>计划维修工时:</text>{{item['计划维修工时']}}{{item['时间单位']}}
                  </view>
                  <view class="detail" v-if="item['实际维修工时']">
                     <text>实际维修工时:</text>{{item['实际维修工时']}}{{item['时间单位']}}
                  </view>
                  <view class="detail" v-if="item['维修要求']">
                     <text>维修要求:</text>{{item['维修要求']}}
                  </view>
                  <view class="detail" v-if="item['表头备注']">
                     <text>表头备注:</text>{{item['表头备注']}}
                  </view>
                  <view class="detail" v-if="item['内部单据号']">
                     <text>内部单据号:</text>{{item['内部单据号']}}
                  </view>
                  <view class="detail" v-if="item['制单人']">
                     <text>制单人:</text>{{item['制单人']}}
                  </view>
                  <view class="detail" v-if="item['制单日期']">
                     <text>制单日期:</text>{{item['制单日期'].substr(0,10)}}
                  </view>
                  <view class="detail" v-if="item['审核人']">
                     <text>审核人:</text>{{item['审核人']}}
                  </view>
                  <view class="detail" v-if="item['审核日期']">
                     <text>审核日期:</text>{{item['审核日期'].substr(0,10)}}
                  </view>
                  <view class="detail" v-if="item['修改人']">
                     <text>修改人:</text>{{item['修改人']}}
                  </view>
                  <view class="detail" v-if="item['修改日期']">
                     <text>修改日期:</text>{{item['修改日期'].substr(0,10)}}
                  </view>
                  <view class="detail" v-if="item['关闭人']">
                     <text>关闭人:</text>{{item['关闭人']}}
                  </view>
                  <view class="detail" v-if="item['关闭日期']">
                     <text>关闭日期:</text>{{item['关闭日期'].substr(0,10)}}
                  </view>
                  <view class="detail" v-if="item['作废人']">
                     <text>作废人:</text>{{item['作废人']}}
                  </view>
                  <view class="detail" v-if="item['作废日期']">
                     <text>作废日期:</text>{{item['作废日期'].substr(0,10)}}
                  </view>
                  <view class="detail" v-if="item['表体维修项目代码']">
                     <text>表体维修项目代码:</text>{{item['表体维修项目代码']}}
                  </view>
                  <view class="detail" v-if="item['表体维修项目']">
                     <text>表体维修项目:</text>{{item['表体维修项目']}}
                  </view>
                  <view class="detail" v-if="item['表体维修要求']">
                     <text>表体维修要求:</text>{{item['表体维修要求']}}
                  </view>
                  <view class="detail" v-if="item['表体负责人']">
                     <text>表体负责人:</text>{{item['表体负责人']}}
                  </view>
                  <view class="detail" v-if="item['表体负责人代码']">
                     <text>表体负责人代码:</text>{{item['表体负责人代码']}}
                  </view>
                  <view class="detail" v-if="item['行关闭人']">
                     <text>行关闭人:</text>{{item['行关闭人']}}
                  </view>
                  <view class="detail" v-if="item['关闭类型']">
                     <text>关闭类型:</text>{{item['关闭类型']}}
                  </view>
                  <view class="detail" v-if="item['关联数量']">
                     <text>关联数量:</text>{{item['关联数量']}}
                  </view>
                  <view class="detail" v-if="item['源单单号']">
                     <text>源单单号:</text>{{item['源单单号']}}
                  </view>
                  <view class="detail" v-if="item['表体备注']">
                     <text>表体备注:</text>{{item['表体备注']}}
                  </view>
               <view class="part" @tap.stop="operations = operations==index?-1:index">
                  <uni-icons type="more-filled" style="color: #888;margin-right: 10rpx;" size="14"></uni-icons>操作
               </view>
               <!-- #endif -->
               <view class="more" v-if="showDetail == index && operations != index">
                  <view class="part" style="border-right: 1px solid #eee;">
                     <uni-icons type="top" style="color: #888;margin-right: 10rpx;" size="14"></uni-icons>收起
                  </view>
                  <view class="part" @tap.stop="operations = operations==index?-1:index">
                     <uni-icons type="more-filled" style="color: #888;margin-right: 10rpx;"
                        size="14"></uni-icons>操作
                  </view>
            </view>
            <view class="more" v-if="showDetail != index && operations != index">
               <view class="part" style="border-right: 1px solid #eee;">
                  <uni-icons type="bottom" style="color: #888;margin-right: 10rpx;" size="14"></uni-icons>更多信息
               </view>
               <view class="more" v-if="showDetail != index && operations != index">
                  <view class="part" style="border-right: 1px solid #eee;">
                     <uni-icons type="bottom" style="color: #888;margin-right: 10rpx;" size="14"></uni-icons>更多信息
                  </view>
                  <view class="part" @tap.stop="operations = operations==index?-1:index">
                     <uni-icons type="more-filled" style="color: #888;margin-right: 10rpx;"
                        size="14"></uni-icons>操作
                  </view>
               <view class="part" @tap.stop="operations = operations==index?-1:index">
                  <uni-icons type="more-filled" style="color: #888;margin-right: 10rpx;" size="14"></uni-icons>操作
               </view>
               <view class="op" v-if="operations == index">
                  <!-- <button class="op1" size="mini" plain @tap.stop="">子表信息</button> -->
                  <!-- <button class="op2" size="mini" plain @tap.stop="">反审核</button> -->
                  <button class="op3" size="mini" plain @tap.stop="edit(item)">编辑</button>
                  <button class="op4" size="mini" plain @tap.stop="del(item)">删除</button>
                  <button class="op5" size="mini" plain @tap.stop="operations = -1">取消操作</button>
               </view>
            </uni-card>
            </view>
            <view class="op" v-if="operations == index">
               <!-- <button class="op1" size="mini" plain @tap.stop="">子表信息</button> -->
               <!-- <button class="op2" size="mini" plain @tap.stop="">反审核</button> -->
               <button class="op3" size="mini" plain @tap.stop="edit(item)">编辑</button>
               <button class="op4" size="mini" plain @tap.stop="del(item)">删除</button>
               <button class="op5" size="mini" plain @tap.stop="operations = -1">取消操作</button>
            </view>
         </uni-card>
      </view>
      <view class="over" v-if="listData.length == 0">暂无数据</view>
      <view class="over" v-if="listData.length != 0 && listData.length != showList.length">加载中...</view>
      <view class="over" v-if="listData.length != 0 && listData.length == showList.length">已到底</view>
@@ -342,86 +210,80 @@
</template>
<script>
   import {
      getUserInfo
   } from "@/utils/auth.js";
   import { getUserInfo } from "@/utils/auth.js";
   export default {
      data() {
         return {
            userInfo: getUserInfo(),
            serverUrl: uni.getStorageSync('serverUrl') || 'http://47.96.97.237/API',
            hform: {
               HBillNo: '',
               BenginHCreateDate: '',
               EndHCreateDate: '',
               ColName: '',
               Comparator: '',
               ColContent: '',
       data() {
           return {
            userInfo:getUserInfo(),
            serverUrl: uni.getStorageSync('serverUrl')||'http://47.96.97.237/API',
            hform:{
               HBillNo:'',
               BenginHCreateDate:'',
               EndHCreateDate:'',
               ColName:'',
               Comparator:'',
               ColContent:'',
            },
            sWhere: '',
            listData: [],
            showList: [],
            showDetail: -1,
            operations: -1,
            arrayColName: ['日期', '单据号', '设备代码', '设备名称', '设备规格', '设备型号', '源单单号', '维修项目代码', '维修项目', '维修人代码', '维修人',
               '部门代码', '部门名称', '负责人代码', '负责人', '维修开始日期', '维修结束日期', '维修内容', '时间单位', '计划维修工时', '实际维修工时', '维修要求',
               '表头备注', '内部单据号', '制单人', '制单日期', '审核人', '审核日期', '修改人', '修改日期', '关闭人', '关闭日期', '作废人', '作废日期',
               '表体维修项目代码', '表体维修项目', '表体维修要求', '表体负责人代码', '表体负责人', '行关闭人', '关闭类型', '表体备注', '源单单号', '关联数量'
            ],
            arrayComparator: ['=', '>=', '>', '<=', '<', '<>', '包含', '左包含', '右包含', '不包含'],
            page: 1,
            sWhere:'',
            listData:[],
            showList:[],
            showDetail:-1,
            operations:-1,
            arrayColName:['日期','单据号','设备代码','设备名称','设备规格','设备型号','源单单号','维修项目代码','维修项目','维修人代码','维修人','部门代码','部门名称','负责人代码','负责人','维修开始日期','维修结束日期','维修内容','时间单位','计划维修工时','实际维修工时','维修要求','表头备注','内部单据号','制单人','制单日期','审核人','审核日期','修改人','修改日期','关闭人','关闭日期','作废人','作废日期','表体维修项目代码','表体维修项目','表体维修要求','表体负责人代码','表体负责人','行关闭人','关闭类型','表体备注','源单单号','关联数量'],
            arrayComparator:['=','>=','>','<=','<','<>','包含','左包含','右包含','不包含'],
            page:1,
         }
      },
       },
      onLoad() {
         this.getList()
         console.log(this.userInfo, uni.getStorageSync('HUserName'))
         console.log(this.userInfo,uni.getStorageSync('HUserName'))
      },
      onReachBottom: function() {
         this.page++
         setTimeout(() => {
            this.showList = this.showList.concat(this.getPage(this.page, this.listData))
            this.showList = this.showList.concat(this.getPage(this.page,this.listData))
         }, 100)
      },
      onPullDownRefresh: function() {
         this.clear()
         setTimeout(() => {
         setTimeout(()=>{
            uni.stopPullDownRefresh();
         }, 1000);
      },
      methods: {
         getPage(page, list) {
       methods: {
         getPage(page,list){
            let sindex = (parseInt(page) - 1) * 20
            let eindex = parseInt(page) * 20
            let newList = list.slice(sindex, eindex)
            let newList = list.slice(sindex,eindex)
            return newList
         },
         getList() {
         getList(){
            console.log(this.sWhere)
            uni.showLoading({
               title: '加载中...'
               title:'加载中...'
            })
            uni.request({
               url: this.serverUrl + '/Sb_EqpRepairWorkBill/GetEqpRepairWorkBillList',
               data: {
                url: this.serverUrl + '/Sb_EqpRepairWorkBill/GetEqpRepairWorkBillList',
               data:{
                  sWhere: this.sWhere,
                  user: uni.getStorageSync('HUserName')
               },
               success: (res) => {
                  console.log(1, res);
                  if (res.data.count == 1) {
                success: (res) => {
                    console.log(1,res);
                  if(res.data.count == 1){
                     this.listData = res.data.data
                     this.showList = this.getPage(this.page, this.listData)
                     setTimeout(() => {
                        uni.hideLoading()
                     this.showList = this.getPage(this.page,this.listData)
                     setTimeout(()=>{
                          uni.hideLoading()
                     }, 1000)
                  } else {
                  }else{
                     uni.hideLoading()
                     uni.showToast({
                        title: res.data.Message,
                        icon: 'none'
                        title:res.data.Message,
                        icon:'none'
                     })
                  }
               },
@@ -429,171 +291,167 @@
                  console.log(res);
                  uni.hideLoading()
                  uni.showToast({
                     title: '接口请求失败',
                     icon: 'none'
                     title:'接口请求失败',
                     icon:'none'
                  })
               },
            });
         },
         //选择单据日期
         BenginHCreateDateChange(e) {
         BenginHCreateDateChange(e){
            console.log(e.detail.value)
            this.hform.BenginHCreateDate = e.detail.value
         },
         //选择单据日期
         EndHCreateDateChange(e) {
         EndHCreateDateChange(e){
            console.log(e.detail.value)
            this.hform.EndHCreateDate = e.detail.value
         },
         //过滤
         ColNameChange(e) {
         ColNameChange(e){
            // console.log(e.detail.value)
            this.hform.ColName = this.arrayColName[e.detail.value]
            console.log(this.hform)
         },
         //条件
         ComparatorChange(e) {
         ComparatorChange(e){
            // console.log(e.detail.value)
            this.hform.Comparator = this.arrayComparator[e.detail.value]
            console.log(this.hform)
         },
         search() {
         search(){
            this.sWhere = ''
            this.listData = []
            this.page = 1
            this.showList = []
            console.log(this.hform)
            if (this.hform.HBillNo) {
               this.sWhere += " and 单据号 like '%" + this.hform.HBillNo + "%'";
                this.sWhere += " and 单据号 like '%" + this.hform.HBillNo + "%'";
            }
            if (this.hform.BenginHCreateDate) {
               this.sWhere += " and CONVERT(varchar(100),日期, 23) >= '" + this.hform.BenginHCreateDate + "'";
                this.sWhere += " and CONVERT(varchar(100),日期, 23) >= '" + this.hform.BenginHCreateDate + "'";
            }
            if (this.hform.EndHCreateDate) {
               this.sWhere += " and CONVERT(varchar(100),日期, 23) >= '" + this.hform.EndHCreateDate + "'";
                this.sWhere += " and CONVERT(varchar(100),日期, 23) >= '" + this.hform.EndHCreateDate + "'";
            }
            if (this.hform.ColName && this.hform.Comparator) {
               var com = "";
               if (this.hform.Comparator == '包含') {
                var com = "";
               if(this.hform.Comparator == '包含'){
                  com = "like'%" + this.hform.ColContent + "%'";
               } else if (this.hform.Comparator == '左包含') {
               }else if(this.hform.Comparator == '左包含'){
                  com = "like'%" + this.hform.ColContent + "'";
               } else if (this.hform.Comparator == '右包含') {
               }else if(this.hform.Comparator == '右包含'){
                  com = "like'" + this.hform.ColContent + "%'";
               } else if (this.hform.Comparator == '不包含') {
               }else if(this.hform.Comparator == '不包含'){
                  com = "not like'%" + this.hform.ColContent + "%'";
               } else {
               }else{
                  com = "" + this.hform.Comparator + "'" + this.hform.ColContent + "'";
               }
               if (this.hform.ColName == '源单单号') {
               if(this.hform.ColName == '源单单号'){
                  this.sWhere += " and " + 'HMainSourceBillNo' + " " + com;
               } else {
               }else{
                  this.sWhere += " and " + this.hform.ColName + " " + com;
               }
            }
            this.getList()
         },
         creat() {
         creat(){
            uni.navigateTo({
               url: '/pages/shebeiweixiu/form'
               url:'/pages/shebeiweixiu/form'
            })
         },
         clear() {
         clear(){
            this.listData = []
            this.page = 1
            this.showList = []
            this.sWhere = ''
            this.showDetail = -1,
               this.operations = -1,
               this.hform = {
                  HBillNo: '',
                  BenginHCreateDate: '',
                  EndHCreateDate: '',
                  ColName: '',
                  Comparator: '',
                  ColContent: '',
               }
            this.operations = -1,
            this.hform = {
               HBillNo:'',
               BenginHCreateDate:'',
               EndHCreateDate:'',
               ColName:'',
               Comparator:'',
               ColContent:'',
            }
            this.getList()
         },
         //编辑
         edit(item) {
         edit(item){
            console.log(item)
            uni.navigateTo({
               url: '/pages/shebeiweixiu/form?hmainid=' + item.hmainid
               url:'/pages/shebeiweixiu/form?hmainid=' + item.hmainid
            })
         },
         //删除
         del(item) {
         del(item){
            // console.log(item.hmainid,uni.getStorageSync('HUserName'))
            uni.showModal({
               title: '提示',
               content: '确认要删除吗,删除后不能恢复',
               success: (res) => {
                  if (res.confirm) {
                     console.log('用户点击确定');
                title: '提示',
                content: '确认要删除吗,删除后不能恢复',
                success: (res) => {
                    if (res.confirm) {
                        console.log('用户点击确定');
                     uni.request({
                        url: this.serverUrl + '/Sb_EqpRepairWorkBill/DeltetEqpRepairWorkBill',
                        data: {
                         url: this.serverUrl + '/Sb_EqpRepairWorkBill/DeltetEqpRepairWorkBill',
                        data:{
                           HInterID: item.hmainid,
                           user: uni.getStorageSync('HUserName')
                        },
                        success: (res) => {
                           console.log(1, res);
                           if (res.data.count == 1) {
                         success: (res) => {
                             console.log(1,res);
                           if(res.data.count == 1){
                              this.clear()
                           }
                           uni.showToast({
                              title: res.data.Message,
                              icon: 'none'
                              title:res.data.Message,
                              icon:'none'
                           })
                        },
                        fail: (res) => {
                           console.log(res);
                           uni.hideLoading()
                           uni.showToast({
                              title: '接口请求失败',
                              icon: 'none'
                              title:'接口请求失败',
                              icon:'none'
                           })
                        },
                     });
                  } else if (res.cancel) {
                     console.log('用户点击取消');
                  }
               }
                    } else if (res.cancel) {
                        console.log('用户点击取消');
                    }
                }
            });
         },
      }
       }
   }
</script>
<style lang="scss" scoped>
   .form {
   .form{
      width: 640rpx;
      margin: 20rpx auto;
   }
   .form-item {
    .form-item{
      display: flex;
      align-items: center;
      font-size: 28rpx;
      padding: 6rpx 0;
      .title {
      .title{
         width: 180rpx;
         text {
         text{
            color: red;
            font-weight: bold;
         }
      }
      .left {
      .left{
         width: 170rpx;
         padding: 10rpx 0;
         margin-right: 10rpx;
@@ -602,129 +460,110 @@
         color: #888;
         text-align: center;
      }
      .right {
      .right{
         width: 450rpx;
         border-radius: 22rpx;
         border: 1px solid #acacac;
      }
      .righton {
      .righton{
         width: 450rpx;
         border-radius: 22rpx;
         border: 1px solid #e4e4e4;
         background-color: #e4e4e4;
      }
      input {
      input{
         width: 100%;
         padding: 8rpx 20rpx;
         font-size: 30rpx;
      }
   }
   .buttons {
   .buttons{
      width: 100%;
      display: flex;
      justify-content: center;
      margin-top: 20rpx;
      button {
      button{
         border-radius: 50rpx;
         width: 180rpx;
         height: 66rpx;
         line-height: 66rpx;
         font-size: 28rpx;
      }
      .btn-a {
      .btn-a{
         background-color: #acacac;
         color: #fff;
      }
      .btn-b {
      .btn-b{
         background-color: #41a863;
         color: #fff;
      }
      .btn-c {
      .btn-c{
         background-color: #3a78ff;
         color: #fff;
      }
   }
   .list {
   .list{
      width: 100%;
      .card-detail {
      .card-detail{
         width: 100%;
         display: flex;
         flex-wrap: wrap;
         justify-content: space-between;
         line-height: 120%;
         .detail {
         .detail{
            // width: 50%;
            font-size: 26rpx;
            margin-bottom: 12rpx;
            color: #555;
            margin-right: 20rpx;
            text {
            text{
               color: #999;
               font-size: 26rpx;
            }
         }
      }
      .more {
      .more{
         color: #888;
         font-size: 24rpx;
         display: flex;
         border-top: 1px solid #eee;
         padding-top: 20rpx;
         .part {
         .part{
            width: 50%;
            text-align: center;
         }
      }
      .op {
      .op{
         display: flex;
         justify-content: space-around;
         margin-top: 20rpx;
         button {
         button{
            padding: 0;
            width: 150rpx;
            font-size: 25rpx;
         }
         .op1 {
         .op1{
            border: 1px solid #41a863;
            color: #41a863;
         }
         .op2 {
         .op2{
            border: 1px solid #d98d00;
            color: #d98d00;
         }
         .op3 {
         .op3{
            border: 1px solid #3a78ff;
            color: #3a78ff;
         }
         .op4 {
         .op4{
            border: 1px solid #da0000;
            color: #da0000;
         }
         .op5 {
         .op5{
            border: 1px solid #888;
            color: #888;
         }
      }
   }
</style>
</style>