123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162 |
- <script setup lang="ts">
- import { reactive, ref, unref } from "vue";
- import { httpOrderList } from "/@/api/InvoiceSales/invoiceApply";
- import { responseHandle } from "/@/utils/responseHandle";
- import { useNav } from "/@/layout/hooks/nav";
- import { useColumns } from "./columns";
- import { type PaginationProps } from "@pureadmin/table";
- import { PageSearch, usePageSearch } from "/@/components/PageSearch";
- import searchFormConfig from "./../../config/search.config";
- import { ElMessage } from "element-plus";
- const { columns } = useColumns();
- const { logout } = useNav();
- const showModel = ref(false);
- const loading = ref(false);
- const dataList = ref([]);
- const tableRef = ref();
- const handleSelection = ref([]);
- const pagination = reactive<PaginationProps>({
- total: 0,
- pageSize: 15,
- currentPage: 1,
- background: true
- });
- const emit = defineEmits(["reload", "save-btn-click"]);
- let otherParams: Record<any, any> = {};
- const initform = {
- page: 1,
- size: 10,
- start: "",
- end: "",
- total_min: "",
- total_max: "",
- inv_status: "1", //部分开/未开
- pay_status: "",
- sequenceNo: "",
- customerNo: "",
- customer: "",
- platName: "",
- status: "0"
- };
- const ruleForm = ref({ ...initform });
- const { handleSearchClick, handleResetClick } = usePageSearch(
- params => {
- otherParams = params;
- onSearch();
- return {
- result: {},
- deleteProps: []
- };
- },
- () => {
- otherParams = {};
- console.log(123);
- onSearch();
- }
- );
- const handleCurrentChange = (current: number) => {
- ruleForm.value.page = current;
- onSearch();
- };
- async function show() {
- showModel.value = true;
- await onSearch();
- }
- function handleSelectionChange(val) {
- handleSelection.value = val;
- }
- //列表展示
- async function onSearch() {
- loading.value = true;
- const { code, data, message } = await httpOrderList({
- cat_status: "1",
- ...ruleForm.value,
- ...otherParams
- });
- responseHandle({
- code,
- message,
- logout,
- handler: () => {
- const { list, count } = data ?? {};
- dataList.value = list ?? [];
- pagination.total = count ?? 0;
- pagination.pageSize = ruleForm.value.size;
- pagination.currentPage = ruleForm.value.page;
- }
- });
- loading.value = false;
- }
- function handleConfirm() {
- const selectList = unref(handleSelection);
- if (selectList.length === 0) return ElMessage.error("至少选择一个销售订单!");
- //商品数量或开票金额为空
- const noConfirm = selectList.filter(
- o => o.goodNum === "0" || o.winv_fee === "0.00"
- );
- if (noConfirm.length !== 0) {
- return ElMessage.error(
- `销售单 ${noConfirm[0].SequenceNo} 开票金额或数量为空`
- );
- }
- emit("save-btn-click", selectList);
- showModel.value = false;
- }
- defineExpose({
- show
- });
- </script>
- <template>
- <div>
- <el-dialog
- v-model="showModel"
- :close-on-press-escape="false"
- center
- append-to-body
- destroy-on-close
- top="5vh"
- title="添加销售订单"
- :width="'1040px'"
- >
- <PageSearch
- @reset-btn-click="handleResetClick"
- @search-btn-click="handleSearchClick"
- :form-config="searchFormConfig"
- />
- <div v-loading="loading">
- <PureTable
- ref="tableRef"
- border
- align="left"
- row-key="id"
- table-layout="auto"
- :size="'small'"
- :data="dataList"
- :columns="columns"
- :pagination="pagination"
- :paginationSmall="true"
- :header-cell-style="{ background: '#fafafa', color: '#606266' }"
- @selection-change="handleSelectionChange"
- @current-change="handleCurrentChange"
- />
- </div>
- <el-button type="primary" @click="handleConfirm">保存</el-button>
- </el-dialog>
- </div>
- </template>
|