|
|
@@ -1,48 +1,41 @@
|
|
|
<template>
|
|
|
<page-meta root-font-size="system" />
|
|
|
<view class="process_container">
|
|
|
+ <!-- 主表单 -->
|
|
|
<uni-card spacing="0">
|
|
|
<view class="main_container">
|
|
|
- <uni-forms ref="$mainForm" :modelValue="mainFormValue" :rules="$mainFormRules" label-position="left" :label-width="125" :border="true">
|
|
|
- <view v-for="(elem, index) in formElements">
|
|
|
- <!-- <uni-forms-item v-if="!('0' == elem.canEdit && (elem.elementName.slice(-2) == '审批' || elem.elementName.slice(-2) == '意见' || elem.elementName.slice(-2) == '批示'))" :label="elem.elementName" :key="index"> -->
|
|
|
- <uni-forms-item v-if="'0' != elem.canEdit && '8' != elem.type" :name="elem.elementId" :label="elem.elementName" :key="index">
|
|
|
- <uni-easyinput v-if="'多少小时' == elem.elementName" :disabled="true" placeholder=""
|
|
|
- v-model="diffHours"></uni-easyinput>
|
|
|
- <uni-easyinput v-else-if="elem.bddzText" :disabled="true" placeholder=""
|
|
|
- v-model="diffHours"></uni-easyinput>
|
|
|
+ <uni-forms ref="$mainForm" :modelValue="mainFormValue" :rules="$mainFormRules" label-position="left"
|
|
|
+ :label-width="125" :border="true">
|
|
|
+ <view v-for="(elem, index) in formElements" :key="index">
|
|
|
+ <uni-forms-item v-if="'0' != elem.canEdit && '8' != elem.type" :name="elem.elementId" :label="elem.elementName">
|
|
|
+ <!-- 关联变量输入框 -->
|
|
|
+ <uni-easyinput v-if="undefined != elem.bindTimeRange" placeholder="" :value="calculateTimeDifference(elem, formElements)"></uni-easyinput>
|
|
|
+ <!-- 金额转大写 -->
|
|
|
+ <uni-easyinput v-else-if="elem.elementName.endsWith('大写')" placeholder="" :value="computedNumberToChineseCurrency(elem, formElements)"></uni-easyinput>
|
|
|
<!-- 输入框 -->
|
|
|
- <uni-easyinput v-else-if="'0' == elem.type" :disabled="'0' == elem.canEdit"
|
|
|
- :type="fieldTypeDict[elem.fieldType] || 'text'"
|
|
|
+ <uni-easyinput v-else-if="'0' == elem.type" :disabled="'0' == elem.canEdit" :type="fieldTypeDict[elem.fieldType] || 'text'"
|
|
|
:placeholder="'0' == elem.canEdit ? '' : '请输入内容'"
|
|
|
v-model="elem.defaultValue"></uni-easyinput>
|
|
|
<!-- 富文本输入框 -->
|
|
|
- <uni-easyinput v-else-if="'1' == elem.type" :disabled="'0' == elem.canEdit"
|
|
|
- :placeholder="'0' == elem.canEdit ? '' : '请输入内容'" v-model="elem.defaultValue"
|
|
|
+ <uni-easyinput v-else-if="'1' == elem.type" :disabled="'0' == elem.canEdit" :placeholder="'0' == elem.canEdit ? '' : '请输入内容'" v-model="elem.defaultValue"
|
|
|
type="textarea"></uni-easyinput>
|
|
|
<!-- 下拉框 -->
|
|
|
<picker class="picker_container" v-else-if="'2' == elem.type"
|
|
|
- @change="bindPickerChange($event, elem)" :value="elem.defaultValue"
|
|
|
- :range="formatDict(elem.typeDetail.enum)">
|
|
|
+ @change="bindPickerChange($event, elem)" :value="elem.defaultValue" :range="formatDict(elem.typeDetail.enum)">
|
|
|
<view class="uni-input input_text">
|
|
|
<!-- 设置默认值为第一个选项 -->
|
|
|
- {{ elem.defaultValue ? elem.defaultValue : elem.defaultValue =
|
|
|
- elem.typeDetail.enum[0].enumVname }}
|
|
|
+ {{ elem.defaultValue ? elem.defaultValue : elem.defaultValue = elem.typeDetail.enum[0].enumVname }}
|
|
|
</view>
|
|
|
</picker>
|
|
|
<!-- 开始时间选择器 -->
|
|
|
- <uni-datetime-picker :end="endTime" @change="setTimeRange(elem)"
|
|
|
- v-else-if="timeFlag && '9' == elem.type && '开始时间' == elem.elementName"
|
|
|
- v-model="elem.defaultValue" :clear-icon="false" type="datetime" />
|
|
|
+ <uni-datetime-picker :end="formElements[elem.endElemIndex].defaultValue" @change="setTimeRange(elem)"
|
|
|
+ v-else-if="'9' == elem.type && undefined != elem.endElemIndex" v-model="elem.defaultValue" :clear-icon="false" type="datetime" />
|
|
|
<!-- 结束时间选择器 -->
|
|
|
- <uni-datetime-picker :start="startTime" @change="setTimeRange(elem)"
|
|
|
- :disabled="disableEndTime" :placeholder="disableEndTime ? '请先确认开始时间' : '确认结束时间'"
|
|
|
- v-else-if="timeFlag && '9' == elem.type && '结束时间' == elem.elementName"
|
|
|
- v-model="elem.defaultValue" :clear-icon="false" type="datetime" />
|
|
|
+ <uni-datetime-picker :start="formElements[elem.startElemIndex].defaultValue" @change="setTimeRange(elem)"
|
|
|
+ v-else-if="'9' == elem.type && undefined != elem.startElemIndex" v-model="elem.defaultValue" :clear-icon="false" type="datetime" />
|
|
|
<!-- 其他时间选择器 -->
|
|
|
<!-- 年月日 时分秒 -->
|
|
|
- <uni-datetime-picker v-else-if="'9' == elem.type" v-model="elem.defaultValue"
|
|
|
- type="datetime" />
|
|
|
+ <uni-datetime-picker v-else-if="'9' == elem.type" v-model="elem.defaultValue" type="datetime" />
|
|
|
<!-- 年月日 -->
|
|
|
<uni-datetime-picker v-else-if="'3' == elem.type" v-model="elem.defaultValue" type="date" />
|
|
|
</uni-forms-item>
|
|
|
@@ -53,16 +46,12 @@
|
|
|
<!-- 重复表单 -->
|
|
|
<view v-if="repeatingForm.elementItem.length > 0" class="repeating_table">
|
|
|
<uni-card v-for="(table, tableIndex) in repeatingForm.elements" spacing="0" :key="tableIndex">
|
|
|
- <!-- TODO 使用数组保存 refs -->
|
|
|
- <uni-forms :ref="(el) => $repeatingForms[tableIndex] = el" :modelValue="repeatingFormsValue[tableIndex]" :rules="$repFormRules" label-position="left" :label-width="125" :border="true">
|
|
|
+ <uni-forms :ref="(el) => $repeatingForms[tableIndex] = el" :modelValue="repeatingFormsValue[tableIndex]"
|
|
|
+ :rules="$repFormRules" label-position="left" :label-width="125" :border="true">
|
|
|
<uni-forms-item :name="elem.tableField" v-for="(elem, itemIndex) in table"
|
|
|
:label="repeatingForm.elementItem[itemIndex].elementName.slice(3)" :key="itemIndex">
|
|
|
<!-- 自定义关联变量 -->
|
|
|
- <uni-easyinput v-if="repeatingForm.elementItem[itemIndex].bddzText" :disabled="true" :placeholder="''" :value="computedrepeatingFormItemValue(elem, table)"></uni-easyinput>
|
|
|
- <!-- <uni-easyinput v-if="repeatingForm.elementItem[itemIndex].bddzText" :disabled="true"
|
|
|
- :placeholder="''"
|
|
|
- :value="calculateResult(repeatingForm.elementItem[itemIndex], table, elem)"></uni-easyinput> -->
|
|
|
-
|
|
|
+ <uni-easyinput v-if="repeatingForm.elementItem[itemIndex].bddzText" :placeholder="''" :value="calculateRepeatingFormExpression(elem, table)"></uni-easyinput>
|
|
|
<uni-easyinput v-else placeholder="请输入内容" v-model="elem.defaultValue"
|
|
|
:type="fieldTypeDict[repeatingForm.elementItem[itemIndex].fieldType.value] || 'text'"></uni-easyinput>
|
|
|
</uni-forms-item>
|
|
|
@@ -70,16 +59,17 @@
|
|
|
<view class="repeating_table_button_container">
|
|
|
<uni-row>
|
|
|
<uni-col :span="10" :offset="1">
|
|
|
- <button @click="addrepeatingFormItem(tableIndex)" type="primary">新增</button>
|
|
|
+ <button @click="addRepeatingFormItem(tableIndex)" type="primary">新增</button>
|
|
|
</uni-col>
|
|
|
<uni-col :span="10" :offset="2">
|
|
|
- <button @click="delrepeatingFormItem(tableIndex)"
|
|
|
+ <button @click="delRepeatingFormItem(tableIndex)"
|
|
|
:disabled="repeatingForm.elements.length <= 1" type="warn">删除</button>
|
|
|
</uni-col>
|
|
|
</uni-row>
|
|
|
</view>
|
|
|
</uni-card>
|
|
|
</view>
|
|
|
+ <!-- 上传附件 -->
|
|
|
<view class="file_picker_container">
|
|
|
<uni-card title="上传附件" :extra="`${fileList.length}/15`" spacing="0">
|
|
|
<uni-file-picker ref="filePicker" v-model="fileList" :auto-upload="true" mode="list" limit="10"
|
|
|
@@ -104,6 +94,7 @@ import { useUserStore } from '@/store/user.js'
|
|
|
import $modal from '@/plugins/modal.js'
|
|
|
import $tab from '@/plugins/tab.js'
|
|
|
import { convertToChineseCurrency } from '@/utils/ygoa.js'
|
|
|
+import { calCommonExp } from '@/utils/rpn.js'
|
|
|
import { getProcessInfo, getProcessForm, submitProcessForm, uploadFile } from '@/api/work.js'
|
|
|
const fieldTypeDict = {
|
|
|
'0': 'text',
|
|
|
@@ -168,142 +159,90 @@ function initProcessForm() {
|
|
|
getValidateRules()
|
|
|
// 生成第一个重复表数据
|
|
|
if (repeatingForm.value) {
|
|
|
- addrepeatingFormItem(0)
|
|
|
- }
|
|
|
-
|
|
|
- startEleIndex.value = formElements.value.findIndex((item) => '开始时间' == item.elementName)
|
|
|
- endEleIndex.value = formElements.value.findIndex((item) => '结束时间' == item.elementName)
|
|
|
- // console.log('startEle', startEleIndex.value);
|
|
|
- // console.log('endEle', endEleIndex.value);
|
|
|
- if (startEleIndex.value != -1 && endEleIndex.value != -1) { // 判断是否需要计算时间差
|
|
|
- // console.log('if (startEleIndex && endEleIndex)');
|
|
|
- timeFlag.value = true
|
|
|
- disableEndTime.value = true // 计算时间差时默认禁用结束时间选择器
|
|
|
- formElements.value[startEleIndex.value].defaultValue = new Date()
|
|
|
+ addRepeatingFormItem(0)
|
|
|
}
|
|
|
+ bindTimeRangeData()
|
|
|
})
|
|
|
}
|
|
|
|
|
|
-const startEleIndex = ref(0) // 开始时间
|
|
|
-const endEleIndex = ref(0) // 结束时间
|
|
|
-// 新增重复表表单
|
|
|
-function addrepeatingFormItem(index) {
|
|
|
- parseCalculation(repeatingForm.value.elementItem)
|
|
|
- const table = repeatingForm.value.elementItem.map(({ tableField, bddzText }) => {
|
|
|
- const item = {
|
|
|
- name: tableField,
|
|
|
- defaultValue: ""
|
|
|
- }
|
|
|
- if (bddzText != '') {
|
|
|
- const mulItem = bddzText.split('*')
|
|
|
- // 保存关联数据索引
|
|
|
- item['bddzText'] = mulItem.map(item => {
|
|
|
- // item['operation '].operands = mulItem.map(item => {
|
|
|
- return repeatingForm.value.elementItem.findIndex(({ elementName }) => item == elementName)
|
|
|
- })
|
|
|
- }
|
|
|
- return item
|
|
|
- })
|
|
|
- repeatingForm.value.elements.splice(index + 1, 0, table)
|
|
|
-}
|
|
|
-// 保存自定义变量运算信息
|
|
|
-function parseCalculation(items) {
|
|
|
- items.forEach((item, index) => {
|
|
|
- if (item.bddzText) {
|
|
|
- const tokens = item.bddzText.match(/[^\*\+\-\/\(\)\s]+|[\*\+\-\/\(\)]/g);
|
|
|
- if (tokens) {
|
|
|
- const calculation = { operators: [], variables: [] };
|
|
|
-
|
|
|
- tokens.forEach(token => {
|
|
|
- if (/[\*\+\-\/]/.test(token)) {
|
|
|
- calculation.operators.push(token); // 保存运算符
|
|
|
- } else if (/[a-zA-Z]+/.test(token)) {
|
|
|
- // 保存变量的索引
|
|
|
- const variableIndex = items.findIndex(i => i.elementName === token);
|
|
|
- if (-1 !== variableIndex) {
|
|
|
- calculation.variables.push(variableIndex);
|
|
|
- }
|
|
|
+const timeRangeItems = ref([
|
|
|
+ ['开始时间', '结束时间', '多少小时'],
|
|
|
+ ['出发时间', '预计返回时间'],
|
|
|
+ ['出差时间', '返回时间'],
|
|
|
+ ['出门时间', '预计返回时间'],
|
|
|
+ ['开始时间', '结束时间', '合计小时'],
|
|
|
+])
|
|
|
+// 关联时间变量
|
|
|
+function bindTimeRangeData() {
|
|
|
+ return new Promise<void>((resolve) => {
|
|
|
+ timeRangeItems.value.forEach((range) => {
|
|
|
+ const [startName, endName, bindName] = range;
|
|
|
+
|
|
|
+ // 找到 startName 和 endName 的索引
|
|
|
+ const startIndex = formElements.value.findIndex((item) => item.elementName === startName);
|
|
|
+ const endIndex = formElements.value.findIndex((item) => item.elementName === endName);
|
|
|
+
|
|
|
+ // 只有找到 startName 和 endName 后,才检查 bindName
|
|
|
+ if (startIndex !== -1 && endIndex !== -1) {
|
|
|
+ if (bindName) {
|
|
|
+ const bindIndex = formElements.value.findIndex((item) => item.elementName === bindName);
|
|
|
+ if (bindIndex !== -1) {
|
|
|
+ // 所有匹配项都存在,保存索引
|
|
|
+ formElements.value[startIndex].endElemIndex = endIndex;
|
|
|
+ formElements.value[endIndex].startElemIndex = startIndex;
|
|
|
+ formElements.value[bindIndex].bindTimeRange = {
|
|
|
+ startIndex,
|
|
|
+ endIndex
|
|
|
+ };
|
|
|
}
|
|
|
- });
|
|
|
-
|
|
|
- // 保存到当前项
|
|
|
- item.calculation = calculation;
|
|
|
+ } else {
|
|
|
+ // 没有 bindName,仅保存 start 和 end 的索引
|
|
|
+ formElements.value[startIndex].endElemIndex = endIndex;
|
|
|
+ formElements.value[endIndex].startElemIndex = startIndex;
|
|
|
+ }
|
|
|
+ // TODO 加班开始时间默认当天下班时间 请假时间默认当天上班时间
|
|
|
}
|
|
|
- }
|
|
|
+ });
|
|
|
+ resolve(); // 返回一个 resolved 状态的 Promise
|
|
|
});
|
|
|
- return items
|
|
|
}
|
|
|
-// 计算自定义变量值
|
|
|
-function calculateResult(item, items, valueItem) {
|
|
|
- // 运算符和变量索引
|
|
|
- const calculation = item.calculation;
|
|
|
- let result = 0;
|
|
|
-
|
|
|
- if (calculation) {
|
|
|
- // 先处理乘法和除法
|
|
|
- let operators = [...calculation.operators];
|
|
|
- let variables = [...calculation.variables];
|
|
|
-
|
|
|
- // 获取数值(这里使用defaultValue作为值)
|
|
|
- variables = variables.map(index => items[index].defaultValue);
|
|
|
-
|
|
|
- let mediateResults = [...variables];
|
|
|
- console.log('mediateResults (before operations): ', mediateResults);
|
|
|
-
|
|
|
- // 处理乘法和除法运算
|
|
|
- for (let i = 0; i < operators.length; i++) {
|
|
|
- if (operators[i] === "*" || operators[i] === "/") {
|
|
|
- if (operators[i] === "*") {
|
|
|
- mediateResults[i + 1] = mediateResults[i] * mediateResults[i + 1];
|
|
|
- } else if (operators[i] === "/") {
|
|
|
- mediateResults[i + 1] = mediateResults[i] / mediateResults[i + 1];
|
|
|
- }
|
|
|
- mediateResults[i] = 0; // 将已计算过的变量清零,防止重复使用
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // 再进行加法和减法计算
|
|
|
- result = mediateResults[0]; // 第一个变量的值
|
|
|
- console.log('mediateResults (after multiplication/division): ', mediateResults);
|
|
|
-
|
|
|
- for (let i = 1; i < mediateResults.length; i++) {
|
|
|
- if (operators[i - 1] === "+") {
|
|
|
- result += parseFloat(mediateResults[i]);
|
|
|
- } else if (operators[i - 1] === "-") {
|
|
|
- result -= parseFloat(mediateResults[i]);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // 将计算结果存储到valueItem
|
|
|
- valueItem.defaultValue = result;
|
|
|
- return result;
|
|
|
+// 计算时间差
|
|
|
+function calculateTimeDifference(item, table) {
|
|
|
+ // 获取 开始时间 和 结束时间
|
|
|
+ const { startIndex, endIndex } = item.bindTimeRange;
|
|
|
+ const startTime = new Date(table[startIndex].defaultValue);
|
|
|
+ const endTime = new Date(table[endIndex].defaultValue);
|
|
|
+
|
|
|
+ // 检查时间是否合法
|
|
|
+ if (isNaN(startTime.getTime()) || isNaN(endTime.getTime())) {
|
|
|
+ return item.defaultValue = 0
|
|
|
+ }
|
|
|
+
|
|
|
+ // 计算时间差
|
|
|
+ const timeDifferenceInMs = endTime - startTime;
|
|
|
+ let timeDifferenceInHours = (timeDifferenceInMs / (1000 * 60 * 60)).toFixed(1);
|
|
|
+ // let timeDifferenceInHours = (timeDifferenceInMs / (1000 * 60 * 60))
|
|
|
+ // // 计算小数部分
|
|
|
+ // const decimalPart = timeDifferenceInHours - Math.floor(timeDifferenceInHours)
|
|
|
+ // if (decimalPart >= 0.5) {
|
|
|
+ // // 如果小数部分大于等于 0.5,向上取整到 0.5 的倍数
|
|
|
+ // timeDifferenceInHours = Math.floor(timeDifferenceInHours) + 0.5;
|
|
|
+ // } else {
|
|
|
+ // // 如果小数部分小于 0.5,向下取整到 0.5 的倍数
|
|
|
+ // timeDifferenceInHours = Math.floor(timeDifferenceInHours);
|
|
|
+ // }
|
|
|
+ // 保存到 defaultValue
|
|
|
+ return item.defaultValue = timeDifferenceInHours;
|
|
|
}
|
|
|
-// 删除重复表表单
|
|
|
-function delrepeatingFormItem(index) {
|
|
|
- console.log("delrepeatingFormItem: " + index);
|
|
|
- $modal.confirm('', '确认删除该重复表数据')
|
|
|
- .then(() => {
|
|
|
- repeatingForm.value.elements.splice(index, 1)
|
|
|
- $repeatingForms.value.splice(index, 1)
|
|
|
- }).catch(() => { })
|
|
|
+
|
|
|
+function setTimeRange(e) {
|
|
|
+ // console.log('setTimeRange', e)
|
|
|
}
|
|
|
-function computedrepeatingFormItemValue(item, table) {
|
|
|
- let res = 1
|
|
|
- // console.log('item: ',item);
|
|
|
- // console.log('table: ',table);
|
|
|
- // console.log('convertToChineseCurrency', convertToChineseCurrency(res));
|
|
|
- item.bddzText.forEach(itemIndex => {
|
|
|
- res = res * table[itemIndex].defaultValue
|
|
|
- })
|
|
|
- item.defaultValue = res
|
|
|
- return res
|
|
|
+// 生成人民币大写
|
|
|
+function computedNumberToChineseCurrency(item, table) {
|
|
|
+ const elem = table.find(elem => elem.elementName == item.BddzText.slice(3))
|
|
|
+ return item.defaultValue = convertToChineseCurrency(elem.defaultValue)
|
|
|
}
|
|
|
-// function computedNumberToChineseCurrency(item, table) {
|
|
|
-// const res = convertToChineseCurrency(num)
|
|
|
-// item.defaultValue = res
|
|
|
-// return res
|
|
|
-// }
|
|
|
|
|
|
// 下拉框
|
|
|
function bindPickerChange(e, item) {
|
|
|
@@ -314,26 +253,52 @@ function formatDict(dict) {
|
|
|
return dict.map(({ enumVname }) => enumVname)
|
|
|
}
|
|
|
|
|
|
-const startTime = ref(0) // 开始时间
|
|
|
-const endTime = ref(0) // 结束时间
|
|
|
-const diffHours = ref(' ') // 时间差
|
|
|
-const timeFlag = ref(false) // 是否计算时间差
|
|
|
-const disableEndTime = ref(false) // 禁用 结束时间选择器
|
|
|
-// TODO 改为像计算金额一样 记录关联索引计算
|
|
|
-function setTimeRange(e) {
|
|
|
- if (timeFlag.value && '开始时间' == e.elementName) {
|
|
|
- startTime.value = e.defaultValue // 设置 开始时间
|
|
|
- disableEndTime.value = false // 解除 结束时间选择器 禁用
|
|
|
- }
|
|
|
- if (timeFlag.value && '结束时间' == e.elementName) {
|
|
|
- endTime.value = e.defaultValue // 设置 结束时间
|
|
|
+// 新增重复表表单
|
|
|
+function addRepeatingFormItem(index) {
|
|
|
+ const table = repeatingForm.value.elementItem.map(({ tableField, bddzText }) => {
|
|
|
+ const item = {
|
|
|
+ name: tableField,
|
|
|
+ defaultValue: '',
|
|
|
+ bddzText
|
|
|
+ }
|
|
|
+ return item
|
|
|
+ })
|
|
|
+ repeatingForm.value.elements.splice(index + 1, 0, table)
|
|
|
+}
|
|
|
+// 删除重复表表单
|
|
|
+function delRepeatingFormItem(index) {
|
|
|
+ $modal.confirm('', '确认删除该重复表数据')
|
|
|
+ .then(() => {
|
|
|
+ repeatingForm.value.elements.splice(index, 1)
|
|
|
+ $repeatingForms.value.splice(index, 1)
|
|
|
+ })
|
|
|
+ .catch(() => { })
|
|
|
+}
|
|
|
+
|
|
|
+// 计算重复表关联变量表达式结果值
|
|
|
+function calculateRepeatingFormExpression(item, table) {
|
|
|
+ // 提取表达式中的变量名
|
|
|
+ const variablePattern = /my:[\u4e00-\u9fa5]+/g;
|
|
|
+ let match;
|
|
|
+ let expression = item.bddzText
|
|
|
+ // 替换表达式中的变量
|
|
|
+ while ((match = variablePattern.exec(item.bddzText)) !== null) {
|
|
|
+ const variableName = match[0]; // 完整变量名
|
|
|
+ // 找到 重复表 中对应的索引
|
|
|
+ const index = repeatingForm.value.elementItem.findIndex(item => item.elementName === variableName);
|
|
|
+ if (index !== -1) {
|
|
|
+ const value = table[index]?.defaultValue || 0;
|
|
|
+ expression = expression.replace(match[0], value);
|
|
|
+ } else {
|
|
|
+ // 未匹配到的变量替换为 0
|
|
|
+ expression = expression.replace(match[0], 0);
|
|
|
+ }
|
|
|
}
|
|
|
- if (timeFlag.value && startTime.value && endTime.value) {
|
|
|
- const start = new Date(startTime.value).getTime() // 获取 开始时间 时间戳
|
|
|
- const end = new Date(endTime.value).getTime() // 获取 结束时间 时间戳
|
|
|
- const diffSec = Math.abs(end - start) // 获取 时间戳 差值
|
|
|
- diffHours.value = (diffSec / 1000 / 60 / 60).toFixed(2) // 计算 时间差值 并格式化 为只有2位小数
|
|
|
+ if (/[^0-9\+\-\*\/\(\)\.]/.test(expression)) {
|
|
|
+ console.error('错误的表达式:', expression);
|
|
|
+ return expression;
|
|
|
}
|
|
|
+ return item.defaultValue = calCommonExp(expression); // 返回填充后的表达式
|
|
|
}
|
|
|
|
|
|
const fileList = ref([]) // 文件列表
|
|
|
@@ -366,11 +331,9 @@ async function handleFileSelect(files) { // 新增文件
|
|
|
})
|
|
|
})
|
|
|
// console.log('UploadFiles', files.tempFiles);
|
|
|
-
|
|
|
}
|
|
|
function handleFileProgress(file, progress) {
|
|
|
// console.log('handleFileProgress', file, progress);
|
|
|
-
|
|
|
}
|
|
|
function handleFileSuccess(file, res) {
|
|
|
// console.log('handleFileSuccess', file, res);
|
|
|
@@ -432,7 +395,7 @@ function validateRepeatingForm2() {
|
|
|
repeatingFormsValue.value.forEach((item, index) => {
|
|
|
for (const elem in item) {
|
|
|
if (item[elem] == '') {
|
|
|
- $modal.msgError(`重复表 ${index+1} 数据填写错误`)
|
|
|
+ $modal.msgError(`重复表 ${index + 1} 数据填写错误`)
|
|
|
flag = false
|
|
|
return
|
|
|
}
|
|
|
@@ -450,7 +413,7 @@ function getValidateRules() {
|
|
|
repeatingForm.value.elementItem.forEach(elem => {
|
|
|
obj[elem.tableField] = {
|
|
|
rules: [
|
|
|
- {
|
|
|
+ {
|
|
|
required: true,
|
|
|
},
|
|
|
{
|
|
|
@@ -469,7 +432,7 @@ function getValidateRules() {
|
|
|
obj[elem.elementId] = {
|
|
|
rules: [
|
|
|
{
|
|
|
- required: '0' == elem.noNull,
|
|
|
+ required: '1' == elem.noNull,
|
|
|
},
|
|
|
{
|
|
|
format: formatTypeDict[elem.fieldType] || 'string',
|
|
|
@@ -497,8 +460,8 @@ function submitProcess() { // 提交表单
|
|
|
return obj;
|
|
|
}).value
|
|
|
// 主表数据校验
|
|
|
- $mainForm.value.validate().then(res=>{
|
|
|
-
|
|
|
+ $mainForm.value.validate().then(res => {
|
|
|
+
|
|
|
// 重复表数据校验
|
|
|
// validateRepeatingForm()
|
|
|
if (!validateRepeatingForm2()) {
|
|
|
@@ -540,46 +503,50 @@ function submitProcess() { // 提交表单
|
|
|
}, 1000)
|
|
|
}
|
|
|
})
|
|
|
-
|
|
|
}).catch(err => {
|
|
|
button_state.value = true
|
|
|
$modal.msgError('表单填写错误')
|
|
|
});
|
|
|
-
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
.process_container {
|
|
|
position: relative;
|
|
|
-
|
|
|
+
|
|
|
::v-deep .uni-forms {
|
|
|
.uni-forms-item__label {
|
|
|
font-size: calc(1rem + 0px) !important;
|
|
|
line-height: calc(1rem + 0px) !important;
|
|
|
font-weight: 600;
|
|
|
}
|
|
|
+
|
|
|
.uni-forms-item__content {
|
|
|
.uni-easyinput__content-textarea {
|
|
|
font-size: calc(14px + .5*(1rem - 16px)) !important;
|
|
|
}
|
|
|
+
|
|
|
.uni-easyinput__content-input {
|
|
|
font-size: calc(14px + .5*(1rem - 16px)) !important;
|
|
|
color: #333;
|
|
|
}
|
|
|
+
|
|
|
.uni-date {
|
|
|
.uni-icons {
|
|
|
font-size: calc(22px + .5*(1rem - 16px)) !important;
|
|
|
}
|
|
|
+
|
|
|
.uni-date__x-input {
|
|
|
font-size: calc(14px + .5*(1rem - 16px)) !important;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
::v-deep button {
|
|
|
font-size: calc(18px + .5*(1rem - 16px));
|
|
|
}
|
|
|
+
|
|
|
.main_container {
|
|
|
min-height: 30vh;
|
|
|
}
|
|
|
@@ -592,7 +559,7 @@ function submitProcess() { // 提交表单
|
|
|
// box-sizing: border-box;
|
|
|
.input_text {
|
|
|
color: #333;
|
|
|
- font-size: 14px;
|
|
|
+ font-size: calc(14px + .5*(1rem - 16px));
|
|
|
line-height: 35px;
|
|
|
height: 35px;
|
|
|
padding: 0 0 0 10px;
|
|
|
@@ -622,12 +589,13 @@ function submitProcess() { // 提交表单
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
.file_picker_container {
|
|
|
::v-deep .uni-card {
|
|
|
.uni-card__header-content-title {
|
|
|
font-size: calc(15px + .5*(1rem - 16px));
|
|
|
}
|
|
|
+
|
|
|
.uni-card__header-extra-text {
|
|
|
font-size: calc(15px + .5*(1rem - 16px));
|
|
|
}
|