Files
ba_web/src/views/Training/AnnualInspection/components/pxgs.vue

83 lines
1.8 KiB
Vue
Raw Normal View History

2025-09-22 17:16:42 +08:00
<template>
2025-09-25 09:44:43 +08:00
<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>
2025-09-22 17:16:42 +08:00
</template>
<script setup>
2025-09-25 09:44:43 +08:00
import { ref, defineExpose } from 'vue';
import { dwglList, njglEdit } from '@/api/pxzx';
2025-09-22 17:16:42 +08:00
2025-09-25 09:44:43 +08:00
import { ElMessage } from "element-plus";
const props = defineProps({
dict: {
type: Object,
default: () => ({})
}
})
const dialogForm = ref(false);
const companyList = ref([]);
const pxgsData = ref()
2025-09-22 17:16:42 +08:00
const active = ref(null)
2025-09-25 09:44:43 +08:00
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()
2025-09-22 17:16:42 +08:00
}
defineExpose({
2025-09-25 09:44:43 +08:00
init
2025-09-22 17:16:42 +08:00
})
</script>
<style scoped lang="scss">
.company-list {
2025-09-25 09:44:43 +08:00
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;
}
2025-09-22 17:16:42 +08:00
}
</style>