From ad54cf427ee94e01e8c72a01f738615eb2b6569d Mon Sep 17 00:00:00 2001
From: qx <1084500556@qq.com>
Date: 星期五, 04 七月 2025 17:58:34 +0800
Subject: [PATCH] Merge branch 'master' of http://101.42.27.146:5001/r/ltkj_peisweb

---
 src/components/createproposal/index.vue |  137 ++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 114 insertions(+), 23 deletions(-)

diff --git a/src/components/createproposal/index.vue b/src/components/createproposal/index.vue
index 95901fa..50dd191 100644
--- a/src/components/createproposal/index.vue
+++ b/src/components/createproposal/index.vue
@@ -6,13 +6,28 @@
       width="1200px"
       append-to-body
     >
-      <el-form ref="form" :model="propform" label-width="80px">
+      <el-form ref="form" :model="propform" label-width="80px" @submit.native.prevent>
         <el-form-item label="寤鸿鏍囬" prop="title">
           <el-input v-model="propform.title" placeholder="璇疯緭鍏ュ悕绉版爣棰�" />
         </el-form-item>
         <el-form-item label="蹇嵎鏍囩" prop="kjbq">
-          <el-checkbox-group v-model="propform.kjbq" @change="handleCheckedCitiesChange">
-            <el-checkbox v-for="(item,index) in dataList" :key="index" :label="item.id" >{{ item.kjbq}}</el-checkbox>
+          <span
+            slot="label"
+            style="display: inline-block; border-bottom: 2px solid blue"
+            @click="handleQuery"
+          >
+            蹇嵎鏍囩
+          </span>
+          <el-checkbox-group
+            v-model="propform.kjbq"
+            @change="handleCheckedCitiesChange"
+          >
+            <el-checkbox
+              v-for="(item, index) in dataList"
+              :key="index"
+              :label="item.id"
+              >{{ item.kjbq }}</el-checkbox
+            >
           </el-checkbox-group>
         </el-form-item>
         <el-form-item label="寤鸿鍐呭" prop="advice">
@@ -30,23 +45,47 @@
         <el-button type="primary" @click="handleOk">纭� 瀹�</el-button>
       </span>
     </el-dialog>
+    <el-dialog
+      title="娣诲姞蹇嵎鏍囩"
+      :visible.sync="kjbqopen"
+      width="500px"
+      append-to-body
+    >
+      <el-form ref="form" :model="form" label-width="80px">
+        <el-form-item label="鍚嶇О" prop="kjbq">
+          <el-input v-model="form.kjbq" placeholder="璇疯緭鍏ュ悕绉�" />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm">纭� 瀹�</el-button>
+        <el-button @click="cancel">鍙� 娑�</el-button>
+      </div>
+    </el-dialog>
   </div>
 </template>
   
 <script>
-import { getTjAdviceKjbqByFl } from "@/api/system/biaoqianzidian";
+import {
+  getTjAdviceKjbqByFl,
+  addCyTjAdvice,
+  addTjAdviceKjbq,
+} from "@/api/system/biaoqianzidian";
 import { getInfo } from "@/api/login";
 export default {
   name: "createproposal",
   props: {
-    dataText: Array,
+    creatobj: Object,
   },
   data() {
     return {
+      deptId:"",
+      isZjs: 0,
       propform: {
         advice: "",
-        kjbq:[],
+        kjbq: [],
       },
+      form: {},
+      kjbqopen: false,
       open: false,
       openone: false,
       // 寮瑰嚭灞傛爣棰�
@@ -62,50 +101,102 @@
       },
       list: [],
       fList: [],
+      id: "",
     };
   },
   watch: {
-    dataText(val, newVla) {
-      this.fList = val;
-      val.forEach((item) => {
-        this.propform.advice += item.advice;
-      });
-      if (this.propform.advice) {
+    creatobj(val, newVla) {
+      console.log(val, 111);
+      this.propform.advice = val.proParentList;
+      this.isZjs = val.isZj;
+      if(val.proParentList){
         this.getList();
       }
+      
     },
   },
   mounted() {
-    // this.getList()
+    this.propform.kjbq = [];
+    // this.getList();
   },
 
   created() {
-    // if( this.queryParams){
-    //     this.getList()
-    // }
+    // this.getList();
   },
   methods: {
     getList() {
       this.loading = true;
       getInfo().then((res) => {
+        this.form.userId = res.user.userId;
         this.queryParams.userId = res.user.userId;
+        this.deptId = res.user.deptId;
+        console.log(this.deptId);
         getTjAdviceKjbqByFl(this.queryParams).then((res) => {
-          if(res.data){
+          if (res.data) {
             this.dataList = res.data.records;
           }
-        
+
           this.loading = false;
         });
       });
     },
-    handleCheckedCitiesChange(val){
-      console.log(val)
+    handleQuery() {
+      this.kjbqopen = true;
     },
+    cancel() {
+      this.kjbqopen = false;
+    },
+    submitForm() {
+      this.$refs["form"].validate((valid) => {
+        if (valid) {
+          if (this.form.id != null) {
+            updateTjAdviceKjbq(this.form).then((response) => {
+              this.$modal.msgSuccess("淇敼鎴愬姛");
+              this.kjbqopen = false;
+              this.getList();
+            });
+          } else {
+            addTjAdviceKjbq(this.form).then((response) => {
+              this.$modal.msgSuccess("鏂板鎴愬姛");
+              this.kjbqopen = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+    handleCheckedCitiesChange(val) {},
     handleOk() {
-      this.open = false;
-      if (this.list.length != 0) {
-        this.$emit("event1", this.list);
+      if (this.isZjs == 0) {
+        let data = {
+          title: this.propform.title,
+          isZj: this.isZjs,
+          kjbq: this.propform.kjbq.toString(),
+          advice: this.propform.advice,
+        };
+        addCyTjAdvice(data).then((res) => {
+          if (res.code == 200) {
+            this.open = false;
+          }
+        });
+      } else {
+        let data = {
+          deptId:this.deptId,
+          title: this.propform.title,
+          isZj: this.isZjs,
+          kjbq: this.propform.kjbq.toString(),
+          advice: this.propform.advice,
+        };
+        addCyTjAdvice(data).then((res) => {
+          if (res.code == 200) {
+            this.open = false;
+          }
+        });
       }
+
+      // if (this.list.length != 0) {
+      //   this.$emit("event1", this.list);
+      // }
     },
   },
 };

--
Gitblit v1.8.0