From 14d29f928b24d203e76f1dcefc1a51182657cd45 Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期一, 10 三月 2025 16:29:09 +0800
Subject: [PATCH] Merge branch 'dev' of http://114.132.189.42:9002/r/center-lims-before-ruoyi into dev

---
 src/views/CNAS/personnel/personnelInfo/Department/components/PersonnelTraining/AddInDetail.vue |  319 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 319 insertions(+), 0 deletions(-)

diff --git a/src/views/CNAS/personnel/personnelInfo/Department/components/PersonnelTraining/AddInDetail.vue b/src/views/CNAS/personnel/personnelInfo/Department/components/PersonnelTraining/AddInDetail.vue
new file mode 100644
index 0000000..38bb4b4
--- /dev/null
+++ b/src/views/CNAS/personnel/personnelInfo/Department/components/PersonnelTraining/AddInDetail.vue
@@ -0,0 +1,319 @@
+<template>
+  <div>
+    <el-dialog :visible.sync="addTrainingPlanDia" :show="currshowlist" @close="$emit('update:currshowlist', false)"
+      title="鏂板鍩硅璁″垝" width="50%">
+      <div class="body">
+        <el-form ref="trainingPlan" :model="trainingPlan" label-position="right" label-width="90px"
+          :rules="trainingPlanRules">
+          <el-row>
+            <el-col :span="12">
+              <!-- <el-form-item label="鍩硅鏃ユ湡:" prop="trainingDate">
+                <el-date-picker v-model="trainingPlan.trainingDate" format="yyyy-MM-dd"
+                                placeholder="閫夋嫨鏃ユ湡" size="small" value-format="yyyy-MM-dd"
+                                type="date" style="width: 100%"></el-date-picker>
+              </el-form-item> -->
+              <el-form-item label="鍩硅鏈堜唤:" prop="trainingDate">
+                <el-select v-model="trainingPlan.trainingDate">
+                  <el-option v-for="(v, i) in months" :key="i" :label="v.label" :value="v.value"></el-option>
+                </el-select>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="鍩硅鏃ユ湡:" prop="trainingDateTwo">
+                <el-date-picker v-model="trainingPlan.trainingDateTwo" type="date" value-format="yyyy-MM-dd"
+                  placeholder="閫夋嫨鏃ユ湡">
+                </el-date-picker>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="寮�濮嬫椂闂�:" prop="openingTime">
+                <el-time-picker v-model="trainingPlan.openingTime" placeholder="閫夋嫨鏃堕棿" size="small" style="width: 100%"
+                  value-format="HH:mm:ss"></el-time-picker>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="缁撴潫鏃堕棿:" prop="endTime">
+                <el-time-picker v-model="trainingPlan.endTime" placeholder="閫夋嫨鏃堕棿" size="small" style="width: 100%"
+                  value-format="HH:mm:ss"></el-time-picker>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="鍩硅鐩爣:">
+                <el-input v-model="trainingPlan.trainingObjectives" placeholder="璇疯緭鍏�" size="small"></el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="鍙傚姞瀵硅薄:">
+                <el-input v-model="trainingPlan.participants" placeholder="璇疯緭鍏�" size="small"></el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="鍩硅鍐呭:" prop="trainingContent">
+                <el-input v-model="trainingPlan.trainingContent" placeholder="璇疯緭鍏�" size="small"></el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="鍩硅璁插笀:" prop="trainingLecturerId">
+                <el-select v-model="trainingPlan.trainingLecturerId" multiple clearable filterable placeholder="璇烽�夋嫨"
+                  size="small" style="width: 100%">
+                  <el-option v-for="item in responsibleOptions" :key="item.id" :label="item.name" :value="item.name">
+                  </el-option>
+                </el-select>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="璇鹃瀛﹀垎:">
+                <el-input type="number" v-model="trainingPlan.projectCredits" label="鎻忚堪鏂囧瓧" size="small"></el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="鍩硅鍦扮偣:">
+                <el-input v-model="trainingPlan.placeTraining" placeholder="璇疯緭鍏�" size="small"></el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="鍩硅鏂瑰紡:">
+                <el-input v-model="trainingPlan.trainingMode" placeholder="璇疯緭鍏�" size="small"></el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="涓惧姙閮ㄩ棬:">
+                <el-select v-model="trainingPlan.holdingDepartment" placeholder="璇烽�夋嫨">
+                  <el-option v-for="(v, i) in departLims" :key="i" :label="v.name" :value="v.id"></el-option>
+                </el-select>
+                <!--
+                <el-input
+                  v-model="trainingPlan.holdingDepartment"
+                  placeholder="璇疯緭鍏�"
+                  size="small"
+                ></el-input> -->
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="璇炬椂:">
+                <el-input type="number" v-model="trainingPlan.classHour" label="鎻忚堪鏂囧瓧" size="small"></el-input>
+              </el-form-item>
+            </el-col>
+          </el-row>
+        </el-form>
+      </div>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="closeAdd">鍙� 娑�</el-button>
+        <el-button type="primary" @click="submitAdd">纭� 瀹�</el-button>
+      </span>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import {
+  selectDepartLims,
+  addOrUpdatePersonTrainingDetailed,
+} from '@/api/cnas/personnel/personnelInfo.js'
+import { selectUserCondition } from "@/api/system/user";
+export default {
+  props: {
+    currshowlist: {
+      type: Boolean,
+      default: false,
+    },
+    currentChangeRow: {
+      type: Object,
+      default: () => {
+        return {};
+      },
+    },
+  },
+  name: "Add",
+  // import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢�
+  components: {},
+  data() {
+    var trainingLecturerIdValidate = (rule, value, callback) => {
+      if (typeof value !== "undefined" && value.length == 0) {
+        callback(new Error("璇烽�夋嫨璁插笀"));
+      } else {
+        callback();
+      }
+    };
+    // 杩欓噷瀛樻斁鏁版嵁
+    return {
+      departLims: [],
+      months: [
+        { label: "1鏈�", value: "1鏈�" },
+        { label: "2鏈�", value: "2鏈�" },
+        { label: "3鏈�", value: "3鏈�" },
+        { label: "4鏈�", value: "4鏈�" },
+        { label: "5鏈�", value: "5鏈�" },
+        { label: "6鏈�", value: "6鏈�" },
+        { label: "7鏈�", value: "7鏈�" },
+        { label: "8鏈�", value: "8鏈�" },
+        { label: "9鏈�", value: "9鏈�" },
+        { label: "10鏈�", value: "10鏈�" },
+        { label: "11鏈�", value: "11鏈�" },
+        { label: "12鏈�", value: "12鏈�" },
+      ],
+      addTrainingPlanDia: false,
+      trainingPlan: {
+        id: "",
+        planId: "",
+        trainingDate: "",
+        trainingDateTwo: "",
+        classHour: "",
+        openingTime: "",
+        endTime: "",
+        trainingObjectives: "",
+        participants: "",
+        trainingContent: "",
+        trainingLecturerId: undefined,
+        projectCredits: "",
+        placeTraining: "",
+        trainingMode: "",
+        holdingDepartment: "",
+      },
+      trainingPlanRules: {
+        trainingDate: [
+          { required: true, message: "璇烽�夋嫨鍩硅鏃ユ湡", trigger: "change" },
+        ],
+        trainingDateTwo: [
+          { required: true, message: "璇烽�夋嫨鍩硅鏃ユ湡", trigger: "change" },
+        ],
+        openingTime: [
+          { required: true, message: "璇烽�夋嫨寮�濮嬫椂闂�", trigger: "change" },
+        ],
+        endTime: [
+          { required: true, message: "璇烽�夋嫨缁撴潫鏃堕棿", trigger: "change" },
+        ],
+        trainingContent: [
+          { required: true, message: "璇疯緭鍏ュ煿璁唴瀹�", trigger: "blur" },
+        ],
+        trainingLecturerId: [
+          {
+            required: true,
+            validator: trainingLecturerIdValidate,
+            trigger: "change",
+          },
+        ],
+      },
+      responsibleOptions: [],
+    };
+  },
+  created() {
+    this.departLims = [];
+    selectDepartLims().then((res) => {
+      this.departLims = res.data;
+    });
+  },
+  // 鏂规硶闆嗗悎
+  methods: {
+    showDialog(id) {
+      this.trainingPlan.planId = id;
+      this.getUserList();
+      // this.addTrainingPlanDia = true;
+    },
+    showEditDialog(row) {
+      this.getUserList();
+      let data = JSON.parse(JSON.stringify(row));
+
+      console.log(data.trainingLecturerId);
+      let list = data.trainingLecturerId.split(/銆亅锛寍,|\\s+/);
+      this.$set(this.trainingPlan, "trainingLecturerId", list);
+      this.$set(this.trainingPlan, "id", data.id);
+      this.$set(this.trainingPlan, "trainingDate", data.trainingDate);
+      this.$set(this.trainingPlan, "trainingDateTwo", data.trainingDateTwo);
+      this.$set(this.trainingPlan, "classHour", data.classHour);
+      this.$set(this.trainingPlan, "openingTime", data.openingTime);
+      this.$set(this.trainingPlan, "endTime", data.endTime);
+      this.$set(
+        this.trainingPlan,
+        "trainingObjectives",
+        data.trainingObjectives
+      );
+      this.$set(this.trainingPlan, "participants", data.participants);
+      this.$set(this.trainingPlan, "projectCredits", data.projectCredits);
+      this.$set(this.trainingPlan, "placeTraining", data.placeTraining);
+      this.$set(this.trainingPlan, "trainingContent", data.trainingContent);
+      this.$set(this.trainingPlan, "trainingMode", data.trainingMode);
+      this.$set(this.trainingPlan, "holdingDepartment", data.holdingDepartment);
+      this.$set(this.trainingPlan, "planId", data.planId);
+
+      console.log("222", this.trainingPlan);
+    },
+    // 鎻愪氦鏂板
+    submitAdd() {
+      this.$refs.trainingPlan.validate((valid) => {
+        if (valid) {
+          // 灏嗗煿璁甯堝�煎皝瑁�
+          this.trainingPlan.trainingLecturerId =
+            this.trainingPlan.trainingLecturerId.join(",");
+          console.log(
+            "this.trainingPlan.trainingLecturerId",
+            this.trainingPlan.trainingLecturerId
+          );
+          const personTrainingDetailed = this.trainingPlan;
+          console.log("personTrainingDetailed", personTrainingDetailed);
+          addOrUpdatePersonTrainingDetailed(personTrainingDetailed).then((res) => {
+            if (res.code == 200) {
+              this.$message.success("鎻愪氦鎴愬姛");
+              this.closeAdd();
+              this.dialogVisible = false;
+            }
+          });
+        }
+      });
+    },
+    // 鍏抽棴寮规
+    closeAdd() {
+      this.$refs.trainingPlan.resetFields();
+      this.$emit("search");
+      this.$emit("searchPlan");
+      this.addTrainingPlanDia = false;
+    },
+    // 鑾峰彇璐熻矗浜轰俊鎭帴鍙�
+    getUserList() {
+      selectUserCondition().then((res) => {
+        if (res.code == 200) {
+          this.responsibleOptions = res.data;
+        }
+      });
+    },
+  },
+  watch: {
+    // addTrainingPlanDia(newVal) {
+    //   if (newVal) {
+    //     this.trainingPlan.planId = null;
+    //   }
+    // },
+    currshowlist(newValue) {
+      this.addTrainingPlanDia = this.currshowlist;
+      if (!newValue) {
+        this.closeAdd();
+        this.trainingPlan = {
+          id: "",
+          planId: "",
+          trainingDate: "",
+          classHour: "",
+          openingTime: "",
+          endTime: "",
+          trainingObjectives: "",
+          participants: "",
+          trainingContent: "",
+          trainingLecturerId: undefined,
+          projectCredits: "",
+          placeTraining: "",
+          trainingMode: "",
+          holdingDepartment: "",
+        };
+      }
+      if (this.currshowlist) {
+        this.$nextTick(() => {
+          if (this.trainingPlan.trainingLecturerId.length == 0) {
+            this.trainingPlan.trainingLecturerId = undefined;
+          }
+        });
+      }
+    },
+  },
+};
+</script>
+
+<style scoped></style>

--
Gitblit v1.9.3