123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207 |
- <template>
- <el-card class="box-card">
- <byTable
- :source="sourceList.data"
- :pagination="sourceList.pagination"
- :config="config"
- :loading="loading"
- :searchConfig="searchConfig"
- highlight-current-row
- :action-list="[
- {
- text: '导出Excel',
- action: () => deriveExcel(),
- },
- ]"
- @get-list="getList"
- @clickReset="clickReset">
- </byTable>
- </el-card>
- </template>
- <script setup>
- import byTable from "/src/components/byTable/index";
- import { ElMessage, ElMessageBox } from "element-plus";
- import moment from "moment";
- const { proxy } = getCurrentInstance();
- const type = ref([
- {
- dictKey: "1",
- dictValue: "制作损坏",
- },
- {
- dictKey: "2",
- dictValue: "裸垫质量不良",
- },
- {
- dictKey: "3",
- dictValue: "生产错误",
- },
- {
- dictKey: "4",
- dictValue: "丢件",
- },
- {
- dictKey: "5",
- dictValue: "补单",
- },
- ]);
- const sourceList = ref({
- data: [],
- pagination: {
- total: 0,
- pageNum: 1,
- pageSize: 10,
- type: "",
- orderCode: "",
- orderWlnCode: "",
- skuSpecCode: "",
- skuSpecName: "",
- beginTime: "",
- endTime: "",
- },
- });
- const loading = ref(false);
- const searchConfig = computed(() => {
- return [
- {
- type: "select",
- prop: "type",
- data: type.value,
- label: "超领类型",
- },
- {
- type: "input",
- prop: "orderCode",
- label: "订单号",
- },
- {
- type: "input",
- prop: "orderWlnCode",
- label: "万里牛单号",
- },
- {
- type: "input",
- prop: "skuSpecCode",
- label: "SKU品号",
- },
- {
- type: "input",
- prop: "skuSpecName",
- label: "SKU品名",
- },
- {
- type: "date",
- propList: ["beginTime", "endTime"],
- label: "日期",
- },
- ];
- });
- const config = computed(() => {
- return [
- {
- attrs: {
- label: "订单号",
- prop: "orderCode",
- width: 200,
- },
- },
- {
- attrs: {
- label: "万里牛单号",
- prop: "orderWlnCode",
- width: 150,
- },
- },
- {
- attrs: {
- label: "SKU品号",
- prop: "skuSpecCode",
- width: 160,
- },
- },
- {
- attrs: {
- label: "SKU品名",
- prop: "skuSpecName",
- "min-width": 220,
- },
- },
- {
- attrs: {
- label: "超领类型",
- prop: "typeValue",
- width: 130,
- },
- },
- {
- attrs: {
- label: "仓库名称",
- prop: "warehouseName",
- width: 150,
- },
- },
- {
- attrs: {
- label: "超领数量",
- prop: "quantity",
- width: 120,
- },
- },
- {
- attrs: {
- label: "超领时间",
- prop: "exceedReceiveTime",
- width: 160,
- },
- },
- ];
- });
- const getList = async (req, status) => {
- if (status) {
- sourceList.value.pagination = {
- pageNum: sourceList.value.pagination.pageNum,
- pageSize: sourceList.value.pagination.pageSize,
- };
- } else {
- sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
- }
- loading.value = true;
- proxy.post("/productionExceedReceive/page", sourceList.value.pagination).then((res) => {
- sourceList.value.data = res.rows;
- sourceList.value.pagination.total = res.total;
- setTimeout(() => {
- loading.value = false;
- }, 200);
- });
- };
- getList();
- const clickReset = () => {
- getList("", true);
- };
- const deriveExcel = () => {
- ElMessageBox.confirm("你是否确认此操作", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- })
- .then(() => {
- proxy.postFile("/productionExceedReceive/exceedReceiveExportExcel", sourceList.value.pagination).then((res) => {
- if (res.type === "application/json") {
- const fileReader = new FileReader();
- fileReader.onloadend = () => {
- const jsonData = JSON.parse(fileReader.result);
- ElMessage({ message: jsonData.msg, type: "error" });
- };
- fileReader.readAsText(res);
- } else {
- proxy.downloadFile(res, "SKU报价看板-" + moment().format("yyyy-MM-DD") + ".xlsx");
- }
- });
- })
- .catch(() => {});
- };
- </script>
- <style lang="scss" scoped></style>
|