seatonwan9
2025-08-28 b877343496638d3c80b5e408a4af3a997182d311
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
<template>
  <div class="bodyBox">
    <el-dialog style="width: 800px;height: 500px" v-model="state.visible" :title="state.title" @closed="closeDialog"
               :fullscreen="state.fullscreen"
               :close-on-click-modal="false">
 
      <div class="bodyDiv">
        <div class="topDiv">
          <el-radio-group v-model="state.radioData" @change="radioChange">
            <el-radio v-for="item in state.classifyInfoType" :label="item.code" :value="item.id" size="large">
              {{
                item.name
              }}
            </el-radio>
          </el-radio-group>
        </div>
        <div class="btmDiv">
          <div class="btmBtnDiv" v-if="state.editType == 'file'">
            <!--            <el-upload ref="upload" class="upload-demo" accept=".jpg,.jpeg,.png,.gif,.pdf" :limit="1"-->
            <!--                       :file-list="fileList" :on-exceed="handleExceed" :before-upload="handleBeforeUpload"-->
            <!--                       :http-request="uploadRequest" :on-preview="handlePreview" :on-remove="handleRemoveFile">-->
            <!--              <template #trigger>-->
            <!--                <el-button class="elBtnClass" type="primary">上传文件</el-button>-->
            <!--              </template>-->
            <!--            </el-upload>-->
            <UploadSingleFile
                :tips="tips"
                acceptType="pdf,docx"
                :fileList="fileList"
                @update:fileList="uploadFile"
                @removeFile="handleRemoveFile"
                style="width: 100%"
            ></UploadSingleFile>
          </div>
          <div class="btmBtnDiv" v-if="state.editType == 'video'">
            <!--            <el-button class="elBtnClass" type="primary">上传视频</el-button>-->
            <UploadSingleVideo
                :tips="tips2"
                acceptType="mp4"
                :fileList="fileList2"
                @update:fileList2="uploadVideo"
                @removeFile2="handleRemoveFile2"
                style="width: 100%"
            ></UploadSingleVideo>
          </div>
          <template v-if="state.editType == 'file'">
            <div class="spanDiv">1.仅支持上传PDF格式文件</div>
            <div class="spanDiv">2.文件大小不超过50M</div>
          </template>
 
          <template v-else>
            <div class="spanDiv">1.仅支持上传mp4格式文件</div>
            <div class="spanDiv">2.文件大小不超过1G</div>
          </template>
 
 
        </div>
      </div>
    </el-dialog>
  </div>
</template>
 
<script setup lang="ts">
import type {TabsPaneContext, UploadProps, UploadUserFile} from 'element-plus'
import {
  ElNotification,
  ElMessageBox,
  UploadInstance,
  UploadRawFile,
  genFileId,
  UploadRequestOptions
} from 'element-plus'
import informationBasicInfo from './informationBasicInfo.vue'
import versionClassifyService from '@/api/versionClassify' // 能耗费用接口
import _ from 'lodash'
import screenfull from "screenfull";
import commonApi from "@/api/commonApi";
import optionService from "@/api/zhongjian/optionApi";
 
 
const state = reactive<any>({
  visible: false,
  title: '',
  editType: 'add',
  id: '',
  //--------------
  fullscreen: false, // 全屏对话框
  radioData: '',
  classifyInfoType: [],
  pageTypeData: '', // 调用的类型
  fileId: '', // 文件ID
  videoId: '', // 文件ID
 
})
 
// 控制弹窗的显示
const visibleShowT = (data?: any) => {
  state.title = data?.typeData == 'file' ? '上传文件' : '上传视频'
  state.editType = data?.typeData ?? 'file'
  state.id = data?.id ?? ''
  state.pageTypeData = data?.pageTypeData ?? ''
  if (state.editType == 'file') {
    // 获取选择数据
    categoryListUrlFun('document_type')
  } else {
    // 获取选择数据
    categoryListUrlFun('video_type')
  }
 
 
  // if (data?.informationEditType == 'edit') {
  //   // 编辑时根据id获取详情
  //   // queryEnergyDetailById()
  // } else {
  //
  // }
 
  state.visible = true
}
 
// 将方法暴露给父组件
defineExpose({
  visibleShowT
})
 
// 将子组件的事件触发暴露给父组件
const emit = defineEmits(['uploadUpdataFun', 'uploadCloseDialog'])
// 关闭弹窗
const closeDialog = () => {
  emit('uploadUpdataFun')
}
 
// 保存基本信息
const saveCustomerBasicInfo = (data: any) => {
  const params = _.cloneDeep(data)
  if (params.id) {
    // 编辑- 更新
    updateCustomerInfo(params)
  } else {
    // 新增
    delete params.id
    // delete params.addType
    addNewInformation(params)
  }
 
 
}
 
// 新增版本分类基本信息
const addNewInformation = (data: any) => {
  versionClassifyService.addNewpClassifyInformation({
    ...data
  }).then(res => {
    if (res.code == 200) {
      ElNotification({
        type: 'success',
        message: '信息保存成功'
      })
      state.visible = false
 
      // 更新数据
      emit('uploadUpdataFun')
    }
  })
}
 
// 编辑修改档案盒信息
const updateCustomerInfo = (data: any) => {
  versionClassifyService.updataClassifyInformation({
    ...data
  }).then(res => {
    if (res.code == 200) {
      ElNotification({
        type: 'success',
        message: '信息保存成功'
      })
      state.visible = false
      // 更新数据
      emit('updataFun')
    }
  })
}
 
// 取消档案盒信息保存
const cancelCustomerBasicInfoEdit = () => {
  state.visible = false
}
 
// 根据id查看详情
const queryEnergyDetailById = (listData: any) => {
  const param: object = {
    id: state.id
  }
  versionClassifyService.queryClassifyDetailURL({
    ...param
  }).then(res => {
    if (res.code == 200) {
      state.basicInfo = {...res.data}
      // 控制显示
      state.basicInfo.addType = 'showTrue'
      // 再次赋值
      state.basicInfo.parentName = state.parentName
 
      state.visible = true
    }
  })
}
 
// 是否全屏
const isFullscreen = ref(false);
 
// // 监听变化
// const change = () => {
//   isFullscreen.value = screenfull.isFullscreen;
// };
//
// 切换全屏/窗口
const handleFullscreenchange = (show?: any) => {
  // screenfull.toggle();
 
  state.fullscreen = !state.fullscreen
}
 
// ------上传文件
const tips: string = '只能上传.pdf、.doc、.docx格式文件,并且只能上传一个文件'
const fileList = ref<any[]>([])
const fileDetailFile = ref('')
 
// fileList.value.push({
//   name: res.data.policyDetailFile.originalName,
//   id: res.data.policyDetailFile.id,
//   url: res.data.policyDetailFile.url
// })
 
// 文件上传返回值
const uploadFile = (data: any) => {
}
const handleRemoveFile = () => {
  // state.formData.policyDetailFile = null
}
 
// -----------上传视频
const tips2: string = '只能上传.mp4格式文件,并且只能上传一个文件'
const fileList2 = ref<any[]>([])
const fileDetailFile2 = ref('')
 
// fileList2.value.push({
//   name: res.data.policyDetailFile.originalName,
//   id: res.data.policyDetailFile.id,
//   url: res.data.policyDetailFile.url
// })
 
// 文件上传返回值
const uploadVideo = (data: any) => {
  // state.formData.policyDetailFile = data.uploadFileInfo.data
}
const handleRemoveFile2 = () => {
  // state.formData.policyDetailFile = null
}
 
 
// 获取选择数据
// 下拉数据-产业链方向
const categoryListUrlFun = (data?: any) => {
  const searchList = {
    parentCode: data
  }
  optionService.categoryListUrl({...searchList}).then((res: any) => {
    if (res.code == 200) {
      state.classifyInfoType = [...res.data]
    }
  })
}
 
 
// 单选按钮选择
const radioChange = (val?: any) => {
  console.log(val)
}
 
onMounted(() => {
})
 
watchEffect(() => {
})
 
// // 设置侦听器
// onMounted(() => {
//   screenfull.on("change", change);
// });
//
// // 删除侦听器
// onUnmounted(() => {
//   screenfull.off("change", change);
// });
</script>
 
<style scoped lang="scss">
.bodyBox {
  position: relative;
 
  .FullScreenDiv {
    position: absolute;
    top: 21px;
    right: 50px;
  }
 
  .bodyDiv {
    width: 100%;
    height: 420px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
 
    .topDiv {
      width: 100%;
      height: 20%;
      display: flex;
      flex-direction: row;
      justify-content: center;
      margin-top: 10px;
    }
 
    .btmDiv {
      width: 100%;
      height: 50%;
      display: flex;
      flex-direction: column;
      align-items: center;
 
      .btmBtnDiv {
        width: 50%;
        height: 100px;
        display: flex;
        flex-direction: column;
        align-items: center;
        //background-color: pink;
 
        .elBtnClass {
          width: 380px;
          height: 60px;
          font-size: 18px;
        }
      }
 
      .spanDiv {
        width: 50%;
        font-size: 16px;
        margin-top: 5px;
      }
    }
  }
 
}
</style>