<template>
|
<view>
|
<view class="page-header">
|
<view class="search-item">
|
<view class="left">日期间隔</view>
|
<view class="right">
|
<picker mode="selector" :value="curDateGap" :range="dateRangePicker"
|
@change="onDateRangePickerChangeHandler">
|
<input disabled v-model="curDateGap" placeholder="请选择日期间隔" />
|
<view class="picker-overlay"></view>
|
</picker>
|
|
</view>
|
</view>
|
<view class="search-item">
|
<view class="left">开始日期</view>
|
<view class="right">
|
<uni-datetime-picker :clear-icon="false" type="date" v-model="startDate"
|
:disabled="!enableCustomDateRange">
|
<view class="datetime-picker-inner"
|
:class="enableCustomDateRange?'font__enable':'font__disable'">
|
<text>{{ startDate }}</text>
|
</view>
|
</uni-datetime-picker>
|
</view>
|
</view>
|
<view class="search-item">
|
<view class="left">结束日期</view>
|
<view class="right">
|
<uni-datetime-picker :clear-icon="false" type="date" v-model="endDate"
|
:disabled="!enableCustomDateRange">
|
<view class="datetime-picker-inner"
|
:class="enableCustomDateRange?'font__enable':'font__disable'">{{ endDate }}</view>
|
</uni-datetime-picker>
|
</view>
|
</view>
|
|
<view class="button-groups">
|
<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="tabs" id="tabs">
|
<view :class="tabs == 0 ? 'on':''" @tap="switchTab(0)">未读消息</view>
|
<view :class="tabs == 1 ? 'on':''" @tap="switchTab(1)">我接收的</view>
|
<view :class="tabs == 2 ? 'on':''" @tap="switchTab(2)">我发送的</view>
|
<view :class="tabs == 3 ? 'on':''" @tap="switchTab(3)">抄送我的</view>
|
</view>
|
|
<!-- 工作联系单 列表 -->
|
<view class="list" v-for="(item,index) in BillsDisplay" :key="index">
|
<uni-card :title="item.制单日期.substr(0,10)" :extra="item.单据号" style="margin: 10px;"
|
@tap="showDetail = showDetail==index?-1:index">
|
<view class="card-detail">
|
<template v-for="(HBillField, index) in CommonUtils.emptyValueFilter(item,HFieldList).slice(0,10)">
|
<view class="detail" v-if="HBillField.ColmType == 'DateTime'">
|
<text>{{ HBillField.ColmCols }}:</text>{{ item[HBillField.ColmCols] ? dayjs(item[HBillField.ColmCols]).format("YYYY-MM-DD HH:mm:ss") : "" }}
|
</view>
|
<view class="detail" v-else>
|
<text>{{ HBillField.ColmCols }}:</text>{{ item[HBillField.ColmCols] }}
|
</view>
|
</template>
|
</view>
|
<view class="card-detail" v-if="showDetail == index">
|
<view class="card-detail">
|
<template
|
v-for="(HBillField, index) in CommonUtils.emptyValueFilter(item,HFieldList).slice(10,-1)">
|
<view class="detail" v-if="HBillField.ColmType == 'DateTime'">
|
<text>{{ HBillField.ColmCols }}:</text>{{ item[HBillField.ColmCols] ? dayjs(item[HBillField.ColmCols]).format("YYYY-MM-DD HH:mm:ss") : "" }}
|
</view>
|
<view class="detail" v-else>
|
<text>{{ HBillField.ColmCols }}:</text>{{ item[HBillField.ColmCols] }}
|
</view>
|
</template>
|
|
</view>
|
</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="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="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="op" v-if="operations == index">
|
<!-- <button class="op3" size="mini" plain @tap.stop="edit(item)">编辑</button> -->
|
<!-- <button class="op4" size="mini" plain @tap.stop="del(item)">删除</button> -->
|
<button class="op3" size="mini" plain @tap.stop="displayDetail(item)">查看详情</button>
|
<button class="op1" size="mini" plain @tap.stop="reply(item)">回复</button>
|
<button class="op5" size="mini" plain @tap.stop="operations = -1">取消操作</button>
|
</view>
|
</uni-card>
|
</view>
|
<view class="over" v-if="BillsDisplay.length == 0">暂无数据</view>
|
</view>
|
</template>
|
|
<script>
|
import {
|
getUserInfo
|
} from '../../../utils/auth';
|
import {
|
CommonUtils
|
} from '../../../utils/common';
|
import dayjs from 'dayjs';
|
export default {
|
// 工作联系单查询 模块
|
name: 'OA_WorkLinkBillQuery',
|
data() {
|
return {
|
dateRangePicker: ["任意间隔", "今天", "近两天", "近三天", "近四天", "近五天", "近六天", "近七天", "近30天"],
|
curDateGap: "近七天",
|
enableCustomDateRange: false,
|
startDate: dayjs(new Date()).subtract(7, 'day').format('YYYY-MM-DD'),
|
endDate: dayjs(new Date()).format('YYYY-MM-DD'),
|
|
dayjs,
|
CommonUtils,
|
tabs: 0,
|
BillsDisplay: [],
|
HFieldList: [], // 字段列表
|
sWhere: "",
|
showDetail: -1,
|
operations: -1,
|
};
|
},
|
methods: {
|
onDateRangePickerChangeHandler({
|
detail
|
}) {
|
this.enableCustomDateRange = false
|
this.curDateGap = this.dateRangePicker[detail.value]
|
let date = new Date()
|
switch (this.curDateGap) {
|
case "今天":
|
this.startDate = dayjs(date).format("YYYY-MM-DD")
|
break;
|
case "近一天":
|
this.startDate = dayjs(date).subtract(1, 'day').format("YYYY-MM-DD")
|
break;
|
case "近两天":
|
this.startDate = dayjs(date).subtract(2, 'day').format("YYYY-MM-DD")
|
break;
|
case "近三天":
|
this.startDate = dayjs(date).subtract(3, 'day').format("YYYY-MM-DD")
|
break;
|
case "近四天":
|
this.startDate = dayjs(date).subtract(4, 'day').format("YYYY-MM-DD")
|
break;
|
case "近五天":
|
this.startDate = dayjs(date).subtract(5, 'day').format("YYYY-MM-DD")
|
break;
|
case "近六天":
|
this.startDate = dayjs(date).subtract(6, 'day').format("YYYY-MM-DD")
|
break;
|
case "近七天":
|
this.startDate = dayjs(date).subtract(7, 'day').format("YYYY-MM-DD")
|
break;
|
case "近30天":
|
this.startDate = dayjs(date).subtract(30, 'day').format("YYYY-MM-DD")
|
break;
|
}
|
if (this.curDateGap == '任意间隔') {
|
this.enableCustomDateRange = true
|
}
|
},
|
onSearchClickHandler() {
|
this.getWorkLinkList()
|
},
|
onResetClickHandler() {
|
this.dateRangePicker = ["任意间隔", "今天", "近两天", "近三天", "近四天", "近五天", "近六天", "近七天", "近30天"],
|
this.curDateGap = "近七天",
|
this.enableCustomDateRange = false,
|
this.startDate = dayjs(new Date()).subtract(7, 'day').format('YYYY-MM-DD'),
|
this.endDate = dayjs(new Date()).format('YYYY-MM-DD'),
|
this.getWorkLinkList()
|
},
|
switchTab(tabIndex) {
|
this.tabs = tabIndex
|
switch (tabIndex) {
|
case 0:
|
this.sWhere =
|
` and (接收人 = '${getUserInfo()['HEmpName']}' or 抄送接收人 = '${getUserInfo()['HEmpName']}') and 阅读状态 = '未阅'`
|
break;
|
case 1:
|
this.sWhere = ` and 接收人 = '${getUserInfo()['HEmpName']}'`
|
break;
|
case 2:
|
this.sWhere = ` and 发送人 = '${getUserInfo()['HEmpName']}'`
|
break;
|
case 3:
|
this.sWhere = ` and 抄送接收人 = '${getUserInfo()['HEmpName']}'`
|
break;
|
default:
|
this.sWhere = ` and 接收人 = '${getUserInfo()['HEmpName']}'`
|
}
|
this.getWorkLinkList()
|
},
|
async getWorkLinkList() {
|
try {
|
this.sWhere += ` and 日期 >= CONVERT(VARCHAR(10), '${this.startDate}', 23) and 日期 <= CONVERT(VARCHAR(10), '${this.endDate}', 23)`
|
|
let res = await CommonUtils.doRequest2Async({
|
url: 'Sc_MESTransFerWorkBill/GetOA_WorkLinkBillList',
|
data: {
|
sWhere: this.sWhere,
|
user: getUserInfo()["Czymc"]
|
}
|
})
|
|
let {
|
count,
|
data,
|
Message,
|
list
|
} = res.data
|
if (count == 1) {
|
console.log('data: ', data);
|
|
this.BillsDisplay = data
|
|
|
let fieldList = CommonUtils.fieldListFilterRole({
|
ExcludeKeys: ['日期', '单据号'],
|
FieldList: list
|
})
|
|
if (fieldList.status == false) {
|
CommonUtils.showTips({
|
title: '温馨提示',
|
message: `获取表单结构失败: ${fieldList.Message}`
|
})
|
}
|
|
this.HFieldList = fieldList.data
|
} else {
|
CommonUtils.showTips({
|
title: '温馨提示',
|
message: `获取维修单异常: ${Message}`
|
})
|
}
|
|
} catch (err) {
|
CommonUtils.showTips({
|
title: '温馨提示',
|
message: `获取维修单异常: ${err}`
|
})
|
}
|
},
|
displayDetail(item) {
|
console.log('item: ', item);
|
uni.showModal({
|
title: `${item["主题"]}`,
|
content: `${item["内容"]}`,
|
showCancel: false,
|
success: async (res) => {
|
if (res.confirm) {
|
console.log('用户点击确定');
|
// 发送 该单据 已阅请求到后端
|
this.updateWorkLink(item.hmainid, item.HEntryID)
|
}
|
}
|
})
|
},
|
async updateWorkLink(HInterID, HEntryID) {
|
try {
|
let res = await CommonUtils.doRequest2Async({
|
url: "/Sc_MESTransFerWorkBill/UpdateOA_WorkLinkBillFlagMessage",
|
data: {
|
HInterID,
|
HEntryID
|
}
|
})
|
|
let {
|
count,
|
Message
|
} = res.data
|
if (count == 1) {
|
this.switchTab(this.tabs)
|
} else {
|
CommonUtils.showTips({
|
title: '温馨提示',
|
message: `更新工作联系单失败: ${Message}`
|
})
|
}
|
} catch (err) {
|
CommonUtils.showTips({
|
title: '温馨提示',
|
message: `更新工作联系单失败: ${err}`
|
})
|
}
|
},
|
reply(item) {
|
uni.navigateTo({
|
url: `/pages/ZLGL/OA_WorkLink/OA_WorkLinkBill?HInterID=${item.hmainid}` +
|
`&HEntryID=${item.HEntryID}&operationType=5`
|
})
|
}
|
},
|
onShow() {
|
this.switchTab(0)
|
}
|
}
|
</script>
|
|
<style lang="scss">
|
@import "@/pages/MJGL/style/MJBillStyle.scss";
|
|
.more {
|
color: #888;
|
font-size: 26rpx;
|
display: flex;
|
border-top: 1px solid #eee;
|
padding-top: 20rpx;
|
|
.part {
|
width: 50%;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
}
|
}
|
|
.op {
|
display: flex;
|
justify-content: space-around;
|
margin-top: 20rpx;
|
|
button {
|
padding: 0;
|
width: 150rpx;
|
font-size: 25rpx;
|
}
|
|
.op1 {
|
border: 1px solid #41a863;
|
color: #41a863;
|
}
|
|
.op2 {
|
border: 1px solid #d98d00;
|
color: #d98d00;
|
}
|
|
.op3 {
|
border: 1px solid #3a78ff;
|
color: #3a78ff;
|
}
|
|
.op4 {
|
border: 1px solid #da0000;
|
color: #da0000;
|
}
|
|
.op5 {
|
border: 1px solid #888;
|
color: #888;
|
}
|
}
|
|
.page-header {
|
display: flex;
|
box-sizing: border-box;
|
padding: 20rpx;
|
flex-direction: column;
|
gap: 10rpx;
|
font-size: 32rpx;
|
|
.search-item {
|
display: flex;
|
flex-direction: row;
|
gap: 10rpx;
|
justify-content: center;
|
align-items: center;
|
|
.left {
|
width: 4em;
|
}
|
|
.right {
|
flex: 1;
|
position: relative;
|
border-radius: 22rpx;
|
border: 1px solid #acacac;
|
display: flex;
|
padding: 4rpx 10rpx;
|
|
picker {
|
width: 100%;
|
}
|
}
|
}
|
|
input {
|
width: inherit;
|
padding: 8rpx 20rpx;
|
font-size: 30rpx;
|
}
|
|
.datetime-picker-inner {
|
padding: 8rpx 20rpx;
|
font-size: 30rpx;
|
display: flex;
|
align-items: center;
|
}
|
|
.font__enable {
|
color: #000;
|
}
|
|
.font__disable {
|
color: #cccccc;
|
}
|
}
|
|
.button-groups {
|
box-sizing: border-box;
|
padding: 10rpx 0 0 0;
|
display: flex;
|
flex-direction: row;
|
gap: 10rpx;
|
justify-content: space-between;
|
|
button {
|
border-radius: 50rpx;
|
width: 180rpx;
|
height: 66rpx;
|
line-height: 66rpx;
|
font-size: 28rpx;
|
}
|
|
.btn-a {
|
background-color: #acacac;
|
color: #fff;
|
}
|
|
.btn-b {
|
background-color: #41a863;
|
color: #fff;
|
}
|
|
.btn-c {
|
background-color: #3a78ff;
|
color: #fff;
|
}
|
}
|
</style>
|