From aa9ed4ac9790b3512572f40b66d44b68f2b0c1aa Mon Sep 17 00:00:00 2001 From: shj <1790240199@qq.com> Date: 星期三, 03 八月 2022 15:45:17 +0800 Subject: [PATCH] 对接 --- src/views/goalManagement/targetDecompositionYear/component/DailogAdd.vue | 80 +++++++++++++------------- src/views/goalManagement/targetDecompositionYear/index.vue | 10 ++- src/views/goalManagement/targetDecompositionYear/component/Dailog.vue | 77 +++++++++++++++++-------- src/views/goalManagement/targetDecompositionMonth/index.vue | 8 ++ 4 files changed, 105 insertions(+), 70 deletions(-) diff --git a/src/views/goalManagement/targetDecompositionMonth/index.vue b/src/views/goalManagement/targetDecompositionMonth/index.vue index 579df10..2828635 100644 --- a/src/views/goalManagement/targetDecompositionMonth/index.vue +++ b/src/views/goalManagement/targetDecompositionMonth/index.vue @@ -66,13 +66,13 @@ v-model:page-size="pageSize4" :page-sizes="[10, 20, 30, 40]" layout="total, sizes, prev, pager, next, jumper" - :total="400" + :total="total" @size-change="handleSizeChange" @current-change="handleCurrentChange" /> </div> </div> - <Dailog ref="Show"></Dailog> + <Dailog ref="Show" @addList="add"></Dailog> </div> </template> <script lang="ts"> @@ -219,7 +219,11 @@ }); }); }; + const add=()=>{ + listApi() + } return { + add, listApi, resetForm, tableData, diff --git a/src/views/goalManagement/targetDecompositionYear/component/Dailog.vue b/src/views/goalManagement/targetDecompositionYear/component/Dailog.vue index 797b644..04d74fe 100644 --- a/src/views/goalManagement/targetDecompositionYear/component/Dailog.vue +++ b/src/views/goalManagement/targetDecompositionYear/component/Dailog.vue @@ -40,7 +40,7 @@ <el-table-column align="center" property="dutyDepartmentId" label="责任部门" width="180" /> <el-table-column align="center" property="value" label="考核指标" width="180" /> <el-table-column align="center" property="makerDepartmentId" label="制定人部门" /> - <el-table-column align="center" property="makeDate" label="制定日期" /> + <el-table-column align="center" property="makeDate" :formatter="timeDate(makeDate)" label="制定日期" /> <el-table-column align="center" property="commitPersonId" label="上报人" /> <el-table-column align="center" property="操作"> <template #default="scope"> @@ -67,11 +67,18 @@ import { ElMessageBox, ElMessage, ElButton, ElInput, TabsPaneContext } from 'element-plus'; import DailogSearch from '../../../../components/DailogSearch/DailogSearch.vue'; import { goalManagementApi } from '/@/api/goalManagement'; +import { emit } from 'process'; export default defineComponent({ components: { DailogAdd, DailogSearch }, - setup() { + setup(props,{emit}) { const dialogVisible = ref<boolean>(false); - const form = ref({}); + const form = ref({ + qName: '', + indexNum: '', + year: '', + value: '', + targetDivideDetailList:[] + }); const targetType = ref(); const disabled = ref(false); const titles = ref(); @@ -86,14 +93,15 @@ .then((res) => { if (res.data.code == 200) { form.value = res.data.data; + formUp.targetDivideDetailList=form.value.targetDivideDetailList } else { ElMessage.error(res.data.msg); } }); } }; - const onNumber = (e: object) => { - form.value = e; + const onNumber = (val: object) => { + form.value = val; }; // 导航 const activeName = ref('1'); @@ -101,9 +109,9 @@ const tableData = ref([]); // 新增弹窗 const Show = ref(); - const daiAdd = (title:string,data: any) => { - console.log(data) - Show.value.openDailog(title,data); + const daiAdd = (title: string, data: any) => { + console.log(data); + Show.value.openDailog(title, data); }; const formUp = reactive({ targetId: '', //关联的目标指标/外键 @@ -116,6 +124,7 @@ }; // 新增 const submitForm = () => { + formUp.delTargetDivideDetails=arr.value.toString() formUp.targetId = form.value.id; goalManagementApi() .gettargetDivideDetail(formUp) @@ -125,29 +134,30 @@ message: res.data.msg, type: 'success', }); - dialogVisible.value=false + dialogVisible.value = false; + emit("addList") } else { ElMessage.error(res.data.msg); } }); + form.value = { + qName: '', + indexNum: '', + year: '', + value: '', + targetDivideDetailList:[] + }; + tableData.value = []; + formUp.targetId = ''; + formUp.delTargetDivideDetails = ''; + formUp.targetDivideDetailList = []; }; + const arr=ref([]) // 删除 const Delete = (data: any) => { - formUp.targetId= data.targetId - formUp.delTargetDivideDetails = data.id; - // formUp.targetDivideDetailList=data - goalManagementApi() - .gettargetDivideDetail(formUp) - .then((res) => { - if (res.data.code == 200) { - ElMessage({ - message: res.data.msg, - type: 'success', - }); - } else { - ElMessage.error(res.data.msg); - } - }); + formUp.targetDivideDetailList.splice(form.value.targetDivideDetailList.indexOf(data), 1); + formUp.targetId = data.targetId; + arr.value.push(data.id) }; // 安全目标指标弹窗 const Shows = ref(); @@ -157,8 +167,17 @@ // 关闭 const resetForm = () => { dialogVisible.value = false; - form.value = {}; + form.value = { + qName: '', + indexNum: '', + year: '', + value: '', + targetDivideDetailList:[] + }; tableData.value = []; + formUp.targetId = ''; + formUp.delTargetDivideDetails = ''; + formUp.targetDivideDetailList = []; }; //全屏 const full = ref(false); @@ -169,7 +188,15 @@ full.value = false; } }; + // 时间格式处理 + const timeDate = (data: any) => { + console.log('xxxxxxxxxxx',data) + let result = new Date(data).getTime(); + return result; + }; return { + arr, + timeDate, form, dialogVisible, openDailog, diff --git a/src/views/goalManagement/targetDecompositionYear/component/DailogAdd.vue b/src/views/goalManagement/targetDecompositionYear/component/DailogAdd.vue index 1f15d99..6b04990 100644 --- a/src/views/goalManagement/targetDecompositionYear/component/DailogAdd.vue +++ b/src/views/goalManagement/targetDecompositionYear/component/DailogAdd.vue @@ -1,5 +1,5 @@ <template> - <el-dialog v-model="dialogVisible" :fullscreen="full" title="新建目标指标分解" width="50%" draggable> + <el-dialog v-model="dialogVisible" :fullscreen="full" title="新建目标指标分解" width="50%" draggable> <el-button @click="toggleFullscreen" size="small" class="pot" :icon="FullScreen"></el-button> <el-form :model="form" :disabled="disabled" label-width="120px" ref="ruleFormRef" :rules="rules"> <el-row> @@ -64,55 +64,17 @@ value: '', ////考核指标值 makeDate: '', ////制定日期 }); - const ruleFormRef = ref<FormInstance>(); - const rules = reactive<FormRules>({ - dutyDepartmentId: [ - { - required: true, - message: '责任部门不能为空', - trigger: 'change', - }, - ], - makerDepartmentId: [ - { - required: true, - message: '制定人部门不能为空', - trigger: 'change', - }, - ], - commitPersonId: [ - { - required: true, - message: '上报人不能为空', - trigger: 'change', - }, - ], - value: [ - { - required: true, - message: '考核指标值不能为空', - trigger: 'change', - }, - ], - makeDate: [ - { - required: true, - message: '制定日期不能为空', - trigger: 'change', - }, - ], - }); const submitForm = async (formEl: FormInstance | undefined) => { if (!formEl) return; await formEl.validate((valid, fields) => { if (valid) { dialogVisible.value = false; emit('onAdd', form.value); + // formEl.resetFields(); } else { console.log('error submit!', fields); } }); - formEl.resetFields(); }; const resetForm = (formEl: FormInstance | undefined) => { @@ -160,6 +122,44 @@ const openUser = () => { Show.value.openDailog(); }; + const ruleFormRef = ref<FormInstance>(); + const rules = reactive<FormRules>({ + dutyDepartmentId: [ + { + required: true, + message: '责任部门不能为空', + trigger: 'change', + }, + ], + makerDepartmentId: [ + { + required: true, + message: '制定人部门不能为空', + trigger: 'change', + }, + ], + commitPersonId: [ + { + required: true, + message: '上报人不能为空', + trigger: 'change', + }, + ], + value: [ + { + required: true, + message: '考核指标值不能为空', + trigger: 'change', + }, + ], + makeDate: [ + { + required: true, + message: '制定日期不能为空', + trigger: 'change', + }, + ], + }); //全屏 const full = ref(false); const toggleFullscreen = () => { diff --git a/src/views/goalManagement/targetDecompositionYear/index.vue b/src/views/goalManagement/targetDecompositionYear/index.vue index bddd610..9d282fb 100644 --- a/src/views/goalManagement/targetDecompositionYear/index.vue +++ b/src/views/goalManagement/targetDecompositionYear/index.vue @@ -36,7 +36,7 @@ <div class="tableC"> <el-tabs v-model="activeNames"> <el-tab-pane label="目标指标分解" name="1"> - <el-table :data="targetDivideDetailList" style="width: 100%"> + <el-table :data="tableData.targetDivideDetailList" style="width: 100%"> <el-table-column align="center" prop="dutyDepartmentId" label="责任部门" /> <el-table-column align="center" prop="value" label="考核指标" /> <el-table-column align="center" prop="makerDepartmentId" label="制定人部门" /> @@ -66,13 +66,13 @@ v-model:page-size="pageSize4" :page-sizes="[10, 20, 30, 40]" layout="total, sizes, prev, pager, next, jumper" - :total="400" + :total="total" @size-change="handleSizeChange" @current-change="handleCurrentChange" /> </div> </div> - <Dailog ref="Show"></Dailog> + <Dailog ref="Show" @addList="add"></Dailog> </div> </template> <script lang="ts"> @@ -217,8 +217,12 @@ }); }); }; + const add=()=>{ + listApi() + } return { listApi, + add, resetForm, tableData, currentPage4, -- Gitblit v1.9.2