1
lkk
2025-04-16 4f55c0255e5e68b3685d1510062dff6e1e3dbc48
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
<template>
  <div>
    <el-dialog
      :title="title"
      :visible.sync="open"
      width="1200px"
      append-to-body
    >
      <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">
          <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">
          <el-input
            type="textarea"
            v-model="propform.advice"
            :autosize="{ minRows: 9, maxRows: 10 }"
            placeholder="请输入建议"
          />
        </el-form-item>
      </el-form>
 
      <span slot="footer" class="dialog-footer">
        <el-button @click="open = false">取 消</el-button>
        <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,
  addCyTjAdvice,
  addTjAdviceKjbq,
} from "@/api/system/biaoqianzidian";
import { getInfo } from "@/api/login";
export default {
  name: "createproposal",
  props: {
    creatobj: Object,
  },
  data() {
    return {
      deptId:"",
      isZjs: 0,
      propform: {
        advice: "",
        kjbq: [],
      },
      form: {},
      kjbqopen: false,
      open: false,
      openone: false,
      // 弹出层标题
      title: "",
      dataList: [],
      // 遮罩层
      loading: false,
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        userId: null,
        qyzt: 0,
      },
      list: [],
      fList: [],
      id: "",
    };
  },
  watch: {
    creatobj(val, newVla) {
      console.log(val, 111);
      this.propform.advice = val.proParentList;
      this.isZjs = val.isZj;
      if(val.proParentList){
        this.getList();
      }
      
    },
  },
  mounted() {
    this.propform.kjbq = [];
    // this.getList();
  },
 
  created() {
    // 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) {
            this.dataList = res.data.records;
          }
 
          this.loading = false;
        });
      });
    },
    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() {
      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);
      // }
    },
  },
};
</script>
  
<style scoped>
.pag {
  width: 100%;
  display: flex;
  justify-content: center;
}
 
.pag1 {
  width: 30%;
}
</style>