1.8.0前端

fix(AI):完善AI智能填充form功能
master
xs 3 weeks ago
parent 463053ae0f
commit 3d4e7bb0c8

@ -385,12 +385,17 @@ watch(selectedFormSettingId, async (formSettingId) => {
// proxy.$store.commit('aiFormSettingId', formSettingId)
// proxy.$store.commit('aiFormSetting', formPageMap.value[formSettingId])
} else {
isShowLeft.value = true
currentSize.value = "form";
const mod = await formPageMap.value[formSettingId].loader()
console.log(formPageMap.value[formSettingId].props)
currentComponent.value = mod.default
currentProps.value = {...formPageMap.value[formSettingId].props, userInput: ''}
isShowLeft.value = false
currentSize.value = "menu";
router.push({path: "/" + formPageMap.value[formSettingId].props.formPath, query: {from: "ai"}})
// alert(2)
// isShowLeft.value = true
// currentSize.value = "form";
// const mod = await formPageMap.value[formSettingId].loader()
// console.log(formPageMap.value[formSettingId].props)
// currentComponent.value = mod.default
// currentProps.value = {...formPageMap.value[formSettingId].props, userInput: ''}
}
@ -659,7 +664,12 @@ const handleSend = async (selectedText?: string) => {
})
} else {
//使
currentProps.value = sendForm.value;
// currentProps.value = sendForm.value;
sharedStore.updateDynamicValue({
message: sendForm.value,
timestamp: new Date().toLocaleString()
})
}
@ -796,7 +806,7 @@ const toggleRecording = () => {
//
async function startRecording() {
try {
//
// (使https)
if (!navigator.mediaDevices || !navigator.mediaDevices.getUserMedia) {
proxy.$modal.msgError('您的浏览器不支持录音功能')
return

@ -90,6 +90,10 @@
import { ref } from 'vue';
import { ElMessage } from 'element-plus';
import { filterEmptyValues, copyNonEmptyValues } from '@/api/objectUtil';
import { useSharedDataStore } from '@/api/monitorData'
const sharedStore = useSharedDataStore()
interface FormData {
completeAmount: number;
productionTime: number;
@ -111,19 +115,35 @@ const formData = reactive<FormData>({
// }
// })
// props
//
watch(
() => ({ ...props }),
(newProps) => {
Object.keys(formData).forEach(key => {
if (newProps[key] !== undefined) {
formData[key] = newProps[key]
}
})
() => sharedStore.dynamicValue,
(newValue, oldValue) => {
if (newValue!=null && newValue.message!=null && newValue !== oldValue) {
ElMessage.info('收到新数据更新')
//
// handleDataUpdate(newValue)
copyNonEmptyValues(newValue.message,formData);
//onchange
}
},
{ immediate: true, deep: true }
{ deep: true } //
)
// props
// watch(
// () => ({ ...props }),
// (newProps) => {
// Object.keys(formData).forEach(key => {
// if (newProps[key] !== undefined) {
// formData[key] = newProps[key]
// }
// })
// },
// { immediate: true, deep: true }
// )
const processOptions = [
{ label: '工序A', value: 'processA' },
{ label: '工序B', value: 'processB' },

Loading…
Cancel
Save