<template>
|
<!-- 搜索 -->
|
<ContentWrap>
|
<el-form
|
class="-mb-15px"
|
:model="queryParams"
|
ref="queryFormRef"
|
:inline="true"
|
label-width="68px"
|
>
|
<el-form-item label="开始时间">
|
<el-date-picker
|
size="mini"
|
v-model="queryParams.startTime"
|
format="YYYY-MM-DD HH:mm:00"
|
value-format="YYYY-MM-DD HH:mm:00"
|
type="datetime"
|
:clearable="false"
|
placeholder="选择日期时间"/>
|
</el-form-item>
|
<el-form-item label="结束时间">
|
<el-date-picker
|
size="mini"
|
v-model="queryParams.endTime"
|
format="YYYY-MM-DD HH:mm:00"
|
value-format="YYYY-MM-DD HH:mm:00"
|
type="datetime"
|
:clearable="false"
|
placeholder="选择日期时间"/>
|
</el-form-item>
|
<el-form-item label="库存煤种" prop="kcmz">
|
<el-select
|
v-model="queryParams.kcmz"
|
class="!w-240px"
|
clearable
|
placeholder="请选择库存煤种"
|
>
|
<el-option
|
v-for="dict in getIntDictOptions(DICT_TYPE.PMS_KCMZ)"
|
:key="dict.value"
|
:label="dict.label"
|
:value="dict.value"
|
/>
|
</el-select>
|
</el-form-item>
|
<el-form-item>
|
<el-button @click="handleQuery">
|
<Icon icon="ep:search" class="mr-5px" />
|
搜索
|
</el-button>
|
<el-button @click="resetQuery">
|
<Icon icon="ep:refresh" class="mr-5px" />
|
重置
|
</el-button>
|
<el-button
|
type="primary"
|
plain
|
@click="openForm('create')"
|
v-hasPermi="['data:point:create']"
|
>
|
<Icon icon="ep:plus" class="mr-5px" />
|
新增
|
</el-button>
|
<el-button
|
type="warning"
|
plain
|
@click="handleImport"
|
v-hasPermi="['data:point:import']"
|
>
|
<Icon icon="ep:upload" /> 导入
|
</el-button>
|
<el-button
|
type="success"
|
plain
|
@click="handleExport"
|
:loading="exportLoading"
|
v-hasPermi="['data:point:export']"
|
>
|
<Icon icon="ep:download" />导出
|
</el-button>
|
</el-form-item>
|
<el-form-item>
|
<el-button v-if="!updateKcView" @click="updateKc">调整仓存
|
</el-button>
|
</el-form-item>
|
<el-form-item>
|
<el-button v-if="updateKcView" @click="commitUpdateKc">确认修改
|
</el-button>
|
</el-form-item>
|
</el-form>
|
</ContentWrap>
|
|
<!-- 列表 -->
|
<ContentWrap>
|
<el-table border stripe v-loading="loading" :data="list">
|
<el-table-column type="index" header-align="center" align="center" min-width="50" label="序号"/>
|
<el-table-column prop="lsh" header-align="center" align="center" label="流水号" min-width="200"/>
|
<el-table-column prop="rq" header-align="center" align="center" label="日期" min-width="200"/>
|
<el-table-column prop="kcmzName" header-align="center" align="center" label="原煤" min-width="300"/>
|
<el-table-column prop="nbjrkc" header-align="center" align="center" label="估算库存(t)" min-width="200">
|
<template #default="scope">
|
<el-input-number v-model="scope.row.nbjrkc" :disabled="!updateKcView" :precision="2" :step="0.1"/>
|
</template>
|
</el-table-column>
|
<el-table-column show-overflow-tooltip prop="bz" header-align="center" align="center" label="备注" min-width="400"/>
|
</el-table>
|
<!-- 分页 -->
|
<Pagination
|
:total="total"
|
v-model:page="queryParams.pageNo"
|
v-model:limit="queryParams.pageSize"
|
@pagination="getList"
|
/>
|
</ContentWrap>
|
<!--电耗明细-->
|
<Form ref="formRef"/>
|
</template>
|
<script lang="ts" setup>
|
import * as ProductStock from '@/api/prod/productStock'
|
import {ref} from "vue";
|
import download from "@/utils/download";
|
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
|
import det from './form.vue'
|
|
defineOptions({name: 'ProductStock'})
|
|
const message = useMessage() // 消息弹窗
|
const {t} = useI18n() // 国际化
|
|
const loading = ref(true) // 列表的加载中
|
const total = ref(0) // 列表的总页数
|
const list = ref([]) // 列表的数据
|
const queryParams = reactive({
|
pageNo: 1,
|
pageSize: 10,
|
startDate: undefined,
|
endDate: undefined,
|
xt: undefined
|
})
|
const queryFormRef = ref() // 搜索的表单
|
const updateKcView= ref(false)
|
|
const updateKc = () => {
|
updateKcView.value = true;
|
}
|
|
const commitUpdateKc = () => {
|
this.$http.post('/iailab-iems-coal-proddisp/warehouse/stock/update', this.dataList).then(({ data: res }) => {
|
if (res.code==null || res.code !== 0) {
|
return this.$message.error(res.msg)
|
}
|
this.$message({
|
message: this.$t('prompt.success'),
|
type: 'success',
|
duration: 500,
|
})
|
this.updateKcView = false;
|
this.getDataList();
|
}).catch(() => {})
|
}
|
|
/** 查询列表 */
|
const getList = async () => {
|
loading.value = true
|
try {
|
const page = await ProductStock.getProductStockPage(queryParams)
|
list.value = page.list
|
total.value = page.total
|
} finally {
|
loading.value = false
|
}
|
}
|
|
/** 搜索按钮操作 */
|
const handleQuery = () => {
|
queryParams.pageNo = 1
|
getList()
|
}
|
|
/** 查看数据操作 */
|
const chartView = ref()
|
const chartHandle = (raw: object) => {
|
chartView.value.open(raw)
|
}
|
|
/** 重置按钮操作 */
|
const resetQuery = () => {
|
queryFormRef.value.resetFields()
|
handleQuery()
|
}
|
|
/** 添加/修改操作 */
|
const formRef = ref()
|
const openForm = (type: string, id?: number) => {
|
formRef.value.open(type, id)
|
}
|
|
/** 删除按钮操作 */
|
const handleDelete = async (id: number) => {
|
try {
|
// 删除的二次确认
|
await message.delConfirm()
|
// 发起删除
|
await ProductStock.deleteProductStock(id)
|
message.success(t('common.delSuccess'))
|
// 刷新列表
|
await getList()
|
} catch {
|
}
|
}
|
/** 测点导入 */
|
const importFormRef = ref()
|
const handleImport = () => {
|
importFormRef.value.open()
|
}
|
|
/** 导出按钮操作 */
|
const exportLoading = ref(false)
|
const handleExport = async () => {
|
try {
|
// 导出的二次确认
|
await message.exportConfirm()
|
// 发起导出
|
exportLoading.value = true
|
const data = await ProductStock.exportProductStock(queryParams)
|
download.excel(data, '测点列表.xlsx')
|
} catch {
|
} finally {
|
exportLoading.value = false
|
}
|
}
|
/** 初始化 **/
|
onMounted(async () => {
|
await getList()
|
})
|
</script>
|