feat:组价修改

This commit is contained in:
houjunxiang
2026-01-13 10:38:07 +08:00
parent 351c66086b
commit 4d8e7b7a06
4 changed files with 51 additions and 48 deletions

View File

@@ -34,29 +34,28 @@
:placeholder="field.placeholder"
:disabled="field.disabled || field.fillingWay == 'calculate'"
/>
<!--select-->
<view v-if="field.type == 'select'" class="x-bc select-my" @click="handleFieldClick(field)">
<text v-if="field.value">{{ field.value }}</text>
<text v-else>请选择</text>
<u-icon name="arrow-down" size="20"></u-icon>
</view>
<u-picker
v-if="field.type == 'select'"
:show="field.showPicker"
:columns="[field.options]"
keyName="displayName"
@cancel="field.showPicker = false"
@confirm="event => pickerConfirm(event, field)"
/>
<uni-data-select v-if="field.type == 'Select'" v-model="field.value" :localdata="field.options">
<template v-slot:selected="{ selectedItems }">
<view v-if="selectedItems.length == 0" style="color: #c0c4cc"> 请选择 </view>
<view v-else v-html="selectedItems[0].value"> </view>
</template>
<template v-slot:option="{ item, itemSelected }">
<uni-list-item :disabled="item.disable">
<template #body>
<view v-html="item.label"></view>
</template>
</uni-list-item>
</template>
</uni-data-select>
<!--日期-->
<view v-if="field.type == 'date'" class="x-bc select-my" @click="handleFieldClick(field)">
<view v-if="field.type == 'Date'" class="x-bc select-my" @click="handleFieldClick(field)">
<text v-if="field.value">{{ nx.$dayjs(field.value).format('YYYY-MM-DD HH:mm:ss') }}</text>
<text v-else>请选择</text>
<u-icon name="calendar-fill" size="20"></u-icon>
</view>
<u-datetime-picker
v-if="field.type == 'date'"
v-if="field.type == 'Date'"
:show="field.showPicker"
v-model="curDate"
mode="datetime"
@@ -103,7 +102,7 @@ const staticFormSchema = [
{ label: '指派单号', fieldKey: 'businessAssayTaskId', hidden: true },
{ label: '检测方法', type: 'Input', fieldKey: 'assayMethodName' },
{ label: '分析人', type: 'Input', fieldKey: 'assayOperator', disabled: true },
{ label: '检测时间', type: 'date', fieldKey: 'assayTime' }
{ label: '检测时间', type: 'Date', fieldKey: 'assayTime' }
]
let dynamicFormSchema = []
@@ -111,8 +110,7 @@ let dynamicFormSchema = []
onLoad(param => {
if (param.currentTaskId) {
currentTaskId.value = param.currentTaskId
configReportTemplateKey.value = param.configReportTemplateKey
configReportTemplateKey.value = param.configReportTemplateKey
}
loadTaskDetail()
})
@@ -152,12 +150,19 @@ async function loadTaskDetail() {
dataCollectionParams.dataCollectionKey = dataCollectionKey
}
const data = await nx.$api.assayTask.getDynamicBaseFormSchema(dataCollectionParams)
dynamicFormSchema = data.map(item => ({
label: item.fieldName,
fieldKey: item.fieldKey,
type: item.fieldType,
placeholder: '请输入'
}))
dynamicFormSchema = data.map(item => {
let customConfig = JSON.parse(item.customConfig)
let field = {
label: item.fieldName,
fieldKey: item.fieldKey,
type: item.fieldType,
placeholder: '请输入'
}
if (customConfig?.componentProps?.options) {
field.options = customConfig.componentProps.options
}
return field
})
formFields.value = [...staticFormSchema, ...dynamicFormSchema]
bindFormValue()
@@ -201,10 +206,10 @@ async function updateTableDataByConfigFields() {
if (!columnObj) continue
tab.tableData.forEach(row => {
// 赋值配置列参与计算
if(row[columnObj.fieldIndex]){
row[columnObj.fieldIndex].value = formData[key]
calcRowAnalysisValue(row, columnObj, tab.columns)
}
if (row[columnObj.fieldIndex]) {
row[columnObj.fieldIndex].value = formData[key]
calcRowAnalysisValue(row, columnObj, tab.columns)
}
})
}
}
@@ -271,10 +276,8 @@ const realFormData = computed(() => {
// 实际保存逻辑
async function handleSave(change) {
let params = {}
const dynamicData = Object.fromEntries(
Object.entries(realFormData.value).filter(([key]) => key !== 'assayTime')
);
const dynamicData = Object.fromEntries(Object.entries(realFormData.value).filter(([key]) => key !== 'assayTime'))
console.log(dynamicData)
if (change) {
// 计算样品数据