From 1d66f43353524889999bbd9ac0b331c557ff98f7 Mon Sep 17 00:00:00 2001
From: zhouwx <1175765986@qq.com>
Date: 星期一, 30 六月 2025 17:29:22 +0800
Subject: [PATCH] 修改

---
 src/views/system/industryManage/components/editDialog.vue |  136 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 136 insertions(+), 0 deletions(-)

diff --git a/src/views/system/industryManage/components/editDialog.vue b/src/views/system/industryManage/components/editDialog.vue
new file mode 100644
index 0000000..a3c2a90
--- /dev/null
+++ b/src/views/system/industryManage/components/editDialog.vue
@@ -0,0 +1,136 @@
+<template>
+  <div class="notice">
+    <el-dialog
+        v-model="dialogVisible"
+        :title="state.title"
+        width="550px"
+        :before-close="handleClose"
+        :close-on-press-escape="false"
+        :close-on-click-modal="false"
+    >
+      <el-form :model="state.form" size="default" ref="busRef" :rules="state.formRules" label-width="150px" >
+        <el-form-item label="行业名称:" prop="name">
+          <el-input v-model.trim="state.form.name" :disabled="state.title =='查看'" placeholder="行业名称"></el-input>
+        </el-form-item>
+      </el-form>
+      <template #footer v-if="state.title !='查看'">
+        <span class="dialog-footer">
+            <el-button @click="handleClose" size="default">取 消</el-button>
+            <el-button type="primary"  @click="onSubmit" size="default" v-preReClick>确认</el-button>
+        </span>
+      </template>
+    </el-dialog>
+  </div>
+</template>
+<script setup>
+import {reactive, ref, toRefs, defineEmits, nextTick, onMounted} from 'vue'
+import {ElMessage} from "element-plus";
+import {addUser, editUser, getUserById, resetPwd} from "@/api/onlineEducation/user"
+import {Base64} from "js-base64"
+import {getCompany} from "@/api/onlineEducation/company";
+import {updateInfoPlatforms, updateSysClause} from "@/api/staffManage/staff";
+import Cookies from "js-cookie";
+import {addBasic, editBasic} from "@/api/companyInfo/basicInfo";
+
+const emit = defineEmits(["getList"]);
+const dialogVisible = ref(false)
+const busRef = ref();
+const state = reactive({
+  title: '',
+  form: {
+    id: null,
+    name: '',
+  },
+  formRules:{
+    name: [{ required: true, message: '请输入行业名称', trigger: 'blur' }],
+  }
+})
+onMounted(() => {
+
+});
+
+const openDialog = async (type, value,companyId) => {
+  state.title = type === 'add' ? '新增' : type ==='edit' ? '编辑' : '查看'
+  state.form.companyId = companyId
+  if(state.title == '编辑'||state.title == '查看'){
+    Object.keys(state.form).forEach(key => {
+      if (key in value) {
+        state.form[key] = value[key]
+      }
+    })
+  }
+  dialogVisible.value = true
+}
+
+
+const onSubmit = async () => {
+  const valid = await busRef.value.validate();
+  if(valid){
+    if(title.value === '新增'){
+      const {id, ...data} = JSON.parse(JSON.stringify(state.form))
+      const res = await addBasic(data)
+      if(res.code === 200){
+        ElMessage({
+          type: 'success',
+          message: '新增成功'
+        });
+      }else{
+        ElMessage.warning(res.message)
+      }
+      emit("getList")
+      busRef.value.clearValidate();
+      reset();
+      dialogVisible.value = false;
+    }else if(title.value === '编辑'){
+      const {...data} = JSON.parse(JSON.stringify(state.form))
+      const res = await editBasic(data)
+      if(res.code === 200){
+        ElMessage({
+          type: 'success',
+          message: '编辑成功'
+        });
+      }else{
+        ElMessage.warning(res.message)
+      }
+      emit("getList")
+      busRef.value.clearValidate();
+      reset();
+      dialogVisible.value = false;
+    }
+  }
+}
+
+const handleClose = () => {
+  busRef.value.clearValidate();
+  reset();
+  dialogVisible.value = false;
+  emit("getList")
+}
+const reset = () => {
+  state.form = {
+    id: null,
+    clauseNum: '',
+    name: '',
+    companyId: null
+
+  }
+}
+
+defineExpose({
+  openDialog
+});
+
+</script>
+
+<style scoped lang="scss">
+.notice{
+  :deep(.el-form .el-form-item__label) {
+    font-size: 15px;
+  }
+  .file {
+    display: flex;
+    flex-direction: column;
+    align-items: flex-start;
+  }
+}
+</style>

--
Gitblit v1.9.2