Newer
Older
KaiFengPC / src / views / spongePerformance / management / operate.vue
@zhangdeliang zhangdeliang on 23 May 2 KB 初始化项目
  1. <template>
  2. <el-form ref="ruleForm" :model="form" :rules="rules">
  3. <el-row :gutter="40">
  4. <el-col :span="12">
  5. <el-form-item label="工程类型:" prop="engineeringType">
  6. <el-select v-model="form.engineeringType" placeholder="请选择工程类型" style="width: 100%">
  7. <el-option
  8. v-for="dict in sponge_engineering_type"
  9. :key="dict.value"
  10. :label="dict.label"
  11. :value="dict.value"
  12. />
  13. </el-select>
  14. </el-form-item>
  15. </el-col>
  16. <el-col :span="12">
  17. <el-form-item label="考核类型:" prop="assessType">
  18. <el-select v-model="form.assessType" placeholder="请选择考核类型" style="width: 100%">
  19. <el-option
  20. v-for="dict in assess_type"
  21. :key="dict.value"
  22. :label="dict.label"
  23. :value="dict.value"
  24. />
  25. </el-select>
  26. </el-form-item>
  27. </el-col>
  28. </el-row>
  29. </el-form>
  30. </template>
  31.  
  32. <script setup>
  33. import { reactive } from 'vue'
  34. import {
  35. assessTargetConfigAdd
  36. }
  37. from '@/api/spongePerformance/examineManage.js'
  38. const { proxy } = getCurrentInstance();
  39.  
  40. const emit = defineEmits(['close'])
  41.  
  42. const form = reactive({
  43. engineeringType: '',
  44. assessType: ''
  45. })
  46.  
  47. const rules = {
  48. engineeringType: [{ required: true, trigger: "change", message: "请选择工程类型" }],
  49. assessType: [{ required: true, trigger: "change", message: "请选择考核类型" }]
  50. };
  51.  
  52.  
  53. const { sponge_engineering_type } = proxy.useDict("sponge_engineering_type")
  54. const { assess_type } = proxy.useDict("assess_type")
  55.  
  56. const submit = () => {
  57. proxy.$refs.ruleForm.validate(async (valid, fields) => {
  58. if (valid) {
  59. const params = { ...form }
  60. const res = await assessTargetConfigAdd(params)
  61. if(res?.code !== 200) return
  62. proxy.$modal.msgSuccess('操作成功!')
  63. emit('close', 'add')
  64. } else {
  65. console.log('error submit!', fields)
  66. }
  67. })
  68. }
  69.  
  70. defineExpose({
  71. submit
  72. })
  73. </script>
  74.  
  75. <style lang="scss" scoped></style>