kongdeqiang
2023-09-12 b6809f71253a524d81c086ef1293acafdaba395e
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
<template>
  <div>
    <el-dialog
      :title="!dataForm.id ? '新增' : '完善信息'"
      append-to-body
      :close-on-click-modal="false"
      :visible.sync="visible"
      v-dialogDrag>
      <el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()"
               label-width="140px">
<!--          <el-col :span="12">-->
<!--            <el-form-item label="年份">-->
<!--              <el-date-picker-->
<!--                style="width: 100%"-->
<!--                v-model="dataForm.year"-->
<!--                value-format="yyyy"-->
<!--                type="year"-->
<!--                placeholder="选择年">-->
<!--              </el-date-picker>-->
<!--            </el-form-item>-->
<!--          </el-col>-->
<!--          <el-col :span="12">-->
<!--            <el-form-item label="文书号">-->
<!--              <el-input v-model="dataForm.number"></el-input>-->
<!--            </el-form-item>-->
<!--          </el-col>-->
<!--        </el-row>-->
<!--        <el-row>-->
          <!--<el-col :span="12">
            <el-form-item label="决定书号">
              <el-input
                v-model="dataForm.unitName"
                placeholder="峰综当罚决〔     〕第    号"
              ></el-input>
            </el-form-item>
          </el-col>-->
 
            <el-form-item label="当事人" prop="personName">
              <el-input v-model="dataForm.personName" placeholder="请输入当事人"></el-input>
            </el-form-item>
 
            <el-form-item label="身份证号码" prop="idCard">
              <el-input v-model="dataForm.idCard" placeholder="请输入身份证号码"></el-input>
            </el-form-item>
 
            <el-form-item label="住址" prop="personAddress">
              <el-input v-model="dataForm.personAddress" placeholder="请输入住址"></el-input>
            </el-form-item>
<!--       -->
<!--            <el-form-item label="执行期限" prop="days">-->
<!--              <el-input v-model="dataForm.days" placeholder="请输入执行期限"></el-input>-->
<!--            </el-form-item>-->
 
<!--        <el-row>-->
<!--          <el-col :span="12">-->
<!--            <el-form-item label="执法人员" prop="zfName1">-->
<!--              <el-input v-model="dataForm.zfName1" placeholder="请输入账号"></el-input>-->
<!--            </el-form-item>-->
<!--          </el-col>-->
<!--          <el-col :span="12">-->
<!--            <el-form-item label="执法证号" prop="zfNum1">-->
<!--              <el-input v-model="dataForm.zfNum1" placeholder="请输入户名"></el-input>-->
<!--            </el-form-item>-->
<!--          </el-col>-->
<!--        </el-row>-->
<!--        <el-row>-->
<!--          <el-col :span="12">-->
<!--            <el-form-item label="执法人员" prop="zfName2">-->
<!--              <el-input v-model="dataForm.zfName2" placeholder="请输入账号"></el-input>-->
<!--            </el-form-item>-->
<!--          </el-col>-->
<!--          <el-col :span="12">-->
<!--            <el-form-item label="执法证号" prop="zfNum2">-->
<!--              <el-input v-model="dataForm.zfNum2" placeholder="请输入户名"></el-input>-->
<!--            </el-form-item>-->
<!--          </el-col>-->
<!--        </el-row>-->
      </el-form>
      <span slot="footer" class="dialog-footer">
      <el-button @click="visible = false">取消</el-button>
      <el-button type="primary" @click="dataFormSubmit()" :loading="loadingSubmit">保存</el-button>
      <el-button type="primary" @click="viewVord(dataForm)">预览</el-button>
      <el-button type="success" @click="downloadWord(dataForm)">下载</el-button>
    </span>
    </el-dialog>
    <WordView v-if="WordViewShow" ref="WordView"></WordView>
  </div>
</template>
 
<script>
  import WordView from './word-view/index'
  import {exportDoc} from '../../../libs/word'
 
  export default {
    components: {
        WordView
    },
    data() {
      return {
        WordViewShow: false,   //word文档是否显示
        visible: false,
        loadingSubmit:false,
        dataForm: {
            year:'',
            number:'',
            personName:'',
            idCard: '',
            chufaCheckList:[],
            fakuanCheckList:[],
            personAddress:'',
            zfName1:'',
            zfName2:'',
            zfNum1:'',
            zfNum2:'',
            id:'',
            days: '0'
 
        },
        dataRule: {
 
          personName: [
                {required: true, message: '当事人不能为空', trigger: 'blur'}
              ],
          personAddress: [
            {required: true, message: '当事人地址不能为空', trigger: 'blur'}
          ],
          idCard: [
                {required: true, message: '身份证号不能为空', trigger: 'blur'}
              ],
          zfName1: [
                {required: true, message: '执法人员1不能为空', trigger: 'blur'}
              ],
          zfName2: [
                {required: true, message: '执法人员2不能为空', trigger: 'blur'}
              ],
        }
      }
    },
    methods: {
      init(id) {
        this.dataForm.id = id || null;
        this.visible = true;
        this.$nextTick(() => {
          this.$refs['dataForm'].resetFields()
          if (this.dataForm.id) {
            this.$byutil.getData(this,this.$systemconfig.basePath+'/ffzf/ticket/'+id,null,res=>{
              this.dataForm = res.data
            })
          }
        })
      },
      viewVord(data) {  //word预览
        if(this.dataForm.number === '' || this.dataForm.number === null){
          this.$message.error("请先保存再预览")
        }else {
          this.WordViewShow = true
          this.$nextTick(() => {
            this.$refs.WordView.initWord(data,'/words/administrativeDecisionLetter.docx')
          })
        }
      },
      downloadWord(data) {  //word下载
        if(this.dataForm.number === '' || this.dataForm.number === null){
          this.$message.error("请先保存再下载")
        }else {
          exportDoc(data,'/words/administrativeDecisionLetter.docx','当场行政处罚决定书')
        }
      },
      // 表单提交
      dataFormSubmit() {
      this.$refs['dataForm'].validate((valid) => {
          if (valid) {
            this.loadingSubmit = true;
            if (this.dataForm.id) {
              this.$byutil.postData(this, this.$systemconfig.basePath + '/ffzf/ticket/updateById', this.dataForm, res => {
                if (res.code === 0) {
                  this.$message.success('修改成功')
                  this.visible = false
                  this.loadingSubmit = false;
                  this.$emit('refreshDataList')
                } else {
                  this.loadingSubmit = false;
                }
              })
            } else {
              alert("未选择违章车辆")
            }
          }
        })
      }
    }
  }
</script>
<style lang="scss">
  .el-checkbox.flexDate{
    display: flex;
    align-items: baseline;
    .el-checkbox__label{
      display: flex;
      flex-wrap: wrap;
      line-height: 2;
      white-space: initial;
    }
  }
</style>
<style lang="scss" scoped>
::v-deep{
 
  .el-dialog{
    max-height: 90%;
    overflow-y: auto;
    margin-top: 6vh!important;
  }
}
  .flexDate{
    display: flex;
    span{
      margin-left: 5px;
    }
  }
  .dialog-footer{
    display: flex;
    justify-content: center;
    .el-button{
      margin: 0 5px;
    }
  }
</style>