123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310 |
- <template>
- <div>
- <el-card class="box-card">
- <el-tabs v-model="activeName" type="card" @tab-change="changeActiveName">
- <el-tab-pane label="成品库" name="first">
- <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-tab-pane>
- <el-tab-pane label="成品库明细" name="second">
- <byTable
- :source="sourceListTwo.data"
- :pagination="sourceListTwo.pagination"
- :config="configTwo"
- :loading="loading"
- :searchConfig="searchConfigTwo"
- highlight-current-row
- :action-list="[
- {
- text: '导出Excel',
- action: () => deriveExcelTwo(),
- },
- ]"
- @get-list="getListTwo"
- @clickReset="clickResetTwo">
- </byTable>
- </el-tab-pane>
- </el-tabs>
- </el-card>
- </div>
- </template>
- <script setup>
- import byTable from "/src/components/byTable/index";
- import { ElMessageBox } from "element-plus";
- const { proxy } = getCurrentInstance();
- const activeName = ref("first");
- const departmentList = ref([{ dictKey: "0", dictValue: "胜德体育" }]);
- const sourceList = ref({
- data: [],
- pagination: {
- total: 0,
- pageNum: 1,
- pageSize: 10,
- skuSpecCode: "",
- skuSpecName: "",
- },
- });
- const sourceListTwo = ref({
- data: [],
- pagination: {
- total: 0,
- pageNum: 1,
- pageSize: 10,
- skuSpecCode: "",
- skuSpecName: "",
- orderCode: "",
- orderWlnCode: "",
- departmentId: "",
- },
- });
- const loading = ref(false);
- const searchConfig = computed(() => {
- return [
- {
- type: "input",
- prop: "skuSpecCode",
- label: "SKU品号",
- },
- {
- type: "input",
- prop: "skuSpecName",
- label: "SKU品名",
- },
- ];
- });
- const searchConfigTwo = computed(() => {
- return [
- {
- type: "input",
- prop: "orderCode",
- label: "订单号",
- },
- {
- type: "input",
- prop: "orderWlnCode",
- label: "万里牛单号",
- },
- {
- type: "input",
- prop: "skuSpecCode",
- label: "SKU品号",
- },
- {
- type: "input",
- prop: "skuSpecName",
- label: "SKU品名",
- },
- {
- type: "select",
- prop: "departmentId",
- data: departmentList.value,
- label: "事业部",
- },
- ];
- });
- const config = computed(() => {
- return [
- {
- attrs: {
- label: "SKU品号",
- prop: "skuSpecCode",
- "min-width": 140,
- },
- },
- {
- attrs: {
- label: "SKU品名",
- prop: "skuSpecName",
- "min-width": 340,
- },
- },
- {
- attrs: {
- label: "数量",
- prop: "quantity",
- "min-width": 120,
- },
- },
- ];
- });
- const configTwo = computed(() => {
- return [
- {
- attrs: {
- label: "订单号",
- prop: "orderCode",
- width: 160,
- },
- },
- {
- attrs: {
- label: "万里牛单号",
- prop: "orderWlnCode",
- width: 140,
- },
- },
- {
- attrs: {
- label: "事业部",
- prop: "departmentName",
- width: 140,
- },
- },
- {
- attrs: {
- label: "SKU品号",
- prop: "skuSpecCode",
- width: 140,
- },
- },
- {
- attrs: {
- label: "SKU品名",
- prop: "skuSpecName",
- },
- },
- {
- attrs: {
- label: "数量",
- prop: "quantity",
- width: 120,
- },
- },
- {
- attrs: {
- label: "操作类型",
- prop: "operationType",
- width: 120,
- },
- render(val) {
- if (val == "1") {
- return "入库";
- } else if (val == "2") {
- return "出库";
- }
- },
- },
- {
- attrs: {
- label: "操作时间",
- prop: "createTime",
- width: 160,
- align: "center",
- },
- },
- ];
- });
- const getDemandData = () => {
- proxy.post("/department/page", { pageNum: 1, pageSize: 999 }).then((res) => {
- if (res.rows && res.rows.length > 0) {
- departmentList.value = departmentList.value.concat(
- res.rows.map((item) => {
- return {
- dictKey: item.id,
- dictValue: item.name,
- };
- })
- );
- }
- });
- };
- getDemandData();
- 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("/inventoryFinished/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 getListTwo = async (req, status) => {
- if (status) {
- sourceListTwo.value.pagination = {
- pageNum: sourceListTwo.value.pagination.pageNum,
- pageSize: sourceListTwo.value.pagination.pageSize,
- };
- } else {
- sourceListTwo.value.pagination = { ...sourceListTwo.value.pagination, ...req };
- }
- loading.value = true;
- proxy.post("/inventoryFinishedOrder/page", sourceListTwo.value.pagination).then((res) => {
- sourceListTwo.value.data = res.rows;
- sourceListTwo.value.pagination.total = res.total;
- setTimeout(() => {
- loading.value = false;
- }, 200);
- });
- };
- const clickResetTwo = () => {
- getListTwo("", true);
- };
- const changeActiveName = (val) => {
- if (val === "first") {
- getList();
- } else {
- getListTwo();
- }
- };
- const deriveExcel = () => {
- ElMessageBox.confirm("你是否确认此操作", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- })
- .then(() => {
- proxy.getFile("/inventoryFinished/excelExport", sourceList.value.pagination).then((res) => {
- proxy.downloadFile(res, "成品库.xlsx");
- });
- })
- .catch(() => {});
- };
- const deriveExcelTwo = () => {
- ElMessageBox.confirm("你是否确认此操作", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- })
- .then(() => {
- proxy.getFile("/inventoryFinishedOrder/excelExport", sourceListTwo.value.pagination).then((res) => {
- proxy.downloadFile(res, "成品库明细.xlsx");
- });
- })
- .catch(() => {});
- };
- </script>
- <style lang="scss" scoped>
- ::v-deep(.el-input-number .el-input__inner) {
- text-align: left;
- }
- </style>
|