| | |
| | | style="margin-bottom: 10px"> |
| | | <div> |
| | | 标题: |
| | | <el-input v-model="jianyi.bt" size="small" type="textarea" autosize></el-input> |
| | | <el-input v-model="jianyi.bt" size="small" type="textarea" autosize |
| | | @blur="handleAdviceBlur(props.row, index1)"></el-input> |
| | | </div> |
| | | <div> |
| | | 内容: |
| | | <el-input v-model="jianyi.nr" size="small" type="textarea" autosize></el-input> |
| | | <el-input v-model="jianyi.nr" size="small" type="textarea" autosize |
| | | @blur="handleAdviceBlur(props.row, index1)"></el-input> |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | <div v-else> |
| | | <div> |
| | | 标题: |
| | | <el-input v-model="emptyAdvice.bt" size="small" type="textarea" autosize></el-input> |
| | | <el-input v-model="emptyAdvice.bt" size="small" type="textarea" autosize |
| | | @blur="handleAdviceBlur(props.row, -1)"></el-input> |
| | | </div> |
| | | <div> |
| | | 内容: |
| | | <el-input v-model="emptyAdvice.nr" size="small" type="textarea" autosize></el-input> |
| | | <el-input v-model="emptyAdvice.nr" size="small" type="textarea" autosize |
| | | @blur="handleAdviceBlur(props.row, -1)"></el-input> |
| | | </div> |
| | | </div> |
| | | |
| | | |
| | | <div style="margin-top: 10px;"> |
| | | <el-button @click="shanchu(props.row)" type="danger" size="small">删除</el-button> |
| | |
| | | style="margin-bottom: 10px"> |
| | | <div> |
| | | 标题: |
| | | <el-input v-model="jianyi.bt" size="small" type="textarea" autosize></el-input> |
| | | <el-input v-model="jianyi.bt" size="small" type="textarea" autosize |
| | | @blur="handleAdviceBlur(props.row, index1)"></el-input> |
| | | </div> |
| | | <div> |
| | | 内容: |
| | | <el-input v-model="jianyi.nr" size="small" type="textarea" autosize></el-input> |
| | | <el-input v-model="jianyi.nr" size="small" type="textarea" autosize |
| | | @blur="handleAdviceBlur(props.row, index1)"></el-input> |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | <div v-else> |
| | | <div> |
| | | 标题: |
| | | <el-input v-model="emptyAdvice.bt" size="small" type="textarea" autosize></el-input> |
| | | <el-input v-model="emptyAdvice.bt" size="small" type="textarea" autosize |
| | | @blur="handleAdviceBlur(props.row, -1)"></el-input> |
| | | </div> |
| | | <div> |
| | | 内容: |
| | | <el-input v-model="emptyAdvice.nr" size="small" type="textarea" autosize></el-input> |
| | | <el-input v-model="emptyAdvice.nr" size="small" type="textarea" autosize |
| | | @blur="handleAdviceBlur(props.row, -1)"></el-input> |
| | | </div> |
| | | </div> |
| | | |
| | | |
| | | <div style="margin-top: 10px;"> |
| | | <el-button @click="shanchu(props.row)" type="danger" size="small">删除</el-button> |
| | |
| | | <el-input v-model="advice.bt" placeholder="请输入建议标题" clearable @focus="tan"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="建议内容" :prop="'map.' + index + '.nr'"> |
| | | <el-input v-model="advice.nr" type="textarea" rows="3" placeholder="请输入建议内容" resize="none" @focus="tan"></el-input> |
| | | <el-input v-model="advice.nr" type="textarea" rows="3" placeholder="请输入建议内容" resize="none" |
| | | @focus="tan"></el-input> |
| | | </el-form-item> |
| | | <el-button v-if="index > 0" type="danger" size="small" @click="removeAdvice(index)" |
| | | style="margin-left: 100px; margin-bottom: 10px;">删除</el-button> |
| | |
| | | |
| | | |
| | | <!-- 分页组件 --> |
| | | <div class="pag"> |
| | | <div class="pag"> |
| | | <div class="pag2"> |
| | | <pagination v-show="total1 > 0" :total="total1" :page.sync="queryParams1.pageNum" |
| | | :limit.sync="queryParams1.pageSize" @pagination="filterAdvices(false)" /> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button @click="showjianyi = false">取消</el-button> |
| | | <el-button type="primary" @click="applySelectedAdvice" :disabled="!selectedAdvice">确定</el-button> |
| | |
| | | }); |
| | | }, |
| | | methods: { |
| | | handleAdviceBlur(row, index) { |
| | | // 构造 advices 数据 |
| | | let advicesToSubmit = []; |
| | | |
| | | if (index === -1) { |
| | | // advices 为空,使用 emptyAdvice 的值 |
| | | if (this.emptyAdvice.bt || this.emptyAdvice.nr) { |
| | | advicesToSubmit = [{ bt: this.emptyAdvice.bt || '', nr: this.emptyAdvice.nr || '' }]; |
| | | // 将 emptyAdvice 的值赋值给 row.advices |
| | | this.$set(row, 'advices', advicesToSubmit); |
| | | } |
| | | } else { |
| | | // advices 不为空,直接使用 row.advices |
| | | advicesToSubmit = row.advices; |
| | | } |
| | | |
| | | // 如果 advicesToSubmit 为空或没有有效数据,不提交 |
| | | if (!advicesToSubmit || advicesToSubmit.length === 0) { |
| | | return; |
| | | } |
| | | |
| | | |
| | | const parentItem = this.yichangList.find(item => |
| | | item.sone.some(soneItem => soneItem.orderDetailId === row.orderDetailId) |
| | | ); |
| | | |
| | | if (!parentItem) { |
| | | this.$message.error('未找到对应的父级项目'); |
| | | return; |
| | | } |
| | | |
| | | const data = { |
| | | tjh: this.tableAll.tjNumber, // 体检号 |
| | | parentName: parentItem.proName, // 父级项目名称 |
| | | jcxm: row.proName, // 检测项目 |
| | | jcjg: row.proResult, // 检测结果 |
| | | ckfw: row.stanId, // 参考范围 |
| | | dw: row.proAdvice, // 单位 |
| | | map: advicesToSubmit, // 建议列表 |
| | | jyjc: parentItem.jyjc, // 检查类型(0 或 1) |
| | | id: row.orderDetailId, // 当前项的 orderDetailId |
| | | }; |
| | | |
| | | addOrder1(data).then((res) => { |
| | | if (res.code === 200) { |
| | | |
| | | } else { |
| | | this.$message.error('建议更新失败:' + (res.msg || '未知错误')); |
| | | } |
| | | }).catch((error) => { |
| | | console.error('建议更新失败:', error); |
| | | this.$message.error('建议更新失败:' + error.message); |
| | | }); |
| | | }, |
| | | handleCurrentChangeAdvice(currentRow) { |
| | | this.selectedAdvice = currentRow; // 存储选中的建议项 |
| | | }, |
| | |
| | | this.$message.warning('至少保留一组建议'); |
| | | } |
| | | }, |
| | | |
| | | shanchu(row) { |
| | | // 禁用删除按钮,防止重复点击 |
| | | this.isdisabled = true; |
| | | |
| | | // 调用后端接口删除数据 |
| | | shanchu({ |
| | | id: row.orderDetailId, |
| | | }).then((res) => { |
| | | if (res.code === 200) { // 添加成功响应检查 |
| | | if (res.code === 200) { // 后端删除成功 |
| | | // 找到要删除项所在的父级数组 |
| | | const parentItem = this.yichangList.find(item => |
| | | item.sone.some(soneItem => soneItem.proId === row.proId) |
| | | item.sone.some(soneItem => soneItem.orderDetailId === row.orderDetailId) |
| | | ); |
| | | |
| | | if (parentItem) { |
| | | // 从父级的 sone 数组中删除该项 |
| | | const index = parentItem.sone.findIndex(item => item.proId === row.proId); |
| | | const index = parentItem.sone.findIndex(item => item.orderDetailId === row.orderDetailId); |
| | | if (index > -1) { |
| | | parentItem.sone.splice(index, 1); |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | // 更新 expends 数组 |
| | | // 更新 expends 数组,确保展开状态正确 |
| | | this.getExpends(); |
| | | |
| | | // 强制刷新表格 |
| | | this.$forceUpdate(); |
| | | |
| | | this.$message.success('删除成功'); |
| | | |
| | | // 自动更新异常结果数据 |
| | | this.yichangjieguo(); |
| | | // 可选:调用 yichangjieguo 刷新数据(如果需要与后端同步) |
| | | // this.yichangjieguo(); |
| | | } else { |
| | | this.$message.error('未找到要删除的子项'); |
| | | } |
| | | } else { |
| | | this.$message.error('未找到要删除的父项'); |
| | | } |
| | | } else { |
| | | this.$message.error('删除失败'); |
| | | this.$message.error('后端删除失败:' + (res.msg || '未知错误')); |
| | | } |
| | | }).catch((error) => { |
| | | console.error('删除失败:', error); |
| | | this.$message.error('删除操作失败'); |
| | | this.$message.error('删除操作失败:' + error.message); |
| | | }).finally(() => { |
| | | // 恢复删除按钮状态 |
| | | this.isdisabled = false; |
| | | }); |
| | | }, |
| | | |
| | | // 确保 getExpends 方法存在,用于更新展开状态 |
| | | getExpends() { |
| | | this.expends = this.yichangList.flatMap(item => |
| | | item.sone.map(soneItem => soneItem.orderDetailId) |
| | | ); |
| | | console.log('Updated expends:', this.expends); |
| | | }, |
| | | getConfigKey() { |
| | | getconfigKey("sfkqtwbg").then((res) => { |
| | |
| | | }); |
| | | }, |
| | | //设置table中的扩展项,展开的id,此处我需要全部展开 |
| | | getExpends() { |
| | | // 通过flatMap将每个sone数组中的ID提取出来,并返回一个扁平化的ID数组 |
| | | this.expends = this.yichangList.flatMap((item) => |
| | | item.sone.map((subItem) => subItem.proId) |
| | | ); |
| | | }, |
| | | |
| | | |
| | | getRowKeys(row) { |
| | | return row.orderDetailId; |
| | |
| | | }).then((res) => { |
| | | this.yichangList = res.data; |
| | | |
| | | console.log(this.yichangList, 3232); |
| | | this.getExpends(); |
| | | |
| | | |
| | | this.yichangList.forEach((item) => { |
| | | item.sone.forEach((soneItem) => { |
| | |
| | | margin-top: 15px; |
| | | /* 与表格的间距 */ |
| | | } |
| | | |
| | | .pag2 { |
| | | width: auto; |
| | | /* 移除固定宽度,让分页器根据内容自适应 */ |
| | |
| | | text-align: center; |
| | | /* 确保分页器内部元素居中 */ |
| | | } |
| | | @media (max-width: 768px) { |
| | | |
| | | @media (max-width: 750px) { |
| | | .pag2 { |
| | | min-width: 300px; /* 移动端最小宽度 */ |
| | | overflow-x: auto; /* 允许横向滚动 */ |
| | | padding: 10px; /* 移动端内边距 */ |
| | | min-width: 300px; |
| | | /* 移动端最小宽度 */ |
| | | overflow-x: auto; |
| | | /* 允许横向滚动 */ |
| | | padding: 10px; |
| | | /* 移动端内边距 */ |
| | | } |
| | | } |
| | | |