This commit is contained in:
lcw
2025-09-25 09:44:43 +08:00
parent 691216c207
commit 5ae8ac0355
8 changed files with 236 additions and 121 deletions

View File

@ -1,55 +1,82 @@
<template>
<div>
<el-dialog title="选择培训公司" v-model="dialogForm" width="400px">
<ul class="company-list">
<li :class="{'active': active == item.id}" @click="active = item.id" class="company-item one_text_detail" v-for="item in companyList" :key="item.id">{{ item.name }}</li>
</ul>
<div class="flex just-center mt10">
<el-button type="primary" @click="dialogForm = false">确定</el-button>
</div>
</el-dialog>
</div>
<div>
<el-dialog title="选择培训公司" v-model="dialogForm" width="400px">
<ul class="company-list">
<li :class="{ 'active': active == item.id }" @click="updateActive(item)" class="company-item one_text_detail"
v-for="item in companyList" :key="item.id">{{ item.dwmc }}</li>
</ul>
<div class="flex just-center mt10">
<el-button type="primary" @click="dialogForm = false">确定</el-button>
</div>
</el-dialog>
</div>
</template>
<script setup>
import { ref ,defineExpose} from 'vue';
import { ref, defineExpose } from 'vue';
import { dwglList, njglEdit } from '@/api/pxzx';
import { ElMessage } from "element-plus";
const props = defineProps({
dict: {
type: Object,
default: () => ({})
}
})
const dialogForm = ref(false);
const companyList = ref([
{ id: 1, name: '公司A' },
{ id: 2, name: '公司B' },
{ id: 3, name: '公司C' },
]);
const companyList = ref([]);
const pxgsData = ref()
const active = ref(null)
const init = (id) => {
active.value = id;
dialogForm.value = true;
const getList = () => {
dwglList({}).then(res => {
companyList.value = res.length > 0 ? res.filter(item => item.type == '02' || item.type == '03') : []
})
}
const updateActive = (item) => {
active.value = item.id;
njglEdit({
id: pxgsData.value.id,
pxgs: item.dwmc,
pxgsdm: item.id
}).then(res => {
if (res.code == 200) {
ElMessage.success('修改成功');
dialogForm.value = false;
}
})
}
const init = (row) => {
active.value = row.pxgsdm?row.pxgsdm:null;
pxgsData.value =row
dialogForm.value = true;
getList()
}
defineExpose({
init
init
})
</script>
<style scoped lang="scss">
.company-list {
list-style-type: none;
padding: 0;
margin: 0;
max-height: 40vh;
overflow: hidden;
overflow-y: auto;
.company-item {
padding: 10px;
cursor: pointer;
line-height: 20px;
text-align: center;
border-bottom: 1px solid #eee;
}
.active{
background: #00bfbf;
color: #fff;
}
list-style-type: none;
padding: 0;
margin: 0;
max-height: 40vh;
overflow: hidden;
overflow-y: auto;
.company-item {
padding: 10px;
cursor: pointer;
line-height: 20px;
text-align: center;
border-bottom: 1px solid #eee;
}
.active {
background: #00bfbf;
color: #fff;
}
}
</style>