copy from pages/MJGL/mujubaoyangjiludan/mouldMaintainRecordBillList.vue
copy to pages/MJGL/SBMJReport/Sb_EquipMaintainTaskReport.vue
| File was copied from pages/MJGL/mujubaoyangjiludan/mouldMaintainRecordBillList.vue |
| | |
| | | </uni-datetime-picker> |
| | | </view> |
| | | </view> |
| | | <view class="search-item"> |
| | | <view class="left">单据号</view> |
| | | <view class="right"> |
| | | <input type="text" auto-focus v-model="HBillNo" /> |
| | | </view> |
| | | </view> |
| | | |
| | | <view class="button-groups"> |
| | | <button type="default" size="mini" class="btn-b" @tap.stop="onAddClickHandler">新增</button> |
| | | <button type="default" size="mini" class="btn-c" @tap.stop="onSearchClickHandler">查询</button> |
| | | <button type="default" size="mini" class="btn-a" @tap.stop="onResetClickHandler">重置</button> |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- 页签区域 --> |
| | | <view class="tab-container"> |
| | | <view class="tab-list"> |
| | | <view v-for="(tab, index) in tabs" :key="index" :class="['tab-item', { 'active': activeTab === index }]" |
| | | @tap="switchTab(index)"> |
| | | <text>{{ tab.label }}</text> |
| | | <text v-if="tab.count > 0" class="tab-count">{{ tab.count }}</text> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | |
| | | <view style="width: 100%;height: 16rpx;background-color: #e5e5e5;"></view> |
| | | <scroll-view id="pageContent" scroll-y class="page-content" :style="{height: pageContentHeight + 'px'}"> |
| | | <view v-for="(item,index) in listData" :key="index"> |
| | | <uni-card :title="item.产品模具" :extra="item.单据号" style="margin: 10px;" |
| | | @tap="showDetail = showDetail==index?-1:index"> |
| | | |
| | | <!-- 页签内容区域 --> |
| | | <scroll-view v-for="(tab, tabIndex) in tabs" :key="tabIndex" v-show="activeTab === tabIndex" id="pageContent" |
| | | scroll-y class="page-content" :style="{height: pageContentHeight + 'px'}"> |
| | | <view class="list" v-for="(item,index) in tab.listData" :key="index"> |
| | | <uni-card :title="item.设备代码" :extra="item.设备保养计划单号" style="margin: 10px;" |
| | | @tap="showDetail = showDetail==item.hmainid?-1:item.hmainid"> |
| | | <view class="card-detail"> |
| | | <view class="detail" v-if="item.产品模具编码"> |
| | | <text>产品模具编码:</text>{{item.产品模具编码}} |
| | | <view class="detail" v-if="item.设备名称"> |
| | | <text>设备名称:</text>{{item.设备名称}} |
| | | </view> |
| | | <view class="detail" v-if="item.保养计划编号"> |
| | | <text>保养计划编号:</text>{{item.保养计划编号}} |
| | | <view class="detail" v-if="item.设备规格"> |
| | | <text>设备规格:</text>{{item.设备规格}} |
| | | </view> |
| | | <view class="detail" v-if="item.保养规程编号"> |
| | | <text>保养规程编号:</text>{{item.保养规程编号}} |
| | | <view class="detail" v-if="item.设备型号"> |
| | | <text>设备型号:</text>{{item.设备型号}} |
| | | </view> |
| | | <view class="detail" v-if="item.保养开始日期"> |
| | | <text>保养开始日期:</text>{{item.保养开始日期.substr(0,10)}} |
| | | <view class="detail" v-if="item.生产资源"> |
| | | <text>生产资源:</text>{{item.对应生产资源}} |
| | | </view> |
| | | <view class="detail" v-if="item.保养结束日期"> |
| | | <text>保养结束日期:</text>{{item.保养结束日期.substr(0,10)}} |
| | | <view class="detail" v-if="item.保养周期"> |
| | | <text>保养周期:</text>{{item.保养周期}} |
| | | </view> |
| | | <view class="detail" v-if="item.最终结论"> |
| | | <text>最终结论:</text>{{item.最终结论}} |
| | | <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.计划结束时间点.substr(0,10)}} |
| | | </view> |
| | | </view> |
| | | <view class="card-detail" v-if="showDetail == index"> |
| | | <view class="card-detail" v-if="showDetail == item.hmainid"> |
| | | <view class="detail" v-if="item.制单人"> |
| | | <text>制单人:</text>{{item.制单人}} |
| | | </view> |
| | |
| | | </view> |
| | | </view> |
| | | |
| | | |
| | | <view class="more" v-if="showDetail == index && operations != index"> |
| | | <view class="more" v-if="showDetail == item.hmainid && operations != item.hmainid"> |
| | | <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"> |
| | | <view class="part" @tap.stop="operations = operations==item.hmainid?-1:item.hmainid"> |
| | | <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="more" v-if="showDetail != item.hmainid && operations != item.hmainid"> |
| | | <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"> |
| | | <view class="part" @tap.stop="operations = operations==item.hmainid?-1:item.hmainid"> |
| | | <uni-icons type="more-filled" style="color: #888;margin-right: 10rpx;" |
| | | size="14"></uni-icons>操作 |
| | | </view> |
| | | </view> |
| | | |
| | | <view class="op" v-if="operations == index"> |
| | | <button class="op1" size="mini" plain @tap.stop="toSon(item)">子表信息</button> |
| | | <button class="op3" size="mini" plain @tap.stop="edit(item)">编辑</button> |
| | | <button class="op4" size="mini" plain @tap.stop="del(item)">删除</button> |
| | | <view class="op" v-if="operations == item.hmainid"> |
| | | <button class="op1" v-if="activeTab == 0" size="mini" plain @tap.stop="pushBill(0,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="tabs[activeTab].listData.length == 0">暂无数据</view> |
| | | </scroll-view> |
| | | |
| | | <!-- 分页器 --> |
| | | <view class="page-footer"> |
| | | <uni-pagination id="pagination" title="标题文字" v-model="pageMeta.curPage" :pageSize="pageMeta.size" |
| | | :total="pageMeta.total" @change="onPageChangeHandler"></uni-pagination> |
| | | <uni-pagination id="pagination" title="标题文字" v-model="tabs[activeTab].pageMeta.curPage" |
| | | :pageSize="tabs[activeTab].pageMeta.size" :total="tabs[activeTab].pageMeta.total" |
| | | @change="onPageChangeHandler"></uni-pagination> |
| | | </view> |
| | | </view> |
| | | </template> |
| | |
| | | // 计算卡片列表高度 |
| | | pagination_top: 0, |
| | | pageContent_top: 0, |
| | | // 分页控制 |
| | | pageMeta: { |
| | | curPage: 1, |
| | | size: 50, |
| | | total: 0, |
| | | }, |
| | | |
| | | // 当前激活的页签 |
| | | activeTab: 0, |
| | | |
| | | tabs: [{ |
| | | label: '近日待保养', |
| | | type: 0, |
| | | count: 0, |
| | | listData: [], // 添加这个 |
| | | pageMeta: { // 添加这个 |
| | | curPage: 1, |
| | | size: 50, |
| | | total: 0, |
| | | } |
| | | }, |
| | | { |
| | | label: '近日已保养', |
| | | type: 1, |
| | | count: 0, |
| | | listData: [], // 添加这个 |
| | | pageMeta: { // 添加这个 |
| | | curPage: 1, |
| | | size: 50, |
| | | total: 0, |
| | | } |
| | | }, |
| | | { |
| | | label: '近日全部任务', |
| | | type: 2, |
| | | count: 0, |
| | | listData: [], // 添加这个 |
| | | pageMeta: { // 添加这个 |
| | | curPage: 1, |
| | | size: 50, |
| | | total: 0, |
| | | } |
| | | } |
| | | ], |
| | | |
| | | // 滚动控制 |
| | | scrollTop: 0, |
| | | old: { |
| | |
| | | dateRangePicker: ["任意间隔", "今天", "近两天", "近三天", "近四天", "近五天", "近六天", "近七天", "近30天"], |
| | | curDateGap: "近七天", |
| | | enableCustomDateRange: false, |
| | | startDate: dayjs(new Date()).subtract(7, 'day').format('YYYY-MM-DD'), |
| | | startDate: dayjs(new Date()).subtract(7, 'days').format('YYYY-MM-DD'), |
| | | endDate: dayjs(new Date()).format('YYYY-MM-DD'), |
| | | HBillNo: '', |
| | | |
| | | listData: [], |
| | | showDetail: -1, |
| | | operations: -1, |
| | | } |
| | |
| | | }) |
| | | .exec(); |
| | | // #endif |
| | | |
| | | }, |
| | | methods: { |
| | | pushBill(currTab, item) { |
| | | let Query = `?operationType=4&HBarCode=${item['设备代码']}` |
| | | if(currTab == 0) { |
| | | uni.navigateTo({ |
| | | url: '/pages/MJGL/Sb_EquipMaintainBill/Sb_EquipMaintainBill' + Query |
| | | }) |
| | | } |
| | | }, |
| | | goTop: function(e) { |
| | | // 解决view层不同步的问题 |
| | | this.scrollTop = this.old.scrollTop |
| | |
| | | this.scrollTop = 0 |
| | | }); |
| | | }, |
| | | |
| | | // 切换页签 |
| | | switchTab(index) { |
| | | this.activeTab = index |
| | | this.showDetail = -1 |
| | | this.operations = -1 |
| | | }, |
| | | |
| | | onDateRangePickerChangeHandler({ |
| | | detail |
| | | }) { |
| | |
| | | this.enableCustomDateRange = true |
| | | } |
| | | }, |
| | | |
| | | onSearchClickHandler() { |
| | | let sWhere = "" |
| | | if (this.startDate) { |
| | | sWhere += " and CONVERT(varchar(100),日期, 23) >= '" + this.startDate + "'"; |
| | | // 获取当前激活的页签 |
| | | const currentTab = this.tabs[this.activeTab] |
| | | sWhere = { |
| | | HBeginDate: this.startDate, |
| | | HEndDate: this.endDate |
| | | } |
| | | if (this.endDate) { |
| | | sWhere += " and CONVERT(varchar(100),日期, 23) <= '" + this.endDate + "'"; |
| | | } |
| | | if (this.HBillNo) { |
| | | sWhere += " and 单据号 like '%" + this.HBillNo + "%'"; |
| | | } |
| | | this.get_DisplayPage(sWhere); |
| | | this.get_DisplayPage(JSON.stringify(sWhere), currentTab.type) |
| | | }, |
| | | |
| | | clear() { |
| | | this.curDateGap = "近七天" |
| | | this.curDateGap = "近7天" |
| | | this.enableCustomDateRange = false |
| | | this.startDate = dayjs(new Date()).subtract(7, 'day').format('YYYY-MM-DD') |
| | | this.startDate = dayjs(new Date()).subtract(7, 'days').format('YYYY-MM-DD') |
| | | this.endDate = dayjs(new Date()).format('YYYY-MM-DD') |
| | | this.HBillNo = '' |
| | | }, |
| | | |
| | | async onResetClickHandler() { |
| | | this.clear() |
| | | await this.$nextTick() |
| | | this.onSearchClickHandler() |
| | | }, |
| | | get_DisplayPage(sWhere) { |
| | | |
| | | get_DisplayPage(sWhere, tabType) { |
| | | CommonUtils.doRequest2({ |
| | | url: '/Sc_MouldMaintainBill/GetMouldMaintainBillListPage', |
| | | url: '/Sb_EquipMaintainTaskReport/MaintainList_APP', |
| | | data: { |
| | | "sWhere": sWhere, |
| | | "user": getUserInfo()["Czymc"], |
| | | "page": this.pageMeta.curPage, |
| | | "size": this.pageMeta.size |
| | | }, |
| | | resFunction: (res) => { |
| | | let { |
| | |
| | | Message, |
| | | count |
| | | } = res.data |
| | | console.log('res.data: ', res.data); |
| | | this.listData = data; |
| | | this.pageMeta.total = count |
| | | console.log('res.data: ', res.data) |
| | | |
| | | if (data && data.h_p_Sb_EquipMaintainTaskReport_APP) { |
| | | // 更新待签到页签 |
| | | this.tabs[0].listData = data.h_p_Sb_EquipMaintainTaskReport_APP |
| | | this.tabs[0].pageMeta.total = data.h_p_Sb_EquipMaintainTaskReport_APP.length |
| | | this.tabs[0].count = data.h_p_Sb_EquipMaintainTaskReport_APP.length |
| | | } |
| | | |
| | | if (data && data.h_p_Sb_EquipMaintainTaskReport_APP1) { |
| | | // 更新待处理页签 |
| | | this.tabs[1].listData = data.h_p_Sb_EquipMaintainTaskReport_APP1 |
| | | this.tabs[1].pageMeta.total = data.h_p_Sb_EquipMaintainTaskReport_APP1.length |
| | | this.tabs[1].count = data.h_p_Sb_EquipMaintainTaskReport_APP1.length |
| | | } |
| | | |
| | | if (data && data.h_p_Sb_EquipMaintainTaskReport_APP2) { |
| | | // 更新待验收页签 |
| | | this.tabs[2].listData = data.h_p_Sb_EquipMaintainTaskReport_APP2 |
| | | this.tabs[2].pageMeta.total = data.h_p_Sb_EquipMaintainTaskReport_APP2.length |
| | | this.tabs[2].count = data.h_p_Sb_EquipMaintainTaskReport_APP2.length |
| | | } |
| | | |
| | | |
| | | uni.stopPullDownRefresh() |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | onPageChangeHandler() { |
| | | this.onSearchClickHandler() |
| | | this.goTop() |
| | | }, |
| | | // 新增模具保养记录单 |
| | | onAddClickHandler() { |
| | | uni.navigateTo({ |
| | | url: "/pages/MJGL/mujubaoyangjiludan/form" |
| | | }) |
| | | }, |
| | | //编辑保养记录单 |
| | | edit(item) { |
| | | console.log(item) |
| | | uni.navigateTo({ |
| | | url: '/pages/MJGL/mujubaoyangjiludan/form?hmainid=' + item.hmainid |
| | | }) |
| | | }, |
| | | //删除保养记录单 |
| | | del(item) { |
| | | uni.showModal({ |
| | | title: '删除确认', |
| | | content: '确认要删除吗,删除后不能恢复', |
| | | success: (res) => { |
| | | if (res.confirm) { |
| | | console.log('用户点击确定'); |
| | | CommonUtils.doRequest2({ |
| | | url: '/Sc_MouldMaintainBill/DeltetSc_MouldMaintainBill', |
| | | data: { |
| | | HInterID: item['hmainid'], |
| | | user: getUserInfo()['Czymc'] |
| | | }, |
| | | resFunction: (res) => { |
| | | let { |
| | | data, |
| | | count, |
| | | Message |
| | | } = res.data |
| | | if (count == 1) { |
| | | uni.showToast({ |
| | | icon: count === 1 ? 'success' : 'error', |
| | | title: Message, |
| | | duration: 2000 |
| | | }); |
| | | |
| | | // 等待提示显示完成再刷新 |
| | | setTimeout(() => { |
| | | this.onSearchClickHandler(); |
| | | }, 2000); |
| | | } else { |
| | | uni.showToast({ |
| | | icon: 'none', |
| | | title: Message |
| | | }) |
| | | } |
| | | } |
| | | }) |
| | | } else if (res.cancel) { |
| | | console.log('用户点击取消'); |
| | | } |
| | | } |
| | | }); |
| | | }, |
| | | //子表查看 |
| | | toSon(item) { |
| | | uni.navigateTo({ |
| | | url: '/pages/MJGL/mujubaoyangjiludan/mouldMaintainRecordBillList_son?HInterID=' + item.hmainid + '&产品模具=' + item |
| | | .产品模具 + '&产品模具代码=' + item.产品模具代码, |
| | | }); |
| | | } |
| | | }, |
| | | } |
| | | </script> |
| | |
| | | } |
| | | } |
| | | |
| | | /* 页签样式 */ |
| | | .tab-container { |
| | | background-color: #fff; |
| | | } |
| | | |
| | | .tab-list { |
| | | display: flex; |
| | | flex-direction: row; |
| | | border-bottom: 1px solid #e5e5e5; |
| | | } |
| | | |
| | | .tab-item { |
| | | flex: 1; |
| | | padding: 20rpx 0; |
| | | text-align: center; |
| | | font-size: 28rpx; |
| | | color: #666; |
| | | position: relative; |
| | | |
| | | &.active { |
| | | color: #3a78ff; |
| | | font-weight: bold; |
| | | |
| | | &::after { |
| | | content: ''; |
| | | position: absolute; |
| | | bottom: 0; |
| | | left: 50%; |
| | | transform: translateX(-50%); |
| | | width: 80rpx; |
| | | height: 4rpx; |
| | | background-color: #3a78ff; |
| | | } |
| | | } |
| | | |
| | | .tab-count { |
| | | display: inline-block; |
| | | margin-left: 10rpx; |
| | | padding: 0 12rpx; |
| | | background-color: #ff6b6b; |
| | | color: #fff; |
| | | border-radius: 20rpx; |
| | | font-size: 20rpx; |
| | | min-width: 30rpx; |
| | | text-align: center; |
| | | } |
| | | } |
| | | |
| | | .page-content { |
| | | // height: 40vh; |
| | | box-sizing: border-box; |
| | | padding: 10rpx 0; |
| | | |
| | |
| | | line-height: 120%; |
| | | |
| | | .detail { |
| | | // width: 50%; |
| | | font-size: 26rpx; |
| | | margin-bottom: 12rpx; |
| | | color: #555; |
| | |
| | | padding: 0; |
| | | width: 150rpx; |
| | | font-size: 25rpx; |
| | | |
| | | &:disabled { |
| | | opacity: 0.5; |
| | | } |
| | | } |
| | | |
| | | .op1 { |
| | |
| | | } |
| | | } |
| | | |
| | | .over { |
| | | text-align: center; |
| | | padding: 40rpx; |
| | | color: #999; |
| | | font-size: 28rpx; |
| | | } |
| | | |
| | | .page-footer { |
| | | position: fixed; |
| | | bottom: 0; |