From 3aedad63dd01f1fc5154cb520af32edab967d6e0 Mon Sep 17 00:00:00 2001
From: schangxiang@126.com <schangxiang@126.com>
Date: 周一, 12 5月 2025 09:15:26 +0800
Subject: [PATCH] Merge branch 'master' of http://222.71.245.114:9086/r/HIA24016N_PipeLineDemo
---
PipeLineLems/pipelinelems_web/src/widgets/OrderManagement-main/views/order-records/index.vue | 413 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 413 insertions(+), 0 deletions(-)
diff --git a/PipeLineLems/pipelinelems_web/src/widgets/OrderManagement-main/views/order-records/index.vue b/PipeLineLems/pipelinelems_web/src/widgets/OrderManagement-main/views/order-records/index.vue
new file mode 100644
index 0000000..53a9c11
--- /dev/null
+++ b/PipeLineLems/pipelinelems_web/src/widgets/OrderManagement-main/views/order-records/index.vue
@@ -0,0 +1,413 @@
+<template>
+ <div class="container">
+ <div class="head">
+ <div class="head-left">
+ <el-date-picker
+ v-model="timeValue"
+ type="daterange"
+ range-separator="-"
+ :start-placeholder="_t('寮�濮嬫椂闂�')"
+ :end-placeholder="_t('缁撴潫鏃堕棿')"
+ value-format="YYYY-MM-DD HH:mm:ss"
+ :default-time="[
+ new Date(2000, 1, 1, 0, 0, 0),
+ new Date(2000, 2, 1, 23, 59, 59),
+ ]"
+ @change="initTableData"
+ class="fix-input-style fix-datetime-picker"
+ popper-class="light-datetime-picker"
+ :style="{ marginRight: '5px' }"
+ />
+ <IconButton icon="export" :onClick="onExport">
+ {{ _t('瀵煎嚭') }}
+ </IconButton>
+ </div>
+ <div class="head-right">
+ <Search
+ v-model="searchValue"
+ @Confirm="initTableData"
+ :style="{ marginLeft: '5px' }"
+ />
+ </div>
+ </div>
+ <!-- -->
+ <!-- url="/api/v1/ordermanagement/order"
+ :params="{
+ Filter: '',
+ StartTime: head(backtrackingCondition.timeValue),
+ FinishTime: last(backtrackingCondition.timeValue),
+ Status: FIXED_STATUS, // 鍥哄畾浼�5 涓哄伐鍗曡褰�->4
+ Sorting: '',
+ }" -->
+ <BaseTable
+ v-model:dataSource="tableData"
+ v-model:total="paginationConfig.total"
+ @page="onPage"
+ :pageSize="paginationConfig.pageSize"
+ id="id_key"
+ :isSeq="true"
+ :columns="tableHead"
+ >
+ <template #formulaName="{ row }">
+ {{ row.formula.name }}
+ </template>
+
+ <template #productModel="{ row }">
+ {{ row.product.model }}
+ </template>
+
+ <template #statusDescription="{ row }">
+ {{ row.status.description }}
+ </template>
+ <template #segments="{ row }">
+ <Text :truncated="true" :title="currentSegment(row)">{{
+ currentSegment(row)
+ }}</Text>
+ </template>
+ </BaseTable>
+ </div>
+</template>
+
+<script lang="ts">
+import {
+ defineComponent,
+ ref,
+ reactive,
+ onActivated,
+ onMounted,
+ watch,
+ computed,
+} from 'vue'
+import { head, last, get, cloneDeep } from 'lodash'
+import dayjs from 'dayjs'
+import sdk from 'sdk'
+import api from '../../api/product-setting'
+import { ElMessageBox, ElMessage } from 'element-plus'
+import type { IProductTableItem } from '../../api/product'
+import Pagination from '../../components/pagination/index.vue'
+import IconButton from '@/components/IconButton/IconButton'
+import Search from '@/components/Search/Search'
+import { createInjector } from '../../hooks/use-permission'
+import Text from '@/components/Text/Text'
+import { _t } from '../../app'
+//import { downloadFile } from '@/utils/client'
+const FIXED_STATUS = '4'
+import BaseTable from '@/components/Table/Table'
+
+export default defineComponent({
+ name: 'OrderRecords',
+ components: {
+ Pagination,
+ BaseTable,
+ IconButton,
+ Search,
+ Text,
+ },
+ setup(props) {
+ const { curTab } = createInjector()
+ watch(curTab, (val: any) => {
+ if (val == 'OrderRecords') {
+ init()
+ }
+ })
+
+ const searchValue = ref('')
+ const timeValue = ref([
+ dayjs().subtract(7, 'day').startOf('day').format('YYYY-MM-DD 00:00:00'),
+ dayjs().startOf('day').format('YYYY-MM-DD 23:59:59'),
+ ])
+ const MaxResultCount = 20
+ // 淇濈暀initTableData 璇锋眰鏃剁殑鍙傛暟
+ const backtrackingCondition = ref({
+ timeValue: [],
+ SkipCount: '',
+ MaxResultCount,
+ })
+ const tableData = ref<IProductTableItem[]>([])
+ const tableSelectList = ref<IProductTableItem[]>([])
+ const tableHead = computed(() => [
+ {
+ field: 'seq',
+ title: _t('搴忓彿'),
+ type: 'seq',
+ },
+ {
+ field: 'code',
+ title: _t('宸ュ崟鍙�'),
+ },
+ {
+ field: 'source',
+ title: _t('宸ュ崟鏉ユ簮'),
+ },
+ {
+ field: 'planStartTime',
+ title: _t('璁″垝寮�濮嬫椂闂�'),
+ },
+ {
+ field: 'planFinishTime',
+ title: _t('璁″垝缁撴潫鏃堕棿'),
+ },
+ {
+ field: 'productModel',
+ title: _t('浜у搧鍨嬪彿'),
+ },
+ {
+ field: 'formulaName',
+ title: _t('宸ヨ壓閰嶆柟'),
+ },
+ {
+ field: 'segments',
+ title: _t('浜х嚎娈�'),
+ },
+ {
+ field: 'planQty',
+ title: _t('璁″垝鏁伴噺'),
+ },
+ {
+ field: 'produceQty',
+ title: _t('鎶曚骇鏁伴噺'),
+ },
+ {
+ field: 'qualifiedQty',
+ title: _t('鍚堟牸鏁�'),
+ },
+ {
+ field: 'shift',
+ title: _t('鐝'),
+ },
+ {
+ field: 'startTime',
+ title: _t('瀹為檯寮�濮嬫椂闂�'),
+ },
+ {
+ field: 'finishTime',
+ title: _t('瀹為檯缁撴潫鏃堕棿'),
+ },
+ {
+ field: 'statusDescription',
+ title: _t('宸ュ崟鐘舵��'),
+ },
+ {
+ field: 'finishReason',
+ title: _t('璁㈠崟缁撴潫鍘熷洜'),
+ },
+ ])
+ // 鍒嗛〉閰嶇疆
+ const paginationConfig = reactive<{
+ pageSize: number
+ currentPage: number
+ total: number
+ }>({
+ pageSize: MaxResultCount, // X鏉�/椤�
+ currentPage: 1, // 褰撳墠绗琗椤�
+ total: 0, // 鎬诲叡X椤�
+ })
+ const currentSegment = computed(() => {
+ return (row: Record<string, any>) => {
+ const text = row?.segments
+ ?.map((v: { segmentName: string; segmentId: string }) => {
+ return v.segmentName
+ })
+ .join(',')
+ return text
+ }
+ })
+ const handleSelectionChange = (val: IProductTableItem[]) => {
+ tableSelectList.value = val
+ }
+
+ const onExport = async () => {
+ // if (!isHasPermission('OrderRecords-actions-export')) {
+ // return
+ // }
+
+ const StartTime =
+ head(backtrackingCondition.value.timeValue) || timeValue.value[0]
+ const FinishTime =
+ last(backtrackingCondition.value.timeValue) || timeValue.value[1]
+ const params = {
+ Filter: '',
+ StartTime,
+ FinishTime,
+ Status: FIXED_STATUS, // 鍥哄畾浼�5 涓哄伐鍗曡褰�->4
+ Sorting: '',
+ SkipCount: backtrackingCondition.value.SkipCount,
+ MaxResultCount: backtrackingCondition.value.MaxResultCount,
+ }
+
+ // const result = await api.exportOrder(params)
+ // console.log(result, 'result >>>')
+
+ // downloadFile(
+ // result,
+ // `${_t('宸ュ崟璁板綍')}${
+ // '' +
+ // new Date().getFullYear() +
+ // Number(new Date().getMonth() + 1) +
+ // new Date().getDate() +
+ // new Date().getTime()
+ // }.xlsx`
+ // )
+
+ await downloadFile({
+ fileUrl: '/api/v1/ordermanagement/order/export',
+ fileName: `${_t('宸ュ崟璁板綍')}${
+ '' +
+ new Date().getFullYear() +
+ Number(new Date().getMonth() + 1) +
+ new Date().getDate() +
+ new Date().getTime()
+ }.xlsx`,
+ params,
+ })
+ }
+
+ const onPage = async (current: number) => {
+ paginationConfig.currentPage = current
+
+ const StartTime = head(backtrackingCondition.value.timeValue)
+ const FinishTime = last(backtrackingCondition.value.timeValue)
+ const params = {
+ Filter: '',
+ StartTime,
+ FinishTime,
+ Status: FIXED_STATUS, // 鍥哄畾浼�5 涓哄伐鍗曡褰�->4
+ Sorting: '',
+ SkipCount: (current - 1) * paginationConfig.pageSize,
+ MaxResultCount: backtrackingCondition.value.MaxResultCount,
+ }
+
+ const result = await api.getTable(params)
+ tableData.value = get(result, 'items', [])
+
+ paginationConfig.total = get(result, 'totalCount', 0)
+ }
+ async function initTableData() {
+ const StartTime = head(timeValue.value)
+ const FinishTime = last(timeValue.value)
+
+ const params = {
+ Filter: searchValue.value,
+ StartTime,
+ FinishTime,
+ Status: FIXED_STATUS, // 鍥哄畾浼�5 涓哄伐鍗曡褰�->4
+ Sorting: '',
+ SkipCount:
+ (paginationConfig.currentPage - 1) * paginationConfig.pageSize,
+ MaxResultCount: paginationConfig.pageSize + '',
+ }
+ // console.log(params, paginationConfig.currentPage, current, 'params')
+
+ const result = await api.getTable(params)
+ tableData.value = get(result, 'items', [])
+ paginationConfig.total = get(result, 'totalCount', 0)
+
+ backtrackingCondition.value = {
+ // @ts-ignore
+ timeValue: cloneDeep(timeValue.value),
+ SkipCount:
+ (paginationConfig.currentPage - 1) * paginationConfig.pageSize + '',
+ MaxResultCount: paginationConfig.pageSize + '',
+ }
+ }
+ function init() {
+ initTableData()
+ }
+
+ // @ts-ignore
+ // function downloadFile(file, fileName) {
+ // const blob = new Blob([file])
+ // // 鍏煎涓嶅悓娴忚鍣ㄧ殑URL瀵硅薄
+ // // const url:any = window.URL || window.webkitURL || window.moxURL
+ // const url = window.URL || window.webkitURL
+ // // 鍒涘缓涓嬭浇閾炬帴
+ // const downloadHref = url.createObjectURL(blob)
+ // // 鍒涘缓a鏍囩骞朵负鍏舵坊鍔犲睘鎬�
+ // let downloadLink = document.createElement('a')
+ // downloadLink.href = downloadHref
+ // downloadLink.download = fileName
+ // // 瑙﹀彂鐐瑰嚮浜嬩欢鎵ц涓嬭浇
+ // downloadLink.click()
+ // // @ts-ignore
+ // window.URL.revokeObjectURL(url)
+ // }
+ 聽 // @ts-ignore
+聽 聽 function downloadFile(file, fileName) {
+聽 聽 聽 const blob = new Blob([file])
+聽 聽 聽 // 鍏煎涓嶅悓娴忚鍣ㄧ殑URL瀵硅薄
+聽 聽 聽 // const url:any = window.URL || window.webkitURL || window.moxURL
+聽 聽 聽 const url = window.URL || window.webkitURL
+聽 聽 聽 // 鍒涘缓涓嬭浇閾炬帴
+聽 聽 聽 const downloadHref = url.createObjectURL(blob)
+聽 聽 聽 // 鍒涘缓a鏍囩骞朵负鍏舵坊鍔犲睘鎬�
+聽 聽 聽 let downloadLink = document.createElement('a')
+聽 聽 聽 downloadLink.href = downloadHref
+聽 聽 聽 downloadLink.download = fileName
+聽 聽 聽 // 瑙﹀彂鐐瑰嚮浜嬩欢鎵ц涓嬭浇
+聽 聽 聽 downloadLink.click()
+聽 聽 聽 // @ts-ignore
+聽 聽 聽 window.URL.revokeObjectURL(url)
+聽 聽 }
+
+ init()
+ return {
+ timeValue,
+ tableHead,
+ tableData,
+ paginationConfig,
+ searchValue,
+ FIXED_STATUS,
+ backtrackingCondition,
+ _t,
+ currentSegment,
+ initTableData,
+ onExport,
+ handleSelectionChange,
+ onPage,
+ head,
+ last,
+ }
+ },
+})
+</script>
+
+<style lang="scss" scoped>
+@import url('../../styles/common.scss');
+@import '../../styles/datePicker.scss';
+
+.container {
+ height: calc(100% - 80px);
+}
+
+.head {
+ background-color: #f3f3f3;
+ padding: 8px 10px;
+ border-radius: 5px;
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+
+ &-left {
+ display: flex;
+ align-items: center;
+ }
+
+ &-right {
+ display: flex;
+ align-items: center;
+ justify-content: flex-end;
+ }
+
+ :deep(.cs-input__wrapper) {
+ height: 32px;
+ }
+}
+
+.mt-12 {
+ margin-top: 12px;
+}
+</style>
+
+<style lang="scss" scoped>
+@import url('../../styles/common.scss');
+</style>
--
Gitblit v1.9.3