liuchen864
8 months ago
22 changed files with 1674 additions and 19 deletions
@ -0,0 +1,57 @@ |
|||
import request from '@/config/axios' |
|||
|
|||
export interface MarketplaceDataVO { |
|||
id: number |
|||
type: string |
|||
name: string |
|||
describes: string |
|||
price: number |
|||
amountIncrease: string |
|||
field1: string |
|||
field2: string |
|||
field3: string |
|||
field4: string |
|||
available: string |
|||
concurrencyStamp: number |
|||
} |
|||
|
|||
// 查询市场数据管理列表
|
|||
export const getMarketplaceDataPage = async (params) => { |
|||
if (params.isSearch) { |
|||
delete params.isSearch |
|||
const data = {...params} |
|||
return await request.post({ url: '/basic/marketplace-data/senior', data }) |
|||
} else { |
|||
return await request.get({ url: `/basic/marketplace-data/page`, params }) |
|||
} |
|||
} |
|||
|
|||
// 查询市场数据管理详情
|
|||
export const getMarketplaceData = async (id: number) => { |
|||
return await request.get({ url: `/basic/marketplace-data/get?id=` + id }) |
|||
} |
|||
|
|||
// 新增市场数据管理
|
|||
export const createMarketplaceData = async (data: MarketplaceDataVO) => { |
|||
return await request.post({ url: `/basic/marketplace-data/create`, data }) |
|||
} |
|||
|
|||
// 修改市场数据管理
|
|||
export const updateMarketplaceData = async (data: MarketplaceDataVO) => { |
|||
return await request.put({ url: `/basic/marketplace-data/update`, data }) |
|||
} |
|||
|
|||
// 删除市场数据管理
|
|||
export const deleteMarketplaceData = async (id: number) => { |
|||
return await request.delete({ url: `/basic/marketplace-data/delete?id=` + id }) |
|||
} |
|||
|
|||
// 导出市场数据管理 Excel
|
|||
export const exportMarketplaceData = async (params) => { |
|||
return await request.download({ url: `/basic/marketplace-data/export-excel`, params }) |
|||
} |
|||
|
|||
// 下载导入模板
|
|||
export const importTemplate = () => { |
|||
return request.download({ url: '/basic/marketplace-data/get-import-template' }) |
|||
} |
@ -0,0 +1,231 @@ |
|||
<template> |
|||
<ContentWrap> |
|||
<!-- 搜索工作栏 --> |
|||
<Search :schema="MarketplaceData.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
|||
</ContentWrap> |
|||
|
|||
<!-- 列表头部 --> |
|||
<TableHead |
|||
:HeadButttondata="HeadButttondata" |
|||
@button-base-click="buttonBaseClick" |
|||
:routeName="routeName" |
|||
@updataTableColumns="updataTableColumns" |
|||
@searchFormClick="searchFormClick" |
|||
:allSchemas="MarketplaceData.allSchemas" |
|||
/> |
|||
|
|||
<!-- 列表 --> |
|||
<ContentWrap> |
|||
<Table |
|||
:columns="tableColumns" |
|||
:data="tableObject.tableList" |
|||
:loading="tableObject.loading" |
|||
:pagination="{ |
|||
total: tableObject.total |
|||
}" |
|||
v-model:pageSize="tableObject.pageSize" |
|||
v-model:currentPage="tableObject.currentPage" |
|||
v-model:sort="tableObject.sort" |
|||
> |
|||
<template #code="{row}"> |
|||
<el-button type="primary" link @click="openDetail(row, '代码', row.code)"> |
|||
<span>{{ row.code }}</span> |
|||
</el-button> |
|||
</template> |
|||
<template #action="{ row }"> |
|||
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> |
|||
</template> |
|||
</Table> |
|||
</ContentWrap> |
|||
|
|||
<!-- 表单弹窗:添加/修改 --> |
|||
<BasicForm |
|||
ref="basicFormRef" |
|||
@success="getList" |
|||
:rules="MarketplaceDataRules" |
|||
:formAllSchemas="MarketplaceData.allSchemas" |
|||
:searchTableParams="searchTableParams" |
|||
:apiUpdate="MarketplaceDataApi.updateMarketplaceData" |
|||
:apiCreate="MarketplaceDataApi.createMarketplaceData" |
|||
@searchTableSuccess="searchTableSuccess" |
|||
:isBusiness="false" |
|||
/> |
|||
|
|||
<!-- 详情 --> |
|||
<!-- <Detail ref="detailRef" :isBasic="true" :allSchemas="MarketplaceData.allSchemas" /> --> |
|||
|
|||
<!-- 导入 --> |
|||
<ImportForm ref="importFormRef" url="/basic/marketplace-data/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import download from '@/utils/download' |
|||
import { MarketplaceData,MarketplaceDataRules } from './marketplaceData.data' |
|||
import * as MarketplaceDataApi from '@/api/basedata/marketplaceData' |
|||
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|||
// import TableHead from '@/components/TableHead/src/TableHead.vue' |
|||
// import ImportForm from '@/components/ImportForm/src/ImportForm.vue' |
|||
// import Detail from '@/components/Detail/src/Detail.vue' |
|||
|
|||
defineOptions({ name: 'marketplace' }) |
|||
|
|||
const message = useMessage() // 消息弹窗 |
|||
const { t } = useI18n() // 国际化 |
|||
|
|||
const route = useRoute() // 路由信息 |
|||
const routeName = ref() |
|||
routeName.value = route.name |
|||
const tableColumns = ref(MarketplaceData.allSchemas.tableColumns) |
|||
|
|||
// 字段设置 更新主列表字段 |
|||
const updataTableColumns = (val) => { |
|||
tableColumns.value = val |
|||
} |
|||
|
|||
// 查询列表页面参数设置 |
|||
const searchTableParams = ref([ |
|||
//{ |
|||
// formField: 'productItemCode', |
|||
// searchTableTitle: '物料信息', |
|||
// searchTableAllSchemas: Itembasic.allSchemas, |
|||
// searchTablePage: ItembasicApi.getItembasicPage |
|||
//} |
|||
]) |
|||
|
|||
const { tableObject, tableMethods } = useTable({ |
|||
getListApi: MarketplaceDataApi.getMarketplaceDataPage // 分页接口 |
|||
}) |
|||
|
|||
// 获得表格的各种操作 |
|||
const { getList, setSearchParams } = tableMethods |
|||
|
|||
// 列表头部按钮 |
|||
const HeadButttondata = [ |
|||
defaultButtons.defaultAddBtn(null), // 新增 |
|||
// defaultButtons.defaultImportBtn({hasPermi:'wms:marketplaceData:import'}), // 导入 |
|||
// defaultButtons.defaultExportBtn({hasPermi:'wms:marketplaceData:export'}), // 导出 |
|||
defaultButtons.defaultFreshBtn(null), // 刷新 |
|||
// defaultButtons.defaultFilterBtn(null), // 筛选 |
|||
defaultButtons.defaultSetBtn(null), // 设置 |
|||
// { |
|||
// label: '自定义扩展按钮', |
|||
// name: 'zdy', |
|||
// hide: false, |
|||
// type: 'primary', |
|||
// icon: 'Select', |
|||
// color: '' |
|||
// }, |
|||
] |
|||
|
|||
// 头部按钮事件 |
|||
const buttonBaseClick = (val, item) => { |
|||
if (val == 'add') { // 新增 |
|||
openForm('create') |
|||
} else if (val == 'import') { // 导入 |
|||
handleImport() |
|||
} else if (val == 'export') { // 导出 |
|||
handleExport() |
|||
} else if (val == 'refresh') { // 刷新 |
|||
getList() |
|||
} else if (val == 'filtrate') { // 筛选 |
|||
} else { // 其他按钮 |
|||
console.log('其他按钮', item) |
|||
} |
|||
} |
|||
|
|||
// 列表-操作按钮 |
|||
const butttondata = [ |
|||
defaultButtons.mainListEditBtn(null), // 编辑 |
|||
defaultButtons.mainListDeleteBtn(null), // 删除 |
|||
] |
|||
|
|||
// 列表-操作按钮事件 |
|||
const buttonTableClick = async (val, row) => { |
|||
if (val == 'edit') { // 编辑 |
|||
openForm('update', row) |
|||
} else if (val == 'delete') { // 删除 |
|||
handleDelete(row.id) |
|||
} |
|||
} |
|||
|
|||
/** 添加/修改操作 */ |
|||
const basicFormRef = ref() |
|||
const openForm = (type: string, row?: any) => { |
|||
basicFormRef.value.open(type, row) |
|||
} |
|||
|
|||
// 查询页面返回 |
|||
const searchTableSuccess = (formField, searchField, val, formRef) => { |
|||
nextTick(() => { |
|||
const setV = {} |
|||
setV[formField] = val[0][searchField] |
|||
formRef.setValues(setV) |
|||
}) |
|||
} |
|||
|
|||
/** 详情操作 */ |
|||
const detailRef = ref() |
|||
const openDetail = (row: any, titleName: any, titleValue: any) => { |
|||
detailRef.value.openDetail(row, titleName, titleValue, 'basicMarketplaceData') |
|||
} |
|||
|
|||
/** 删除按钮操作 */ |
|||
const handleDelete = async (id: number) => { |
|||
try { |
|||
// 删除的二次确认 |
|||
await message.delConfirm() |
|||
// 发起删除 |
|||
await MarketplaceDataApi.deleteMarketplaceData(id) |
|||
message.success(t('common.delSuccess')) |
|||
// 刷新列表 |
|||
await getList() |
|||
} catch {} |
|||
} |
|||
|
|||
/** 导出按钮操作 */ |
|||
const exportLoading = ref(false) // 导出的加载中 |
|||
const handleExport = async () => { |
|||
try { |
|||
// 导出的二次确认 |
|||
await message.exportConfirm() |
|||
// 发起导出 |
|||
exportLoading.value = true |
|||
const data = await MarketplaceDataApi.exportMarketplaceData(setSearchParams) |
|||
download.excel(data, '市场数据管理.xls') |
|||
} catch { |
|||
} finally { |
|||
exportLoading.value = false |
|||
} |
|||
} |
|||
|
|||
/** 导入 */ |
|||
const importFormRef = ref() |
|||
const handleImport = () => { |
|||
importFormRef.value.open() |
|||
} |
|||
// 导入附件弹窗所需的参数 |
|||
const importTemplateData = reactive({ |
|||
templateUrl: '', |
|||
templateTitle: '市场数据管理导入模版.xls' |
|||
}) |
|||
// 导入成功之后 |
|||
const importSuccess = () => { |
|||
getList() |
|||
} |
|||
|
|||
// 筛选提交 |
|||
const searchFormClick = (searchData) => { |
|||
tableObject.params = { |
|||
isSearch: true, |
|||
filters: searchData.filters |
|||
} |
|||
getList() // 刷新当前列表 |
|||
} |
|||
|
|||
/** 初始化 **/ |
|||
onMounted(async () => { |
|||
getList() |
|||
importTemplateData.templateUrl = await MarketplaceDataApi.importTemplate() |
|||
}) |
|||
|
|||
</script> |
@ -0,0 +1,131 @@ |
|||
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
|||
import { dateFormatter } from '@/utils/formatTime' |
|||
|
|||
// 表单校验
|
|||
export const MarketplaceDataRules = reactive({ |
|||
available: [required], |
|||
concurrencyStamp: [required], |
|||
}) |
|||
|
|||
export const MarketplaceData = useCrudSchemas(reactive<CrudSchema[]>([ |
|||
{ |
|||
label: 'id', |
|||
field: 'id', |
|||
sort: 'custom', |
|||
isTable: false, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '品种', |
|||
field: 'type', |
|||
sort: 'custom', |
|||
form: { |
|||
component: 'Select' |
|||
}, |
|||
isTable: false, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '品种名称', |
|||
field: 'name', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
|
|||
}, |
|||
{ |
|||
label: '描述', |
|||
field: 'describes', |
|||
sort: 'custom', |
|||
isTable: false, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '价格', |
|||
field: 'price', |
|||
sort: 'custom', |
|||
form:{ |
|||
component:'InputNumber', |
|||
componentProps: { |
|||
min: 0, |
|||
precision: 4 |
|||
} |
|||
|
|||
} |
|||
}, |
|||
{ |
|||
label: '涨幅情况', |
|||
field: 'amountIncrease', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '预留字段1', |
|||
field: 'field1', |
|||
sort: 'custom', |
|||
isTable: false, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '预留字段2', |
|||
field: 'field2', |
|||
sort: 'custom', |
|||
isTable: false, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '预留字段3', |
|||
field: 'field3', |
|||
sort: 'custom', |
|||
isTable: false, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '预留字段4', |
|||
field: 'field4', |
|||
sort: 'custom', |
|||
isTable: false, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '创建时间', |
|||
field: 'createTime', |
|||
sort: 'custom', |
|||
formatter: dateFormatter, |
|||
isSearch: true, |
|||
search: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
|||
type: 'daterange', |
|||
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
|||
} |
|||
}, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '是否可用', |
|||
field: 'available', |
|||
sort: 'custom', |
|||
isTable: false, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '并发乐观锁', |
|||
field: 'concurrencyStamp', |
|||
sort: 'custom', |
|||
form: { |
|||
component: 'InputNumber', |
|||
value: 0 |
|||
}, |
|||
isTable: false, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '操作', |
|||
field: 'action', |
|||
isForm: false, |
|||
table: { |
|||
width: 150, |
|||
fixed: 'right' |
|||
} |
|||
} |
|||
])) |
@ -0,0 +1,259 @@ |
|||
<template> |
|||
<ContentWrap> |
|||
<!-- 搜索工作栏 --> |
|||
<Search :schema="Platscale.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
|||
</ContentWrap> |
|||
|
|||
<!-- 列表头部 --> |
|||
<TableHead |
|||
:HeadButttondata="HeadButttondata" |
|||
@button-base-click="buttonBaseClick" |
|||
:routeName="routeName" |
|||
@updataTableColumns="updataTableColumns" |
|||
@searchFormClick="searchFormClick" |
|||
:allSchemas="Platscale.allSchemas" |
|||
/> |
|||
|
|||
<!-- 列表 --> |
|||
<ContentWrap> |
|||
<Table |
|||
:columns="tableColumns" |
|||
:data="tableObject.tableList" |
|||
:loading="tableObject.loading" |
|||
:pagination="{ |
|||
total: tableObject.total |
|||
}" |
|||
v-model:pageSize="tableObject.pageSize" |
|||
v-model:currentPage="tableObject.currentPage" |
|||
v-model:sort="tableObject.sort" |
|||
> |
|||
<template #code="{row}"> |
|||
<el-button type="primary" link @click="openDetail(row, '代码', row.code)"> |
|||
<span>{{ row.code }}</span> |
|||
</el-button> |
|||
</template> |
|||
<template #action="{ row }"> |
|||
<!-- <el-button type="text" @click="auditStatus(row)">确认</el-button> --> |
|||
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> |
|||
</template> |
|||
</Table> |
|||
</ContentWrap> |
|||
|
|||
<!-- 表单弹窗:添加/修改 --> |
|||
<BasicForm |
|||
ref="basicFormRef" |
|||
@success="getList" |
|||
:rules="PlatscaleRules" |
|||
:formAllSchemas="Platscale.allSchemas" |
|||
:searchTableParams="searchTableParams" |
|||
:apiUpdate="PlatscaleApi.updatePlatscale" |
|||
:apiCreate="PlatscaleApi.createPlatscale" |
|||
@searchTableSuccess="searchTableSuccess" |
|||
:isBusiness="false" |
|||
/> |
|||
|
|||
<el-dialog title="请选择同步日期" v-model="syncData.dialogVisible" width="20%"> |
|||
<div class="block"> |
|||
<!-- <span class="demonstration">默认</span> --> |
|||
<el-date-picker |
|||
v-model="syncData.busDate" |
|||
type="date" |
|||
value-format="YYYY-MM-DD" |
|||
placeholder="选择同步日期" style="width:100%" /> |
|||
</div> |
|||
<br /> |
|||
<span class="dialog-footer"> |
|||
<el-button @click="syncData.dialogVisible = false">取 消</el-button> |
|||
<el-button type="primary" @click="toSyncData">确 定</el-button> |
|||
</span> |
|||
</el-dialog> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import download from '@/utils/download' |
|||
import { Platscale,PlatscaleRules } from './platscale.data' |
|||
import * as PlatscaleApi from '@/api/lab/platscale' |
|||
import * as AsyncdataApi from '@/api/lab/asyncdata' |
|||
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|||
|
|||
defineOptions({ name: 'platscaledata' }) |
|||
|
|||
const message = useMessage() // 消息弹窗 |
|||
const { t } = useI18n() // 国际化 |
|||
|
|||
const route = useRoute() // 路由信息 |
|||
const routeName = ref() |
|||
routeName.value = route.name |
|||
const tableColumns = ref(Platscale.allSchemas.tableColumns) |
|||
|
|||
const syncData = reactive({dialogVisible: false , busDate: ''}) |
|||
|
|||
// 字段设置 更新主列表字段 |
|||
const updataTableColumns = (val) => { |
|||
tableColumns.value = val |
|||
} |
|||
|
|||
// 查询列表页面参数设置 |
|||
const searchTableParams = ref([ |
|||
//{ |
|||
// formField: 'productItemCode', |
|||
// searchTableTitle: '物料信息', |
|||
// searchTableAllSchemas: Itembasic.allSchemas, |
|||
// searchTablePage: ItembasicApi.getItembasicPage |
|||
//} |
|||
]) |
|||
|
|||
const { tableObject, tableMethods } = useTable({ |
|||
getListApi: PlatscaleApi.getPlatscalePage // 分页接口 |
|||
}) |
|||
|
|||
// 获得表格的各种操作 |
|||
const { getList, setSearchParams } = tableMethods |
|||
|
|||
// 列表头部按钮 |
|||
const HeadButttondata = [ |
|||
// defaultButtons.defaultAddBtn(null), // 新增 |
|||
// defaultButtons.defaultSyncDataBtn(null), // 同步 |
|||
defaultButtons.defaultFreshBtn(null), // 刷新 |
|||
defaultButtons.defaultSetBtn(null), // 设置 |
|||
// { |
|||
// label: '自定义扩展按钮', |
|||
// name: 'zdy', |
|||
// hide: false, |
|||
// type: 'primary', |
|||
// icon: 'Select', |
|||
// color: '' |
|||
// }, |
|||
] |
|||
|
|||
// 头部按钮事件 |
|||
const buttonBaseClick = (val, item) => { |
|||
if (val == 'add') { // 新增 |
|||
openForm('create') |
|||
} else if (val == 'import') { // 导入 |
|||
handleImport() |
|||
} else if (val == 'export') { // 导出 |
|||
handleExport() |
|||
} else if (val == 'refresh') { // 刷新 |
|||
getList() |
|||
} else if (val == 'syncData') { // 同步 |
|||
syncData.dialogVisible = true |
|||
} else { // 其他按钮 |
|||
console.log('其他按钮', item) |
|||
} |
|||
} |
|||
|
|||
function toSyncData () { |
|||
syncData.dialogVisible = false |
|||
AsyncdataApi.asyncLabData({busType: '1' , busDate: syncData.busDate}).then((data) => { |
|||
if (data) { |
|||
message.success('操作成功') |
|||
getList() |
|||
} else { |
|||
message.warning('正在执行同步操作, 5分钟之内不要重复执行 , 请等待......') |
|||
} |
|||
}) |
|||
} |
|||
|
|||
// 列表-操作按钮 |
|||
const butttondata = [ |
|||
// defaultButtons.mainListEditBtn(null), // 编辑 |
|||
// defaultButtons.mainListDeleteBtn(null), // 删除 |
|||
] |
|||
|
|||
// 列表-操作按钮事件 |
|||
const buttonTableClick = async (val, row) => { |
|||
if (val == 'edit') { // 编辑 |
|||
openForm('update', row) |
|||
} else if (val == 'delete') { // 删除 |
|||
handleDelete(row.id) |
|||
} |
|||
} |
|||
|
|||
// 确认审核操作事件 |
|||
const auditStatus = async (row) => { |
|||
let data = {id: row.id , auditStatus: '1'} |
|||
// 确认 |
|||
await message.confirm('确认?') |
|||
// 修改 |
|||
await PlatscaleApi.updatePlatscale(data) |
|||
message.success('操作成功') |
|||
// 刷新列表 |
|||
await getList() |
|||
} |
|||
|
|||
/** 添加/修改操作 */ |
|||
const basicFormRef = ref() |
|||
const openForm = (type: string, row?: any) => { |
|||
basicFormRef.value.open(type, row) |
|||
} |
|||
|
|||
// 查询页面返回 |
|||
const searchTableSuccess = (formField, searchField, val, formRef) => { |
|||
nextTick(() => { |
|||
const setV = {} |
|||
setV[formField] = val[0][searchField] |
|||
formRef.setValues(setV) |
|||
}) |
|||
} |
|||
|
|||
/** 删除按钮操作 */ |
|||
const handleDelete = async (id: number) => { |
|||
try { |
|||
// 删除的二次确认 |
|||
await message.delConfirm() |
|||
// 发起删除 |
|||
await PlatscaleApi.deletePlatscale(id) |
|||
message.success(t('common.delSuccess')) |
|||
// 刷新列表 |
|||
await getList() |
|||
} catch {} |
|||
} |
|||
|
|||
/** 导出按钮操作 */ |
|||
const exportLoading = ref(false) // 导出的加载中 |
|||
const handleExport = async () => { |
|||
try { |
|||
// 导出的二次确认 |
|||
await message.exportConfirm() |
|||
// 发起导出 |
|||
exportLoading.value = true |
|||
const data = await PlatscaleApi.exportPlatscale(setSearchParams) |
|||
download.excel(data, '实验室-地衡.xls') |
|||
} catch { |
|||
} finally { |
|||
exportLoading.value = false |
|||
} |
|||
} |
|||
|
|||
/** 导入 */ |
|||
const importFormRef = ref() |
|||
const handleImport = () => { |
|||
importFormRef.value.open() |
|||
} |
|||
// 导入附件弹窗所需的参数 |
|||
const importTemplateData = reactive({ |
|||
templateUrl: '', |
|||
templateTitle: '实验室-地衡导入模版.xls' |
|||
}) |
|||
// 导入成功之后 |
|||
const importSuccess = () => { |
|||
getList() |
|||
} |
|||
|
|||
// 筛选提交 |
|||
const searchFormClick = (searchData) => { |
|||
tableObject.params = { |
|||
isSearch: true, |
|||
filters: searchData.filters |
|||
} |
|||
getList() // 刷新当前列表 |
|||
} |
|||
|
|||
/** 初始化 **/ |
|||
onMounted(async () => { |
|||
getList() |
|||
// importTemplateData.templateUrl = await PlatscaleApi.importTemplate() |
|||
}) |
|||
|
|||
</script> |
@ -0,0 +1,341 @@ |
|||
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
|||
import { dateFormatter , dateFormatter2 } from '@/utils/formatTime' |
|||
|
|||
// 表单校验
|
|||
export const PlatscaleRules = reactive({ |
|||
}) |
|||
|
|||
export const Platscale = useCrudSchemas(reactive<CrudSchema[]>([ |
|||
// {
|
|||
// label: '主键、自增',
|
|||
// field: 'id',
|
|||
// sort: 'custom',
|
|||
// isForm: false,
|
|||
// },
|
|||
// {
|
|||
// label: '批号',
|
|||
// field: 'batchNo',
|
|||
// sort: 'custom',
|
|||
// isSearch: true,
|
|||
// table: {
|
|||
// width: 150
|
|||
// }
|
|||
// },
|
|||
// {
|
|||
// label: '送样单位',
|
|||
// field: 'sydw',
|
|||
// sort: 'custom',
|
|||
// isSearch: false,
|
|||
// table: {
|
|||
// width: 150
|
|||
// }
|
|||
// },
|
|||
// {
|
|||
// label: '标准',
|
|||
// field: 'standard',
|
|||
// sort: 'custom',
|
|||
// isSearch: false,
|
|||
// table: {
|
|||
// width: 150
|
|||
// }
|
|||
// },
|
|||
// {
|
|||
// label: '材质',
|
|||
// field: 'cz',
|
|||
// sort: 'custom',
|
|||
// isSearch: false,
|
|||
// table: {
|
|||
// width: 150
|
|||
// }
|
|||
// },
|
|||
// {
|
|||
// label: '规格',
|
|||
// field: 'guig',
|
|||
// sort: 'custom',
|
|||
// isSearch: false,
|
|||
// table: {
|
|||
// width: 150
|
|||
// }
|
|||
// },
|
|||
// {
|
|||
// label: '实验人',
|
|||
// field: 'testUser',
|
|||
// sort: 'custom',
|
|||
// isSearch: true,
|
|||
// table: {
|
|||
// width: 150
|
|||
// },
|
|||
// dictType: DICT_TYPE.LAB_USER_TEST_TYPE,
|
|||
// dictClass: 'number'
|
|||
// },
|
|||
{ |
|||
label: '车号', |
|||
field: 'ch', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
table: { |
|||
width: 150 |
|||
} |
|||
}, |
|||
{ |
|||
label: '车型', |
|||
field: 'cx', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
table: { |
|||
width: 150 |
|||
} |
|||
}, |
|||
{ |
|||
label: '品种', |
|||
field: 'pz', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
table: { |
|||
width: 150 |
|||
} |
|||
}, |
|||
{ |
|||
label: '供货单位', |
|||
field: 'ghdw', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
table: { |
|||
width: 150 |
|||
} |
|||
}, |
|||
{ |
|||
label: '运输单位', |
|||
field: 'ysdw', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
table: { |
|||
width: 150 |
|||
} |
|||
}, |
|||
{ |
|||
label: '出入库', |
|||
field: 'crk', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
table: { |
|||
width: 150 |
|||
} |
|||
}, |
|||
{ |
|||
label: '毛重', |
|||
field: 'mz', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
table: { |
|||
width: 150 |
|||
} |
|||
}, |
|||
{ |
|||
label: '皮重', |
|||
field: 'pzh', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
table: { |
|||
width: 150 |
|||
} |
|||
}, |
|||
{ |
|||
label: '净重', |
|||
field: 'jz', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
table: { |
|||
width: 150 |
|||
} |
|||
}, |
|||
{ |
|||
label: '检斤员', |
|||
field: 'jjy', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
table: { |
|||
width: 150 |
|||
} |
|||
}, |
|||
{ |
|||
label: '日期', |
|||
field: 'rq', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
formatter: dateFormatter2, |
|||
form: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
valueFormat: 'YYYY-MM-DD', |
|||
type: 'date' |
|||
} |
|||
}, |
|||
table: { |
|||
width: 200 |
|||
} |
|||
}, |
|||
{ |
|||
label: '一次计量时间', |
|||
field: 'jlsjOne', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
form: { |
|||
component: 'TimePicker', |
|||
componentProps: { |
|||
valueFormat: 'HH:mm:ss', |
|||
type: 'time' |
|||
} |
|||
}, |
|||
table: { |
|||
width: 200 |
|||
} |
|||
}, |
|||
{ |
|||
label: '二次计量时间', |
|||
field: 'jlsjTwo', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
form: { |
|||
component: 'TimePicker', |
|||
componentProps: { |
|||
valueFormat: 'HH:mm:ss', |
|||
type: 'time' |
|||
} |
|||
}, |
|||
table: { |
|||
width: 200 |
|||
} |
|||
}, |
|||
{ |
|||
label: '编号', |
|||
field: 'bh', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
table: { |
|||
width: 150 |
|||
} |
|||
}, |
|||
{ |
|||
label: '送货单位', |
|||
field: 'shdw', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
table: { |
|||
width: 150 |
|||
} |
|||
}, |
|||
{ |
|||
label: '性质', |
|||
field: 'xz', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
table: { |
|||
width: 150 |
|||
} |
|||
}, |
|||
{ |
|||
label: '防伪码', |
|||
field: 'fwm', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
table: { |
|||
width: 150 |
|||
} |
|||
}, |
|||
{ |
|||
label: '抽样时间', |
|||
field: 'cysj', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
table: { |
|||
width: 200 |
|||
} |
|||
}, |
|||
{ |
|||
label: '抽样编号', |
|||
field: 'cybh', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
table: { |
|||
width: 150 |
|||
} |
|||
}, |
|||
{ |
|||
label: '抽样结果', |
|||
field: 'cyjg', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
table: { |
|||
width: 150 |
|||
} |
|||
}, |
|||
{ |
|||
label: '报告单编号', |
|||
field: 'bgdbh', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
table: { |
|||
width: 150 |
|||
} |
|||
}, |
|||
{ |
|||
label: '是否抽检', |
|||
field: 'sfcj', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
table: { |
|||
width: 150 |
|||
} |
|||
}, |
|||
{ |
|||
label: '数据源', |
|||
field: 'dataSource', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
table: { |
|||
width: 150 |
|||
} |
|||
}, |
|||
// {
|
|||
// label: '审核状态',
|
|||
// field: 'auditStatus',
|
|||
// sort: 'custom',
|
|||
// isSearch: true,
|
|||
// table: {
|
|||
// width: 120,
|
|||
// fixed: 'right'
|
|||
// },
|
|||
// dictType: DICT_TYPE.LAB_AUDIT_STATUS,
|
|||
// dictClass: 'number'
|
|||
// },
|
|||
{ |
|||
label: '采集时间', |
|||
field: 'createTime', |
|||
sort: 'custom', |
|||
formatter: dateFormatter, |
|||
isSearch: true, |
|||
search: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
|||
type: 'daterange', |
|||
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
|||
} |
|||
}, |
|||
isForm: false, |
|||
table: { |
|||
width: 200, |
|||
fixed: 'right' |
|||
} |
|||
}, |
|||
// {
|
|||
// label: '操作',
|
|||
// field: 'action',
|
|||
// isForm: false,
|
|||
// table: {
|
|||
// width: 180,
|
|||
// fixed: 'right'
|
|||
// }
|
|||
// }
|
|||
])) |
@ -0,0 +1,198 @@ |
|||
<template> |
|||
<ContentWrap> |
|||
<!-- 能耗搜索工作栏 --> |
|||
<el-form :model="queryParams" ref="queryForm" :inline="true"> |
|||
<el-form-item label="日期" prop="dateRange"> |
|||
<el-date-picker |
|||
v-model="queryParams.dateRange" |
|||
style="width: 240px; height: 30px" |
|||
value-format="YYYY-MM-DD" |
|||
end-placeholder="结束日期" |
|||
start-placeholder="开始日期" |
|||
type="daterange" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item label="位置" prop="flag"> |
|||
<el-select v-model="queryParams.flag" placeholder="请选择"> |
|||
<el-option |
|||
v-for="item in flagList" |
|||
:key="item.value" |
|||
:label="item.label" |
|||
:value="item.value" /> |
|||
</el-select> |
|||
</el-form-item> |
|||
<el-form-item> |
|||
<el-button type="primary" size="mini" @click="handleQuery">搜索</el-button> |
|||
<el-button size="mini" @click="resetQuery">重置</el-button> |
|||
<el-button type="success" @click="exportElecTotal" size="mini">导出</el-button> |
|||
</el-form-item> |
|||
</el-form> |
|||
</ContentWrap> |
|||
|
|||
<!-- 列表 --> |
|||
<ContentWrap> |
|||
<el-divider content-position="left"><div style="font-size:16px; float: left"><b>{{names}}</b></div></el-divider> |
|||
<el-table |
|||
v-loading="loading" :data="dataList" border="true" highlight-current-row="true" |
|||
header-row-style="height: 50px; text-align: center" :span-method="arraySpanMethod" |
|||
:row-class-name="tableRowClassName" :cell-class-name="tableCellClassName"> |
|||
<el-table-column label="生产单位" prop="name" align="right" :show-overflow-tooltip="true" width="150" /> |
|||
<el-table-column label="班组" prop="tiemFrame" align="center" :show-overflow-tooltip="true" /> |
|||
<el-table-column label="生产水耗1" prop="fields" align="center" :show-overflow-tooltip="true" /> |
|||
<el-table-column label="生产水耗2" prop="fields1" align="center" :show-overflow-tooltip="true" /> |
|||
<el-table-column label="循环水" prop="fields2" align="center" :show-overflow-tooltip="true" /> |
|||
<el-table-column label="煤量" prop="fields3" align="center" :show-overflow-tooltip="true" /> |
|||
<el-table-column label="天然气" prop="fields4" align="center" :show-overflow-tooltip="true" /> |
|||
<!-- <el-table-column label="班组用电量" prop="fields5" align="center" :show-overflow-tooltip="true" /> --> |
|||
<el-table-column label="峰期电量" prop="fields6" align="center" :show-overflow-tooltip="true" /> |
|||
<el-table-column label="谷期电量" prop="fields7" align="center" :show-overflow-tooltip="true" /> |
|||
<el-table-column label="平期电量" prop="fields8" align="center" :show-overflow-tooltip="true" /> |
|||
<el-table-column label="尖峰电量" prop="fields8" align="center" :show-overflow-tooltip="true" /> |
|||
<el-table-column label="合计电量" prop="fields5" align="center" :show-overflow-tooltip="true" /> |
|||
</el-table> |
|||
</ContentWrap> |
|||
|
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import * as TjanalysisApi from '@/api/tjanalysis' |
|||
import { formatDate } from '@/utils/formatTime' |
|||
import * as DictApi from '@/utils/dict' |
|||
|
|||
defineOptions({ name: 'energyconsumption' }) |
|||
|
|||
const message = useMessage() // 消息弹窗 |
|||
const { t } = useI18n() // 国际化 |
|||
|
|||
const route = useRoute() // 路由信息 |
|||
const routeName = ref() |
|||
routeName.value = route.name |
|||
const loading = ref(true) |
|||
const dataList = ref([]) |
|||
const names = ref(''); |
|||
const queryParams = reactive({ |
|||
dateRange: [], |
|||
flag: '0', |
|||
iname:'' |
|||
|
|||
}) |
|||
|
|||
const flagList =ref([]) |
|||
const handleQuery = async () => { |
|||
const ll = flagList.value.find(map=>map.value == queryParams.flag); |
|||
names.value = ll?.label |
|||
queryParams.iname= ll?.label |
|||
dataList.value = []; |
|||
getList() |
|||
} |
|||
|
|||
const resetQuery = async () => { |
|||
let today = new Date(); |
|||
|
|||
// 计算昨天的日期 |
|||
today.setDate(today.getDate() - 1); |
|||
|
|||
// 格式化日期为 "yyyy-MM-dd" |
|||
let year = today.getFullYear(); |
|||
let month = String(today.getMonth() + 1).padStart(2, '0'); // 月份从0开始,所以需要+1,并确保是两位数 |
|||
let date = String(today.getDate()).padStart(2, '0'); // 确保日期是两位数 |
|||
|
|||
let yesterdayAsString = `${year}-${month}-${date}`; |
|||
|
|||
console.log(yesterdayAsString); |
|||
|
|||
|
|||
queryParams.dateRange=[yesterdayAsString,yesterdayAsString] |
|||
getList() |
|||
} |
|||
|
|||
const getList = async () => { |
|||
const res = await TjanalysisApi.queryEnergyConsumption(queryParams) |
|||
|
|||
dataList.value = res |
|||
loading.value = false |
|||
} |
|||
|
|||
function arraySpanMethod ({ row, column, rowIndex, columnIndex }) { |
|||
if (rowIndex == 6) { |
|||
if (columnIndex == 0) { |
|||
return { |
|||
rowspan: 1, |
|||
colspan: 10 |
|||
} |
|||
} else if (columnIndex == 10) { |
|||
return { |
|||
rowspan: 1, |
|||
colspan: 2 |
|||
} |
|||
} else { |
|||
return { |
|||
rowspan: 0, |
|||
colspan: 0 |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
function tableRowClassName({row, rowIndex}) { |
|||
if (rowIndex === 7) { |
|||
return 'success-row' |
|||
} |
|||
return '' |
|||
} |
|||
|
|||
function tableCellClassName({row, column, rowIndex, columnIndex}) { |
|||
if (columnIndex == 0) { |
|||
return 'success-cols' |
|||
} |
|||
} |
|||
|
|||
const exportElecTotal = async () => { |
|||
const res = await TjanalysisApi.exportEnergyConsumption(queryParams) |
|||
if (res != null) { |
|||
let url = window.URL.createObjectURL(new Blob([res])); |
|||
let link = document.createElement("a"); |
|||
link.style.display = "none"; |
|||
link.href = url; |
|||
link.setAttribute("download", "能耗日统计.xlsx"); |
|||
document.body.appendChild(link); |
|||
link.click(); |
|||
} |
|||
} |
|||
|
|||
/** 初始化 **/ |
|||
onMounted(async () => { |
|||
// 获取当前日期 |
|||
let today = new Date(); |
|||
// 计算昨天的日期 |
|||
today.setDate(today.getDate() - 1); |
|||
// 格式化日期为 "yyyy-MM-dd" |
|||
let year = today.getFullYear(); |
|||
let month = String(today.getMonth() + 1).padStart(2, '0'); // 月份从0开始,所以需要+1,并确保是两位数 |
|||
let date = String(today.getDate()).padStart(2, '0'); // 确保日期是两位数 |
|||
let yesterdayAsString = `${year}-${month}-${date}`; |
|||
console.log(yesterdayAsString); |
|||
queryParams.dateRange=[yesterdayAsString,yesterdayAsString] |
|||
const res =await DictApi.getStrDictOptions(DICT_TYPE.ENERGY_CONSUMPTION_TYPE); |
|||
if (res != null && res.length>0) { |
|||
flagList.value = res |
|||
queryParams.flag= flagList.value[0].value; |
|||
queryParams.iname= flagList.value[0].label; |
|||
const ll = flagList.value.find(map=>map.value == queryParams.flag); |
|||
names.value = ll?.label |
|||
} |
|||
getList() |
|||
}) |
|||
|
|||
</script> |
|||
|
|||
<style> |
|||
.el-table .success-row { |
|||
background: #f0f9eb; |
|||
} |
|||
|
|||
.el-table .success-cols { |
|||
font-weight: bold; |
|||
} |
|||
</style> |
|||
|
@ -0,0 +1,173 @@ |
|||
<template> |
|||
<ContentWrap> |
|||
<!-- 一次主表统计搜索工作栏 --> |
|||
<el-form :model="queryParams" ref="queryForm" :inline="true"> |
|||
<el-form-item label="日期" prop="dateRange"> |
|||
<el-date-picker |
|||
v-model="queryParams.dateRange" |
|||
style="width: 240px; height: 30px" |
|||
value-format="YYYY-MM-DD" |
|||
end-placeholder="结束日期" |
|||
start-placeholder="开始日期" |
|||
type="daterange" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item label="仪表的描述总用电表" prop="mcode"> |
|||
<el-select v-model="queryParams.flag" placeholder="请选择"> |
|||
<el-option |
|||
v-for="item in typeList" |
|||
:key="item.flag" |
|||
:label="item.mname" |
|||
:value="item.flag" /> |
|||
</el-select> |
|||
</el-form-item> |
|||
<el-form-item> |
|||
<el-button type="primary" size="mini" @click="handleQuery">搜索</el-button> |
|||
<el-button size="mini" @click="resetQuery">重置</el-button> |
|||
<el-button type="success" @click="exportElecTotal" size="mini">导出</el-button> |
|||
</el-form-item> |
|||
</el-form> |
|||
</ContentWrap> |
|||
|
|||
<!-- 列表 --> |
|||
<ContentWrap> |
|||
<el-table |
|||
v-loading="loading" :data="dataList.dList" border="true" > |
|||
highlight-current-row="无功" prop="wugong" align="center" :show-overflow-tooltip="true" /> |
|||
<el-table-column label="无功" prop="wugong" align="center" :show-overflow-tooltip="true" /> |
|||
<el-table-column label="总" prop="idescTotal" align="center" :show-overflow-tooltip="true" /> |
|||
<el-table-column label="峰" prop="idescF" align="center" :show-overflow-tooltip="true" /> |
|||
<el-table-column label="谷" prop="idescG" align="center" :show-overflow-tooltip="true" /> |
|||
<el-table-column label="平" prop="idescP" align="center" :show-overflow-tooltip="true" /> |
|||
<el-table-column label="尖峰" prop="idescPt" align="center" :show-overflow-tooltip="true" /> |
|||
<el-table-column label="功率因数" prop="gy" align="center" :show-overflow-tooltip="true" /> |
|||
</el-table> |
|||
</ContentWrap> |
|||
|
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import * as TjanalysisApi from '@/api/tjanalysis' |
|||
import { formatDate } from '@/utils/formatTime' |
|||
|
|||
defineOptions({ name: 'PlatscaleAnalysis' }) |
|||
|
|||
const message = useMessage() // 消息弹窗 |
|||
const { t } = useI18n() // 国际化 |
|||
|
|||
const route = useRoute() // 路由信息 |
|||
const routeName = ref() |
|||
routeName.value = route.name |
|||
const loading = ref(true) |
|||
const dataList = reactive({dList: [] , total: 0}) |
|||
|
|||
const queryParams = reactive({ |
|||
dateRange: [], |
|||
flag:'0', |
|||
iname:'' |
|||
}) |
|||
|
|||
const typeList= ref([{"flag":"0","mname":"主变1号"},{"flag":"1","mname":"主变2号"}]); |
|||
|
|||
const handleQuery = async () => { |
|||
getList() |
|||
} |
|||
|
|||
const resetQuery = async () => { |
|||
// 获取当前日期 |
|||
let today = new Date(); |
|||
|
|||
// 计算昨天的日期 |
|||
today.setDate(today.getDate() - 1); |
|||
|
|||
// 格式化日期为 "yyyy-MM-dd" |
|||
let year = today.getFullYear(); |
|||
let month = String(today.getMonth() + 1).padStart(2, '0'); // 月份从0开始,所以需要+1,并确保是两位数 |
|||
let date = String(today.getDate()).padStart(2, '0'); // 确保日期是两位数 |
|||
|
|||
let yesterdayAsString = `${year}-${month}-${date}`; |
|||
|
|||
console.log(yesterdayAsString); |
|||
|
|||
|
|||
queryParams.dateRange=[yesterdayAsString,yesterdayAsString] |
|||
getList() |
|||
} |
|||
|
|||
const getList = async () => { |
|||
const ll = typeList.value.find(map=>map.flag == queryParams.flag); |
|||
queryParams.iname = ll?.mname |
|||
const res = await TjanalysisApi.queryIrealdataTimeTj(queryParams) |
|||
console.log(res) |
|||
if (res != null && res.dataList != null) { |
|||
dataList.dList = res.dataList |
|||
} |
|||
loading.value = false |
|||
} |
|||
|
|||
const exportElecTotal = async () => { |
|||
const res = await TjanalysisApi.exportIrealdataTimeTj(queryParams) |
|||
if (res != null) { |
|||
let url = window.URL.createObjectURL(new Blob([res])); |
|||
let link = document.createElement("a"); |
|||
link.style.display = "none"; |
|||
link.href = url; |
|||
link.setAttribute("download", "一次主表统计数据.xlsx"); |
|||
document.body.appendChild(link); |
|||
link.click(); |
|||
} |
|||
} |
|||
|
|||
function getSummaries(param) { |
|||
const { columns, data } = param; |
|||
const sums = []; |
|||
columns.forEach((column, index) => { |
|||
// console.log(column) |
|||
if (index === 0) { |
|||
sums[index] = '总'; |
|||
// return; |
|||
} |
|||
|
|||
const values = data.map(item => Number(item[column.property])); |
|||
if (!values.every(value => isNaN(value))) { |
|||
sums[index] = values.reduce((prev, curr) => { |
|||
const value = Number(curr); |
|||
if (!isNaN(value)) { |
|||
return prev + curr; |
|||
} else { |
|||
return prev; |
|||
} |
|||
}, 0); |
|||
// sums[index] += ' 元'; |
|||
} else { |
|||
// sums[index] = 'N/A'; |
|||
} |
|||
}); |
|||
|
|||
return sums; |
|||
} |
|||
|
|||
/** 初始化 **/ |
|||
onMounted(async () => { |
|||
// 获取当前日期 |
|||
let today = new Date(); |
|||
|
|||
// 计算昨天的日期 |
|||
today.setDate(today.getDate() - 1); |
|||
|
|||
// 格式化日期为 "yyyy-MM-dd" |
|||
let year = today.getFullYear(); |
|||
let month = String(today.getMonth() + 1).padStart(2, '0'); // 月份从0开始,所以需要+1,并确保是两位数 |
|||
let date = String(today.getDate()).padStart(2, '0'); // 确保日期是两位数 |
|||
|
|||
let yesterdayAsString = `${year}-${month}-${date}`; |
|||
|
|||
console.log(yesterdayAsString); |
|||
|
|||
|
|||
queryParams.dateRange=[yesterdayAsString,yesterdayAsString] |
|||
getList() |
|||
}) |
|||
|
|||
</script> |
|||
|
Loading…
Reference in new issue