峰峰执法平台简易案件程序板块 pad端
yang
2022-10-17 4107256a8d1fa9a2db0969122bfc760994b12421
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
<template>
  <el-dialog title="案件调查终结审批表"
             :close-on-click-modal="false"
             :visible.sync="visible">
    <!--案件调查终结审批表-->
    <el-form ref="dataForm" :model="dataForm" label-width="110px" :disabled="dataForm.registerState == '1'">
      <el-form-item label="申请事项">
        <el-input v-model="dataForm.applyItem"></el-input>
      </el-form-item>
      <el-row>
        <el-col :span="12">
          <el-form-item label="案由">
            <el-input v-model="dataForm.casePoint"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="立案日期">
            <el-date-picker
                v-model="dataForm.caseDate"
                :value-format="`yyyy-MM-dd`"
                type="date"
                placeholder="选择日期"
                style="width: 100%">
            </el-date-picker>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12">
          <el-form-item label="当事人姓名">
            <el-input v-model="dataForm.litigant"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="法定代表人">
            <el-input v-model="dataForm.legalPerson"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12">
          <el-form-item label="证件名称">
            <el-select v-model="dataForm.litigantCert" placeholder="请选择证件类型"
                       :disabled="dataForm.registerState == '1'" style="width: 100%;">
              <el-option
                  v-for="item in cardList"
                  :label="item.label"
                  :value="item.value">
              </el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="证件号码">
            <el-input v-model="dataForm.certNo"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12">
          <el-form-item label="住址">
            <el-input v-model="dataForm.address"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="电话">
            <el-input v-model="dataForm.phone"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-form-item label="违法事实和证据">
        <el-input type="textarea" v-model="dataForm.illegalFact"></el-input>
      </el-form-item>
      <el-form-item label="处罚理由和依据">
        <el-input type="textarea" v-model="dataForm.punishBasis"></el-input>
      </el-form-item>
      <public-opinion ref="publicOpinion" :registerState="dataForm.registerState"></public-opinion>
      <WordView ref="wordInfo" :isShowYulan="showView" @cancel="cancelWord"></WordView>
    </el-form>
<!--    <div style="text-align: center;">
      <el-button v-if="dataForm.registerState != '1'" plain @click="dataFormSubmit('0')">保存</el-button>
      <el-button v-if="dataForm.registerState != '1'" type="warning" plain @click="dataFormSubmit('1')">定稿</el-button>
      <el-button type="primary" plain @click="viewVord(dataForm)">预览</el-button>
      <el-button type="success" plain @click="downloadWord(dataForm)">下载</el-button>
    </div>-->
  </el-dialog>
</template>
 
<script>
import {getObj, saveObj} from '@/api/News/examinationInvestigationTermination'
import publicOpinion from "@/views/News/publicOpinion"
import WordView from '@/views/News/word-view/index'
import moment from "moment";
import {remote} from "@/api/admin/dict"
 
 
export default {
  name: "examination_investigation_termination",
  props: ['isShowYulan', 'id', 'processId'],
  components: {
    // Dict,
    publicOpinion,
    WordView
  },
  data() {
    return {
      showView: false,
      cardList: [],
      visible: false,
      dataForm: {
        applyItem: '',
        casePoint: '',
        caseDate: '',
        litigant: '',
        legalPerson: '',
        litigantCert: '',
        certNo: '',
        address: '',
        phone: '',
        illegalFact: '',
        punishBasis: '',
      }
    }
  },
  methods: {
    init(id) {
      //查询字典
      remote('document_type').then(res => {
        this.cardList = res.data.data;
      })
 
      getObj(id).then((res) => {
        this.visible = true
        this.dataForm = res.data.data;
        //查询公共意见
        this.$nextTick(() => {
          this.$refs.publicOpinion.init(this.dataForm.publicOpinion);
        })
      });
    },
    dataFormSubmit(type) {
      this.$refs['dataForm'].validate((valid) => {
        if (valid) {
          let obj = this;
          if ("1" == type) {
            this.$confirm('保存为定稿将不能修改,是否继续?', '提示', {
              confirmButtonText: '是',
              cancelButtonText: '否',
              type: 'warning'
            }).then(function () {
              obj.submitLoading = true;
              obj.dataForm.registerState = type;
              obj.dataForm.registerId = obj.id;
              obj.dataForm.processId = obj.processId;
              saveObj(obj.dataForm).then((res) => {
                if (res.data.code == 0) {
                  obj.$message.success("操作成功");
                  obj.cancel();
                  obj.$emit('getDataList');
                }
              })
            })
          } else {
            this.submitLoading = true;
            this.dataForm.registerState = type;
            this.dataForm.registerId = obj.id;
            this.dataForm.processId = this.processId;
            saveObj(this.dataForm).then((res) => {
              if (res.data.code == 0) {
                this.$message.success("操作成功");
                this.cancel();
                this.$emit('getDataList');
              }
            })
          }
        }
      })
    },
    cancel() {
      this.$emit('cancel', false)
    },
    cancelWord() {
      this.showView = false;
    },
    viewVord(data) {
      //↓↓↓↓↓↓以下部分根据具体业务修改↓↓↓↓↓↓
      //格式转换
      let wordData = this.transforData(data);
      //↑↑↑↑↑↑以上部分根据具体业务修改↑↑↑↑↑↑
      this.showView = true;
      this.$nextTick(() => {
        this.$refs.wordInfo.init(wordData, "/wordes/ajdczj.docx");
      })
    },
    downloadWord(data) {
      let wordData = this.transforData(data);
      WordView.methods.exportDoc(wordData, "/wordes/ajdczj.docx", "案件调查终结审批表.docx");
    },
    transforData(obj) {
      let s = JSON.stringify(obj);
      let data = JSON.parse(s);
      if (data.caseDate != '' && data.caseDate != null) {
        data.caseDate = moment(data.caseDate).format('YYYY年MM月DD日');
      }
      let opinion = data.publicOpinion;
      for (let attr in opinion) {
        if (opinion[attr] == null) {
          data[attr] = '';
        } else {
          data[attr] = opinion[attr];
        }
      }
      let str = JSON.stringify(data);
      let jsonData = JSON.parse(str);
      data = jsonData;
 
      if (opinion.undertakeDate != '' && opinion.undertakeDate != null) {
        data.undertakeDate = moment(opinion.undertakeDate).format('YYYY年MM月DD日');
      } else {
        data.undertakeDate = '  年  月  日'
      }
      if (opinion.takeDate != '' && opinion.takeDate != null) {
        data.takeDate = moment(opinion.takeDate).format('YYYY年MM月DD日');
      } else {
        data.takeDate = '  年  月  日'
      }
      if (opinion.legalDate != '' && opinion.legalDate != null) {
        data.legalDate = moment(opinion.legalDate).format('YYYY年MM月DD日');
      } else {
        data.legalDate = '  年  月  日'
      }
      if (opinion.organDate != '' && opinion.organDate != null) {
        data.organDate = moment(opinion.organDate).format('YYYY年MM月DD日');
      } else {
        data.organDate = '  年  月  日'
      }
      return data;
    }
  }
}
</script>
 
<style scoped>
 
</style>