seatonwan9
2025-08-14 a0fc5b1e703769a8936fd8671ec9cdd9adfda20a
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
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
<template>
  <div class="bodyCont">
    <el-scrollbar style="width: 100%">
      <h2 class="h2title">{{ state.dialogData.title }}</h2>
      <div class="close-icon" @click="closeDialog">
        <el-icon size="24"><CloseBold color="#fff" /></el-icon>
      </div>
      <el-form
        ref="ruleFormRef"
        :model="state.basicInfoForm"
        :rules="rules"
        class="basic-info-form"
        label-width="auto"
      >
        <el-form-item class="form-item" label="申请人">
          <span>{{ state.basicInfo.applyUserName }}</span>
        </el-form-item>
        <el-form-item class="form-item" label="申请日期">
          <span>{{ state.basicInfo.applyDate }}</span>
        </el-form-item>
        <el-form-item class="form-item" label="产品名称">
          <span>{{ state.basicInfo.name }}</span>
        </el-form-item>
        <el-form-item class="form-item" label="产品介绍">
          <p v-html="state.basicInfo.describe"></p>
        </el-form-item>
        <el-form-item class="form-item" label="行业领域">
          <span>{{ state.basicInfo.industrialChainName }}</span>
        </el-form-item>
        <el-form-item class="form-item" label="单位工程">
          <span>{{ state.basicInfo.importantAreaName }}</span>
        </el-form-item>
        <el-form-item class="form-item" label="授权开始日期">
          {{ state.basicInfo.applyStartDate }}
        </el-form-item>
        <el-form-item class="form-item" label="授权结束日期">
          {{ state.basicInfo.applyEndDate }}
        </el-form-item>
        <el-form-item class="form-item" label="申请理由">
          {{ state.basicInfo.applyReason }}
        </el-form-item>
        <el-form-item class="form-item" label="交易管理">
          <div class="fileDiv">
            <span
              class="filelist"
              v-for="file in state.basicInfo.customTradeFileList"
              :key="file.fileId"
              @click="handleFilePreview(file)"
              >{{ file.originalName }}</span
            >
          </div>
        </el-form-item>
        <el-form-item class="form-item" label="审批意见" prop="opinion">
          <el-input
            class="ipt"
            v-model="state.basicInfoForm.opinion"
            :rows="3"
            maxlength="250"
            type="textarea"
            show-word-limit
            placeholder="请输入审批意见"
          />
        </el-form-item>
      </el-form>
 
      <div class="btnDiv">
        <el-button size="large" @click="handleCancel">取消</el-button>
        <el-button
          type="primary"
          size="large"
          :disabled="state.btnLoading"
          @click="subscriptionPasskt('pass')"
          >审批通过</el-button
        >
        <el-button
          type="primary"
          size="large"
          :disabled="state.btnLoading"
          plain
          @click="subscriptionPasskt('rejected')"
          >驳回</el-button
        >
        <el-button type="primary" size="large" @click="traceRow"
          >追踪</el-button
        >
      </div>
    </el-scrollbar>
    <filePreview
      v-if="showfilePreviewDiv"
      ref="filePreviewHtmlRef"
      @closePreview="handleClosePreview"
    ></filePreview>
  </div>
</template>
 
<script setup lang="ts">
import subscriptionApi from '@/api/subscription'
import router from '@/router'
 
import {
  ElNotification,
  ElMessageBox,
  FormRules,
  FormInstance,
} from 'element-plus'
import _ from 'lodash'
import { useUserInfo } from '@/stores/modules/userInfo'
import Base64 from '@/utils/base64'
const userStore = useUserInfo() // 用户相关的
// 个人信心的基本内容类型设定
interface BasicInfoType {
  id?: string // 客户id
}
 
const state = reactive<any>({
  visible: false,
  dialogData: {
    title: '产品使用申请',
    informationEditType: 'apply',
    id: '',
  },
  disabledData: true,
  basicInfo: {},
  basicInfoForm: {
    opinion: '',
    userUseId: '',
  },
  fileId: '', // 文件ID
  opinion: '',
  btnLoading: false,
})
 
// 将子组件的事件触发暴露给父组件
const emit = defineEmits(['closeDialog', 'updataFun'])
// 关闭弹窗
const closeDialog = () => {
  emit('closeDialog')
}
// 跟踪
const traceRow = () => {
  const token = userStore.getAdminToken
  router.push({
    path: '/approve/tracePage',
    query: {
      info: Base64.encode(
        JSON.stringify({
          name: '订阅',
          id: state.dialogData.data.id,
          flowId: state.dialogData.data.flowId,
          token: token,
        })
      ),
    },
  })
}
// 表单的ref
const ruleFormRef = ref<FormInstance>()
 
// 表单验证规则
const rules = reactive<FormRules>({
  opinion: [{ required: true, message: '请输入审批意见', trigger: 'blur' }],
})
const filePreviewHtmlRef = ref()
const showfilePreviewDiv = ref<boolean>(false)
 
const handleCancel = () => {
  emit('closeDialog')
}
const handleClosePreview = () => {
  showfilePreviewDiv.value = false
}
const subscriptionPasskt = (type: string) => {
  ruleFormRef.value?.validate((valid: any) => {
    if (valid) {
      const data = {
        id: state.dialogData.userUseId,
        operationType: type,
        opinion: state.basicInfoForm.opinion,
        taskId: state.dialogData.data.taskId,
      }
      state.btnLoading = true
      subscriptionApi
        .setAuditingComplete({ ...data })
        .then((res: any) => {
          if (res.code == 200) {
            ElNotification({
              type: 'success',
              message: '操作成功!',
            })
            emit('closeDialog', 'refresh')
            state.btnLoading = false
          }
        })
        .catch(() => {
          state.btnLoading = false
        })
    } else {
      return false
    }
  })
}
// 保存基本信息
// const saveCustomerBasicInfo = (data: any) => {
//   const params = _.cloneDeep(data)
//   if (params.id) {
//     // 编辑- 更新
//     updateCustomerInfo(params)
//   } else {
//     // 新增
//     addNewInformation(params)
//   }
// }
 
// // 新增基本信息-存草稿
// const addNewInformation = (data: any) => {
//   optionService
//     .optionCreateUrl({
//       ...data,
//     })
//     .then((res) => {
//       console.log('res------', res)
//       if (res.code == 200) {
//         ElNotification({
//           type: 'success',
//           message: '信息保存成功',
//         })
 
//         state.visible = false
 
//         // 更新数据
//         emit('updataFun')
//       }
//     })
// }
 
// 取消
const cancelFun = () => {
  state.visible = false
  // 更新数据
  emit('updataFun')
}
const getDetailInfo = () => {
  subscriptionApi
    .getSubscriptionDetail({
      userUseId: state.dialogData.userUseId,
    })
    .then((res: any) => {
      if (res.code == 200) {
        state.basicInfo = res.data
        if (state.basicInfo.fileInfos && state.basicInfo.fileInfos.length > 0) {
          state.basicInfo.customTradeFileList = []
          state.basicInfo.customEvaluationFileList = []
          state.basicInfo.fileInfos.forEach((item: any) => {
            if (item.fileKind == 'trade') {
              state.basicInfo.customTradeFileList.push(item)
            }
            if (item.fileKind == 'evaluation') {
              state.basicInfo.customEvaluationFileList.push(item)
            }
          })
        }
      }
    })
}
// 控制弹窗的显示
const visibleShow = (data: any) => {
  state.dialogData = data
  getDetailInfo()
}
const handleFilePreview = (file: any) => {
  if (file.suffix == '.pdf' || file.suffix == '.docx') {
    showfilePreviewDiv.value = true
    nextTick(() => {
      filePreviewHtmlRef.value.visibleShow(file)
    })
  }
}
// 将方法暴露给父组件
defineExpose({
  visibleShow,
})
 
// 设置侦听器
onMounted(() => {})
</script>
 
<style scoped lang="scss">
.bodyCont {
  z-index: 99;
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  bottom: 0;
  background-color: #fff;
 
  .basic-info-form {
    padding: 10px 20px 60px 20px;
  }
 
  .btnDiv {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    position: absolute;
    bottom: 0;
    padding-bottom: 15px;
    left: 0;
    right: 0;
    background-color: #fff;
    z-index: 99;
  }
 
  .fileDiv {
    width: 100%;
    min-height: 60px;
    display: flex;
    flex-direction: column;
    .filelist {
      color: #536be2;
      font-size: 15px;
      cursor: pointer;
      max-width: 400px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      &:hover {
        font-weight: 600;
        font-size: 15px;
      }
    }
  }
}
.form-item {
  margin-bottom: 15px;
}
.h2title {
  border-left: 5px solid #35a4ff;
  font-size: 18px;
  font-weight: 600;
  padding-left: 10px;
  margin: 15px 0 0px 20px;
}
.close-icon {
  position: absolute;
  right: 0;
  top: 0;
  width: 40px;
  height: 40px;
  background-color: #3d6bfa;
  border-bottom-left-radius: 60px;
  padding-left: 10px;
  padding-top: 5px;
  cursor: pointer;
  z-index: 99;
}
ul li {
  list-style-type: none;
  list-style: none;
}
</style>