|  |  | 
 |  |  | <script setup>
 | 
 |  |  | import { getCurrentInstance, ref, computed, reactive, defineProps } from 'vue';
 | 
 |  |  | import { getCurrentInstance, ref, computed, reactive, defineProps, nextTick } from 'vue';
 | 
 |  |  | import { useRouter } from "vue-router";
 | 
 |  |  | import { get, post, postBlob, postForm } from '@/utils/request.js'
 | 
 |  |  | import { message, Modal } from 'ant-design-vue';
 | 
 |  |  | 
 |  |  | import { formatMessage } from '@/utils/localeUtils.js';
 | 
 |  |  | import useTableSearch from '@/utils/tableUtils.jsx';
 | 
 |  |  | import ShowOrderDetlComponent from '@/components/orderDetl/show.vue';
 | 
 |  |  | import OrderPrint from '@/components/print/orderPrint/index.vue'
 | 
 |  |  | import {
 | 
 |  |  |   DownOutlined,
 | 
 |  |  |   UploadOutlined,
 | 
 |  |  |   DownloadOutlined,
 | 
 |  |  | } from "@ant-design/icons-vue";
 | 
 |  |  | import { filters } from 'pixi.js';
 | 
 |  |  | const context = getCurrentInstance()?.appContext.config.globalProperties;
 | 
 |  |  | 
 | 
 |  |  | const router = useRouter();
 | 
 |  |  | 
 | 
 |  |  | const orderBy = ref({});
 | 
 |  |  | const order = ref("")
 | 
 |  |  | const props = defineProps({
 | 
 |  |  |   ioModel: null
 | 
 |  |  | })
 | 
 |  |  | 
 |  |  |   {
 | 
 |  |  |     title: formatMessage('db.man_order.order_no', '订单编号'),
 | 
 |  |  |     dataIndex: 'orderNo',
 | 
 |  |  |     width: 200,
 | 
 |  |  |     width: 230,
 | 
 |  |  |     ellipsis: true,
 | 
 |  |  |     ...getColumnSearchProps('orderNo'),
 | 
 |  |  |   },
 | 
 |  |  |   {
 | 
 |  |  |     title: formatMessage('db.man_order.order_time', '单据日期'),
 | 
 |  |  |     dataIndex: 'orderTime',
 | 
 |  |  |     width: 160,
 | 
 |  |  |     width: 180,
 | 
 |  |  |     ellipsis: true,
 | 
 |  |  |     sorter: true,
 | 
 |  |  |     ...getColumnSearchProps('orderTime'),
 | 
 |  |  |   },
 | 
 |  |  |   {
 | 
 |  |  | 
 |  |  |   {
 | 
 |  |  |     title: formatMessage('db.man_order.create_time', '添加时间'),
 | 
 |  |  |     dataIndex: 'createTime$',
 | 
 |  |  |     width: 140,
 | 
 |  |  |     width: 180,
 | 
 |  |  |     ellipsis: true,
 | 
 |  |  |     ...getColumnSearchProps('createTime$'),
 | 
 |  |  |   },
 | 
 |  |  | 
 |  |  |   {
 | 
 |  |  |     title: formatMessage('db.man_order.update_time', '修改时间'),
 | 
 |  |  |     dataIndex: 'updateTime$',
 | 
 |  |  |     width: 140,
 | 
 |  |  |     width: 180,
 | 
 |  |  |     ellipsis: true,
 | 
 |  |  |     ...getColumnSearchProps('updateTime$'),
 | 
 |  |  |   },
 | 
 |  |  | 
 |  |  |     state.selectedRowKeys = [];
 | 
 |  |  |   }, 1000);
 | 
 |  |  | };
 | 
 |  |  | 
 | 
 |  |  | const onSelectChange = selectedRowKeys => {
 | 
 |  |  |   // console.log('selectedRowKeys changed: ', selectedRowKeys);
 | 
 |  |  |   state.selectedRowKeys = selectedRowKeys;
 | 
 |  |  | };
 | 
 |  |  | 
 | 
 |  |  | const handleTableChange = (pagination, filters, sorter) => {
 | 
 |  |  |   if (sorter != null) {
 | 
 |  |  |     if (sorter?.order == "ascend") {
 | 
 |  |  |       orderBy.__v_raw = { order: "asc", field: sorter.field }
 | 
 |  |  |     } else if (sorter?.order == "descend") {
 | 
 |  |  |       orderBy.__v_raw = { order: "desc", field: sorter.field }
 | 
 |  |  |     }
 | 
 |  |  |   }
 | 
 |  |  | 
 | 
 |  |  |   getPage()
 | 
 |  |  | }
 | 
 |  |  | 
 | 
 |  |  | function getPage() {
 | 
 |  |  |   state.loading = true;
 | 
 |  |  | 
 | 
 |  |  |   let apiUrl = '/api/order/page';
 | 
 |  |  |   if (props.ioModel == 'in') {
 | 
 |  |  |     apiUrl = '/api/order/in/page';
 | 
 |  |  | 
 |  |  |   }
 | 
 |  |  | 
 | 
 |  |  |   post(apiUrl, {
 | 
 |  |  |     orderBy: orderBy?.__v_raw,
 | 
 |  |  |     current: currentPage,
 | 
 |  |  |     pageSize: pageSize,
 | 
 |  |  |     condition: searchInput.value,
 | 
 |  |  | 
 |  |  | const showDetl = (item) => {
 | 
 |  |  |   showOrderDetlChild.value.openDetl = true;
 | 
 |  |  |   showOrderDetlChild.value.orderId = item.id;
 | 
 |  |  |   showOrderDetlChild.value.inModel = 'in';
 | 
 |  |  | }
 | 
 |  |  | 
 | 
 |  |  | const printChild = ref(null);
 | 
 |  |  | // 打印订单
 | 
 |  |  | const handlePrint = async (record) => {
 | 
 |  |  |   let printData = [];
 | 
 |  |  | 
 | 
 |  |  |   const resp = await get("/api/orderDetl/orderId/" + record.__v_raw.id, {});
 | 
 |  |  |   let result = resp.data;
 | 
 |  |  | 
 | 
 |  |  |   result.data.forEach((item) => {
 | 
 |  |  |     let newItem = {};
 | 
 |  |  |     newItem.matnr = item.mat$.matnr
 | 
 |  |  |     newItem.maktx = item.mat$.maktx
 | 
 |  |  |     newItem.specs = item.mat$.specs
 | 
 |  |  |     newItem.batch = item.batch
 | 
 |  |  |     newItem.anfme = item.anfme
 | 
 |  |  |     printData.push(newItem)
 | 
 |  |  |   })
 | 
 |  |  |   printChild.value.printData = printData;
 | 
 |  |  |   printChild.value.orderNo = record.__v_raw.orderNo
 | 
 |  |  |   printChild.value.open = true;
 | 
 |  |  |   printChild.value.inModel = "in";
 | 
 |  |  | }
 | 
 |  |  | 
 | 
 |  |  | const handleExport = async (intl) => {
 | 
 |  |  | 
 |  |  | };
 | 
 |  |  | 
 | 
 |  |  | const onSearch = () => {
 | 
 |  |  |   // console.log('search');
 | 
 |  |  |   currentPage = 1;
 | 
 |  |  | 
 | 
 |  |  |   getPage()
 | 
 |  |  | }
 | 
 |  |  | 
 | 
 |  |  | 
 |  |  |       <div>
 | 
 |  |  |         <a-input v-model:value="searchParam.orderNo" :placeholder="formatMessage('page.order.orderNo.input', '请输入订单编号')"
 | 
 |  |  |           style="width: 140px;margin-right: 10px;" />
 | 
 |  |  |         <a-select v-model:value="searchParam.orderSettle" :placeholder="formatMessage('page.order.orderSettle.select', '请选择单据状态')"
 | 
 |  |  |           style="width: 140px;margin-right: 10px;" show-search allowClear :options="orderSettleQueryList" optionFilterProp="label"
 | 
 |  |  |           optionLabelProp="label">
 | 
 |  |  |         <a-select v-model:value="searchParam.orderSettle"
 | 
 |  |  |           :placeholder="formatMessage('page.order.orderSettle.select', '请选择单据状态')"
 | 
 |  |  |           style="width: 140px;margin-right: 10px;" show-search allowClear :options="orderSettleQueryList"
 | 
 |  |  |           optionFilterProp="label" optionLabelProp="label">
 | 
 |  |  |         </a-select>
 | 
 |  |  |         <a-select v-model:value="searchParam.orderType" :placeholder="formatMessage('page.order.orderType.select', '请选择单据类型')"
 | 
 |  |  |           style="width: 140px;margin-right: 10px;" show-search allowClear :options="orderTypeQueryList" optionFilterProp="label"
 | 
 |  |  |           optionLabelProp="label">
 | 
 |  |  |         <a-select v-model:value="searchParam.orderType"
 | 
 |  |  |           :placeholder="formatMessage('page.order.orderType.select', '请选择单据类型')"
 | 
 |  |  |           style="width: 140px;margin-right: 10px;" show-search allowClear :options="orderTypeQueryList"
 | 
 |  |  |           optionFilterProp="label" optionLabelProp="label">
 | 
 |  |  |         </a-select>
 | 
 |  |  | 
 | 
 |  |  |         <a-input-search v-model:value="searchInput" :placeholder="formatMessage('page.input', '请输入')"
 | 
 |  |  | 
 |  |  |     </div>
 | 
 |  |  |     <a-table :row-selection="{ selectedRowKeys: state.selectedRowKeys, onChange: onSelectChange }"
 | 
 |  |  |       :data-source="tableData.records" :defaultExpandAllRows="false" :key="TABLE_KEY" rowKey="id"
 | 
 |  |  |       :pagination="{ total: tableData.total, onChange: onPageChange }"
 | 
 |  |  |       @change="handleTableChange" :pagination="{ total: tableData.total, onChange: onPageChange }"
 | 
 |  |  |       :scroll="{ y: 768, scrollToFirstRowOnChange: true }" :columns="columns" @resizeColumn="handleResizeColumn"
 | 
 |  |  |       :loading="state.loading">
 | 
 |  |  |       <template #bodyCell="{ column, text, record }">
 | 
 |  |  |         <template v-if="column.dataIndex === 'oper'">
 | 
 |  |  |           <div style="display: flex;justify-content: space-evenly;">
 | 
 |  |  |             <a-button type="link" primary @click="showDetl(record)">{{ formatMessage('page.order.orderDetl', '订单明细')
 | 
 |  |  |               }}</a-button>
 | 
 |  |  |             }}</a-button>
 | 
 |  |  |             <a-button type="link" primary @click="handlePrint(record)">{{ formatMessage('page.order.orderDetl',
 | 
 |  |  |               '打印订单')
 | 
 |  |  |             }}</a-button>
 | 
 |  |  |             <a-button type="link" primary @click="handleEdit(record)">{{ formatMessage('page.edit', '编辑') }}</a-button>
 | 
 |  |  |             <a-button type="link" danger @click="handleDel([record])">{{ formatMessage('page.delete', '删除')
 | 
 |  |  |               }}</a-button>
 | 
 |  |  |             }}</a-button>
 | 
 |  |  |           </div>
 | 
 |  |  |         </template>
 | 
 |  |  |       </template>
 | 
 |  |  | 
 |  |  |     <ShowOrderDetlComponent ref="showOrderDetlChild" />
 | 
 |  |  | 
 | 
 |  |  |   </div>
 | 
 |  |  |   <OrderPrint ref="printChild" />
 | 
 |  |  | </template>
 | 
 |  |  | 
 | 
 |  |  | <style></style>
 |