diff --git a/components.d.ts b/components.d.ts index a9527f7..761092b 100644 --- a/components.d.ts +++ b/components.d.ts @@ -20,6 +20,8 @@ declare module 'vue' { ElCascader: typeof import('element-plus/es')['ElCascader'] ElCheckbox: typeof import('element-plus/es')['ElCheckbox'] ElCol: typeof import('element-plus/es')['ElCol'] + ElCollapse: typeof import('element-plus/es')['ElCollapse'] + ElCollapseItem: typeof import('element-plus/es')['ElCollapseItem'] ElConfigProvider: typeof import('element-plus/es')['ElConfigProvider'] ElCountdown: typeof import('element-plus/es')['ElCountdown'] ElDatePicker: typeof import('element-plus/es')['ElDatePicker'] @@ -27,6 +29,7 @@ declare module 'vue' { ElEmpty: typeof import('element-plus/es')['ElEmpty'] ElForm: typeof import('element-plus/es')['ElForm'] ElFormItem: typeof import('element-plus/es')['ElFormItem'] + ElHeader: typeof import('element-plus/es')['ElHeader'] ElIcon: typeof import('element-plus/es')['ElIcon'] ElImage: typeof import('element-plus/es')['ElImage'] ElInput: typeof import('element-plus/es')['ElInput'] @@ -34,8 +37,10 @@ declare module 'vue' { ElMenu: typeof import('element-plus/es')['ElMenu'] ElMenuItem: typeof import('element-plus/es')['ElMenuItem'] ElOption: typeof import('element-plus/es')['ElOption'] + ElPageHeader: typeof import('element-plus/es')['ElPageHeader'] ElPagination: typeof import('element-plus/es')['ElPagination'] ElPopconfirm: typeof import('element-plus/es')['ElPopconfirm'] + ElProgress: typeof import('element-plus/es')['ElProgress'] ElRadio: typeof import('element-plus/es')['ElRadio'] ElRadioButton: typeof import('element-plus/es')['ElRadioButton'] ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup'] @@ -43,9 +48,11 @@ declare module 'vue' { ElSelect: typeof import('element-plus/es')['ElSelect'] ElStep: typeof import('element-plus/es')['ElStep'] ElSteps: typeof import('element-plus/es')['ElSteps'] + ElSwitch: typeof import('element-plus/es')['ElSwitch'] ElTable: typeof import('element-plus/es')['ElTable'] ElTableColumn: typeof import('element-plus/es')['ElTableColumn'] ElTag: typeof import('element-plus/es')['ElTag'] + ElUpload: typeof import('element-plus/es')['ElUpload'] Empty: typeof import('./src/components/Empty/index.vue')['default'] EquipCard: typeof import('./src/components/equipCard.vue')['default'] EquipCardHall: typeof import('./src/components/equipCardHall/index.vue')['default'] diff --git a/src/http/api/login/index.ts b/src/http/api/login/index.ts index c2f2636..7b748bd 100644 --- a/src/http/api/login/index.ts +++ b/src/http/api/login/index.ts @@ -2,6 +2,7 @@ import { get, post } from '../../index' // 登录接口 - 调试使用 - 产线环境需注释 export const loginApi = (data: any) => { + // return false return post('/auth/login', data) } diff --git a/src/http/api/screen/index.ts b/src/http/api/screen/index.ts index 295bbe9..0231e20 100644 --- a/src/http/api/screen/index.ts +++ b/src/http/api/screen/index.ts @@ -89,3 +89,13 @@ export const getTotalCountApi = (data: any = {}) => { export const getDemandUnitApi = (data: any = {}) => { return get('/material-mall/largeScreen/getDemandUnit', data) } + +// 获取公司列表 +export const getDevNumListApi = (data: any = {}) => { + return get('/material-mall/largeScreen/getDevNumList', data) +} + +// 入驻详情列表 +export const getDevNumDetailsListApi = (data: any = {}) => { + return get('/material-mall/largeScreen/getDevNumDetailsList', data) +} \ No newline at end of file diff --git a/src/router/index.ts b/src/router/index.ts index 18bc33a..2c2c62d 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -248,6 +248,17 @@ const routes: Array = [ isLogin: true }, }, + { + path: '/details-unit', + name: 'details-unit', + component: () => import('views/big-screen/model-components/details-unit.vue'), + meta: { + title: '数据大屏', + keepAlive: true, + AuthFlag: false, + isLogin: true + }, + }, // 消息 { path: '/message', diff --git a/src/utils/download.js b/src/utils/download.js index cd90678..d8443a0 100644 --- a/src/utils/download.js +++ b/src/utils/download.js @@ -1,4 +1,5 @@ import { get, post, put } from '@/http/index.ts' +import { ElLoading, ElMessage } from 'element-plus' import axios from 'axios' import { saveAs } from 'file-saver' @@ -50,6 +51,13 @@ const blobValidate = (data) => { return data.type !== 'application/json' } +const errorCode = { + 401: '认证失败,无法访问系统资源', + 403: '当前操作没有权限', + 404: '访问资源不存在', + default: '系统未知错误,请反馈给管理员', +} + const tansParams = (params) => { let result = '' for (const propName of Object.keys(params)) { @@ -77,42 +85,59 @@ const tansParams = (params) => { } export function download(url, params, filename, config) { - console.log('🚀 ~ download ~ url:', url) - // downloadLoadingInstance = Loading.service({ - // text: '正在下载数据,请稍候', - // spinner: 'el-icon-loading', - // background: 'rgba(0, 0, 0, 0.7)', - // }); - return service - .post(url, params, { - transformRequest: [ - (params) => { - return tansParams(params) - }, - ], - headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, - responseType: 'blob', - ...config, - }) + const downloadLoadingInstance = ElLoading.service({ + text: '正在下载数据,请稍候', + spinner: 'el-icon-loading', + background: 'rgba(0, 0, 0, 0.7)', + }) + + return post(url, params, { + transformRequest: [ + (params) => { + return tansParams(params) + }, + ], + headers: { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' }, + responseType: 'blob', + ...config, + }) .then(async (data) => { - console.log('🚀 ~ .then ~ data:', data) const isBlob = blobValidate(data) - console.log('🚀 ~ .then ~ isBlob:', isBlob) if (isBlob) { const blob = new Blob([data]) saveAs(blob, filename) } else { - // const resText = await data.text(); - // const rspObj = JSON.parse(resText); - // const errMsg = - // errorCode[rspObj.code] || rspObj.msg || errorCode['default']; - // Message.error(errMsg); + const resText = await data.text() + const rspObj = JSON.parse(resText) + const errMsg = errorCode[rspObj.code] || rspObj.msg || errorCode['default'] + ElMessage.error(errMsg) } - // downloadLoadingInstance.close(); + downloadLoadingInstance.close() }) .catch((r) => { console.error(r) - // Message.error('下载文件出现错误,请联系管理员!'); - // downloadLoadingInstance.close(); + ElMessage.error('下载文件出现错误,请联系管理员!') + downloadLoadingInstance.close() }) } + +export const exportWithParams = async (exportUrl, params, fileName) => { + try { + const response = await axios({ + method: 'post', + url: baseUrl + exportUrl, + data: params, + responseType: 'blob', + }) + + const url = window.URL.createObjectURL(new Blob([response.data])) + const link = document.createElement('a') + link.href = url + link.setAttribute('download', fileName) + document.body.appendChild(link) + link.click() + document.body.removeChild(link) + } catch (error) { + console.error('导出失败:', error) + } +} diff --git a/src/views/big-screen/model-components/center-model-7-3.vue b/src/views/big-screen/model-components/center-model-7-3.vue index 947ab20..04b5b83 100644 --- a/src/views/big-screen/model-components/center-model-7-3.vue +++ b/src/views/big-screen/model-components/center-model-7-3.vue @@ -273,8 +273,8 @@ const handleDetail = (type: any) => { let path = '' if (type == 1) { params.title = '入驻装备数' - params.type = 1 - path = '/detail-list-new' + // params.type = 1 + path = '/details-unit' } else if (type == 2) { params.title = '上架装备数' params.type = 2 diff --git a/src/views/big-screen/model-components/details-new.vue b/src/views/big-screen/model-components/details-new.vue index b32eace..ebdaa6b 100644 --- a/src/views/big-screen/model-components/details-new.vue +++ b/src/views/big-screen/model-components/details-new.vue @@ -50,7 +50,6 @@ import { ref, onMounted } from 'vue' import PagingComponent from 'components/PagingComponent/index.vue' import { - getDevNumApi, getDevUpNumApi, getDevTypeNumApi, getDevQcWarningNumApi, @@ -58,11 +57,12 @@ import { getDevLeasingNumApi, } from '@/http/api/screen-f/index.ts' -import { getTotalCountApi, getDemandUnitApi } from '@/http/api/screen/index.ts' +import { getTotalCountApi, getDemandUnitApi, getDevNumDetailsListApi } from '@/http/api/screen/index.ts' const router = useRouter() const currentType = ref(router.currentRoute.value.query.type) const title = ref(router.currentRoute.value.query.title) +const ownCo = ref(router.currentRoute.value.query.ownCo) // 总装备上架时长 const upTotal = ref(0) // 总装备租赁时长 @@ -77,7 +77,21 @@ const orderCount = ref(0) const answerRate = ref(0) const columns = ref([]) -if (currentType.value == 1 || currentType.value == 2) { +if (currentType.value == 1) { + columns.value = [ + { label: '装备名称', prop: 'deviceName' }, + { label: '装备类目', prop: 'categoryName' }, + { label: '装备单位', prop: 'unitName' }, + { label: '装备品牌', prop: 'brand' }, + { label: '出厂日期', prop: 'productionDate' }, + { label: '联系人', prop: 'person' }, + { label: '联系电话', prop: 'personPhone' }, + { label: '上架数量', prop: 'deviceCount' }, + { label: '录入人', prop: 'creatorName' }, + { label: '录入时间', prop: 'createTime' }, + { label: '所属公司', prop: 'comName' }, + ] +} else if (currentType.value == 2) { columns.value = [ { label: '机具类型', prop: 'typeName' }, { label: '机具名称', prop: 'deviceName' }, @@ -153,8 +167,9 @@ const getList = async () => { } let res = null if (currentType.value == 1) { + params.ownCo = ownCo.value // 需求装备种类 - res = await getDevNumApi(params) + res = await getDevNumDetailsListApi(params) } else if (currentType.value == 2) { // 需求装备种类 res = await getDevUpNumApi(params) @@ -188,9 +203,16 @@ const getList = async () => { const back = () => { console.log('back') - router.push({ - path: '/big-screen', - }) + if (currentType.value == 1) { + router.push({ + path: '/details-unit', + query: { title: '入驻装备数' }, + }) + } else { + router.push({ + path: '/big-screen', + }) + } } onMounted(() => { diff --git a/src/views/big-screen/model-components/details-unit.vue b/src/views/big-screen/model-components/details-unit.vue new file mode 100644 index 0000000..5dbee91 --- /dev/null +++ b/src/views/big-screen/model-components/details-unit.vue @@ -0,0 +1,230 @@ + + + + +