提交 2b90c182 authored 作者: 刘旭's avatar 刘旭

更新代码

上级 9c487a93
......@@ -4,20 +4,26 @@
"version" : "0.0",
"configurations" : [
{
"default" : {
"launchtype" : "local"
},
"mp-weixin" : {
"launchtype" : "local"
},
"type" : "uniCloud"
"app-plus" :
{
"launchtype" : "local"
},
"default" :
{
"launchtype" : "local"
},
"mp-weixin" :
{
"launchtype" : "local"
},
"type" : "uniCloud"
},
{
"openVueDevtools" : true,
"type" : "uni-app:h5"
},
{
"playground" : "custom",
"playground" : "standard",
"type" : "uni-app:app-android"
}
]
......
<template>
<view v-if="isShow">
<view @tap.stop.prevent @touchmove.stop.prevent class="wyb-popup-box" :style="{
<view class="wyb-popup-box" :style="{
transitionDuration: duration + 'ms',
opacity: contentOpacity || (type === 'center' ? 0 : 1),
transform: contentTransform || autoTransform,
......@@ -44,7 +44,7 @@
</view>
</scroll-view>
</view>
<view class="wyb-popup-mask" @tap.stop="close" @touchmove.stop.prevent :style="{
<view class="wyb-popup-mask" @tap.stop="close" :style="{
opacity: maskOpacity,
transitionDuration: duration + 'ms',
backgroundColor: 'rgba(0, 0, 0, ' + maskAlpha + ')',
......
// export const ApiUrl: string = 'http://192.168.1.37/ndr'
export const ApiUrl: string = 'http://192.168.1.37/k3Cloud'
// export const ApiUrl: string = '/ndr'
// export const ApiUrl: string = 'http://192.168.1.37/k3Cloud'
// export const ApiUrl = 'http://192.168.0.242:89/k3Cloud'
// export const ApiUrl = 'http://k3.newdegreetech.com:89/k3cloud'
\ No newline at end of file
export const ApiUrl = 'http://k3.newdegreetech.com:89/k3cloud'
<template>
<div class='edit-container'>
<formList ref="formListRef" :select-list="selectList" />
<formList ref="formListRef" :select-list="selectList" @initSelect="initSelect"/>
<view class="button">
<button size="mini" @tap="onSave">保存</button>
</view>
......@@ -33,35 +33,25 @@ onLoad((options: any) => {
})
const initSelect = () => {
const initSelect = (FName?: string) => {
uni.showLoading({
title: '加载中',
mask: true
})
uni.request({
url: ApiUrl + '/LQKJ.K3.NDR.WebApiBusinessServicePlugIn.WebApi.ExecuteCmdSelect,LQKJ.K3.NDR.WebApiBusinessServicePlugIn.common.kdsvc',
method: 'GET',
success(res: any) {
uni.hideLoading()
const { data } = res
if (data.code == 200) {
data.data.map((item: any) => {
selectList.value.push({
text: item.fname,
value: item.fnumber
})
})
} else {
uni.showToast({
title: data.msg,
icon: 'none'
})
}
method: 'POST',
data: { FName },
success({ data: res }: any) {
uni.hideLoading()
if (res.code == 200) {
selectList.value = res.data
}
},
fail() {
uni.hideLoading()
uni.showToast({
title: '请在内网使用',
title: '请求失败',
icon: 'none'
})
}
......@@ -125,7 +115,7 @@ const onSave = () => {
fail() {
uni.hideLoading()
uni.showToast({
title: '请在内网使用',
title: '请求失败',
icon: 'none'
})
}
......
<template>
<view class="item-container">
<view class="form-title">{{ placeholder }}</view>
<view class="line" />
<uni-forms ref="formRef" :modelValue="formData" :rules="rules" label-width="10">
<view style="width: 100%; display: flex; justify-content: center; align-items: center;">
<uni-forms-item name="number" @tap="handleClick">
<uni-easyinput type="text" v-model="formData.number" placeholder="项目编号" :inputBorder="false"
:clearable="false" disabled placeholderStyle="color: rgba(0, 0, 0, 0.9); font-size: 28rpx;" />
</uni-forms-item>
<uni-icons v-show="formData.number" type="clear" size="22" color="#ccc" @tap="clear" />
</view>
<view class="line" />
<uni-forms-item name="Hours">
<uni-easyinput type="number" v-model="formData.Hours" placeholder="工时数" :inputBorder="false"
:clearable="false" placeholderStyle="color: rgba(0, 0, 0, 0.9); font-size: 28rpx" />
<view class="line" />
</uni-forms-item>
<view class="line" />
<uni-forms-item name="workContent">
<uni-easyinput type="textarea" maxlength="-1" v-model="formData.workContent" placeholder="工作内容"
:inputBorder="false" :clearable="false"
placeholderStyle="color: rgba(0, 0, 0, 0.9); font-size: 28rpx" />
<view class="line" />
</uni-forms-item>
</uni-forms>
</view>
<popup ref="popupRef" v-model="formData.number" :selectList="selectList" @input-value="inputValue" />
<view class="item-container">
<view class="form-title">{{ placeholder }}</view>
<view class="line" />
<uni-forms
ref="formRef"
:modelValue="formData"
:rules="rules"
label-width="10"
>
<view
style="
width: 100%;
display: flex;
justify-content: center;
align-items: center;
"
>
<uni-forms-item name="number">
<div @tap="handleClick">
<uni-easyinput
type="text"
v-model="formData.number"
placeholder="项目编号"
:inputBorder="false"
:clearable="false"
disabled
placeholderStyle="color: rgba(0, 0, 0, 0.9); font-size: 28rpx;"
style="pointer-events: none"
/>
</div>
</uni-forms-item>
<uni-icons
v-show="formData.number"
type="clear"
size="22"
color="#ccc"
@tap="clear"
/>
</view>
<view class="line" />
<uni-forms-item name="Hours">
<uni-easyinput
type="number"
v-model="formData.Hours"
placeholder="工时数"
:inputBorder="false"
:clearable="false"
placeholderStyle="color: rgba(0, 0, 0, 0.9); font-size: 28rpx"
/>
<view class="line" />
</uni-forms-item>
<view class="line" />
<uni-forms-item name="workContent">
<uni-easyinput
type="textarea"
maxlength="-1"
v-model="formData.workContent"
placeholder="工作内容"
:inputBorder="false"
:clearable="false"
placeholderStyle="color: rgba(0, 0, 0, 0.9); font-size: 28rpx"
/>
<view class="line" />
</uni-forms-item>
</uni-forms>
</view>
<popup
ref="popupRef"
v-model="formData.number"
:selectList="selectList"
@input-value="inputValue"
/>
</template>
<script setup lang='ts'>
import { nextTick, ref } from 'vue'
import { ApiUrl } from '@/config';
import popup from './popup.vue';
defineProps({
placeholder: {
type: String
},
selectList: {
type: Array,
default: []
}
})
const emits = defineEmits(['initSelect'])
const formData = ref({
number: '',
Hours: '',
workContent: '',
})
const rules = ref({
number: {
rules: [{
required: true,
errorMessage: '请选择项目编号',
}]
<script setup lang="ts">
import { nextTick, ref } from 'vue'
import popup from './popup.vue'
defineProps({
placeholder: {
type: String,
},
selectList: {
type: Array,
default: [],
},
})
const emits = defineEmits(['initSelect'])
const formData = ref({
number: '',
Hours: '',
workContent: '',
})
const rules = ref({
number: {
rules: [
{
required: true,
errorMessage: '请选择项目编号',
},
workContent: {
rules: [{
required: true,
errorMessage: '请选择工作内容',
}]
],
},
workContent: {
rules: [
{
required: true,
errorMessage: '请选择工作内容',
},
Hours: {
rules: [{
required: true,
errorMessage: '请输入工时数',
}]
],
},
Hours: {
rules: [
{
required: true,
errorMessage: '请输入工时数',
},
})
const formRef = ref()
const popupRef = ref()
const initRules = () => {
formRef.value?.setRules(rules.value)
}
const reset = () => {
formData.value = {
number: '',
Hours: '',
workContent: '',
}
}
const submit = () => {
let p = new Promise((resolve: any, reject: any) => {
formRef.value?.validate().then((res: any) => {
resolve(res)
}).catch((err: any) => {
reject(err)
})
],
},
})
const formRef = ref()
const popupRef = ref()
const initRules = () => {
formRef.value?.setRules(rules.value)
}
const reset = () => {
formData.value = {
number: '',
Hours: '',
workContent: '',
}
}
const submit = () => {
let p = new Promise((resolve: any, reject: any) => {
formRef.value
?.validate()
.then((res: any) => {
resolve(res)
})
return p
}
const handleClick = () => {
emits('initSelect')
popupRef.value.open()
const height = localStorage.getItem('windowHeight')
nextTick(() => popupRef.value.windowHeight = Number(height) * 0.8 * 0.9)
}
const clear = () => {
formData.value.number = ''
}
const inputValue = (value: string) => {
emits('initSelect', value)
}
defineExpose({
formData,
initRules,
submit,
reset
})
.catch((err: any) => {
reject(err)
})
})
return p
}
const handleClick = (event: any) => {
event.stopPropagation()
console.log('sss')
emits('initSelect')
popupRef.value.open()
const height = localStorage.getItem('windowHeight')
nextTick(() => (popupRef.value.windowHeight = Number(height) * 0.8 * 0.9))
}
const clear = () => {
formData.value.number = ''
}
const inputValue = (value: string) => emits('initSelect', value)
defineExpose({
formData,
initRules,
submit,
reset,
})
</script>
<style scoped>
.form-title {
padding: 14rpx 20rpx;
color: #ccc;
font-size: 24rpx;
}
.line {
border-bottom: 1px solid #ddd;
width: 100%;
transform: scaleY(0.5);
}
.item-container {
margin-bottom: 20rpx;
/* border: #ddd 1px solid;
.form-title {
padding: 14rpx 20rpx;
color: #ccc;
font-size: 24rpx;
}
.line {
border-bottom: 1px solid #ddd;
width: 100%;
transform: scaleY(0.5);
}
.item-container {
margin-bottom: 20rpx;
/* border: #ddd 1px solid;
padding: 10rpx;
border-radius: 10rpx;
padding-bottom: 20rpx; */
}
}
.item-container>>>.uni-select {
border: 0;
}
.item-container >>> .uni-select {
border: 0;
}
.item-container>>>.uni-select__input-placeholder {
color: rgba(0, 0, 0, 0.9);
font-size: 28rpx
}
.item-container >>> .uni-select__input-placeholder {
color: rgba(0, 0, 0, 0.9);
font-size: 28rpx;
}
.item-container>>>.is-direction-left {
width: 100%;
}
.item-container >>> .is-direction-left {
width: 100%;
}
.item-container>>>.uni-icons {
/* display: none; */
}
.item-container >>> .uni-icons {
/* display: none; */
}
/* .item-container>>>.uni-forms-item:last-child {
/* .item-container>>>.uni-forms-item:last-child {
margin-bottom: 10px;
} */
.item-container>>>.uni-forms-item {
margin-bottom: 0;
}
.item-container >>> .uni-forms-item {
margin-bottom: 0;
}
.item-container>>>.is-textarea {
padding: 0 20rpx;
}
.item-container >>> .is-textarea {
padding: 0 20rpx;
}
.item-container>>>.uni-forms-item__error {
display: none;
}
.item-container >>> .uni-forms-item__error {
display: none;
}
.item-container>>>.is-disabled {
background-color: #fff;
}
</style>
\ No newline at end of file
.item-container >>> .is-disabled {
background-color: #fff;
}
</style>
<template>
<wyb-popup ref="popupRef" type="bottom" height="800" width="500" radius="4" :showCloseIcon="true">
<view class="popup-content">
<uni-easyinput suffixIcon="search" v-model="inputValue" placeholder="项目编号" @iconClick="iconClick" />
<uni-easyinput suffixIcon="search" v-model="inputValue" placeholder="项目编号" @iconClick="inputChange"
@input="inputChange" @change="inputChange" />
<view style="margin-bottom: 20px; box-sizing: border-box; overflow-y: scroll;"
:style="{ 'height': windowHeight + 'px' }">
<!-- <scroll-view scroll-y="true" > -->
<!-- <scroll-view scroll-top="0" scroll-y="true"> -->
<uni-list v-if="selectList.length !== 0">
<uni-list-item v-for="(item, i) in selectList" :key="i" :title="item.fnumber"
<uni-list-item class="project-list" v-for="(item, i) in selectList" :key="i" :title="item.fnumber"
@click="handleList(item.fnumber)" clickable />
</uni-list>
<!-- </scroll-view> -->
<view v-else class="loading">暂无数据</view>
<!-- </scroll-view> -->
</view>
</view>
</wyb-popup>
......@@ -40,12 +41,15 @@ const handleList = (value: String) => {
popupRef.value?.hide()
}
const open = () => {
popupRef.value?.show()
}
const iconClick = () => {
emits('inputValue', inputValue.value)
const inputChange = () => {
setTimeout(() => {
emits('inputValue', inputValue.value)
}, 100)
}
defineExpose({
......@@ -62,6 +66,7 @@ defineExpose({
.uni-easyinput {
width: 90%;
margin-bottom: 20rpx;
}
:deep(.uni-scroll-view) {
......
<template>
<view class="container">
<view class="header">
<text class="title">登记项目工时</text>
<text class="subtitle" @click="selectDate">选择日期 {{ date }}</text>
<text class="title-description">
*每天工时总数应为8小时;每天最多登记3个项目的工时; 最早只能补录{{
<view class="container">
<view class="header">
<text class="title">登记项目工时</text>
<text class="subtitle" @click="selectDate">选择日期 {{ date }}</text>
<text class="title-description">
<!-- *每天工时总数应为8小时;每天最多登记3个项目的工时; 最早只能补录{{
status ? '当日之前' : '当月的'
}}工时数据。
</text>
<view style="display: flex; justify-content: center;">
<view style="width: 80%;">
<uni-easyinput disabled v-model="userName" :border="false"
placeholderStyle="color: rgba(0, 0, 0, 0.9); font-size: 28rpx" />
</view>
</view>
}}工时数据。 -->
工时每天填报需一次性提交满8小时;每天最多可填报3个项目;
快捷填写可自动填写上一次的填报记录。
</text>
<view style="display: flex; justify-content: center">
<view style="width: 80%">
<uni-easyinput
disabled
v-model="userName"
:border="false"
placeholderStyle="color: rgba(0, 0, 0, 0.9); font-size: 28rpx"
/>
</view>
</view>
</view>
<uni-collapse accordion style="margin-bottom: 50rpx;">
<uni-collapse-item title="填报工时" open>
<view class="content">
<!-- <view style="text-align: end;">
</view>
<uni-collapse accordion style="margin-bottom: 50rpx">
<uni-collapse-item title="填报工时" open>
<view class="content">
<!-- <view style="text-align: end;">
<text @tap="uploadFilling" style="margin-right: 20rpx;">导入</text>
<text @tap="quickFilling">快捷填写</text>
</view> -->
<form-list ref="formListRef" v-for="(item, index) in placeholderList" :key="index" @initSelect="initSelect"
:select-list="selectList" />
<view class="button">
<button size="mini" @tap="quickFilling">快捷填写</button>
<button size="mini" @tap="onSubmit">提交</button>
</view>
</view>
</uni-collapse-item>
<uni-collapse-item title="批量导入填报">
<uni-list>
<uni-list-item title="下载导入文件模板" clickable style="background-color: #fafafa;" />
<uni-list-item title="导入文件" clickable style="background-color: #fafafa;" @tap="uploadFilling" />
</uni-list>
</uni-collapse-item>
<uni-list>
<uni-list-item title="项目工时历史记录" clickable showArrow @tap="toQueryPage"></uni-list-item>
<uni-list-item title="退出登录" clickable showArrow @tap="toLogOut"></uni-list-item>
</uni-list>
<!-- <uni-collapse-item title="项目工时历史记录">
<form-list
ref="formListRef"
v-for="(item, index) in placeholderList"
:key="index"
@initSelect="initSelect"
:select-list="selectList"
/>
<view class="button">
<button size="mini" @tap="quickFilling">快捷填写</button>
<button size="mini" @tap="onSubmit">提交</button>
</view>
</view>
</uni-collapse-item>
<uni-collapse-item title="批量导入填报">
<uni-list>
<uni-list-item
title="下载导入文件模板"
clickable
style="background-color: #fafafa"
@tap="downDemo"
/>
<uni-list-item
title="导入文件"
clickable
style="background-color: #fafafa"
@tap="uploadFilling"
/>
</uni-list>
</uni-collapse-item>
<uni-list>
<uni-list-item
title="项目工时历史记录"
clickable
showArrow
@tap="toQueryPage"
></uni-list-item>
<uni-list-item
title="退出登录"
clickable
showArrow
@tap="toLogOut"
></uni-list-item>
</uni-list>
<!-- <uni-collapse-item title="项目工时历史记录">
<text>折叠内容</text>
</uni-collapse-item> -->
</uni-collapse>
<!-- <view class="queryRecords">
</uni-collapse>
<!-- <view class="queryRecords">
<text @tap="toQueryPage">项目工时历史记录</text>
<text @tap="toLogOut">退出登录</text>
</view> -->
<uni-calendar ref="calendarRef" :insert="false" :fillDate="fillDate" :selected="selected" @confirm="onConfirm"
@monthSwitch="monthSwitch" />
<uni-calendar
ref="calendarRef"
:insert="false"
:fillDate="fillDate"
:selected="selected"
@confirm="onConfirm"
@monthSwitch="monthSwitch"
/>
</template>
<script setup lang="ts">
import { nextTick, ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app';
import { ApiUrl } from '../../config/index'
import formList from './components/formList.vue';
import { nextTick, ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { ApiUrl } from '../../config/index'
import formList from './components/formList.vue'
const date: any = ref('')
const placeholderList: any = ref([
const date: any = ref('')
const placeholderList: any = ref([
{ placeholder: '项目1' },
{ placeholder: '项目2' },
{ placeholder: '项目3' }
])
{ placeholder: '项目3' },
])
const userName = ref()
const status = ref(0) // 开账状态, ture是打开 false是关闭
const userName = ref()
const status = ref(0) // 开账状态, ture是打开 false是关闭
const formListRef = ref()
const calendarRef = ref()
const selectList = ref([] as any[])
const submitData = ref([] as any[])
const selected = ref([] as any[])
const fillDate = ref([])
const formListRef = ref()
const calendarRef = ref()
const selectList = ref([] as any[])
const submitData = ref([] as any[])
const selected = ref([] as any[])
const fillDate = ref([])
const flag = ref(false) as any
const flag = ref(false) as any
const toQueryPage = () => {
const toQueryPage = () => {
uni.navigateTo({ url: '/pages/query/index' })
}
}
const toLogOut = () => {
const toLogOut = () => {
localStorage.clear()
uni.reLaunch({ url: '/pages/login/index' })
}
}
const monthSwitch = async (e: any) => {
const monthSwitch = async (e: any) => {
try {
uni.showLoading({
title: '加载中...',
mask: true
});
const { data: res }: any = await uni.request({
url: `https://www.mxnzp.com/api/holiday/list/month/${e}/?app_id=tkpjrhqiwehnvncm&app_secret=OW1ucWtka3hMdXdwUEhBSEQ1ckdBZz09`,
method: 'GET'
});
if (res.code === 1) {
selected.value = res.data.map((item: any) => {
if (item.typeDes !== '工作日') {
item.info = '假期';
} else {
if (fillDate.value) {
fillDate.value.forEach((fill: any) => {
if (fill.F_LQKJ_DATE2 == item.date) {
item.isFill = true;
}
});
}
item.info = item.typeDes;
uni.showLoading({
title: '加载中...',
mask: true,
})
await isFill(e)
const { data: res }: any = await uni.request({
// url: `https://www.mxnzp.com/api/holiday/list/month/${e}/?app_id=tkpjrhqiwehnvncm&app_secret=OW1ucWtka3hMdXdwUEhBSEQ1ckdBZz09`,
url:
ApiUrl +
'/LQKJ.K3.NDR.WebApiBusinessServicePlugIn.WebApi.SelectDateTime,LQKJ.K3.NDR.WebApiBusinessServicePlugIn.common.kdsvc',
method: 'POST',
data: { datetime: e },
})
if (res.code === 200) {
selected.value = res.data.map((item: any) => {
item.date = item.datetime
if (item.message !== '工作日') {
item.info = '假期'
} else {
if (fillDate.value) {
fillDate.value.forEach((fill: any) => {
if (fill.F_LQKJ_DATE2 == item.datetime) {
item.isFill = true
}
return item;
});
})
}
item.info = item.message
}
return item
})
await new Promise((resolve) => setTimeout(resolve, 300));
uni.hideLoading();
return selected.value;
} else {
uni.hideLoading();
return [];
}
await new Promise(resolve => setTimeout(resolve, 300))
uni.hideLoading()
return selected.value
} else {
uni.hideLoading()
return []
}
} catch (error) {
uni.hideLoading();
return [];
uni.hideLoading()
return []
}
};
}
const onConfirm = (e: any) => {
const onConfirm = (e: any) => {
const { month, year, fulldate, date: d } = e
let dateArr = date.value.split('-')
let newData = newDate().split('-')
if (Number(year) >= Number(newData[0])
&& Number(month) >= Number(newData[1])
&& Number(d) > Number(newData[2])) return uni.showToast({
title: '不能选当日后的日期',
icon: 'none',
})
if (Number(month) != Number(newData[1])) initStatus((year + '' + month))
if (
Number(year) >= Number(newData[0]) &&
Number(month) >= Number(newData[1]) &&
Number(d) > Number(newData[2])
)
return uni.showToast({
title: '不能选当日后的日期',
icon: 'none',
})
console.log(Number(month), Number(newData[1]))
if (Number(month) != Number(newData[1]) || Number(d) === Number(newData[2]))
initStatus(year + '' + month)
setTimeout(() => {
if (flag.value) return uni.showToast({
title: flag.value,
icon: 'none'
if (flag.value)
return uni.showToast({
title: flag.value,
icon: 'none',
})
if (!status.value) {
if (month == dateArr[1] && year == dateArr[0])
date.value = fulldate
else uni.showToast({
title: '只能设置当前月份日期',
icon: 'none'
})
} else date.value = fulldate
}, 100);
}
if (!status.value) {
if (month == dateArr[1] && year == dateArr[0]) date.value = fulldate
else
uni.showToast({
title: '只能设置当前月份日期',
icon: 'none',
})
} else date.value = fulldate
}, 100)
}
const newDate = () => {
const newDate = () => {
const d = new Date()
const y = d.getFullYear()
let m: number | string = d.getMonth() + 1
let da: number | string = d.getDate()
m = (m > 9) ? m : ("0" + m)
da = (da < 10) ? ("0" + da) : da
m = m > 9 ? m : '0' + m
da = da < 10 ? '0' + da : da
return y + '-' + m + '-' + da
}
}
const selectDate = () => {
const formattedDate = date.value.split("-").slice(0, 2).join(""); // 格式化后的日期
const selectDate = () => {
const formattedDate = date.value.split('-').slice(0, 2).join('') // 格式化后的日期
monthSwitch(formattedDate)
calendarRef.value?.open()
}
}
const isFill = () => {
const isFill = (date: string) => {
uni.showLoading({
title: '加载中...',
mask: true
title: '加载中...',
mask: true,
})
const formattedDate = date.value.split("-").slice(0, 2).join(""); // 格式化后的日期
uni.request({
url: ApiUrl + '/LQKJ.K3.NDR.WebApiBusinessServicePlugIn.WebApi.YearMonth,LQKJ.K3.NDR.WebApiBusinessServicePlugIn.common.kdsvc',
method: 'POST',
data: { YearMonth: formattedDate },
success({ data: res }: any) {
if (res.code === 200) {
uni.hideLoading()
fillDate.value = res.data
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
},
fail() {
uni.hideLoading()
uni.showToast({
title: '请求错误',
icon: 'none'
})
url:
ApiUrl +
'/LQKJ.K3.NDR.WebApiBusinessServicePlugIn.WebApi.YearMonth,LQKJ.K3.NDR.WebApiBusinessServicePlugIn.common.kdsvc',
method: 'POST',
data: { YearMonth: date, FNumber: uni.getStorageSync('ID') },
success({ data: res }: any) {
if (res.code === 200) {
uni.hideLoading()
fillDate.value = res.data
} else {
uni.showToast({
title: res.msg,
icon: 'none',
})
}
},
fail() {
uni.hideLoading()
uni.showToast({
title: '请求错误',
icon: 'none',
})
},
})
}
}
const quickFilling = () => {
const quickFilling = () => {
uni.showLoading({
title: '加载中',
mask: true
title: '加载中',
mask: true,
})
uni.request({
url: ApiUrl + '/LQKJ.K3.NDR.WebApiBusinessServicePlugIn.WebApi.FastWrite,LQKJ.K3.NDR.WebApiBusinessServicePlugIn.common.kdsvc',
method: 'POST',
data: {
Number: uni.getStorageSync('ID')
},
success({ data: res }: any) {
if (res.code === 200) {
uni.hideLoading()
formListRef.value?.map((item: any, index: number) => {
if (res.data.length > index) {
item.formData.Hours = res.data[index]?.F_LQKJ_WORKTIME
item.formData.workContent = res.data[index]?.F_LQKJ_WORKCONATAINER
item.formData.number = res.data[index]?.FNUMBER
}
})
url:
ApiUrl +
'/LQKJ.K3.NDR.WebApiBusinessServicePlugIn.WebApi.FastWrite,LQKJ.K3.NDR.WebApiBusinessServicePlugIn.common.kdsvc',
method: 'POST',
data: {
Number: uni.getStorageSync('ID'),
},
success({ data: res }: any) {
if (res.code === 200) {
uni.hideLoading()
formListRef.value?.map((item: any, index: number) => {
if (res.data.length > index) {
item.formData.Hours = res.data[index]?.F_LQKJ_WORKTIME
item.formData.workContent = res.data[index]?.F_LQKJ_WORKCONATAINER
item.formData.number = res.data[index]?.FNUMBER
}
})
}
},
})
}
const downDemo = () => {
uni.showModal({
title: '提示',
content: '确定下载模板?',
success: function (res) {
if (res.confirm) {
uni.showLoading({
title: '下载中...',
})
uni.request({
url:
ApiUrl +
'/LQKJ.K3.NDR.WebApiBusinessServicePlugIn.WebApi.DownLoad,LQKJ.K3.NDR.WebApiBusinessServicePlugIn.common.kdsvc',
success({ data: res }: any) {
if (res.code === 200) {
const fileName = res.data.split('/')[res.data.split('/').length - 1]
downloadLink(res.data, fileName, res.msg)
}
},
})
}
},
})
}
}
const uploadFilling = () => {
const uploadFilling = () => {
uni.chooseFile({
count: 1, //默认100
extension: ['.xlsx', '.xls'],
success(res) {
const { tempFilePaths, tempFiles }: any = res;
uploadExcel(tempFilePaths[0], tempFiles[0].name);
console.log();
}
});
}
count: 1, //默认100
extension: ['.xlsx', '.xls'],
success(res) {
const { tempFilePaths, tempFiles }: any = res
uploadExcel(tempFilePaths[0], tempFiles[0].name)
console.log()
},
})
}
const uploadExcel = (filePath: string, fileName: string) => {
const uploadExcel = (filePath: string, fileName: string) => {
uni.uploadFile({
url: ApiUrl + '/LQKJ.K3.NDR.WebApiBusinessServicePlugIn.WebApi.ImportFile,LQKJ.K3.NDR.WebApiBusinessServicePlugIn.common.kdsvc', // 替换为你的上传接口URL
filePath,
name: 'file',
formData: {
FNumber: '03'
},
success: (res: any) => {
let data = JSON.parse(res.data)
if (data.code === 200) {
uni.showToast({
title: '导入成功',
icon: 'none'
});
} else if (data.code === 501 || data.code === 502) {
downloadExcel(data.data, fileName)
} else {
uni.showToast({
title: res,
icon: 'none'
});
}
},
fail: (error) => {
console.error(error);
url:
ApiUrl +
'/LQKJ.K3.NDR.WebApiBusinessServicePlugIn.WebApi.ImportFile,LQKJ.K3.NDR.WebApiBusinessServicePlugIn.common.kdsvc', // 替换为你的上传接口URL
filePath,
name: 'file',
formData: {
FNumber: uni.getStorageSync('ID'),
},
success: (res: any) => {
const match = res.data.match(/"_httpCode":(\d+)/)
if (match && parseInt(match[1]) === 500)
return uni.showToast({
title: '导入失败',
icon: 'none',
})
let data = JSON.parse(res.data)
if (data.code === 200) {
uni.showToast({
title: data.msg,
icon: 'none',
})
} else if (data.code === 501) {
downloadExcel(data.data, fileName, data.msg)
} else {
uni.showToast({
title: data.msg,
icon: 'none',
})
}
});
}
},
fail: error => {
console.error(error)
},
})
}
const downloadExcel = (url: string, fileName: string) => {
const downloadExcel = (url: string, fileName: string, msg: string) => {
uni.showLoading({
title: '下载中...'
});
title: '下载中...',
})
uni.downloadFile({
url,
success: (res) => {
if (res.statusCode === 200) {
downloadLink(res.tempFilePath, fileName)
// uni.saveFile({
// tempFilePath: res.tempFilePath,
// success: (saveRes) => {
// uni.hideLoading();
// uni.showToast({
// title: '下载成功'
// });
// console.log('文件保存路径:', saveRes.savedFilePath);
// },
// fail: (error) => {
// uni.hideLoading();
// uni.showToast({
// title: '保存失败',
// icon: 'none'
// });
// console.error('文件保存失败:', error);
// }
// });
} else {
uni.hideLoading();
uni.showToast({
title: '下载失败',
icon: 'none'
});
console.error('文件下载失败:', res);
}
},
fail: (error) => {
uni.hideLoading();
uni.showToast({
title: '下载失败',
icon: 'none'
});
console.error('文件下载失败:', error);
url,
success: res => {
if (res.statusCode === 200) {
downloadLink(res.tempFilePath, fileName, msg)
// uni.saveFile({
// tempFilePath: res.tempFilePath,
// success: (saveRes) => {
// uni.hideLoading();
// uni.showToast({
// title: '下载成功'
// });
// console.log('文件保存路径:', saveRes.savedFilePath);
// },
// fail: (error) => {
// uni.hideLoading();
// uni.showToast({
// title: '保存失败',
// icon: 'none'
// });
// console.error('文件保存失败:', error);
// }
// });
} else {
uni.hideLoading()
uni.showToast({
title: '下载失败',
icon: 'none',
})
}
});
}
const downloadLink = (tempFilePath: string, fileName: string) => {
const a = document.createElement('a');
a.href = tempFilePath;
a.download = fileName;
a.style.display = 'none';
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
uni.hideLoading();
},
fail: error => {
uni.hideLoading()
uni.showToast({
title: '下载失败',
icon: 'none',
})
},
})
}
const downloadLink = (
tempFilePath: string,
fileName: string,
msg?: string
) => {
const a = document.createElement('a')
a.href = tempFilePath
a.download = fileName
a.style.display = 'none'
document.body.appendChild(a)
a.click()
document.body.removeChild(a)
uni.hideLoading()
uni.showToast({
title: '下载成功'
});
}
title: msg,
icon: 'none',
})
}
const onSubmit = () => {
const onSubmit = () => {
submitData.value = []
let Holiday = ''
const formattedDate = date.value.split("-").slice(0, 2).join(""); // 格式化后的日期
const formattedDate = date.value.split('-').slice(0, 2).join('') // 格式化后的日期
monthSwitch(formattedDate).then((res: any) => {
Holiday = res.filter((item: any) => item.date === date.value)[0].typeDes
formListRef.value?.map((item: any) => {
let obj = {
F_LQKJ_FITEM: {
FNumber: ""//项目编号
},
F_LQKJ_WORKCONATAINER: '', // 工作内容
F_LQKJ_WORKTIME: 0,//工时
F_LQKJ_Date2: "",//工时发生日期
Holiday: '',
F_LQKJ_FNAME: {
FName: "" as string | null
}
}
item.submit().then((res: any) => {
obj.F_LQKJ_WORKTIME = res.Hours
obj.F_LQKJ_FITEM.FNumber = res.number
obj.F_LQKJ_WORKCONATAINER = res.workContent
obj.F_LQKJ_Date2 = date.value
obj.Holiday = Holiday
obj.F_LQKJ_FNAME.FName = localStorage.getItem('Name')
submitData.value.push(obj)
})
Holiday = res.filter((item: any) => item.date === date.value)[0].message
formListRef.value?.map((item: any) => {
let obj = {
F_LQKJ_FITEM: {
FNumber: '', //项目编号
},
F_LQKJ_WORKCONATAINER: '', // 工作内容
F_LQKJ_WORKTIME: 0, //工时
F_LQKJ_Date2: '', //工时发生日期
Holiday: '',
F_LQKJ_FNAME: {
FName: '' as string | null,
},
}
item.submit().then((res: any) => {
obj.F_LQKJ_WORKTIME = res.Hours
obj.F_LQKJ_FITEM.FNumber = res.number
obj.F_LQKJ_WORKCONATAINER = res.workContent
obj.F_LQKJ_Date2 = date.value
obj.Holiday = Holiday
obj.F_LQKJ_FNAME.FName = localStorage.getItem('Name')
submitData.value.push(obj)
})
setTimeout(() => {
if (submitData.value.length === 0) return uni.showToast({
title: '请填写项目内容',
icon: 'none'
})
setTimeout(() => {
if (submitData.value.length === 0)
return uni.showToast({
title: '请填写项目内容',
icon: 'none',
})
let flag = true
formListRef.value?.map((item: any, i: number) => {
if (item.formData.number && !item.formData.Hours) {
flag = false
uni.showToast({
title: '请填写项目' + (i + 1) + '的工时数',
icon: 'none',
})
let flag = true
formListRef.value?.map((item: any, i: number) => {
if (item.formData.number && !item.formData.Hours) {
flag = false
}
if (item.formData.Hours <= 0 && item.formData.Hours) {
flag = false
uni.showToast({
title: '填写项目工时数需大于0',
icon: 'none',
})
}
})
let num = 0
submitData.value.map((item: any) => {
num += Number(item.F_LQKJ_WORKTIME)
})
if (num != 8)
return uni.showToast({
title: '提交总工时数需为8小时',
icon: 'none',
})
if (!flag) return
uni.showModal({
title: '提交',
content: '确认提交?',
success: function (res) {
if (res.confirm) {
uni.showLoading({
title: '提交中...',
mask: true,
})
uni.request({
url:
ApiUrl +
'/LQKJ.K3.NDR.WebApiBusinessServicePlugIn.WebApi.ExecuteCmdAdd,LQKJ.K3.NDR.WebApiBusinessServicePlugIn.common.kdsvc',
method: 'POST',
data: {
parmeters: {
Model: submitData.value,
},
},
success({ data: res }: any) {
uni.hideLoading()
if (res.code === 200) {
const time = 8 - Number(res.data[0].f_lqkj_worktime)
const title = time
? '今日已填写' +
res.data[0].f_lqkj_worktime +
'小时,还需要填写' +
time +
'小时工时登记!'
: '今日工时已填满!'
uni.showToast({
title: '请填写项目' + (i + 1) + '的工时数',
icon: 'none'
title,
icon: 'none',
success() {
formListRef.value?.map((item: any) => item.reset())
},
})
}
if (item.formData.Hours <= 0 && item.formData.Hours) {
flag = false
} else {
uni.showToast({
title: '填写项目工时数需大于0',
icon: 'none'
title: res.msg,
icon: 'none',
})
}
})
let num = 0
submitData.value.map((item: any) => {
num += Number(item.F_LQKJ_WORKTIME)
})
if (num != 8) return uni.showToast({
title: '提交总工时数需为8小时',
icon: 'none'
})
if (!flag) return
uni.showModal({
title: '提交',
content: '确认提交?',
success: function (res) {
if (res.confirm) {
uni.showLoading({
title: '提交中...',
mask: true
})
uni.request({
url: ApiUrl + '/LQKJ.K3.NDR.WebApiBusinessServicePlugIn.WebApi.ExecuteCmdAdd,LQKJ.K3.NDR.WebApiBusinessServicePlugIn.common.kdsvc',
method: 'POST',
data: {
parmeters: {
Model: submitData.value
}
},
success({ data: res }: any) {
uni.hideLoading()
if (res.code === 200) {
const time = 8 - Number(res.data[0].f_lqkj_worktime)
const title = time ? '今日已填写' + res.data[0].f_lqkj_worktime + '小时,还需要填写' + time + '小时工时登记!' :
'今日工时已填满!'
uni.showToast({
title,
icon: 'none',
success() {
formListRef.value?.map((item: any) => item.reset())
}
})
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
},
fail() {
uni.hideLoading()
uni.showToast({
title: '请在内网使用',
icon: 'none'
})
}
})
}
}
})
}, 100);
}
},
fail() {
uni.hideLoading()
uni.showToast({
title: '请求失败',
icon: 'none',
})
},
})
}
},
})
}, 100)
})
isFill()
}
}
onLoad(() => {
onLoad(() => {
date.value = newDate()
formListRef.value?.map((item: any) => item.initRules())
setTimeout(() => {
userName.value = localStorage.getItem('Name')
localStorage.setItem('windowHeight', uni.getSystemInfoSync().windowHeight as any)
isFill()
}, 100);
})
const initStatus = (date: any) => {
userName.value = localStorage.getItem('Name')
localStorage.setItem(
'windowHeight',
uni.getSystemInfoSync().windowHeight as any
)
}, 100)
})
const initStatus = (date: any) => {
uni.showLoading({
title: '加载中',
mask: true
title: '加载中',
mask: true,
})
uni.request({
url: ApiUrl + '/LQKJ.K3.NDR.WebApiBusinessServicePlugIn.WebApi.State,LQKJ.K3.NDR.WebApiBusinessServicePlugIn.common.kdsvc',
method: 'POST',
data: { yearMonth: date },
success(res: any) {
uni.hideLoading()
const { data } = res
if (data.code === 200) {
status.value = data.data[0].state
flag.value = false
} else nextTick(() => {
flag.value = data.msg
console.log(flag.value);
})
}
url:
ApiUrl +
'/LQKJ.K3.NDR.WebApiBusinessServicePlugIn.WebApi.State,LQKJ.K3.NDR.WebApiBusinessServicePlugIn.common.kdsvc',
method: 'POST',
data: { yearMonth: date },
success(res: any) {
uni.hideLoading()
const { data } = res
if (data.code === 200) {
status.value = data.data[0].state
flag.value = false
} else
nextTick(() => {
flag.value = data.msg
})
},
})
}
}
const initSelect = (FName?: string) => {
const initSelect = (FName?: string) => {
uni.showLoading({
title: '加载中...',
mask: true
});
title: '加载中...',
mask: true,
})
uni.request({
url: ApiUrl + '/LQKJ.K3.NDR.WebApiBusinessServicePlugIn.WebApi.ExecuteCmdSelect,LQKJ.K3.NDR.WebApiBusinessServicePlugIn.common.kdsvc',
method: 'POST',
data: { FName },
success({ data: res }: any) {
uni.hideLoading()
if (res.code == 200) {
selectList.value = res.data
}
},
fail() {
uni.hideLoading()
uni.showToast({
title: '请在内网使用',
icon: 'none'
})
url:
ApiUrl +
'/LQKJ.K3.NDR.WebApiBusinessServicePlugIn.WebApi.ExecuteCmdSelect,LQKJ.K3.NDR.WebApiBusinessServicePlugIn.common.kdsvc',
method: 'POST',
data: { FName },
success({ data: res }: any) {
uni.hideLoading()
if (res.code == 200) {
selectList.value = res.data
}
},
fail() {
uni.hideLoading()
uni.showToast({
title: '请求失败',
icon: 'none',
})
},
})
}
}
</script>
<style lang="scss" scoped>
.queryRecords {
.queryRecords {
box-sizing: border-box;
width: 100%;
font-size: 26rpx;
......@@ -516,60 +616,60 @@ const initSelect = (FName?: string) => {
display: flex;
justify-content: space-between;
align-items: center;
}
}
.container {
.container {
margin: 50rpx 0;
.header {
width: 100%;
text-align: center;
.title {
display: block;
font-size: 32rpx;
font-weight: bold;
}
width: 100%;
text-align: center;
.subtitle {
display: block;
font-size: 28rpx;
color: rgb(100, 143, 193);
margin: 24rpx 0;
}
.title-description {
display: block;
font-size: 24rpx;
color: #ccc;
margin: 24rpx 0 30rpx 0;
padding: 20rpx;
}
.title {
display: block;
font-size: 32rpx;
font-weight: bold;
}
.subtitle {
display: block;
font-size: 28rpx;
color: rgb(100, 143, 193);
margin: 24rpx 0;
}
.title-description {
display: block;
font-size: 24rpx;
color: #ccc;
margin: 24rpx 0 30rpx 0;
padding: 20rpx;
}
}
}
}
.content {
.content {
box-sizing: border-box;
width: 100%;
padding: 0 20rpx;
font-size: 26rpx;
}
}
.content-list {
.content-list {
margin-bottom: 20rpx;
}
}
.list-title {
.list-title {
font-size: 24rpx;
color: #ccc;
border-bottom: 1rpx solid #ccc;
}
}
.list-item {
.list-item {
border-bottom: 1rpx solid #ccc;
}
}
.button {
.button {
display: flex;
justify-content: center;
align-items: center;
......@@ -577,19 +677,19 @@ const initSelect = (FName?: string) => {
margin-top: 30rpx;
& button {
width: 240rpx;
margin-bottom: 20rpx;
font-weight: bold;
width: 240rpx;
margin-bottom: 20rpx;
font-weight: bold;
}
& button:first-child {
color: rgb(7, 193, 69);
background-color: rgb(242, 242, 242);
color: rgb(7, 193, 69);
background-color: rgb(242, 242, 242);
}
& button:last-child {
color: #fff;
background-color: rgb(7, 193, 69);
color: #fff;
background-color: rgb(7, 193, 69);
}
}
}
</style>
......@@ -43,7 +43,7 @@ const login = () => {
},
fail: (error) => {
uni.showToast({
title: '请在内网使用',
title: '请求失败',
icon: 'none'
})
}
......
......@@ -26,12 +26,14 @@
:circle="true" />
<uni-tag v-else text="重新审核" type="warning" size="small" :circle="true" /> -->
<uni-tag v-if="item.F_LQKJ_BILLSTATUS == 'C'" text="已审核" type="success" size="small" :circle="true" />
<uni-tag v-else-if="item.F_LQKJ_BILLSTATUS == 'B'" text="审核中" type="primary" size="small"
:circle="true" />
<uni-tag v-else text="未审核" type="default" size="small" :circle="true" />
</view>
</view>
<view class="line" v-show="item.F_LQKJ_BILLSTATUS != 'C'" />
<view class="footer" v-show="item.F_LQKJ_BILLSTATUS != 'C'">
<view class="button" @tap.stop="edit(item)">修改</view>
<view class="line" v-show="item.F_LQKJ_BILLSTATUS != 'C' && item.F_LQKJ_BILLSTATUS != 'B'" />
<view class="footer" v-show="item.F_LQKJ_BILLSTATUS != 'C' && item.F_LQKJ_BILLSTATUS != 'B'">
<view class=" button" @tap.stop="edit(item)">修改</view>
<view class="button error" @tap.stop="deleteItem(item.FID)">删除</view>
</view>
</view>
......@@ -67,7 +69,7 @@ const init = () => {
fail() {
uni.hideLoading()
uni.showToast({
title: '请在内网使用',
title: '请求失败',
icon: 'none'
})
}
......@@ -112,7 +114,7 @@ const deleteItem = (Id: number) => {
fail() {
uni.hideLoading()
uni.showToast({
title: '请在内网使用',
title: '请求失败',
icon: 'none'
})
}
......@@ -153,7 +155,7 @@ const submitTo = (id: number) => {
fail() {
uni.hideLoading()
uni.showToast({
title: '请在内网使用',
title: '请求失败',
icon: 'none'
})
}
......@@ -190,7 +192,7 @@ const cancel = (id: number) => {
fail() {
uni.hideLoading()
uni.showToast({
title: '请在内网使用',
title: '请求失败',
icon: 'none'
})
}
......
<template>
<view class="uni-calendar">
<view v-if="!insert && show" class="uni-calendar__mask" :class="{ 'uni-calendar--mask-show': aniMaskShow }"
@click="clean"></view>
<view v-if="insert || show" class="uni-calendar__content"
:class="{ 'uni-calendar--fixed': !insert, 'uni-calendar--ani-show': aniMaskShow }">
<view v-if="!insert" class="uni-calendar__header uni-calendar--fixed-top">
<view class="uni-calendar__header-btn-box" @click="close">
<text class="uni-calendar__header-text uni-calendar--fixed-width">{{ cancelText }}</text>
</view>
<view class="uni-calendar__header-btn-box" @click="confirm">
<text class="uni-calendar__header-text uni-calendar--fixed-width">{{ okText }}</text>
</view>
</view>
<view class="uni-calendar__header">
<view class="uni-calendar__header-btn-box" @click.stop="pre">
<view class="uni-calendar__header-btn uni-calendar--left"></view>
</view>
<picker mode="date" :value="date" fields="month" @change="bindDateChange">
<text class="uni-calendar__header-text">{{ (nowDate.year || '') + ' / ' + (nowDate.month || '')
}}</text>
</picker>
<view class="uni-calendar__header-btn-box" @click.stop="next">
<view class="uni-calendar__header-btn uni-calendar--right"></view>
</view>
<text class="uni-calendar__backtoday" @click="backtoday">{{ todayText }}</text>
</view>
<view class="uni-calendar__box">
<view v-if="showMonth" class="uni-calendar__box-bg">
<text class="uni-calendar__box-bg-text">{{ nowDate.month }}</text>
</view>
<view class="uni-calendar__weeks">
<view class="uni-calendar__weeks-day">
<text class="uni-calendar__weeks-day-text">{{ SUNText }}</text>
</view>
<view class="uni-calendar__weeks-day">
<text class="uni-calendar__weeks-day-text">{{ monText }}</text>
</view>
<view class="uni-calendar__weeks-day">
<text class="uni-calendar__weeks-day-text">{{ TUEText }}</text>
</view>
<view class="uni-calendar__weeks-day">
<text class="uni-calendar__weeks-day-text">{{ WEDText }}</text>
</view>
<view class="uni-calendar__weeks-day">
<text class="uni-calendar__weeks-day-text">{{ THUText }}</text>
</view>
<view class="uni-calendar__weeks-day">
<text class="uni-calendar__weeks-day-text">{{ FRIText }}</text>
</view>
<view class="uni-calendar__weeks-day">
<text class="uni-calendar__weeks-day-text">{{ SATText }}</text>
</view>
</view>
<view class="uni-calendar__weeks" v-for="(item, weekIndex) in weeks" :key="weekIndex">
<view class="uni-calendar__weeks-item" v-for="(weeks, weeksIndex) in item" :key="weeksIndex">
<calendar-item class="uni-calendar-item--hook" :weeks="weeks" :calendar="calendar"
:selected="selected" :lunar="lunar" @change="choiceDate"
@touchend="dbClickchoiceDate(weeks)">
</calendar-item>
</view>
</view>
</view>
</view>
</view>
<view class="uni-calendar">
<view
v-if="!insert && show"
class="uni-calendar__mask"
:class="{ 'uni-calendar--mask-show': aniMaskShow }"
@click="clean"
></view>
<view
v-if="insert || show"
class="uni-calendar__content"
:class="{
'uni-calendar--fixed': !insert,
'uni-calendar--ani-show': aniMaskShow,
}"
>
<view v-if="!insert" class="uni-calendar__header uni-calendar--fixed-top">
<view class="uni-calendar__header-btn-box" @click="close">
<text class="uni-calendar__header-text uni-calendar--fixed-width">{{
cancelText
}}</text>
</view>
<view class="uni-calendar__header-btn-box" @click="confirm">
<text class="uni-calendar__header-text uni-calendar--fixed-width">{{
okText
}}</text>
</view>
</view>
<view class="uni-calendar__header">
<view class="uni-calendar__header-btn-box" @click.stop="pre">
<view class="uni-calendar__header-btn uni-calendar--left"></view>
</view>
<picker mode="date" :value="date" fields="month" @change="bindDateChange">
<text class="uni-calendar__header-text">{{
(nowDate.year || '') + ' / ' + (nowDate.month || '')
}}</text>
</picker>
<view class="uni-calendar__header-btn-box" @click.stop="next">
<view class="uni-calendar__header-btn uni-calendar--right"></view>
</view>
<text class="uni-calendar__backtoday" @click="backtoday">{{
todayText
}}</text>
</view>
<view class="uni-calendar__box">
<view v-if="showMonth" class="uni-calendar__box-bg">
<text class="uni-calendar__box-bg-text">{{ nowDate.month }}</text>
</view>
<view class="uni-calendar__weeks">
<view class="uni-calendar__weeks-day">
<text class="uni-calendar__weeks-day-text">{{ SUNText }}</text>
</view>
<view class="uni-calendar__weeks-day">
<text class="uni-calendar__weeks-day-text">{{ monText }}</text>
</view>
<view class="uni-calendar__weeks-day">
<text class="uni-calendar__weeks-day-text">{{ TUEText }}</text>
</view>
<view class="uni-calendar__weeks-day">
<text class="uni-calendar__weeks-day-text">{{ WEDText }}</text>
</view>
<view class="uni-calendar__weeks-day">
<text class="uni-calendar__weeks-day-text">{{ THUText }}</text>
</view>
<view class="uni-calendar__weeks-day">
<text class="uni-calendar__weeks-day-text">{{ FRIText }}</text>
</view>
<view class="uni-calendar__weeks-day">
<text class="uni-calendar__weeks-day-text">{{ SATText }}</text>
</view>
</view>
<view
class="uni-calendar__weeks"
v-for="(item, weekIndex) in weeks"
:key="weekIndex"
>
<view
class="uni-calendar__weeks-item"
v-for="(weeks, weeksIndex) in item"
:key="weeksIndex"
>
<calendar-item
class="uni-calendar-item--hook"
:weeks="weeks"
:calendar="calendar"
:selected="selected"
:lunar="lunar"
@change="choiceDate"
@touchend="dbClickchoiceDate(weeks)"
@dblclick="handleDoubleClick(weeks)"
>
</calendar-item>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import Calendar from './util.js';
import calendarItem from './uni-calendar-item.vue'
import {
initVueI18n
} from '@dcloudio/uni-i18n'
import messages from './i18n/index.js'
const { t } = initVueI18n(messages)
/**
* Calendar 日历
* @description 日历组件可以查看日期,选择任意范围内的日期,打点操作。常用场景如:酒店日期预订、火车机票选择购买日期、上下班打卡等
* @tutorial https://ext.dcloud.net.cn/plugin?id=56
* @property {String} date 自定义当前时间,默认为今天
* @property {Boolean} lunar 显示农历
* @property {String} startDate 日期选择范围-开始日期
* @property {String} endDate 日期选择范围-结束日期
* @property {Boolean} range 范围选择
* @property {Boolean} insert = [true|false] 插入模式,默认为false
* @value true 弹窗模式
* @value false 插入模式
* @property {Boolean} clearDate = [true|false] 弹窗模式是否清空上次选择内容
* @property {Array} selected 打点,期待格式[{date: '2019-06-27', info: '签到', data: { custom: '自定义信息', name: '自定义消息头',xxx:xxx... }}]
* @property {Boolean} showMonth 是否选择月份为背景
* @event {Function} change 日期改变,`insert :ture` 时生效
* @event {Function} confirm 确认选择`insert :false` 时生效
* @event {Function} monthSwitch 切换月份时触发
* @example <uni-calendar :insert="true":lunar="true" :start-date="'2019-3-2'":end-date="'2019-5-20'"@change="change" />
*/
export default {
components: {
calendarItem
},
emits: ['close', 'confirm', 'change', 'monthSwitch', 'dbclick'],
props: {
date: {
type: String,
default: ''
},
selected: {
type: Array,
default() {
return []
}
},
lunar: {
type: Boolean,
default: false
},
startDate: {
type: String,
default: ''
},
endDate: {
type: String,
default: ''
},
range: {
type: Boolean,
default: false
},
insert: {
type: Boolean,
default: true
},
showMonth: {
type: Boolean,
default: true
},
clearDate: {
type: Boolean,
default: true
},
fillDate: {
type: Array,
default() {
return []
}
}
},
data() {
return {
show: false,
weeks: [],
calendar: {},
nowDate: '',
aniMaskShow: false,
touchtime: 0
}
},
computed: {
/**
* for i18n
*/
import Calendar from './util.js'
import calendarItem from './uni-calendar-item.vue'
import { initVueI18n } from '@dcloudio/uni-i18n'
import messages from './i18n/index.js'
const { t } = initVueI18n(messages)
/**
* Calendar 日历
* @description 日历组件可以查看日期,选择任意范围内的日期,打点操作。常用场景如:酒店日期预订、火车机票选择购买日期、上下班打卡等
* @tutorial https://ext.dcloud.net.cn/plugin?id=56
* @property {String} date 自定义当前时间,默认为今天
* @property {Boolean} lunar 显示农历
* @property {String} startDate 日期选择范围-开始日期
* @property {String} endDate 日期选择范围-结束日期
* @property {Boolean} range 范围选择
* @property {Boolean} insert = [true|false] 插入模式,默认为false
* @value true 弹窗模式
* @value false 插入模式
* @property {Boolean} clearDate = [true|false] 弹窗模式是否清空上次选择内容
* @property {Array} selected 打点,期待格式[{date: '2019-06-27', info: '签到', data: { custom: '自定义信息', name: '自定义消息头',xxx:xxx... }}]
* @property {Boolean} showMonth 是否选择月份为背景
* @event {Function} change 日期改变,`insert :ture` 时生效
* @event {Function} confirm 确认选择`insert :false` 时生效
* @event {Function} monthSwitch 切换月份时触发
* @example <uni-calendar :insert="true":lunar="true" :start-date="'2019-3-2'":end-date="'2019-5-20'"@change="change" />
*/
export default {
components: {
calendarItem,
},
emits: ['close', 'confirm', 'change', 'monthSwitch', 'dbclick'],
props: {
date: {
type: String,
default: '',
},
selected: {
type: Array,
default() {
return []
},
},
lunar: {
type: Boolean,
default: false,
},
startDate: {
type: String,
default: '',
},
endDate: {
type: String,
default: '',
},
range: {
type: Boolean,
default: false,
},
insert: {
type: Boolean,
default: true,
},
showMonth: {
type: Boolean,
default: true,
},
clearDate: {
type: Boolean,
default: true,
},
fillDate: {
type: Array,
default() {
return []
},
},
},
data() {
return {
show: false,
weeks: [],
calendar: {},
nowDate: '',
aniMaskShow: false,
touchtime: 0,
}
},
computed: {
/**
* for i18n
*/
okText() {
return t('uni-calender.ok')
},
cancelText() {
return t('uni-calender.cancel')
},
todayText() {
return t('uni-calender.today')
},
monText() {
return t('uni-calender.MON')
},
TUEText() {
return t('uni-calender.TUE')
},
WEDText() {
return t('uni-calender.WED')
},
THUText() {
return t('uni-calender.THU')
},
FRIText() {
return t('uni-calender.FRI')
},
SATText() {
return t('uni-calender.SAT')
},
SUNText() {
return t('uni-calender.SUN')
},
},
watch: {
date(newVal) {
// this.cale.setDate(newVal)
this.init(newVal)
},
startDate(val) {
this.cale.resetSatrtDate(val)
this.cale.setDate(this.nowDate.fullDate)
this.weeks = this.cale.weeks
},
endDate(val) {
this.cale.resetEndDate(val)
this.cale.setDate(this.nowDate.fullDate)
this.weeks = this.cale.weeks
},
selected(newVal) {
this.cale.setSelectInfo(this.nowDate.fullDate, newVal)
this.weeks = this.cale.weeks
},
},
directives: {
mydoubleclick: {
bind: function (el, binding) {
var isTouchDevice = 'ontouchstart' in window
var touchStartTimestamp = 0
var touchEndTimestamp = 0
var clickTimeout = null
okText() {
return t("uni-calender.ok")
},
cancelText() {
return t("uni-calender.cancel")
},
todayText() {
return t("uni-calender.today")
},
monText() {
return t("uni-calender.MON")
},
TUEText() {
return t("uni-calender.TUE")
},
WEDText() {
return t("uni-calender.WED")
},
THUText() {
return t("uni-calender.THU")
},
FRIText() {
return t("uni-calender.FRI")
},
SATText() {
return t("uni-calender.SAT")
},
SUNText() {
return t("uni-calender.SUN")
},
},
watch: {
date(newVal) {
// this.cale.setDate(newVal)
this.init(newVal)
},
startDate(val) {
this.cale.resetSatrtDate(val)
this.cale.setDate(this.nowDate.fullDate)
this.weeks = this.cale.weeks
},
endDate(val) {
this.cale.resetEndDate(val)
this.cale.setDate(this.nowDate.fullDate)
this.weeks = this.cale.weeks
},
selected(newVal) {
this.cale.setSelectInfo(this.nowDate.fullDate, newVal)
this.weeks = this.cale.weeks
}
},
created() {
// 获取日历方法实例
this.cale = new Calendar({
// date: new Date(),
selected: this.selected,
startDate: this.startDate,
endDate: this.endDate,
range: this.range,
})
// 选中某一天
// this.cale.setDate(this.date)
this.init(this.date)
// this.setDay
},
methods: {
// 取消穿透
clean() { },
bindDateChange(e) {
const value = e.detail.value + '-1'
const { year, month } = this.cale.getDate(value)
this.setDate(value)
this.monthSwitch()
},
/**
* 初始化日期显示
* @param {Object} date
*/
init(date) {
this.cale.setDate(date)
this.weeks = this.cale.weeks
this.nowDate = this.calendar = this.cale.getInfo(date)
},
/**
* 打开日历弹窗
*/
open() {
// 弹窗模式并且清理数据
if (this.clearDate && !this.insert) {
this.cale.cleanMultipleStatus()
// this.cale.setDate(this.date)
this.init(this.date)
}
this.show = true
this.$nextTick(() => {
setTimeout(() => {
this.aniMaskShow = true
// console.log(this.weeks);
}, 50)
})
},
/**
* 关闭日历弹窗
*/
close() {
this.aniMaskShow = false
this.$nextTick(() => {
setTimeout(() => {
this.show = false
this.$emit('close')
}, 300)
})
},
/**
* 确认按钮
*/
confirm() {
this.setEmit('confirm')
this.close()
},
/**
* 变化触发
*/
change() {
if (!this.insert) return
this.setEmit('change')
},
/**
* 选择月份触发
*/
monthSwitch() {
let {
year,
month
} = this.nowDate
this.$emit('monthSwitch', year + '' + month)
},
/**
* 派发事件
* @param {Object} name
*/
setEmit(name) {
let {
year,
month,
date,
fullDate,
lunar,
extraInfo
} = this.calendar
this.$emit(name, {
range: this.cale.multipleStatus,
year,
month,
date,
fulldate: fullDate,
lunar,
extraInfo: extraInfo || {}
})
},
/**
* 选择天触发
* @param {Object} weeks
*/
choiceDate(weeks) {
if (weeks.disable) return
this.calendar = weeks
// 设置多选
this.cale.setMultiple(this.calendar.fullDate)
this.weeks = this.cale.weeks
this.change()
},
dbClickchoiceDate(weeks) {
if (this.touchtime === 0) {
// 记录第一次触摸的时间
this.touchtime = new Date().getTime();
} else {
// 计算两次触摸之间的间隔时间
const currentTime = new Date().getTime();
if (currentTime - this.touchtime < 300) { // 可以根据实际需求调整时间阈值
// 执行双击逻辑
// console.log(weeks);
this.choiceDate(weeks)
this.touchtime = 0;
this.setEmit('confirm')
this.close()
} else {
this.touchtime = currentTime; // 记录下一次触摸的时间
}
}
},
el.addEventListener(
isTouchDevice ? 'touchend' : 'click',
function (event) {
if (isTouchDevice) {
touchEndTimestamp = new Date().getTime()
/**
* 回到今天
*/
backtoday() {
let date = this.cale.getDate(new Date()).fullDate
// this.cale.setDate(date)
this.init(date)
this.change()
},
/**
* 上个月
*/
pre() {
const preDate = this.cale.getDate(this.nowDate.fullDate, -1, 'month').fullDate
this.setDate(preDate)
this.monthSwitch()
if (touchEndTimestamp - touchStartTimestamp < 300) {
binding.value(event)
}
} else {
if (!clickTimeout) {
clickTimeout = setTimeout(function () {
clickTimeout = null
}, 300)
} else {
clearTimeout(clickTimeout)
binding.value(event)
clickTimeout = null
}
}
}
)
},
/**
* 下个月
*/
next() {
const nextDate = this.cale.getDate(this.nowDate.fullDate, +1, 'month').fullDate
this.setDate(nextDate)
this.monthSwitch()
},
/**
* 设置日期
* @param {Object} date
*/
setDate(date) {
this.cale.setDate(date)
this.weeks = this.cale.weeks
this.nowDate = this.cale.getInfo(date)
}
}
}
if (isTouchDevice) {
el.addEventListener('touchstart', function (event) {
touchStartTimestamp = new Date().getTime()
})
}
},
},
},
created() {
// 获取日历方法实例
this.cale = new Calendar({
// date: new Date(),
selected: this.selected,
startDate: this.startDate,
endDate: this.endDate,
range: this.range,
})
// 选中某一天
// this.cale.setDate(this.date)
this.init(this.date)
// this.setDay
},
methods: {
// 取消穿透
clean() {},
bindDateChange(e) {
const value = e.detail.value + '-1'
const { year, month } = this.cale.getDate(value)
this.setDate(value)
this.monthSwitch()
},
/**
* 初始化日期显示
* @param {Object} date
*/
init(date) {
this.cale.setDate(date)
this.weeks = this.cale.weeks
this.nowDate = this.calendar = this.cale.getInfo(date)
},
/**
* 打开日历弹窗
*/
open() {
// 弹窗模式并且清理数据
if (this.clearDate && !this.insert) {
this.cale.cleanMultipleStatus()
// this.cale.setDate(this.date)
this.init(this.date)
}
this.show = true
this.$nextTick(() => {
setTimeout(() => {
this.aniMaskShow = true
// console.log(this.weeks);
}, 50)
})
},
/**
* 关闭日历弹窗
*/
close() {
this.aniMaskShow = false
this.$nextTick(() => {
setTimeout(() => {
this.show = false
this.$emit('close')
}, 300)
})
},
/**
* 确认按钮
*/
confirm() {
this.setEmit('confirm')
this.close()
},
/**
* 变化触发
*/
change() {
if (!this.insert) return
this.setEmit('change')
},
/**
* 选择月份触发
*/
monthSwitch() {
let { year, month } = this.nowDate
this.$emit('monthSwitch', year + '' + month)
},
/**
* 派发事件
* @param {Object} name
*/
setEmit(name) {
let { year, month, date, fullDate, lunar, extraInfo } = this.calendar
this.$emit(name, {
range: this.cale.multipleStatus,
year,
month,
date,
fulldate: fullDate,
lunar,
extraInfo: extraInfo || {},
})
},
/**
* 选择天触发
* @param {Object} weeks
*/
choiceDate(weeks) {
if (weeks.disable) return
this.calendar = weeks
// 设置多选
this.cale.setMultiple(this.calendar.fullDate)
this.weeks = this.cale.weeks
this.change()
},
// 移动端双击事件
dbClickchoiceDate(weeks) {
if (this.touchtime === 0) {
// 记录第一次触摸的时间
this.touchtime = new Date().getTime()
} else {
// 计算两次触摸之间的间隔时间
const currentTime = new Date().getTime()
if (currentTime - this.touchtime < 300) {
// 可以根据实际需求调整时间阈值
// 执行双击逻辑
// console.log(weeks);
this.choiceDate(weeks)
this.touchtime = 0
this.setEmit('confirm')
this.close()
} else {
this.touchtime = currentTime // 记录下一次触摸的时间
}
}
},
handleDoubleClick(weeks) {
this.choiceDate(weeks)
this.touchtime = 0
this.setEmit('confirm')
this.close()
},
/**
* 回到今天
*/
backtoday() {
let date = this.cale.getDate(new Date()).fullDate
// this.cale.setDate(date)
this.init(date)
this.change()
},
/**
* 上个月
*/
pre() {
const preDate = this.cale.getDate(
this.nowDate.fullDate,
-1,
'month'
).fullDate
this.setDate(preDate)
this.monthSwitch()
},
/**
* 下个月
*/
next() {
const nextDate = this.cale.getDate(
this.nowDate.fullDate,
+1,
'month'
).fullDate
this.setDate(nextDate)
this.monthSwitch()
},
/**
* 设置日期
* @param {Object} date
*/
setDate(date) {
this.cale.setDate(date)
this.weeks = this.cale.weeks
this.nowDate = this.cale.getInfo(date)
},
},
}
</script>
<style lang="scss" scoped>
$uni-bg-color-mask: rgba($color: #000000, $alpha: 0.4);
$uni-border-color: #EDEDED;
$uni-text-color: #333;
$uni-bg-color-hover: #f1f1f1;
$uni-font-size-base: 14px;
$uni-text-color-placeholder: #808080;
$uni-color-subtitle: #555555;
$uni-text-color-grey: #999;
.uni-calendar {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: column;
}
$uni-bg-color-mask: rgba(
$color: #000000,
$alpha: 0.4,
);
$uni-border-color: #ededed;
$uni-text-color: #333;
$uni-bg-color-hover: #f1f1f1;
$uni-font-size-base: 14px;
$uni-text-color-placeholder: #808080;
$uni-color-subtitle: #555555;
$uni-text-color-grey: #999;
.uni-calendar__mask {
position: fixed;
bottom: 0;
top: 0;
left: 0;
right: 0;
background-color: $uni-bg-color-mask;
transition-property: opacity;
transition-duration: 0.3s;
opacity: 0;
/* #ifndef APP-NVUE */
z-index: 99;
/* #endif */
}
.uni-calendar {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: column;
}
.uni-calendar--mask-show {
opacity: 1
}
.uni-calendar__mask {
position: fixed;
bottom: 0;
top: 0;
left: 0;
right: 0;
background-color: $uni-bg-color-mask;
transition-property: opacity;
transition-duration: 0.3s;
opacity: 0;
/* #ifndef APP-NVUE */
z-index: 99;
/* #endif */
}
.uni-calendar--fixed {
position: fixed;
/* #ifdef APP-NVUE */
bottom: 0;
/* #endif */
left: 0;
right: 0;
transition-property: transform;
transition-duration: 0.3s;
transform: translateY(460px);
/* #ifndef APP-NVUE */
bottom: calc(var(--window-bottom));
z-index: 99;
/* #endif */
}
.uni-calendar--mask-show {
opacity: 1;
}
.uni-calendar--ani-show {
transform: translateY(0);
}
.uni-calendar--fixed {
position: fixed;
/* #ifdef APP-NVUE */
bottom: 0;
/* #endif */
left: 0;
right: 0;
transition-property: transform;
transition-duration: 0.3s;
transform: translateY(460px);
/* #ifndef APP-NVUE */
bottom: calc(var(--window-bottom));
z-index: 99;
/* #endif */
}
.uni-calendar__content {
background-color: #fff;
}
.uni-calendar--ani-show {
transform: translateY(0);
}
.uni-calendar__header {
position: relative;
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
justify-content: center;
align-items: center;
height: 50px;
border-bottom-color: $uni-border-color;
border-bottom-style: solid;
border-bottom-width: 1px;
}
.uni-calendar__content {
background-color: #fff;
}
.uni-calendar--fixed-top {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
justify-content: space-between;
border-top-color: $uni-border-color;
border-top-style: solid;
border-top-width: 1px;
}
.uni-calendar__header {
position: relative;
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
justify-content: center;
align-items: center;
height: 50px;
border-bottom-color: $uni-border-color;
border-bottom-style: solid;
border-bottom-width: 1px;
}
.uni-calendar--fixed-width {
width: 50px;
// padding: 0 15px;
}
.uni-calendar--fixed-top {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
justify-content: space-between;
border-top-color: $uni-border-color;
border-top-style: solid;
border-top-width: 1px;
}
.uni-calendar__backtoday {
position: absolute;
right: 0;
top: 25rpx;
padding: 0 5px;
padding-left: 10px;
height: 25px;
line-height: 25px;
font-size: 12px;
border-top-left-radius: 25px;
border-bottom-left-radius: 25px;
color: $uni-text-color;
background-color: $uni-bg-color-hover;
}
.uni-calendar--fixed-width {
width: 50px;
// padding: 0 15px;
}
.uni-calendar__header-text {
text-align: center;
width: 100px;
font-size: $uni-font-size-base;
color: $uni-text-color;
}
.uni-calendar__backtoday {
position: absolute;
right: 0;
top: 25rpx;
padding: 0 5px;
padding-left: 10px;
height: 25px;
line-height: 25px;
font-size: 12px;
border-top-left-radius: 25px;
border-bottom-left-radius: 25px;
color: $uni-text-color;
background-color: $uni-bg-color-hover;
}
.uni-calendar__header-btn-box {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
align-items: center;
justify-content: center;
width: 50px;
height: 50px;
}
.uni-calendar__header-text {
text-align: center;
width: 100px;
font-size: $uni-font-size-base;
color: $uni-text-color;
}
.uni-calendar__header-btn {
width: 10px;
height: 10px;
border-left-color: $uni-text-color-placeholder;
border-left-style: solid;
border-left-width: 2px;
border-top-color: $uni-color-subtitle;
border-top-style: solid;
border-top-width: 2px;
}
.uni-calendar__header-btn-box {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
align-items: center;
justify-content: center;
width: 50px;
height: 50px;
}
.uni-calendar--left {
transform: rotate(-45deg);
}
.uni-calendar__header-btn {
width: 10px;
height: 10px;
border-left-color: $uni-text-color-placeholder;
border-left-style: solid;
border-left-width: 2px;
border-top-color: $uni-color-subtitle;
border-top-style: solid;
border-top-width: 2px;
}
.uni-calendar--right {
transform: rotate(135deg);
}
.uni-calendar--left {
transform: rotate(-45deg);
}
.uni-calendar--right {
transform: rotate(135deg);
}
.uni-calendar__weeks {
position: relative;
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
}
.uni-calendar__weeks {
position: relative;
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
}
.uni-calendar__weeks-item {
flex: 1;
}
.uni-calendar__weeks-item {
flex: 1;
}
.uni-calendar__weeks-day {
flex: 1;
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: column;
justify-content: center;
align-items: center;
height: 45px;
border-bottom-color: #F5F5F5;
border-bottom-style: solid;
border-bottom-width: 1px;
}
.uni-calendar__weeks-day {
flex: 1;
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: column;
justify-content: center;
align-items: center;
height: 45px;
border-bottom-color: #f5f5f5;
border-bottom-style: solid;
border-bottom-width: 1px;
}
.uni-calendar__weeks-day-text {
font-size: 14px;
}
.uni-calendar__weeks-day-text {
font-size: 14px;
}
.uni-calendar__box {
position: relative;
}
.uni-calendar__box {
position: relative;
}
.uni-calendar__box-bg {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
justify-content: center;
align-items: center;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
.uni-calendar__box-bg {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
justify-content: center;
align-items: center;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
.uni-calendar__box-bg-text {
font-size: 200px;
font-weight: bold;
color: $uni-text-color-grey;
opacity: 0.1;
text-align: center;
/* #ifndef APP-NVUE */
line-height: 1;
/* #endif */
}
.uni-calendar__box-bg-text {
font-size: 200px;
font-weight: bold;
color: $uni-text-color-grey;
opacity: 0.1;
text-align: center;
/* #ifndef APP-NVUE */
line-height: 1;
/* #endif */
}
</style>
import { defineConfig } from 'vite';
import uni from '@dcloudio/vite-plugin-uni';
import { defineConfig } from 'vite'
import uni from '@dcloudio/vite-plugin-uni'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [uni()],
server: {
host: '0.0.0.0',
port: 7879,
open: true,
strictPort: false, // 端口被占用直接退出
proxy: {
'/NDR': {
target: 'http://192.168.1.12',
},
'/k3Cloud': {
target: 'http://192.168.1.37',
},
},
},
build: {
minify: 'terser',
terserOptions: {
compress: {
//生产环境时移除console
drop_console: true,
drop_debugger: true,
},
},
},
});
plugins: [uni()],
server: {
host: '0.0.0.0',
port: 7879,
open: true,
strictPort: false, // 端口被占用直接退出
proxy: {
'/ndr': {
target: 'http://192.168.1.12',
},
},
},
build: {
minify: 'terser',
terserOptions: {
compress: {
//生产环境时移除console
drop_console: true,
drop_debugger: true,
},
},
},
})
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论