chenyc
2025-07-14 05c827fea632f004821cc746ba73880769fab7cd
src/views/home/components/dietary_survey.vue
@@ -1,17 +1,17 @@
<template>
    <div class="dietarySurvey-home" >
        <el-row   style="padding-left: 10px;">
        <el-row v-if="patientsInfo.id"  style="padding-left: 10px;">
            <el-form size="small" :inline="true" :model="state.formInline"> 
                <el-form-item label="调差表">
                <!-- <el-form-item label="调差表">
                    <el-select style="width: 120px;"
                        v-model="state.formInline.formTableName"
                        placeholder="不选默认查全部"
                        clearable
                    >
                        <el-option label="营养膳食调查表" value="营养膳食调查表" />
                        <el-option label="膳食生活调查表" value="膳食生活调查表" />
                        <el-option label="膳食调查表" value="膳食调查表" />
                    </el-select>
                </el-form-item>
                </el-form-item> -->
                <el-form-item label="填报日期">
                    <el-date-picker
                        v-model="state.formInline.date"
@@ -80,7 +80,6 @@
        </div>
        <el-empty v-if="!patientsInfo.id" description="无数据,请先选择患者"></el-empty>
        <editDietary  @shuaxin="onSubmit" ref="editDietaryRef"></editDietary>
        <editDietary2  @shuaxin="onSubmit" ref="editDietaryRef2"></editDietary2>
    </div>
</template>
@@ -97,7 +96,6 @@
const { patientsInfo } = storeToRefs(storesPat);
const props = defineProps(['tableHeight'])
const editDietaryRef=ref()
const editDietaryRef2=ref()
const router = useRouter()
const shortcuts = [
  {
@@ -136,7 +134,7 @@
    loading: false,
    formInline:{
        user: '',
        formTableName:'',
        formTableName:'膳食生活调查表',
        date: [],
    },
    dialogTableVisible:false
@@ -160,13 +158,13 @@
    const pasm={
        page: state.page,
        size: state.size,
        wherecondition: `patient_code = '${patientsInfo.value.code}'`,
        wherecondition:`survery_form_type=0 and patient_code='${patientsInfo.value.code}'`,
        ordercondition: 'survery_time desc'
    }
    if(state.formInline.date.length===2){
    if(state.formInline?.date?.length===2){
        pasm.wherecondition+=` and survery_time BETWEEN '${state.formInline.date[0]} 00:00:00' AND '${state.formInline.date[1]} 23:59:59'`
    }
    if(state.formInline.formTableName){
    if(state.formInline?.formTableName){
        pasm.wherecondition+=`and suvery_form_name='${state.formInline.formTableName}'`
    }
    const loading = ElLoading.service({
@@ -183,15 +181,7 @@
}
const addItem=()=>{
    
    if(state.formInline.formTableName){
        if(state.formInline.formTableName==='膳食调查表'){
            editDietaryRef.value.openShow('add')
        }else if(state.formInline.formTableName==='营养膳食调查表'){
            editDietaryRef2.value.openShow('add')
        }
    }else{
        ElMessage.warning('请先选择你要添加的表单名称!')
    }
    editDietaryRef.value.openShow('add')
    // router.push({path:'/tiaochabiao1',query:{type:'add',id:0}})
}
// 第一步:定义子组件里面的方法
@@ -199,10 +189,10 @@
    const pasm = {
        page: 1,
        size: 10,
        wherecondition:`patient_code='${patientsInfo.value.code}'`,
        wherecondition:`survery_form_type=0 and patient_code='${patientsInfo.value.code}'`,
        ordercondition:'survery_time DESC'
    }
    if(state.formInline.date.length===2){
    if(state.formInline?.date?.length===2){
        pasm.wherecondition+=`and survery_time BETWEEN '${state.formInline.date[0]} 00:00:00' AND '${state.formInline.date[1]} 23:59:59'`
    }
    if(state.formInline.formTableName){
@@ -231,15 +221,8 @@
 * 编辑
 */
const handleEdit = (index: number, row: any) => {
  console.log(index, row)
  if(state.formInline.formTableName){
        if(state.formInline.formTableName==='膳食调查表'){
            editDietaryRef.value.openShow('update',row)
        }else if(state.formInline.formTableName==='营养膳食调查表'){
            editDietaryRef2.value.openShow('update',row)
        }
    }
//   editDietaryRef.value.openShow('update',row)
  console.log(index, row,state.formInline.formTableName)
  editDietaryRef.value.openShow('update',row)
}
const handleDelete = (index: number, row: any) => {
  console.log(index, row)