|
@@ -19,6 +19,7 @@
|
|
|
@change="handleQuery"
|
|
|
value-format="YYYY-MM-DD[T]HH:mm:ss"
|
|
|
:default-time="defaultTimeStartEnd"
|
|
|
+ :clearable="false"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
<el-form-item>
|
|
@@ -69,23 +70,26 @@
|
|
|
<order-detail :order="row" @updateList="queryList">{{ row.title }}</order-detail>
|
|
|
</template>
|
|
|
</vxe-column>
|
|
|
- </vxe-table>
|
|
|
- </el-dialog>‘
|
|
|
+ </vxe-table> </el-dialog
|
|
|
+ >‘
|
|
|
<!-- 录音上传 -->
|
|
|
<RecordUpload ref="uploadRef" @updateList="queryList" />
|
|
|
+ <!-- 播放录音 -->
|
|
|
+ <play-record ref="playRecordRef" />
|
|
|
</div>
|
|
|
</template>
|
|
|
<script setup lang="tsx" name="telsRecordUpload">
|
|
|
import { defineAsyncComponent, onMounted, reactive, ref } from 'vue';
|
|
|
-import { FormInstance } from 'element-plus';
|
|
|
-import { knowledgeExport, knowledgeList } from '@/api/statistics/knowledge';
|
|
|
+import { ElMessage, ElMessageBox, FormInstance } from 'element-plus';
|
|
|
import { defaultDate, defaultTimeStartEnd, shortcuts } from '@/utils/constants';
|
|
|
import Other from '@/utils/other';
|
|
|
-import { uploadRecordExport, uploadRecordList } from '@/api/tels/uploadRecord';
|
|
|
+import { uploadRecordDelete, uploadRecordExport, uploadRecordList } from '@/api/tels/uploadRecord';
|
|
|
+import { fileDownloadByUrl } from '@/api/public/file';
|
|
|
|
|
|
const pagination = defineAsyncComponent(() => import('@/components/ProTable/components/Pagination.vue')); // 分页
|
|
|
const OrderDetail = defineAsyncComponent(() => import('@/components/OrderDetail/index.vue')); // 工单详情
|
|
|
-const RecordUpload = defineAsyncComponent(() => import('@/views/tels/recordUpload/components/Upload.vue')); // 录音上传
|
|
|
+const RecordUpload = defineAsyncComponent(() => import('@/views/tels/recordUpload/components/Upload.vue')); // 录音上传
|
|
|
+const PlayRecord = defineAsyncComponent(() => import('@/components/PlayRecord/index.vue')); // 播放录音
|
|
|
// 定义变量内容
|
|
|
const state = reactive<any>({
|
|
|
queryParams: {
|
|
@@ -138,15 +142,11 @@ const gridOptions = reactive<any>({
|
|
|
height: 'auto',
|
|
|
columns: [
|
|
|
{
|
|
|
- field: 'date',
|
|
|
+ field: 'fileName',
|
|
|
title: '录音名称',
|
|
|
},
|
|
|
{
|
|
|
- field: 'inConnectionRate',
|
|
|
- title: '录音时长(秒)',
|
|
|
- },
|
|
|
- {
|
|
|
- field: 'inConnectionRate',
|
|
|
+ field: 'creationTime',
|
|
|
title: '上传时间',
|
|
|
sortable: true,
|
|
|
formatter: 'formatDate',
|
|
@@ -179,8 +179,8 @@ const queryList = () => {
|
|
|
state.loading = true;
|
|
|
gridOptions.loading = true;
|
|
|
requestParams.value = Other.deepClone(state.queryParams);
|
|
|
- requestParams.value.CreationTimeStart = state.queryParams.crTime === null ? null : state.queryParams.crTime[0];
|
|
|
- requestParams.value.CreationTimeEnd = state.queryParams.crTime === null ? null : state.queryParams.crTime[1];
|
|
|
+ requestParams.value.StartTime = state.queryParams.crTime === null ? null : state.queryParams.crTime[0];
|
|
|
+ requestParams.value.EndTime = state.queryParams.crTime === null ? null : state.queryParams.crTime[1];
|
|
|
Reflect.deleteProperty(requestParams.value, 'crTime');
|
|
|
uploadRecordList(requestParams.value)
|
|
|
.then((res: any) => {
|
|
@@ -209,11 +209,53 @@ const onUpload = () => {
|
|
|
uploadRef.value.openDialog();
|
|
|
};
|
|
|
// 播放
|
|
|
-const onPlay = (row: any) => {};
|
|
|
+const onPlay = (row: any) => {
|
|
|
+ window.open(row.allPath)
|
|
|
+};
|
|
|
// 下载
|
|
|
-const onDownload = (row: any) => {};
|
|
|
+const onDownload = (row: any) => {
|
|
|
+ ElMessageBox.confirm(`确定要下载 ${row.name} 吗?`, '提示', {
|
|
|
+ confirmButtonText: '确认',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning',
|
|
|
+ draggable: true,
|
|
|
+ cancelButtonClass: 'default-button',
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ fileDownloadByUrl({
|
|
|
+ Source: 'hotline',
|
|
|
+ Id: row.fileId,
|
|
|
+ }).then((res: any) => {
|
|
|
+ let blob: Blob = new Blob([res.data], { type: res.data.type }); // 创建blob 设置blob文件类型 data 设置为后端返回的文件(例如mp3,jpeg) type:这里设置后端返回的类型 为 mp3
|
|
|
+ let down: HTMLAnchorElement = document.createElement('a'); // 创建A标签
|
|
|
+ let href: string = window.URL.createObjectURL(blob); // 创建下载的链接
|
|
|
+ down.href = href; // 下载地址
|
|
|
+ down.download = row.fileName; // 下载文件名
|
|
|
+ document.body.appendChild(down);
|
|
|
+ down.click(); // 模拟点击A标签
|
|
|
+ document.body.removeChild(down); // 下载完成移除元素
|
|
|
+ window.URL.revokeObjectURL(href); // 释放blob对象
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
+};
|
|
|
// 删除
|
|
|
-const onDelete = (row: any) => {};
|
|
|
+const onDelete = (row: any) => {
|
|
|
+ ElMessageBox.confirm(`确定要删除 ${row.name} 吗?`, '提示', {
|
|
|
+ confirmButtonText: '确认',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning',
|
|
|
+ draggable: true,
|
|
|
+ cancelButtonClass: 'default-button',
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ uploadRecordDelete({ ids: [row.fileId] }).then(() => {
|
|
|
+ queryList();
|
|
|
+ ElMessage.success('删除成功');
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
+};
|
|
|
onMounted(() => {
|
|
|
queryList();
|
|
|
});
|