123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171 |
- <template>
- <div>
- <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"
- :cellClassName="cellClassName">
- <template #purchaseCode="{ item }">
- <div>
- <a style="color: #409eff; cursor: pointer; word-break: break-all" @click="clickPurchaseCode(item)">{{ item.purchaseCode }}</a>
- </div>
- </template>
- </byTable>
- </el-card>
- </div>
- </template>
- <script setup>
- import byTable from "/src/components/byTable/index";
- import moment from "moment";
- const { proxy } = getCurrentInstance();
- const sourceList = ref({
- data: [],
- pagination: {
- total: 0,
- pageNum: 1,
- pageSize: 10,
- purchaseCode: "",
- bomSpecCode: "",
- bomSpecName: "",
- },
- });
- const loading = ref(false);
- const searchConfig = computed(() => {
- return [
- {
- type: "input",
- prop: "purchaseCode",
- label: "采购单号",
- },
- {
- type: "input",
- prop: "bomSpecCode",
- label: "品号",
- },
- {
- type: "input",
- prop: "bomSpecName",
- label: "品名",
- },
- ];
- });
- const config = computed(() => {
- return [
- {
- attrs: {
- label: "品号",
- prop: "bomSpecCode",
- width: 160,
- },
- },
- {
- attrs: {
- label: "品名",
- prop: "bomSpecName",
- "min-width": 220,
- },
- },
- {
- attrs: {
- label: "采购单号",
- slot: "purchaseCode",
- width: 160,
- },
- },
- {
- attrs: {
- label: "供应商",
- prop: "supplierName",
- width: 220,
- },
- },
- {
- attrs: {
- label: "采购数量",
- prop: "purchaseQuantity",
- width: 120,
- },
- },
- {
- attrs: {
- label: "在途数量",
- prop: "inTransitQuantity",
- width: 120,
- },
- },
- {
- attrs: {
- label: "交期",
- prop: "deliveryDate",
- width: 160,
- align: "center",
- },
- },
- ];
- });
- 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("/purchaseInTransitBom/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 = () => {
- proxy.postFile("/purchaseInTransitBom/export", sourceList.value.pagination).then((res) => {
- proxy.downloadFile(res, "在途物料.xlsx");
- });
- };
- const cellClassName = (val) => {
- if (val.row.deliveryDate < moment().format("yyyy-MM-DD HH:mm:ss")) {
- return "colorDim";
- }
- };
- const clickPurchaseCode = (item) => {
- proxy.$router.replace({
- path: "/platform_manage/process/processApproval",
- query: {
- flowKey: "purchase",
- flowName: "采购流程",
- processType: "20",
- id: item.purchaseId,
- flowId: item.flowId,
- random: proxy.random(),
- },
- });
- };
- </script>
- <style lang="scss" scoped>
- ::v-deep(.colorDim) {
- color: red;
- }
- </style>
|