feat: 更新一次选择研判报告
This commit is contained in:
@ -0,0 +1,148 @@
|
||||
<template>
|
||||
<el-dialog v-model="visible" title="指令反馈" width="50%" :before-close="handleClose">
|
||||
<div class="feedback-form">
|
||||
<!-- 报告类型下拉框 -->
|
||||
<div class="form-item">
|
||||
<label class="form-label">报告类型:</label>
|
||||
<el-select v-model="formData.bglx" placeholder="请选择报告类型" style="width: 100%">
|
||||
<el-option label="战术报告" value="01" />
|
||||
<el-option label="战略报告" value="02" />
|
||||
</el-select>
|
||||
</div>
|
||||
|
||||
<!-- 研判报告选择 -->
|
||||
<div class="form-item">
|
||||
<label class="form-label">研判报告:</label>
|
||||
<ReportSelectInput
|
||||
v-model="formData.ypmc"
|
||||
:bglx="formData.bglx"
|
||||
@change="handleReportChange"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<template #footer>
|
||||
<el-button @click="handleClose">关闭</el-button>
|
||||
<el-button type="primary" @click="handleSave" :loading="loading">保存</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive, watch } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import ReportSelectInput from './ReportSelectInput.vue'
|
||||
import { feedbackCommand } from '@/api/huiShangyp/judgmentCommand'
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
currentRow: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
})
|
||||
|
||||
const emit = defineEmits(['update:modelValue', 'success'])
|
||||
|
||||
const visible = ref(false)
|
||||
const loading = ref(false)
|
||||
|
||||
// 表单数据
|
||||
const formData = reactive({
|
||||
bglx: '01', // 默认战术报告
|
||||
ypmc: '', // 研判报告名称
|
||||
ypid: '' // 研判报告ID
|
||||
})
|
||||
|
||||
// 选中的报告数据
|
||||
const selectedReport = ref(null)
|
||||
|
||||
// 监听弹框显示状态
|
||||
watch(() => props.modelValue, (newVal) => {
|
||||
visible.value = newVal
|
||||
if (newVal && props.currentRow?.id) {
|
||||
// 重置表单
|
||||
formData.bglx = '01'
|
||||
formData.ypmc = ''
|
||||
formData.ypid = ''
|
||||
selectedReport.value = null
|
||||
}
|
||||
})
|
||||
|
||||
// 监听弹框关闭状态
|
||||
watch(visible, (newVal) => {
|
||||
emit('update:modelValue', newVal)
|
||||
})
|
||||
|
||||
// 报告选择变化处理
|
||||
const handleReportChange = (report) => {
|
||||
selectedReport.value = report
|
||||
if (report && report.id) {
|
||||
formData.ypid = report.id
|
||||
} else {
|
||||
formData.ypid = ''
|
||||
}
|
||||
}
|
||||
|
||||
// 关闭弹框
|
||||
const handleClose = () => {
|
||||
visible.value = false
|
||||
// 重置表单
|
||||
formData.bglx = '01'
|
||||
formData.ypmc = ''
|
||||
formData.ypid = ''
|
||||
selectedReport.value = null
|
||||
}
|
||||
|
||||
// 保存反馈
|
||||
const handleSave = async () => {
|
||||
if (!props.currentRow?.id) {
|
||||
ElMessage.error('请先选择要反馈的指令')
|
||||
return
|
||||
}
|
||||
|
||||
if (!formData.ypid) {
|
||||
ElMessage.error('请选择研判报告')
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
loading.value = true
|
||||
|
||||
const params = {
|
||||
zlid: props.currentRow.id,
|
||||
bglx: formData.bglx,
|
||||
ypid: formData.ypid
|
||||
}
|
||||
|
||||
await feedbackCommand(params)
|
||||
|
||||
ElMessage.success('反馈成功')
|
||||
emit('ok')
|
||||
handleClose()
|
||||
} catch (error) {
|
||||
console.error('反馈失败:', error)
|
||||
ElMessage.error('反馈失败,请重试')
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.feedback-form {
|
||||
.form-item {
|
||||
margin-bottom: 24px;
|
||||
|
||||
.form-label {
|
||||
display: block;
|
||||
margin-bottom: 8px;
|
||||
font-weight: 500;
|
||||
color: #303133;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@ -0,0 +1,158 @@
|
||||
<template>
|
||||
<div class="report-select-input">
|
||||
<el-input
|
||||
v-model="inputValue"
|
||||
placeholder="请选择研判报告"
|
||||
readonly
|
||||
@click="showDialog = true"
|
||||
>
|
||||
<template #suffix>
|
||||
<el-icon class="cursor-pointer" @click="showDialog = true">
|
||||
<ArrowDown />
|
||||
</el-icon>
|
||||
</template>
|
||||
</el-input>
|
||||
|
||||
<!-- 选择报告弹框 -->
|
||||
<el-dialog v-model="showDialog" title="选择研判报告" width="80%">
|
||||
<div class="dialog-content">
|
||||
<!-- 顶部筛选区域 -->
|
||||
<div class="filter-section">
|
||||
<el-radio-group v-model="reportType" @change="onTypeChange">
|
||||
<el-radio label="01">战术报告</el-radio>
|
||||
<el-radio label="02">战略报告</el-radio>
|
||||
</el-radio-group>
|
||||
<el-button type="primary" @click="handleQuery" :loading="loading">查询</el-button>
|
||||
</div>
|
||||
|
||||
<!-- 表格区域 -->
|
||||
<div class="table-section">
|
||||
<ReportSelectTable
|
||||
:tableData="tableData"
|
||||
:loading="loading"
|
||||
:selectedId="selectedId"
|
||||
@select="handleSelect"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<template #footer>
|
||||
<el-button @click="showDialog = false">关闭</el-button>
|
||||
<el-button type="primary" @click="handleConfirm">确定</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, watch } from 'vue'
|
||||
import { ArrowDown } from '@element-plus/icons-vue'
|
||||
import ReportSelectTable from './ReportSelectTable.vue'
|
||||
import { tacticalGet } from '@/api/huiShangyp/tacticalApi.js'
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
type: [String, Number],
|
||||
default: ''
|
||||
},
|
||||
bglx: {
|
||||
type: String,
|
||||
default: '01'
|
||||
}
|
||||
})
|
||||
|
||||
const emit = defineEmits(['update:modelValue', 'change'])
|
||||
|
||||
const inputValue = ref('')
|
||||
const showDialog = ref(false)
|
||||
const reportType = ref('01')
|
||||
const loading = ref(false)
|
||||
const tableData = ref([])
|
||||
const selectedId = ref('')
|
||||
const selectedReport = ref(null)
|
||||
|
||||
// 监听外部传入的值
|
||||
watch(() => props.modelValue, (newVal) => {
|
||||
inputValue.value = newVal || ''
|
||||
})
|
||||
|
||||
// 监听报告类型变化
|
||||
watch(() => props.bglx, (newVal) => {
|
||||
reportType.value = newVal || '01'
|
||||
})
|
||||
|
||||
// 监听报告类型变化,自动查询
|
||||
watch(reportType, () => {
|
||||
handleQuery()
|
||||
})
|
||||
|
||||
// 报告类型变化处理
|
||||
const onTypeChange = () => {
|
||||
selectedId.value = ''
|
||||
selectedReport.value = null
|
||||
}
|
||||
|
||||
// 查询报告列表
|
||||
const handleQuery = async () => {
|
||||
try {
|
||||
loading.value = true
|
||||
const params = {
|
||||
bglx: reportType.value,
|
||||
pageSize: 20,
|
||||
pageCurrent: 1
|
||||
}
|
||||
|
||||
const res = await tacticalGet(params)
|
||||
tableData.value = res.records || []
|
||||
} catch (error) {
|
||||
console.error('查询报告列表失败:', error)
|
||||
tableData.value = []
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 选择报告
|
||||
const handleSelect = (row) => {
|
||||
selectedId.value = row.id
|
||||
selectedReport.value = row
|
||||
}
|
||||
|
||||
// 确定选择
|
||||
const handleConfirm = () => {
|
||||
if (!selectedReport.value) {
|
||||
return
|
||||
}
|
||||
|
||||
inputValue.value = selectedReport.value.ypyt || selectedReport.value.zlbt || ''
|
||||
emit('update:modelValue', inputValue.value)
|
||||
emit('change', selectedReport.value)
|
||||
showDialog.value = false
|
||||
}
|
||||
|
||||
// 初始化时加载默认数据
|
||||
handleQuery()
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.report-select-input {
|
||||
.cursor-pointer {
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
.filter-section {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 20px;
|
||||
margin-bottom: 20px;
|
||||
padding: 16px;
|
||||
background: #f5f7fa;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.table-section {
|
||||
max-height: 400px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
</style>
|
||||
@ -0,0 +1,90 @@
|
||||
<template>
|
||||
<div class="report-select-table">
|
||||
<el-table :data="tableData" :loading="loading" height="600px"
|
||||
@selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" :reserve-selection="false" />
|
||||
<el-table-column label="研判议题" prop="ypyt" />
|
||||
<el-table-column label="研判要求" prop="ypyq" />
|
||||
<el-table-column label="研判时间" prop="ypsj" />
|
||||
<el-table-column label="发起部门" prop="ssbm" />
|
||||
</el-table>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, watch } from 'vue'
|
||||
|
||||
const props = defineProps({
|
||||
tableData: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
loading: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
selectedId: {
|
||||
type: [String, Number],
|
||||
default: ''
|
||||
}
|
||||
})
|
||||
|
||||
const emit = defineEmits(['select'])
|
||||
|
||||
const selectedRows = ref([])
|
||||
|
||||
// 监听选中ID变化,用于回显
|
||||
watch(() => props.selectedId, (newId) => {
|
||||
if (newId && props.tableData.length > 0) {
|
||||
// 清空当前选择
|
||||
selectedRows.value = []
|
||||
|
||||
// 找到对应的行并选中
|
||||
const targetRow = props.tableData.find(row => row.id === newId)
|
||||
if (targetRow) {
|
||||
selectedRows.value = [targetRow]
|
||||
}
|
||||
}
|
||||
}, { immediate: true })
|
||||
|
||||
// 监听表格数据变化,回显选中状态
|
||||
watch(() => props.tableData, () => {
|
||||
if (props.selectedId) {
|
||||
const targetRow = props.tableData.find(row => row.id === props.selectedId)
|
||||
if (targetRow) {
|
||||
selectedRows.value = [targetRow]
|
||||
}
|
||||
}
|
||||
}, { immediate: true })
|
||||
|
||||
// 选择变化处理
|
||||
const handleSelectionChange = (selection) => {
|
||||
// 由于是单选,只取第一个
|
||||
if (selection.length > 0) {
|
||||
// 清空之前的选择
|
||||
selectedRows.value = []
|
||||
// 设置新的选择
|
||||
setTimeout(() => {
|
||||
selectedRows.value = [selection[selection.length - 1]]
|
||||
emit('select', selection[selection.length - 1])
|
||||
}, 0)
|
||||
} else {
|
||||
selectedRows.value = []
|
||||
emit('select', null)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.report-select-table {
|
||||
|
||||
// 表格样式
|
||||
:deep(.el-table) {
|
||||
border: 1px solid #ebeef5;
|
||||
}
|
||||
|
||||
:deep(.el-table__header-wrapper) {
|
||||
background: #f5f7fa;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@ -31,6 +31,7 @@
|
||||
<el-link size="small" type="primary" @click="getDataById('detail', row)">详情</el-link>
|
||||
<el-link size="small" type="danger" @click="deleteFile(row)">删除</el-link>
|
||||
<el-link size="small" type="success" @click="sign(row)">签收</el-link>
|
||||
<el-link size="small" type="warning" @click="feedback(row)">反馈</el-link>
|
||||
</template>
|
||||
</MyTable>
|
||||
<Pages @changeNo="changeNo" @changeSize="changeSize" :tableHeight="pageData.tableHeight" :pageConfiger="{
|
||||
@ -40,6 +41,11 @@
|
||||
</div>
|
||||
</div>
|
||||
<AddForm ref="addForm" @getList="getList" :dict="{ D_BZ_YPFS, D_BZ_YPLX }" />
|
||||
<FeedbackDialog
|
||||
v-model="feedbackDialog"
|
||||
:currentRow="currentFeedbackRow"
|
||||
@ok="handleFeedbackSuccess"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
@ -51,6 +57,7 @@ import { useRoute } from 'vue-router'
|
||||
import { getJudgmentCommandList, deleteJudgmentCommand, signCommand,feedbackCommand } from "@/api/huiShangyp/judgmentCommand.js";
|
||||
import { reactive, ref, onMounted, getCurrentInstance, watch, computed } from "vue";
|
||||
import AddForm from "./addForm.vue";
|
||||
import FeedbackDialog from "./components/FeedbackDialog.vue";
|
||||
const { proxy } = getCurrentInstance();
|
||||
const { D_BZ_YPFS, D_BZ_YPLX } = proxy.$dict("D_BZ_YPFS", "D_BZ_YPLX")
|
||||
const detailDiloag = ref();
|
||||
@ -136,6 +143,8 @@ const tabHeightFn = () => {
|
||||
const route = useRoute()
|
||||
|
||||
const addForm = ref(null)
|
||||
const feedbackDialog = ref(false)
|
||||
const currentFeedbackRow = ref({})
|
||||
const getDataById = (type, row) => {
|
||||
addForm.value.init(type, row, '01');
|
||||
}
|
||||
@ -172,6 +181,16 @@ const sign = (row) => {
|
||||
proxy.$message.info('已取消签收');
|
||||
});
|
||||
}
|
||||
|
||||
const feedback = (row) => {
|
||||
currentFeedbackRow.value = row;
|
||||
feedbackDialog.value = true;
|
||||
}
|
||||
|
||||
const handleFeedbackSuccess = () => {
|
||||
// 反馈成功后刷新列表
|
||||
getList();
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
Reference in New Issue
Block a user