This commit is contained in:
lcw
2025-09-25 12:42:28 +08:00
parent 5662689bb5
commit 377c62b0d6
5 changed files with 334 additions and 69 deletions

View File

@ -29,7 +29,14 @@ const dialogForm = ref(false);
const FormRef = ref();
const listQuery = ref({});
const formList = reactive([
const formList = ref([])
// 初始化数据
const init = (type, row,) => {
dialogForm.value = true;
listQuery.value=row
formList.value=[
[
{ label: "姓名", prop: "xm", type: "input" },
{ label: "证件号码", prop: "sfzh", type: "input" },
@ -39,13 +46,8 @@ const formList = reactive([
{ label: "是否年检", prop: "isnj", type:"select",options: props.dict.D_BZ_SF},
{ label: "年检时间", prop: "njsj", type: "date" },
],
])
]
// 初始化数据
const init = (type, row,) => {
dialogForm.value = true;
listQuery.value=row
};
const close = () => {

View File

@ -3,73 +3,66 @@
<div class="head_box">
<span class="title">年检培训申请</span>
<div>
<el-button size="small" @click="save" type="primary" :loading="loading">保存</el-button>
<el-button size="small" @click="save" type="primary" :loading="loading">保存</el-button>
<el-button size="small" @click="close">关闭</el-button>
</div>
</div>
<div class="cntinfo">
<FormMessage ref="FormRef" v-model="listQuery" :formList="formList">
<el-divider />
<el-divider />
</FormMessage>
<div style="padding:0 10vw 0 10vw;">
<div class="table-title">培训保安人员 <el-icon size="20px" style="top: 4px;" color="green"><CirclePlusFilled /></el-icon> </div>
<MyTable :tableData="pageData.tableData" :tableColumn="pageData.tableColumn" :tableHeight="pageData.tableHeight"
<div class="table-title" @click="dialogFormVisible = true">培训保安人员 <el-icon size="20px" style="top: 4px;"
color="green">
<CirclePlusFilled />
</el-icon> </div>
<MyTable :tableData="pageData.tableData" :tableColumn="pageData.tableColumn" :tableHeight="pageData.tableHeight"
:key="pageData.keyCount" :tableConfiger="pageData.tableConfiger" :controlsWidth="pageData.controlsWidth"
@chooseData="chooseData">
<template #controls="{ row }">
<template #controls="{ row }">
<el-link type="danger" link @click="delRow(row.id)">删除</el-link>
</template>
</MyTable>
</template>
</MyTable>
</div>
</div>
</div>
<ChooseBapxry v-model="dialogFormVisible" :Single="Single" :roleIds="roleIds" @close="closeBapxry"
@choosedUsers="choosedList"></ChooseBapxry>
</template>
<script setup>
import MyTable from "@/components/aboutTable/MyTable.vue";
import { qcckPost , qcckGet} from "@/api/qcckApi.js";
import ChooseBapxry from "@/components/ChooseList/ChooseBapxry/index.vue";
import FormMessage from "@/components/aboutTable/FormMessage.vue";
import { ref, reactive,defineEmits,getCurrentInstance } from 'vue';
import { ref, reactive, defineEmits, getCurrentInstance } from 'vue';
import { dwglList, baxxNjpxSaveEntity } from '@/api/pxzx';
const { proxy } = getCurrentInstance();
const emit = defineEmits(["refresh"]);
const dialogForm = ref(false);
const FormRef = ref();
const listQuery = ref({});
const formList = reactive([
[
{ label: "培训日期", prop: "pxrq", type: "date" },
{ label: "培训时间", prop: "pxsj", type: "input" },
{ label: "课程名称", prop: "kcmc", type: "input" },
],
[
{ label: "组织单位", prop: "zzdw", type: "input" },
{ label: "授课教员", prop: "skfcy", type: "select" },
{ label: "培训内容", prop: "pxnr", type: "input" },
],
{ label: "分割线", prop: "diver", type: "slot" },
[
{ label: "培训日期", prop: "pxrq", type: "date" },
{ label: "培训时间", prop: "pxsj", type: "time" },
{ label: "课程名称", prop: "kcmc", type: "input" },
],
[
{ label: "组织单位", prop: "zzdw", type: "input" },
{ label: "授课教员", prop: "skfcy", type: "select" },
{ label: "培训内容", prop: "pxnr", type: "input" },
],
{ label: "分割线", prop: "diver", type: "slot" },
[
{ label: "培训日期", prop: "pxrq", type: "date" },
{ label: "培训时间", prop: "pxsj", type: "time" },
{ label: "课程名称", prop: "kcmc", type: "input" },
],
[
{ label: "组织单位", prop: "zzdw", type: "input" },
{ label: "授课教员", prop: "skfcy", type: "select" },
{ label: "培训内容", prop: "pxnr", type: "input" },
],
])
const companyList = ref([])
const getList = () => {
dwglList({}).then(res => {
companyList.value = res.length > 0 ? res.filter(item => item.type == '02' || item.type == '03').map(item => {
return {
zdmc: item.dwmc,
dm: item.id
}
}) : []
})
}
const formList = ref()
const dialogFormVisible = ref(false)
const roleIds = ref([])
const choosedList = (val) => {
pageData.tableData = val;
roleIds.value = val.map(item => item.id)
}
const closeBapxry = () => {
dialogFormVisible.value = false
}
const pageData = reactive({
tableData: [],
keyCount: 0,
@ -78,52 +71,133 @@ const pageData = reactive({
showSelectType: "null",
loading: false,
},
tableHeight:400,
tableHeight: 400,
tableColumn: [
{ label: "姓名", prop: "xm"},
{ label: "姓名", prop: "xm" },
{ label: "证件号码", prop: "zjhm" },
{ label: "电话号码", prop: "dhhm" },
{ label: "电话号码", prop: "lxdh" },
{ label: "所属单位", prop: "ssdw" },
]
});
const title = ref("新增")
// 初始化数据
const init = async (type, id,) => {
if (id) {
title.value == '新增'
} else {
title.value == '修改'
}
dialogForm.value = true;
// const res = await qcckGet({ url: `/training/annualInspectionTraining/detail/${id}`})
// listQuery.value = res || {}
getList()
formList.value = [
[
{ label: "培训日期", prop: "pxrq0", type: "date" },
{ label: "培训时间", prop: "pxsj0", type: "time" },
{ label: "课程名称", prop: "kcmc0", type: "input" },
],
[
{ label: "组织单位", prop: "zzdw0", type: "select", options: companyList },
{ label: "授课教员", prop: "skfcy0", type: "input" },
{ label: "培训内容", prop: "pxnr0", type: "input" },
],
{ label: "分割线", prop: "diver", type: "slot" },
[
{ label: "培训日期", prop: "pxrq1", type: "date" },
{ label: "培训时间", prop: "pxsj1", type: "time" },
{ label: "课程名称", prop: "kcmc1", type: "input" },
],
[
{ label: "组织单位", prop: "zzdw1", type: "select", options: companyList },
{ label: "授课教员", prop: "skfcy1", type: "input" },
{ label: "培训内容", prop: "pxnr1", type: "input" },
],
{ label: "分割线", prop: "diver", type: "slot" },
[
{ label: "培训日期", prop: "pxrq2", type: "date" },
{ label: "培训时间", prop: "pxsj2", type: "time" },
{ label: "课程名称", prop: "kcmc2", type: "input" },
],
[
{ label: "组织单位", prop: "zzdw2", type: "select", options: companyList },
{ label: "授课教员", prop: "skfcy2", type: "input" },
{ label: "培训内容", prop: "pxnr2", type: "input" },
],
]
};
const delRow = (id) => {
pageData.tableData = pageData.tableData.filter(item => item.id !== id)
}
const loading = ref(false)
const save = () => {
FormRef.value.submit(()=>{
// loading.value = true;
// let url = title.value == '新增' ? `/mosty-jbld/jbldzsd/add` : `/mosty-jbld/jbldzsd/update`;
// qcckPost(listQuery.value, url).then(() => {
// loading.value = false;
FormRef.value.submit(() => {
loading.value = true;
let url = title.value == '新增' ? `/baxx/njpx/saveEntity` : `/baxx/njpx/updateEntity `;
console.log(listQuery.value);
let pxkcList = []
// 固定是3个
for (let i = 0; i < 3; i++) {
pxkcList.push({
pxrq: listQuery.value[`pxrq${i}`],
pxsj: listQuery.value[`pxsj${i}`],
kcmc: listQuery.value[`kcmc${i}`],
zzdw: listQuery.value[`zzdw${i}`],
skfcy: listQuery.value[`skfcy${i}`],
pxnr: listQuery.value[`pxnr${i}`],
})
}
const pxkcryList = pageData.tableData.map(item => {
return {
pxdwid: item.pxdwid,
xm: item.xm,
zjhm: item.zjhm,
dhhm: item.lxdh,
ssdw: item.ssdw,
ssdwdm: item.ssdwdm,
}
})
if (JSON.stringify(listQuery.value) == '{}') {
loading.value = false;
proxy.$message.error("请填写培训课程");
return;
}
if (pxkcryList.length == 0) {
loading.value = false;
proxy.$message.error("请选择培训人员");
return;
}
const promes = {
pxgsdm: listQuery.value.pxgsdm,
pxkcList: pxkcList,
pxrq: listQuery.value.pxrq0,
pxryList: pxkcryList,
pxrysl: pxkcryList.length,
}
baxxNjpxSaveEntity(promes).then(() => {
loading.value = false;
proxy.$message.success("保存成功");
// emit("refresh");
close();
// }).catch(() => {
// loading.value = false;
// })
}).catch(() => {
loading.value = false;
})
});
}
const close = () => {
dialogForm.value = false;
pageData.tableData = []
FormRef.value.reset()
};;
defineExpose({init})
defineExpose({ init })
</script>
<style lang="scss" scoped>
@import "@/assets/css/layout.scss";
.table-title{
.table-title {
line-height: 40px;
text-align: center;
background: #f5f5f5;

View File

@ -46,7 +46,6 @@ import Pages from "@/components/aboutTable/Pages.vue";
import Search from "@/components/aboutTable/Search.vue";
import DetailForm from "./components/detailForm.vue";
import PxApllication from "./components/pxApllication.vue";
import { qcckGet, qcckPost, qcckDelete } from "@/api/qcckApi.js";
import {baxxNjryNjshPage} from '@/api/pxzx.js'
import { reactive, ref, onMounted, getCurrentInstance, nextTick } from "vue";
const { proxy } = getCurrentInstance();