|
|
@@ -14,22 +14,22 @@
|
|
|
<uni-easyinput v-if="undefined != elem.bindTimeRange && elem.elementName == '出差天数'"
|
|
|
:type="fieldTypeDict[elem.fieldType] || 'text'"
|
|
|
:value="calculateBusinessDifference(elem, formElements)"
|
|
|
- placeholder=""></uni-easyinput>
|
|
|
+ placeholder="" :disabled="true"></uni-easyinput>
|
|
|
|
|
|
<uni-easyinput v-else-if="undefined != elem.bindTimeRange"
|
|
|
:type="fieldTypeDict[elem.fieldType] || 'text'"
|
|
|
- :value="calculateTimeDifference(elem, formElements)" placeholder=""></uni-easyinput>
|
|
|
+ :value="calculateTimeDifference(elem, formElements)" placeholder="" :disabled="true"></uni-easyinput>
|
|
|
<!-- 金额转大写 -->
|
|
|
<uni-easyinput v-else-if="elem.elementName.endsWith('大写')" placeholder=""
|
|
|
:value="computedNumberToChineseCurrency(elem, formElements)"></uni-easyinput>
|
|
|
<!-- 主表关联变量输入框 -->
|
|
|
<!-- 数值输入框 -->
|
|
|
<uni-easyinput v-else-if="'1' == elem.fieldType && elem.BddzText"
|
|
|
- type="digit" :value="computedBddzTextValue(elem)" @input="digitInput($event, elem)" placeholder=""></uni-easyinput>
|
|
|
+ type="digit" :value="computedBddzTextValue(elem)" @input="digitInput($event, elem)" placeholder="" :disabled="true"></uni-easyinput>
|
|
|
<!-- 输入框 -->
|
|
|
<uni-easyinput v-else-if="elem.BddzText"
|
|
|
:type="fieldTypeDict[elem.fieldType] || 'text'"
|
|
|
- :value="computedBddzTextValue(elem)" placeholder=""></uni-easyinput>
|
|
|
+ :value="computedBddzTextValue(elem)" placeholder="" :disabled="true"></uni-easyinput>
|
|
|
<!-- 数值输入框 -->
|
|
|
<uni-easyinput v-else-if="'0' == elem.type && '1' == elem.fieldType" :disabled="'0' == elem.canEdit" type="digit" :placeholder="'0' == elem.canEdit ? '' : '请输入内容'" @input="digitInput($event, elem)"
|
|
|
v-model="elem.defaultValue" placeholderStyle="font-size: calc(14px + 1.2*(1rem - 16px))"></uni-easyinput>
|
|
|
@@ -82,7 +82,7 @@
|
|
|
<uni-forms-item :name="elem.tableField" v-for="(elem, itemIndex) in form"
|
|
|
:label="repeatingForm.elementItem[itemIndex].elementName.slice(3)" :key="itemIndex">
|
|
|
<!-- 自定义关联变量 -->
|
|
|
- <uni-easyinput v-if="repeatingForm.elementItem[itemIndex].bddzText" :placeholder="''" :type="fieldTypeDict[repeatingForm.elementItem[itemIndex].fieldType.value] || 'text'" placeholderStyle="font-size: calc(14px + 1.2*(1rem - 16px))" :value="calculateRepeatingFormExpression(elem, form)"></uni-easyinput>
|
|
|
+ <uni-easyinput v-if="repeatingForm.elementItem[itemIndex].bddzText" :placeholder="''" :type="fieldTypeDict[repeatingForm.elementItem[itemIndex].fieldType.value] || 'text'" placeholderStyle="font-size: calc(14px + 1.2*(1rem - 16px))" :value="calculateRepeatingFormExpression(elem, form)" :disabled="true"></uni-easyinput>
|
|
|
<!-- 数值输入框 -->
|
|
|
<uni-easyinput v-else-if="'1' == repeatingForm.elementItem[itemIndex].fieldType.value" placeholder="请输入内容" v-model="elem.defaultValue" @input="digitInput($event, elem)" placeholderStyle="font-size: calc(14px + 1.2*(1rem - 16px))" type="digit"></uni-easyinput>
|
|
|
<!-- 输入框 -->
|
|
|
@@ -257,7 +257,7 @@ function calculateTimeDifference(item, form) {
|
|
|
const { startIndex, endIndex } = item.bindTimeRange;
|
|
|
const startTime = new Date(form[startIndex].defaultValue);
|
|
|
const endTime = new Date(form[endIndex].defaultValue);
|
|
|
-
|
|
|
+
|
|
|
// 检查时间是否合法
|
|
|
if (isNaN(startTime.getTime()) || isNaN(endTime.getTime())) {
|
|
|
return item.defaultValue = 0
|
|
|
@@ -302,11 +302,12 @@ function setAttendanceSegment() {
|
|
|
{ start: "13:30", end: "17:30" }, // 下午
|
|
|
]
|
|
|
}
|
|
|
+ workDays = workDays.map(item => Number(item))
|
|
|
const sundayIndex = workDays.findIndex(item => item == 7)
|
|
|
+ console.log('workDays: ',workDays);
|
|
|
if (sundayIndex != -1) {
|
|
|
- workDays[sundayIndex] = "0"
|
|
|
+ workDays[sundayIndex] = 0
|
|
|
}
|
|
|
- console.log('workDays: ',workDays);
|
|
|
if (workDays.length == 0) {
|
|
|
workDays = [1, 2, 3, 4, 5, 6, 0] // 0为周日
|
|
|
}
|
|
|
@@ -340,15 +341,12 @@ function calculateWorkingHours(startTime, endTime, type) {
|
|
|
endDate.setHours(0, 0, 0, 0)
|
|
|
|
|
|
let totalMinutes = 0
|
|
|
-
|
|
|
// 遍历时间范围的每一天
|
|
|
for (
|
|
|
let currentDate = new Date(startDate);
|
|
|
currentDate <= endDate;
|
|
|
currentDate.setDate(currentDate.getDate() + 1)
|
|
|
) {
|
|
|
- // 如果当前日期不是工作日,跳过
|
|
|
- if (isRestdays(currentDate)) continue;
|
|
|
|
|
|
const isStartDay = currentDate.getTime() === startDate.getTime();
|
|
|
const isEndDay = currentDate.getTime() === endDate.getTime();
|
|
|
@@ -358,6 +356,8 @@ function calculateWorkingHours(startTime, endTime, type) {
|
|
|
const dayEnd = isEndDay ? dateToMinutes(endTime) : 1440; // 1440 = 24 * 60
|
|
|
// TODO 改为配置选择
|
|
|
if (type == "工作时间") {
|
|
|
+ // 如果当前日期不是工作日,跳过
|
|
|
+ if (isRestdays(currentDate)) continue;
|
|
|
// 计算工作时间段内的时间
|
|
|
workingPeriods.forEach((period) => {
|
|
|
const periodStart = formatTime(period.start);
|
|
|
@@ -365,6 +365,14 @@ function calculateWorkingHours(startTime, endTime, type) {
|
|
|
totalMinutes += calculateOverlap(dayStart, dayEnd, periodStart, periodEnd);
|
|
|
});
|
|
|
} else if (type == "非工作时间") {
|
|
|
+ if (isRestdays(currentDate)) {
|
|
|
+ // 计算非工作日时间差
|
|
|
+ const midnight = new Date(currentDate)
|
|
|
+ midnight.setHours(24, 0, 0, 0)
|
|
|
+ const timeDiffInMs = dayEnd - dayStart
|
|
|
+ totalMinutes += timeDiffInMs
|
|
|
+ continue
|
|
|
+ }
|
|
|
// 计算非工作时间段的时间
|
|
|
let nonWorkingMinutes = 0;
|
|
|
let current = dayStart;
|
|
|
@@ -387,7 +395,6 @@ function calculateWorkingHours(startTime, endTime, type) {
|
|
|
// 转换为小时
|
|
|
return totalMinutes / 60;
|
|
|
}
|
|
|
-
|
|
|
function setTimeRange(e) {
|
|
|
// console.log('setTimeRange', e)
|
|
|
}
|
|
|
@@ -397,6 +404,7 @@ function computedNumberToChineseCurrency(item, form) {
|
|
|
return item.defaultValue = convertToChineseCurrency(elem.defaultValue)
|
|
|
}
|
|
|
function computedBddzTextValue(item) {
|
|
|
+ console.log('computedBddzTextValue');
|
|
|
const mainIndex = formElements.value.findIndex(({ elementName }) => elementName == item.BddzText.slice(3))
|
|
|
const reIndex = repeatingForm.value.elementItem.findIndex(({ elementName }) => elementName == item.BddzText)
|
|
|
if (mainIndex != -1) {
|