Your Name
2022-04-06 37b718547bc441c7502f0bfcf86209efe253851b
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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
<template>
  <div class="app-container">
    <div class="box">
      <div class="box-right">
        <Titlename title="基础信息"></Titlename>
        <el-form ref="form" :model="form" label-width="120px">
          <div style="width: 80%; margin: auto">
            <el-row class="box-right-content" align="top">
              <el-col :span="11">
                <el-form-item label="A级要素">
                  <el-select
                    v-model="form.elementAName"
                    :disabled="true"
                    style="width: 100%"
                  >
                    <el-option label="区域一" value="shanghai"></el-option>
                    <el-option label="区域二" value="beijing"></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="11" :offset="2" style="white-space: nowrap">
                <el-form-item label="B级要素">
                  <el-select
                    v-model="form.elementBName"
                    :disabled="true"
                    style="width: 100%"
                  >
                    <el-option label="区域一" value="shanghai"></el-option>
                    <el-option label="区域二" value="beijing"></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <el-form-item label="标准化要求">
                  <el-input
                    :rows="3"
                    type="textarea"
                    v-model="form.standardizationRequirements"
                    placeholder=""
                  ></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <el-form-item label="企业达标标准">
                  <el-input
                    type="textarea"
                    :rows="3"
                    v-model="form.enterpriseStandard"
                    placeholder=""
                  ></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <el-form-item label="评审方法">
                  <el-input
                    type="textarea"
                    :rows="3"
                    v-model="form.reviewMethod"
                    placeholder=""
                  ></el-input>
                </el-form-item>
              </el-col>
            </el-row>
          </div>
          <Titlename title="评选标准"></Titlename>
          <div style="width: 80%; margin: auto">
            <el-row>
              <el-col :span="24">
                <el-form-item label="否决项">
                  <el-input
                    type="textarea"
                    :rows="3"
                    v-model="form.veto"
                    placeholder=""
                  ></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row style="padding: 15px 1%">
              <el-col :span="10" :offset="2">
                <span
                  style="font-size: 16px; font-weight: bold; line-height: 29px"
                  >扣分清单</span
                >
              </el-col>
              <el-col :span="12" style="text-align: right">
                <el-button
                  type="primary"
                  @click="coAdd('', '新增')"
                  class="btns"
                  size="mini"
                  icon="el-icon-plus"
                  >新增</el-button
                >
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="22" :offset="2">
                <el-table
                  :data="form.deductionList"
                  border
                  style="width: 99%; margin-left: 1%"
                >
                  <el-table-column
                    type="index"
                    align="center"
                    label="序号"
                    width="150"
                  >
                  </el-table-column>
                  <el-table-column
                    prop="name"
                    align="center"
                    label="说明"
                  ></el-table-column>
                  <el-table-column align="center" label="操作" width="200px">
                    <template slot-scope="scope">
                      <el-button
                        @click="coAdd(scope.row, '编辑')"
                        type="text"
                        size="small"
                        >编辑</el-button
                      >
                      <el-button
                        type="text"
                        size="small"
                        style="color: red"
                        @click="listDel(scope.row)"
                        >删除</el-button
                      >
                    </template>
                  </el-table-column>
                </el-table>
              </el-col>
            </el-row>
          </div>
          <el-row>
            <el-col :span="24" style="padding: 20px 0; text-align: center">
              <el-button type="primary" @click="safetyInspectionItemA()" class="btns">提交</el-button>
              <el-button @click="back()">取消</el-button>
            </el-col>
          </el-row>
        </el-form>
      </div>
    </div>
 
    <el-dialog title="扣分详情" :visible.sync="dialogVisible" :close-on-click-modal="false" width="30%">
      <el-form ref="form" :rules="rules" :model="formInline" label-width="54px">
        <el-form-item label="说明" prop="name">
          <el-input v-model="formInline.name"></el-input>
        </el-form-item>
        <el-form-item label="备注">
          <el-input
            v-model="formInline.remark"
            :rows="5"
            type="textarea"
          ></el-input>
        </el-form-item>
      </el-form>
      <span
        slot="footer"
        class="dialog-footer"
        style="text-align: center; display: block"
      >
        <el-button type="primary" class="btns" @click="listAdd"
          >确 定</el-button
        >
        <el-button @click="bacQx">取 消</el-button>
      </span>
    </el-dialog>
  </div>
</template>
<script>
import Titlename from "../../components/Titlename/index.vue";
import { safetyInspectionItemId } from "@/api/safetySelfInspection.js";
import { safetyInspectionItemMod } from "@/api/safetyInspectionItem.js";
export default {
  components: { Titlename },
  data() {
    return {
      dialogVisible: false,
      id: "",
      resource: "0",
      form: {},
      formInline: {
        name: "",
        remark: "",
      },
      name:"",
      typeid:'',
        rules: {
        name: [
          { required: true, message: "说明不能为空", trigger: "change" },
        ],}
    };
  },
  created() {
    this.id = this.$route.query.idX;
    this.typeid=this.$route.query.id;
    this.name = this.$route.query.name
    this.safeT(this.id);
  },
  methods: {
    safeT(id) {
      safetyInspectionItemId({ id: id }).then((res) => {
        if (res.data.code == 200) {
          this.form = res.data.result;
        }
      });
    },
    coAdd(val, type) {
       this.$nextTick(() => {
        this.$refs["form"].clearValidate();
      });
      this.titleN = type;
      if (type == "新增") {
        this.dialogVisible = true;
        this.formInline = {
          name: "",
          remark: "",
        };
      } else {
        this.dialogVisible = true;
        this.index = this.form.deductionList.findIndex(
          (item) => item.name == val.name
        );
        // this.formInline = val;
          this.formInline=JSON.parse(JSON.stringify(val));
      }
    },
    listAdd() {
       this.$refs["form"].validate((valid) => {
        if (valid) {
      if (this.titleN == "新增") {
        this.form.deductionList.push(this.formInline);
        this.dialogVisible = false;
      } else {
        this.form.deductionList[this.index].name = this.formInline.name;
        this.form.deductionList[this.index].space = this.formInline.space;
        this.dialogVisible = false;
      }
          }
      });
    },
    listDel(val) {
      var i = this.form.deductionList.findIndex(
        (item) => item.name == val.name
      );
      this.form.deductionList.splice(i, 1);
    },
       safetyInspectionItemA() {
        safetyInspectionItemMod(this.form).then((res) => {
          if (res.data.code == 200) {
            this.$notify({
              type: "success",
              duration: 2000,
              message: "修改成功",
              title: "成功",
            });
            this.$router.push({
              path:"/new",
              query:{
                name:this.name,
                id:this.typeid
              }
            })
          } else {
            this.$message({
              type: "warning",
              message: res.data.message,
            });
          }
        });
    },
    back(){
       this.$router.push({
              path:"/new",
               query:{
                name:this.name,
                id:this.typeid
              }
            })
    },
    bacQx(){
      this.dialogVisible = false;
    this.safeT(this.id);
    },
    handleClick() {
      this.dialogVisible = true;
    },
  },
};
</script>
<style scoped>
.app-container {
  padding: 0px;
}
.box {
  width: 100%;
  display: flex;
  justify-content: space-between;
  background-color: #dedede;
}
.box-left {
  width: 20%;
  /* height: 800px; */
  background-color: white;
  border-radius: 5px;
}
.box-left-content {
  padding: 10px;
}
.box-right {
  width: 100%;
  background-color: white;
  border-radius: 5px;
}
.box-right-content {
  padding: 15px 0;
}
.btns {
  background-color: #034ea2;
  border: 1px solid #034ea2;
}
</style>