|
|
@@ -40,25 +40,25 @@
|
|
|
</uni-forms>
|
|
|
</uni-card>
|
|
|
|
|
|
- <view v-if="repeatingTable.elementItem.length > 0" class="repeating_table">
|
|
|
- <uni-card v-for="(table, tableIndex) in repeatingTable.elements" margin="10px" spacing="0"
|
|
|
+ <view v-if="repeatingForm.elementItem.length > 0" class="repeating_table">
|
|
|
+ <uni-card v-for="(table, tableIndex) in repeatingForm.elements" margin="10px" spacing="0"
|
|
|
:key="tableIndex">
|
|
|
<uni-forms label-position="left" :label-width="125" :border="true">
|
|
|
<uni-forms-item v-for="(item, itemIndex) in table"
|
|
|
- :label="repeatingTable.elementItem[itemIndex].elementName.slice(3)" :key="itemIndex">
|
|
|
- <uni-easyinput v-if="repeatingTable.elementItem[itemIndex].bddzText" :disabled="true"
|
|
|
- :placeholder="''" :value="computedRepeatingTableItemValue(item, table)"></uni-easyinput>
|
|
|
+ :label="repeatingForm.elementItem[itemIndex].elementName.slice(3)" :key="itemIndex">
|
|
|
+ <uni-easyinput v-if="repeatingForm.elementItem[itemIndex].bddzText" :disabled="true"
|
|
|
+ :placeholder="''" :value="computedrepeatingFormItemValue(item, table)"></uni-easyinput>
|
|
|
<uni-easyinput v-else placeholder="请输入内容" v-model="item.value"></uni-easyinput>
|
|
|
</uni-forms-item>
|
|
|
</uni-forms>
|
|
|
<view class="repeating_table_button_container">
|
|
|
<uni-row>
|
|
|
<uni-col :span="10" :offset="1">
|
|
|
- <button @click="addRepeatingTableItem(tableIndex)" type="primary">新增</button>
|
|
|
+ <button @click="addrepeatingFormItem(tableIndex)" type="primary">新增</button>
|
|
|
</uni-col>
|
|
|
<uni-col :span="10" :offset="2">
|
|
|
- <button @click="delRepeatingTableItem(tableIndex)"
|
|
|
- :disabled="repeatingTable.elements.length <= 1" type="warn">删除</button>
|
|
|
+ <button @click="delrepeatingFormItem(tableIndex)"
|
|
|
+ :disabled="repeatingForm.elements.length <= 1" type="warn">删除</button>
|
|
|
</uni-col>
|
|
|
</uni-row>
|
|
|
</view>
|
|
|
@@ -80,6 +80,7 @@ import { onLoad } from '@dcloudio/uni-app'
|
|
|
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 { getProcessInfo, getProcessForm, submitProcessForm, uploadFile } from '@/api/work.js'
|
|
|
|
|
|
let processInfo = reactive({
|
|
|
@@ -128,10 +129,10 @@ function initProcessInfo() {
|
|
|
function initProcessForm() {
|
|
|
getProcessForm(userStore.user, processInfo).then(({ returnParams }) => {
|
|
|
formElements.value = returnParams.formElements
|
|
|
- repeatingTable.value = returnParams.repeatingTable
|
|
|
+ repeatingForm.value = returnParams.repeatingForm
|
|
|
// 生成第一个重复表数据
|
|
|
- if (repeatingTable.value) {
|
|
|
- addRepeatingTableItem(0)
|
|
|
+ if (repeatingForm.value) {
|
|
|
+ addrepeatingFormItem(0)
|
|
|
}
|
|
|
|
|
|
startEleIndex.value = formElements.value.findIndex((item) => '开始时间' == item.elementName)
|
|
|
@@ -148,14 +149,14 @@ function initProcessForm() {
|
|
|
}
|
|
|
|
|
|
const formElements = ref([])
|
|
|
-const repeatingTable = ref({
|
|
|
+const repeatingForm = ref({
|
|
|
elementItem: [],
|
|
|
elements: []
|
|
|
})
|
|
|
const startEleIndex = ref(0) // 开始时间
|
|
|
const endEleIndex = ref(0) // 结束时间
|
|
|
-function addRepeatingTableItem(index) {
|
|
|
- const table = repeatingTable.value.elementItem.map(({ tableField, bddzText }) => {
|
|
|
+function addrepeatingFormItem(index) {
|
|
|
+ const table = repeatingForm.value.elementItem.map(({ tableField, bddzText }) => {
|
|
|
const item = {
|
|
|
name: tableField,
|
|
|
value: ""
|
|
|
@@ -163,29 +164,30 @@ function addRepeatingTableItem(index) {
|
|
|
if (bddzText != '') {
|
|
|
const mulItem = bddzText.split('*')
|
|
|
item['bddzText'] = mulItem.map(item => {
|
|
|
- return repeatingTable.value.elementItem.findIndex(({ elementName }) => item == elementName)
|
|
|
+ return repeatingForm.value.elementItem.findIndex(({ elementName }) => item == elementName)
|
|
|
})
|
|
|
}
|
|
|
return item
|
|
|
})
|
|
|
- repeatingTable.value.elements.splice(index + 1, 0, table)
|
|
|
+ repeatingForm.value.elements.splice(index + 1, 0, table)
|
|
|
}
|
|
|
-function delRepeatingTableItem(index) {
|
|
|
- console.log("delRepeatingTableItem: " + index);
|
|
|
+function delrepeatingFormItem(index) {
|
|
|
+ console.log("delrepeatingFormItem: " + index);
|
|
|
$modal.confirm('', '确认删除该重复表数据')
|
|
|
.then(() => {
|
|
|
- repeatingTable.value.elements.splice(index, 1)
|
|
|
+ repeatingForm.value.elements.splice(index, 1)
|
|
|
})
|
|
|
.catch(err => {
|
|
|
|
|
|
})
|
|
|
}
|
|
|
-function computedRepeatingTableItemValue(item, table) {
|
|
|
+function computedrepeatingFormItemValue(item, table) {
|
|
|
let res = 1
|
|
|
item.bddzText.forEach(itemIndex => {
|
|
|
res = res * table[itemIndex].value
|
|
|
})
|
|
|
item.value = res
|
|
|
+ console.log('convertToChineseCurrency', convertToChineseCurrency(res));
|
|
|
return res
|
|
|
}
|
|
|
|
|
|
@@ -278,7 +280,7 @@ function submitProcess() { // 提交表单
|
|
|
processInfo.form = formElements.value.map(({ tableField, defaultValue }) => {
|
|
|
return { name: tableField, value: defaultValue }
|
|
|
})
|
|
|
- repeatingTable.value.elements.forEach((item, index) => {
|
|
|
+ repeatingForm.value.elements.forEach((item, index) => {
|
|
|
const newItem = item.map(({ name, value }) => {
|
|
|
return {
|
|
|
name: name + '_' + (index + 1),
|
|
|
@@ -288,7 +290,7 @@ function submitProcess() { // 提交表单
|
|
|
processInfo.form.push(...newItem)
|
|
|
})
|
|
|
// console.log('submitProcessForm', processInfo.form);
|
|
|
- // console.log('repeatingTable', repeatingTable.value);
|
|
|
+ // console.log('repeatingForm', repeatingForm.value);
|
|
|
// console.log('formElements', formElements.value);
|
|
|
// console.log('fileList', fileList.value);
|
|
|
// console.log('fileSeqs', fileSeqs.value);
|