|
@@ -15,65 +15,73 @@
|
|
|
<!-- <el-button v-if="is_filling_ended === 0" type="primary" @click="handleReport()">智能识别</el-button>-->
|
|
|
<!-- </el-col>-->
|
|
|
<el-col :span="1.5">
|
|
|
- <el-button v-if="is_filling_ended === 0" type="primary" @click="handleSaveTemporarily()">暂存</el-button>
|
|
|
+ <el-button v-if="is_filling_ended === 0" type="primary" @click="handleSaveTemporarily(1)">暂存</el-button>
|
|
|
</el-col>
|
|
|
<el-col :span="1.5">
|
|
|
- <el-button v-if="is_filling_ended === 0" type="primary" @click="handleData()">数据</el-button>
|
|
|
+ <el-button v-if="reportInfo.issued_status === 2" type="primary" @click="handleData()">数据</el-button>
|
|
|
</el-col>
|
|
|
<el-col :span="1.5">
|
|
|
- <el-button v-if="is_filling_ended === 0" type="primary" @click="handleSave()">发布</el-button>
|
|
|
+ <el-button v-if="is_filling_ended === 0" type="primary" @click="handleSave(2)">发布</el-button>
|
|
|
</el-col>
|
|
|
<el-col :span="1.5">
|
|
|
<el-button type="danger" @click="handleReturn()">返回</el-button>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
- <el-col :lg="30" :xs="24" style="">
|
|
|
- <el-row :span="24" :gutter="10">
|
|
|
- <el-col :span="8">
|
|
|
- <el-form-item label="联系人姓名:" prop="creator_name" label-width="auto">
|
|
|
- <div>{{ reportInfo.creator_name }}</div>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="8">
|
|
|
- <el-form-item label="联系电话:" prop="creator_phone" label-width="auto">
|
|
|
- <div>{{ reportInfo.creator_phone }}</div>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="8">
|
|
|
- <el-form-item label="截止时间:" prop="release_time">
|
|
|
- <div>{{ reportInfo.end_time }}</div>
|
|
|
- <span class="label">前报送该表</span>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="8">
|
|
|
- <el-form-item label="表名:" prop="table_name" label-width="auto">
|
|
|
- <div>{{ reportInfo.table_name }}</div>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="8">
|
|
|
- <el-form-item label="" prop="people_name" label-width="auto">
|
|
|
- <el-form-item label="选择填报人:" prop="user_ids" label-width="auto" style="font-weight: bold">
|
|
|
- <div>
|
|
|
- <el-tag
|
|
|
- v-for="tag in selectedReporter"
|
|
|
- :key="tag"
|
|
|
- closable
|
|
|
- :disable-transitions="false"
|
|
|
- @close="handleClose(tag)"
|
|
|
- style="margin-right: 10px"
|
|
|
- >
|
|
|
- {{ tag.label }}
|
|
|
- </el-tag>
|
|
|
- </div>
|
|
|
- <el-button @click="showSelect">点击选择</el-button>
|
|
|
- </el-form-item>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- </el-col>
|
|
|
</el-row>
|
|
|
+ <el-form :model="reportInfo" :rules="rules" ref="formRef" style="margin-top: 20px">
|
|
|
+ <el-row :gutter="20">
|
|
|
+ <el-col :lg="30" :xs="24" style="margin-top: -10px">
|
|
|
+ <el-row :span="24" :gutter="10">
|
|
|
+ <!-- 联系人姓名 -->
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="联系人姓名:" prop="creator_name" label-width="auto">
|
|
|
+ <el-input v-model="reportInfo.creator_name" placeholder="请输入联系人姓名" style="width: 300px"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <!-- 联系电话 -->
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="联 系 电 话:" prop="creator_phone" label-width="auto">
|
|
|
+ <el-input v-model="reportInfo.creator_phone" placeholder="请输入联系电话" style="width: 300px"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <!-- 截止时间 -->
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="截 止 时 间 :" prop="end_time">
|
|
|
+ <el-date-picker v-model="reportInfo.end_time" value-format="YYYY-MM-DD HH:mm:ss" time-format="HH:mm" type="datetime" placeholder="选择截止时间" style="width: 300px" @change="handleTimeChange" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <!-- 操作按钮 -->
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="表           名:" prop="table_name" label-width="auto">
|
|
|
+ <el-input v-model="reportInfo.table_name" placeholder="请输入表名" style="width: 300px"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <!-- 选择填报人 -->
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="" prop="people_name" label-width="auto">
|
|
|
+ <el-form-item label="选择填报人:" prop="user_ids" label-width="auto" style="font-weight: bold">
|
|
|
+ <div>
|
|
|
+ <el-tag
|
|
|
+ v-for="tag in selectedReporter"
|
|
|
+ :key="tag"
|
|
|
+ closable
|
|
|
+ :disable-transitions="false"
|
|
|
+ @close="handleClose(tag)"
|
|
|
+ style="margin-right: 10px"
|
|
|
+ >
|
|
|
+ {{ tag.label }}
|
|
|
+ </el-tag>
|
|
|
+ </div>
|
|
|
+ <el-button @click="showSelect">点击选择</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-form>
|
|
|
</div>
|
|
|
- <div style="height: 350px">
|
|
|
+ <div style="height: 350px; margin-left: 10px">
|
|
|
<hot-table v-if="tableData && tableData.length > 0" ref="wrapper" :data="tableData" :settings="hotSettings" />
|
|
|
<hot-table v-if="isShowTable" ref="wrapper" :data="hotData" :settings="hotSettings" />
|
|
|
</div>
|
|
@@ -82,13 +90,16 @@
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
import * as XLSX from 'xlsx';
|
|
|
-import { fillingList } from '@/api/dataFilling/fillingManage';
|
|
|
+import { fillingAdd, fillingChange, fillingList, fillingRelease } from '@/api/dataFilling/fillingManage';
|
|
|
import { useRouter } from 'vue-router';
|
|
|
import { HotTable } from '@handsontable/vue3';
|
|
|
import { getPhoneList } from '@/api/informationissue/informationissue';
|
|
|
import informantSelect from './informantSelect.vue';
|
|
|
import { deepClone } from '@/utils';
|
|
|
+import { ElButton, ElCol, ElDatePicker, ElFormItem, ElInput, ElRow } from 'element-plus';
|
|
|
+import { validatePhone } from '@/utils/validate';
|
|
|
|
|
|
+const { proxy } = getCurrentInstance();
|
|
|
const isShowSelect = ref(false);
|
|
|
let treeData = ref([]);
|
|
|
const emits = defineEmits(['close']);
|
|
@@ -110,8 +121,19 @@ const reportInfo = ref({
|
|
|
updated_at: '',
|
|
|
num_reported: 0,
|
|
|
num_unreported: 0,
|
|
|
+ field_names: [], //表格内容
|
|
|
user_ids: []
|
|
|
});
|
|
|
+const rules = {
|
|
|
+ table_name: [{ required: true, message: '表名不能为空', trigger: 'blur' }],
|
|
|
+ end_time: [{ required: true, message: '截止时间不能为空', trigger: 'blur' }],
|
|
|
+ creator_name: [{ required: true, message: '联系人姓名不能为空', trigger: 'blur' }],
|
|
|
+ creator_phone: [
|
|
|
+ { required: true, message: '联系电话不能为空', trigger: 'blur' },
|
|
|
+ { validator: validatePhone, message: '请输入正确格式的联系电话', trigger: 'blur' }
|
|
|
+ ],
|
|
|
+ user_ids: [{ required: true, message: '请选择填报人', trigger: 'blur' }],
|
|
|
+}
|
|
|
const is_filling_ended = ref(0);
|
|
|
const tableData = ref([]);
|
|
|
const selectedReporter = ref(null);
|
|
@@ -123,6 +145,12 @@ const props = defineProps({
|
|
|
const reportId = ref(props.eventId);
|
|
|
|
|
|
watch(reportId, async (newVal) => {
|
|
|
+ // tableData.value = [];
|
|
|
+ //
|
|
|
+ //
|
|
|
+ // nextTick(() => {
|
|
|
+ // tableData.value = [{id: 1}];
|
|
|
+ // })
|
|
|
if (newVal) {
|
|
|
await fetchReportDetails(newVal);
|
|
|
}
|
|
@@ -299,31 +327,52 @@ const handleReload = () => {
|
|
|
alert('表格已清空');
|
|
|
};
|
|
|
|
|
|
-const handleSaveTemporarily = () => {
|
|
|
- alert('数据已暂存');
|
|
|
+const handleSaveTemporarily = async (statuCode) => {
|
|
|
+ if (hotData.value && hotData.value[0] && hotData.value[0].length > 0) {
|
|
|
+ const data2 = [];
|
|
|
+ hotData.value[0].forEach((item) => {
|
|
|
+ if (!!item) {
|
|
|
+ data2.push(item);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ reportInfo.value.field_names = tableData.value;
|
|
|
+ }
|
|
|
+
|
|
|
+ reportInfo.value.issued_status = statuCode;
|
|
|
+ const tempHead = reportInfo.value.field_names.flatMap(obj =>
|
|
|
+ Object.values(obj).filter(value => typeof value === "string")
|
|
|
+ );
|
|
|
+ let data = {
|
|
|
+ table_name: reportInfo.value.table_name,
|
|
|
+ status: reportInfo.value.issued_status,
|
|
|
+ period_type: reportInfo.value.period_type,
|
|
|
+ end_time: reportInfo.value.end_time,
|
|
|
+ new_fields: tempHead
|
|
|
+ }
|
|
|
+ fillingChange(reportId.value, data).then(() => {
|
|
|
+ proxy.$modal.msgSuccess('暂存成功');
|
|
|
+ emits('close');
|
|
|
+ });
|
|
|
};
|
|
|
|
|
|
const handleReport = () => console.log('上报');
|
|
|
|
|
|
-const handleSave = async () => {
|
|
|
- const data = {
|
|
|
+const handleSave = async (statuCode) => {
|
|
|
+ reportInfo.value.issued_status = statuCode;
|
|
|
+ const tempHead = reportInfo.value.field_names.flatMap(obj =>
|
|
|
+ Object.values(obj).filter(value => typeof value === "string")
|
|
|
+ );
|
|
|
+ let data = {
|
|
|
table_name: reportInfo.value.table_name,
|
|
|
- data_table_name: reportInfo.value.data_table_name,
|
|
|
- start_time: reportInfo.value.start_time,
|
|
|
- end_time: reportInfo.value.end_time,
|
|
|
- status: reportInfo.value.status,
|
|
|
- issued_status: reportInfo.value.issued_status,
|
|
|
+ status: reportInfo.value.issued_status,
|
|
|
period_type: reportInfo.value.period_type,
|
|
|
- creator_name: reportInfo.value.creator_name,
|
|
|
- creator_id: reportInfo.value.creator_id,
|
|
|
- creator_phone: reportInfo.value.creator_phone, // 使用 reportInfo 中的 creator_phone
|
|
|
- field_names: tableData.value,
|
|
|
- user_ids: []
|
|
|
- };
|
|
|
- const response = await fillingList(data); // 确保 fillingAdd 函数被定义
|
|
|
- if (response && response.success) {
|
|
|
- alert('数据已成功保存');
|
|
|
+ end_time: reportInfo.value.end_time,
|
|
|
+ new_fields: tempHead
|
|
|
}
|
|
|
+ fillingChange(reportId.value, data).then(() => {
|
|
|
+ proxy.$modal.msgSuccess('发布成功');
|
|
|
+ emits('close');
|
|
|
+ });
|
|
|
};
|
|
|
|
|
|
const handleReturn = () => {
|