|
@@ -15,13 +15,13 @@
|
|
<!-- <el-button v-if="is_filling_ended === 0" type="primary" @click="handleReport()">智能识别</el-button>-->
|
|
<!-- <el-button v-if="is_filling_ended === 0" type="primary" @click="handleReport()">智能识别</el-button>-->
|
|
<!-- </el-col>-->
|
|
<!-- </el-col>-->
|
|
<el-col :span="1.5">
|
|
<el-col :span="1.5">
|
|
- <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="reportInfo.issued_status === 2" type="primary" @click="handleData()">数据</el-button>
|
|
|
|
|
|
+ <el-button v-if="is_filling_ended === 0" type="primary" @click="handleSaveTemporarily(formRef,1)">暂存</el-button>
|
|
</el-col>
|
|
</el-col>
|
|
|
|
+<!-- <el-col :span="1.5">-->
|
|
|
|
+<!-- <el-button v-if="reportInfo.issued_status === 2" type="primary" @click="handleData()">数据</el-button>-->
|
|
|
|
+<!-- </el-col>-->
|
|
<el-col :span="1.5">
|
|
<el-col :span="1.5">
|
|
- <el-button v-if="is_filling_ended === 0" type="primary" @click="handleSave(2)">发布</el-button>
|
|
|
|
|
|
+ <el-button v-if="is_filling_ended === 0" type="primary" @click="handleSave(formRef, 2)">发布</el-button>
|
|
</el-col>
|
|
</el-col>
|
|
<el-col :span="1.5">
|
|
<el-col :span="1.5">
|
|
<el-button type="danger" @click="handleReturn()">返回</el-button>
|
|
<el-button type="danger" @click="handleReturn()">返回</el-button>
|
|
@@ -98,9 +98,11 @@ import informantSelect from './informantSelect.vue';
|
|
import { deepClone } from '@/utils';
|
|
import { deepClone } from '@/utils';
|
|
import { ElButton, ElCol, ElDatePicker, ElFormItem, ElInput, ElRow } from 'element-plus';
|
|
import { ElButton, ElCol, ElDatePicker, ElFormItem, ElInput, ElRow } from 'element-plus';
|
|
import { validatePhone } from '@/utils/validate';
|
|
import { validatePhone } from '@/utils/validate';
|
|
|
|
+import { ref } from 'vue';
|
|
|
|
|
|
const { proxy } = getCurrentInstance();
|
|
const { proxy } = getCurrentInstance();
|
|
const isShowSelect = ref(false);
|
|
const isShowSelect = ref(false);
|
|
|
|
+const formRef = ref('');
|
|
let treeData = ref([]);
|
|
let treeData = ref([]);
|
|
const emits = defineEmits(['close']);
|
|
const emits = defineEmits(['close']);
|
|
const reportInfo = ref({
|
|
const reportInfo = ref({
|
|
@@ -327,51 +329,90 @@ const handleReload = () => {
|
|
alert('表格已清空');
|
|
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);
|
|
|
|
|
|
+const handleSaveTemporarily = async (formEl,statuCode) => {
|
|
|
|
+ if (!formEl) return;
|
|
|
|
+ await formEl.validate((valid, fields) => {
|
|
|
|
+ if (valid) {
|
|
|
|
+ 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.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');
|
|
|
|
|
|
+ reportInfo.value.issued_status = statuCode;
|
|
|
|
+ const tempHead = reportInfo.value.field_names.flatMap(obj =>
|
|
|
|
+ Object.values(obj).filter(value => typeof value === "string")
|
|
|
|
+ );
|
|
|
|
+ let data = {
|
|
|
|
+ creator_name: reportInfo.value.creator_name,
|
|
|
|
+ creator_phone: reportInfo.value.creator_phone,
|
|
|
|
+ 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,
|
|
|
|
+ user_ids: reportInfo.value.user_ids
|
|
|
|
+ }
|
|
|
|
+ fillingChange(reportId.value, data).then(() => {
|
|
|
|
+ proxy.$modal.msgSuccess('暂存成功');
|
|
|
|
+ emits('close');
|
|
|
|
+ });
|
|
|
|
+ } else {
|
|
|
|
+ nextTick(() => {
|
|
|
|
+ let isError = document.getElementsByClassName('is-error');
|
|
|
|
+ isError[0].scrollIntoView({
|
|
|
|
+ // 滚动到指定节点
|
|
|
|
+ // 值有start,center,end,nearest,当前显示在视图区域中间
|
|
|
|
+ block: 'center',
|
|
|
|
+ // 值有auto、instant,smooth,缓动动画(当前是慢速的)
|
|
|
|
+ behavior: 'smooth'
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ proxy.$modal.msgError('表单校验失败');
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
});
|
|
});
|
|
};
|
|
};
|
|
|
|
|
|
const handleReport = () => console.log('上报');
|
|
const handleReport = () => console.log('上报');
|
|
|
|
|
|
-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,
|
|
|
|
- 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 handleSave = async (formEl, statuCode) => {
|
|
|
|
+ if (!formEl) return;
|
|
|
|
+ await formEl.validate((valid, fields) => {
|
|
|
|
+ if (valid) {
|
|
|
|
+ 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');
|
|
|
|
+ });
|
|
|
|
+ } else {
|
|
|
|
+ nextTick(() => {
|
|
|
|
+ let isError = document.getElementsByClassName('is-error');
|
|
|
|
+ isError[0].scrollIntoView({
|
|
|
|
+ // 滚动到指定节点
|
|
|
|
+ // 值有start,center,end,nearest,当前显示在视图区域中间
|
|
|
|
+ block: 'center',
|
|
|
|
+ // 值有auto、instant,smooth,缓动动画(当前是慢速的)
|
|
|
|
+ behavior: 'smooth'
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ proxy.$modal.msgError('表单校验失败');
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
});
|
|
});
|
|
};
|
|
};
|
|
|
|
|