gaoluyang
2025-11-19 a5ddaf6b76f1266a180a45d0cbde9cd4eefe5912
src/views/personnelManagement/onboarding/components/formDia.vue
@@ -37,7 +37,9 @@
        <el-row :gutter="30">
          <el-col :span="12">
            <el-form-item label="岗位:" prop="postJob">
              <el-input v-model="form.postJob" placeholder="请输入" clearable/>
              <el-select v-model="form.postJob" filterable placeholder="请选择岗位" :loading="positionLoading" clearable>
                <el-option v-for="p in positionOptions" :key="p.id" :label="p.name || p.label" :value="p.id" />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
@@ -131,13 +133,18 @@
</template>
<script setup>
import {ref} from "vue";
import {ref, reactive, toRefs, getCurrentInstance, onMounted} from "vue";
import {getStaffJoinInfo, staffJoinAdd, staffJoinUpdate} from "@/api/personnelManagement/onboarding.js";
import {deptPositionListPage} from "@/api/lavorissce/issue";
const { proxy } = getCurrentInstance()
const emit = defineEmits(['close'])
const dialogFormVisible = ref(false);
const operationType = ref('')
const positionOptions = ref([])
const positionLoading = ref(false)
const data = reactive({
  form: {
    staffNo: "",
@@ -177,10 +184,21 @@
});
const { form, rules } = toRefs(data);
async function loadPositions() {
  try {
    positionLoading.value = true
    const res = await deptPositionListPage({pageNum: 1, pageSize: 9999})
    positionOptions.value = res?.data?.records || res?.data || []
  } finally {
    positionLoading.value = false
  }
}
// 打开弹框
const openDialog = (type, row) => {
  operationType.value = type;
  dialogFormVisible.value = true;
  loadPositions()
  if (operationType.value === 'edit') {
    getStaffJoinInfo(row.id).then(res => {
      form.value = {...res.data}
@@ -191,6 +209,7 @@
      form.value.id = ''
   }
}
// 提交产品表单
const submitForm = () => {
  proxy.$refs.formRef.validate(valid => {