Blame view

src/views/baseSystemInfo/InspectForm.vue 12 KB
006cc67a   monkeyhouyi   巡查上报
1
2
3
4
5
6
7
  <template>
    <el-dialog
      title="上报"
      :close-on-click-modal="false"
      :visible.sync="visible"
      class="NCC-dialog NCC-dialog_center"
      lock-scroll
61009cfc   monkeyhouyi   2024/8/8
8
      width="60%"
006cc67a   monkeyhouyi   巡查上报
9
    >
7180000e   monkeyhouyi   优化
10
11
12
13
14
15
      <el-row :gutter="15" class="NCC-dialog-content" v-loading="form_loading">
        <el-form ref="elForm" :model="dataForm" size="small" label-width="100px" label-position="right" :rules="rules">
          <el-col :span="24">
            <el-form-item label="问题来源" prop="reportSource">
              <el-radio-group v-model="dataForm.reportSource">
                <el-radio v-for="(item, index) in sourceOptions" :key="index" :label="item.Id" >{{ item.FullName }}</el-radio>
61009cfc   monkeyhouyi   2024/8/8
16
              </el-radio-group>
9913f656   monkeyhouyi   巡查上报
17
18
            </el-form-item>
          </el-col>
7180000e   monkeyhouyi   优化
19
          <el-col :span="23">
65aeaaa1   monkeyhouyi   样式修改
20
            <el-form-item label="应用名称" prop="platformName">
57235647   monkeyhouyi   应用上报
21
              <el-select
7180000e   monkeyhouyi   优化
22
                ref="select"
57235647   monkeyhouyi   应用上报
23
24
25
26
                v-model="dataForm.platformName"
                filterable
                remote
                reserve-keyword
65aeaaa1   monkeyhouyi   样式修改
27
                placeholder="请输入应用名称"
7180000e   monkeyhouyi   优化
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
                @blur.native.capture="selectBlur"
                @visible-change="visibleNameChange"
                @change="(val) => platformNameChange(val, 'change')"
                :loading="name_loading"
                disabled>
                <el-option v-for="item in nameOptions" :key="item.id" :label="item.systemName" :value="item.id"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="23">
            <el-form-item label="运营主体" prop="company">
              <el-select
                v-model="dataForm.company"
                placeholder="请选择运营主体"
                clearable
                filterable 
                style="width: 100%"
                disabled
              >
                <el-option v-for="item in companyOptions" :key="item.id" :label="item.companyName" :value="item.id">
57235647   monkeyhouyi   应用上报
48
49
                </el-option>
              </el-select>
006cc67a   monkeyhouyi   巡查上报
50
51
52
            </el-form-item>
          </el-col>
          <el-col :span="24">
65aeaaa1   monkeyhouyi   样式修改
53
            <el-form-item label="应用类型" prop="platformType">
7180000e   monkeyhouyi   优化
54
55
              <el-radio-group v-model="dataForm.platformType" disabled>
                <el-radio v-for="(item, index) in platformTypeOptions" :key="index" :label="item.Id" >{{ item.FullName }}</el-radio>
9913f656   monkeyhouyi   巡查上报
56
              </el-radio-group>
006cc67a   monkeyhouyi   巡查上报
57
58
            </el-form-item>
          </el-col>
7180000e   monkeyhouyi   优化
59
60
61
62
          <el-col :span="23" v-show="dataForm.platformType == '580634746028033285'">
            <el-form-item label="归属平台" prop="selfMediaPlatformType">
              <el-radio-group v-model="dataForm.selfMediaPlatformType" :disabled="!!this.dataForm.id">
                <el-radio v-for="(item, index) in mediaPlatList" :key="index" :label="item" >{{ item }}</el-radio>
006cc67a   monkeyhouyi   巡查上报
63
64
65
              </el-radio-group>
            </el-form-item>
          </el-col>
7180000e   monkeyhouyi   优化
66
67
68
69
70
          <el-col :span="23" v-show="dataForm.selfMediaPlatformType == '其他'">
            <el-form-item label="其他归属平台" prop="selfMediaPlatformTypeOther">
              <el-input v-model="dataForm.selfMediaPlatformTypeOther" placeholder="请输入其他归属平台" clearable :style="{ width: '100%' }" />
            </el-form-item>
          </el-col>
57235647   monkeyhouyi   应用上报
71
          <el-col :span="23">
7180000e   monkeyhouyi   优化
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
            <el-form-item label="问题类型" prop="questionType">
              <el-radio-group v-model="dataForm.questionType">
                <el-radio v-for="(item, index) in questionTypeOptions" :key="index" :label="item.fullName" >{{ item.fullName }}</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
          <el-col :span="23" v-show="dataForm.questionType == '其他'">
            <el-form-item label="其他问题类型" prop="otherQuestionType">
              <el-input v-model="dataForm.otherQuestionType" placeholder="请输入其他问题类型" clearable :style="{ width: '100%' }" />
            </el-form-item>
          </el-col>
          <el-col :span="23" v-show="dataForm.questionType == '错误表述'">
            <el-form-item label="正确描述" prop="accurateDescription">
              <el-input v-model="dataForm.accurateDescription" placeholder="请输入正确描述" clearable :style="{ width: '100%' }"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="23" v-show="dataForm.questionType == '错误表述'">
            <el-form-item label="错误描述" prop="incorrectDescription">
              <el-input v-model="dataForm.incorrectDescription" placeholder="请输入错误描述" clearable :style="{ width: '100%' }"></el-input>
006cc67a   monkeyhouyi   巡查上报
91
92
            </el-form-item>
          </el-col>
57235647   monkeyhouyi   应用上报
93
          <el-col :span="23">
7180000e   monkeyhouyi   优化
94
95
            <el-form-item label="问题内容" prop="questionContent">
              <el-input v-model="dataForm.questionContent" placeholder="请输入" show-word-limit :style="{ width: '100%' }" type="textarea" :autosize="{ minRows: 4, maxRows: 4 }" />
006cc67a   monkeyhouyi   巡查上报
96
97
            </el-form-item>
          </el-col>
57235647   monkeyhouyi   应用上报
98
          <el-col :span="23">
61009cfc   monkeyhouyi   2024/8/8
99
            <el-form-item label="关键词" prop="questionClass">
7180000e   monkeyhouyi   优化
100
              <el-input v-model="dataForm.questionClass" placeholder="请输入关键词" clearable :style="{ width: '100%' }"></el-input>
61009cfc   monkeyhouyi   2024/8/8
101
102
103
            </el-form-item>
          </el-col>
          <el-col :span="23">
7180000e   monkeyhouyi   优化
104
105
            <el-form-item label="附件" prop="annex">
              <NCC-UploadFz v-model="dataForm.annex" :fileSize="5" sizeUnit="MB" :limit="9" buttonText="点击上传" />
006cc67a   monkeyhouyi   巡查上报
106
107
108
109
110
111
            </el-form-item>
          </el-col>
        </el-form>
      </el-row>
      <span slot="footer" class="dialog-footer">
        <el-button @click="visible = false">取 消</el-button>
7180000e   monkeyhouyi   优化
112
        <el-button type="primary" @click="dataFormSubmit()">确 定</el-button>
006cc67a   monkeyhouyi   巡查上报
113
114
115
116
117
118
119
      </span>
    </el-dialog>
  </template>
  <script>
  import request from "@/utils/request";
  import { getDictionaryDataSelector } from "@/api/systemData/dictionary";
  import { getDetail, addForm, updataForm } from "@/api/systemData/dataInterface";
7180000e   monkeyhouyi   优化
120
  import { MediaPlatList } from "@/assets/data"
006cc67a   monkeyhouyi   巡查上报
121
122
123
124
125
126
127
  export default {
    components: {},
    props: [],
    data() {
      return {
        loading: false,
        visible: false,
7180000e   monkeyhouyi   优化
128
        name_loading: false,
006cc67a   monkeyhouyi   巡查上报
129
        isDetail: false,
7180000e   monkeyhouyi   优化
130
        form_loading: true,
006cc67a   monkeyhouyi   巡查上报
131
        dataForm: {
9913f656   monkeyhouyi   巡查上报
132
          id: undefined,
7180000e   monkeyhouyi   优化
133
134
135
136
137
138
          reportSource: undefined,
          platformNameStr: undefined,
          platformTypeStr: undefined,
          companyStr: undefined,
          platformName: '',
          selfMediaPlatformType: '',
006cc67a   monkeyhouyi   巡查上报
139
140
141
142
143
          platformType: undefined,
          questionType: undefined,
          questionClass: undefined,
          questionContent: undefined,
          link: undefined,
57235647   monkeyhouyi   应用上报
144
145
          accurateDescription: undefined,
          incorrectDescription: undefined,
7180000e   monkeyhouyi   优化
146
147
148
149
          annex: [],
          otherQuestionType: undefined,
          selfMediaPlatformTypeOther: undefined,
          company: undefined,
006cc67a   monkeyhouyi   巡查上报
150
        },
9913f656   monkeyhouyi   巡查上报
151
        rules: {
7180000e   monkeyhouyi   优化
152
153
154
155
156
157
          platformName: [
            { required: true, message: "请选择应用名称", trigger: "blur" },
          ],
          company: [
            { required: true, message: "请选择运营主体", trigger: "blur" },
          ],
9913f656   monkeyhouyi   巡查上报
158
          platformType: [
7180000e   monkeyhouyi   优化
159
            { required: true, message: "请选择应用类型", trigger: "blur" },
9913f656   monkeyhouyi   巡查上报
160
161
          ],
          questionType: [
7180000e   monkeyhouyi   优化
162
            { required: true, message: "请选择问题类型", trigger: "blur" },
9913f656   monkeyhouyi   巡查上报
163
          ],
7180000e   monkeyhouyi   优化
164
165
166
          // otherQuestionType: [
          //   { required: true, message: "请输入其他问题类型", trigger: "blur" },
          // ],
9913f656   monkeyhouyi   巡查上报
167
        },
7180000e   monkeyhouyi   优化
168
        sourceOptions: [],
006cc67a   monkeyhouyi   巡查上报
169
170
        platformTypeOptions: [],
        questionTypeOptions: [],
7180000e   monkeyhouyi   优化
171
172
173
174
        nameOptions: [],
        mediaPlatList: MediaPlatList,
        companyOptions: [],
        btnLoading: false,
006cc67a   monkeyhouyi   巡查上报
175
176
177
178
      };
    },
    computed: {},
    watch: {},
7180000e   monkeyhouyi   优化
179
    created() {},
006cc67a   monkeyhouyi   巡查上报
180
181
    mounted() {},
    methods: {
7180000e   monkeyhouyi   优化
182
183
184
185
186
187
188
      async initAllList() {
        let companyRes = await request({
          url: `/Extend/basecomapnyinfo/GetNoPagingList`,
          method: "GET",
        });
        this.companyOptions = companyRes.data;
        let SourceRes = await request({
61009cfc   monkeyhouyi   2024/8/8
189
190
          url: `/Extend/baseinspectionreport/GetReportSourceList`,
          method: "GET",
7180000e   monkeyhouyi   优化
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
        });
        this.sourceOptions = SourceRes.data;
        let list = this.$store.state.meta.system;
        !list && (list = await this.$store.dispatch("getTypeListByCode", "system"));
        this.platformTypeOptions = list;
        await getDictionaryDataSelector("577006814432855301").then((res) => {
          this.questionTypeOptions = [...res.data.list, {Id: '0', fullName: '其他'}];
        });
        this.name_loading = true
        await request({
          url: `/Extend/basesysteminfo/GetNoPagingList`,
          method: "GET",
        }).then(({data}) => {
          if(!data) return;
          this.nameOptions = data;
          this.name_loading = false;
        });
      },
      async initCompanyList() {
        request({
          url: `/Extend/basecomapnyinfo/GetNoPagingList`,
          method: "GET",
61009cfc   monkeyhouyi   2024/8/8
213
        }).then(({data}) => {
7180000e   monkeyhouyi   优化
214
          this.companyOptions = data;
61009cfc   monkeyhouyi   2024/8/8
215
216
        })
      },
7180000e   monkeyhouyi   优化
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
      selectBlur(e) {
        let value = e.target.value;
        if(!value) return;
        this.dataForm.platformName = e.target.value;
        this.platformNameChange(value, 'blur');
      },
      platformNameChange(val, type) {
        let obj = this.nameOptions.find(v => type == 'blur' ? val == v.fullName : val == v.id);
        this.dataForm.platformName = obj ? obj.id : val;
        this.dataForm.company = obj ? this.companyOptions.find(v => v.id == obj.companyId || v.companyName == obj.companyId).id : '';
        this.dataForm.platformType = obj ? this.platformTypeOptions.find(v => v.Id == obj.systemType || v.FullName == obj.systemType).Id : '';
        if(obj && obj.selfMediaPlatformType && this.dataForm.platformType == '580634746028033285') {
          if(this.mediaPlatList.findIndex(j => j == obj.selfMediaPlatformType) == -1) {
            this.dataForm.selfMediaPlatformType = '其他';
            this.dataForm.selfMediaPlatformTypeOther = obj.selfMediaPlatformType;
          } else {
            this.dataForm.selfMediaPlatformType = obj.selfMediaPlatformType;
          }
        }
      },
      visibleNameChange(val) {
        if (val) return
        let input = this.$refs.select.$children[0].$refs.input;
        input.blur();
      },
      async loadList() {
57235647   monkeyhouyi   应用上报
243
        this.name_loading = true;
7180000e   monkeyhouyi   优化
244
245
246
247
248
249
        request({
          url: `/Extend/basesysteminfo/GetNoPagingList`,
          method: "GET",
        }).then(({data}) => {
          if(!data) return;
          this.nameOptions = data;
57235647   monkeyhouyi   应用上报
250
          this.name_loading = false;
7180000e   monkeyhouyi   优化
251
        })
57235647   monkeyhouyi   应用上报
252
      },
006cc67a   monkeyhouyi   巡查上报
253
254
      async getplatformTypeOptions() {
        let list = this.$store.state.meta.system;
7180000e   monkeyhouyi   优化
255
        !list && (list = await this.$store.dispatch("getTypeListByCode", "system"));
006cc67a   monkeyhouyi   巡查上报
256
257
        this.platformTypeOptions = list;
      },
7180000e   monkeyhouyi   优化
258
259
260
261
      async getSourceOptions() {
        let { data } = await request({
          url: `/Extend/baseinspectionreport/GetReportSourceList`,
          method: "GET",
006cc67a   monkeyhouyi   巡查上报
262
        });
7180000e   monkeyhouyi   优化
263
        this.sourceOptions = data;
006cc67a   monkeyhouyi   巡查上报
264
      },
7180000e   monkeyhouyi   优化
265
266
267
268
      async getquestionTypeOptions() {
        getDictionaryDataSelector("577006814432855301").then((res) => {
          this.questionTypeOptions = [...res.data.list, {Id: '0', fullName: '其他'}];
        });
57235647   monkeyhouyi   应用上报
269
      },
006cc67a   monkeyhouyi   巡查上报
270
271
272
      goBack() {
        this.$emit("refresh");
      },
7180000e   monkeyhouyi   优化
273
274
      async init(row) {
        this.dataForm.id = '';
006cc67a   monkeyhouyi   巡查上报
275
        this.visible = true;
7180000e   monkeyhouyi   优化
276
277
278
        this.isDetail = false;
        this.form_loading = true;
        await this.initAllList();
006cc67a   monkeyhouyi   巡查上报
279
280
        this.$nextTick(async () => {
          this.$refs["elForm"].resetFields();
7180000e   monkeyhouyi   优化
281
282
          this.platformNameChange(row.id);
          this.form_loading = false;
006cc67a   monkeyhouyi   巡查上报
283
284
285
286
287
        });
      },
      dataFormSubmit() {
        this.$refs["elForm"].validate(async (valid) => {
          if (valid) {
7180000e   monkeyhouyi   优化
288
289
290
291
292
293
294
295
296
            console.log(this.dataForm);
            let obj = {
              ...this.dataForm,
              questionType: this.dataForm.questionType == '其他' ? this.dataForm.otherQuestionType : this.dataForm.questionType,
              selfMediaPlatformType: this.dataForm.selfMediaPlatformType == '其他' ? this.dataForm.selfMediaPlatformTypeOther : this.dataForm.selfMediaPlatformType,
            }
            this.btnLoading = true;
            let res = !this.dataForm.id ? await addForm(obj) : await updataForm(obj);
            if (res.code != 200) return this.btnLoading = false;
006cc67a   monkeyhouyi   巡查上报
297
298
299
300
301
302
303
304
305
306
307
308
309
310
            this.$message({
              message: res.msg,
              type: "success",
              duration: 1000,
              onClose: () => {
                (this.visible = false), this.$emit("refresh", true);
              },
            });
          }
        });
      },
    },
  };
  </script>