gaoluyang
5 天以前 a0111e18d44d0c78e5479f6dfba7b80c29fd0ebf
src/views/productionManagement/productionOrder/index.vue
@@ -3,6 +3,14 @@
    <div class="search_form">
      <el-form :model="searchForm"
               :inline="true">
        <el-form-item label="生产订单号:">
          <el-input v-model="searchForm.npsNo"
                    placeholder="请输入"
                    clearable
                    prefix-icon="Search"
                    style="width: 160px;"
                    @change="handleQuery" />
        </el-form-item>
        <el-form-item label="客户名称:">
          <el-input v-model="searchForm.customerName"
                    placeholder="请输入"
@@ -40,7 +48,7 @@
                     @click="handleQuery">搜索</el-button>
        </el-form-item>
      </el-form>
      <div>
      <div class="action-buttons">
        <el-button type="primary" @click="isShowNewModal = true">新增</el-button>
        <el-button type="danger" @click="handleDelete">删除</el-button>
        <el-button @click="handleOut">导出</el-button>
@@ -62,6 +70,20 @@
            :color="progressColor(toProgressPercentage(row?.completionStatus))"
            :status="toProgressPercentage(row?.completionStatus) >= 100 ? 'success' : ''"
          />
        </template>
        <template #salesContractNo="{ row }">
          <template v-if="row.salesContractNos && row.salesContractNos.length > 0">
            <el-tag v-for="(no, idx) in row.salesContractNos" :key="idx" size="small" style="margin: 2px;">{{ no }}</el-tag>
          </template>
          <span v-else-if="row.salesContractNo">{{ row.salesContractNo }}</span>
          <span v-else>-</span>
        </template>
        <template #customerName="{ row }">
          <template v-if="row.customerNames && row.customerNames.length > 0">
            <el-tag v-for="(name, idx) in row.customerNames" :key="idx" size="small" style="margin: 2px;">{{ name }}</el-tag>
          </template>
          <span v-else-if="row.customerName">{{ row.customerName }}</span>
          <span v-else>-</span>
        </template>
      </PIMTable>
    </div>
@@ -91,6 +113,17 @@
      </template>
    </el-dialog>
    <MaterialLedgerDialog
      v-model="materialDialogVisible"
      :order-row="currentMaterialOrder"
      @saved="getList"
    />
    <MaterialDetailDialog
      v-model="materialDetailDialogVisible"
      :order-row="currentMaterialDetailOrder"
      @confirmed="getList"
    />
    <new-product-order v-if="isShowNewModal"
                         v-model:visible="isShowNewModal"
                         @completed="handleQuery" />
@@ -98,7 +131,7 @@
</template>
<script setup>
  import { onMounted, ref } from "vue";
  import { computed, defineAsyncComponent, getCurrentInstance, onMounted, reactive, ref, toRefs } from "vue";
  import { ElMessageBox } from "element-plus";
  import dayjs from "dayjs";
  import { useRouter } from "vue-router";
@@ -109,7 +142,8 @@
    listProcessBom, delProductOrder,
  } from "@/api/productionManagement/productionOrder.js";
  import { listMain as getOrderProcessRouteMain } from "@/api/productionManagement/productProcessRoute.js";
  import {fileDel} from "@/api/financialManagement/revenueManagement.js";
  import MaterialLedgerDialog from "@/views/productionManagement/productionOrder/components/MaterialLedgerDialog.vue";
  import MaterialDetailDialog from "@/views/productionManagement/productionOrder/components/MaterialDetailDialog.vue";
  import PIMTable from "@/components/PIMTable/PIMTable.vue";
  const NewProductOrder = defineAsyncComponent(() => import("@/views/productionManagement/productionOrder/New.vue"));
@@ -122,17 +156,21 @@
    {
      label: "生产订单号",
      prop: "npsNo",
      width: '120px',
      width: '150px',
    },
    {
      label: "销售合同号",
      prop: "salesContractNo",
      width: '150px',
      dataType: "slot",
      slot: "salesContractNo",
    },
    {
      label: "客户名称",
      prop: "customerName",
      width: '200px',
      dataType: "slot",
      slot: "customerName",
    },
    {
      label: "产品名称",
@@ -176,18 +214,18 @@
      formatData: val => (val ? dayjs(val).format("YYYY-MM-DD") : ""),
      width: 120,
    },
    {
      label: "交付日期",
      prop: "deliveryDate",
      formatData: val => (val ? dayjs(val).format("YYYY-MM-DD") : ""),
      width: 120,
    },
    // {
    //   label: "交付日期",
    //   prop: "deliveryDate",
    //   formatData: val => (val ? dayjs(val).format("YYYY-MM-DD") : ""),
    //   width: 120,
    // },
    {
      dataType: "action",
      label: "操作",
      align: "center",
      fixed: "right",
      width: 200,
      width: 340,
      operation: [
        {
          name: "工艺路线",
@@ -204,13 +242,27 @@
            openBindRouteDialog(row);
          },
        },
        {
          name: "产品结构",
          type: "text",
          clickFun: row => {
            showProductStructure(row);
          },
        },
        // {
        //   name: "产品结构",
        //   type: "text",
        //   clickFun: row => {
        //     showProductStructure(row);
        //   },
        // },
        // {
        //   name: "领料",
        //   type: "text",
        //   clickFun: row => {
        //     openMaterialDialog(row);
        //   },
        // },
        // {
        //   name: "领料详情",
        //   type: "text",
        //   clickFun: row => {
        //     openMaterialDetailDialog(row);
        //   },
        // },
      ],
    },
  ]);
@@ -225,6 +277,7 @@
  const data = reactive({
    searchForm: {
      npsNo: "",
      customerName: "",
      salesContractNo: "",
      projectName: "",
@@ -277,6 +330,10 @@
    orderId: null,
    routeId: null,
  });
  const materialDialogVisible = ref(false);
  const currentMaterialOrder = ref(null);
  const materialDetailDialogVisible = ref(false);
  const currentMaterialDetailOrder = ref(null);
  const openBindRouteDialog = async row => {
    bindForm.orderId = row.id;
@@ -322,6 +379,16 @@
    }
  };
  const openMaterialDialog = row => {
    currentMaterialOrder.value = row;
    materialDialogVisible.value = true;
  };
  const openMaterialDetailDialog = async row => {
    currentMaterialDetailOrder.value = row;
    materialDetailDialogVisible.value = true;
  };
  // 查询列表
  /** 搜索按钮操作 */
  const handleQuery = () => {
@@ -351,7 +418,12 @@
    productOrderListPage(params)
      .then(res => {
        tableLoading.value = false;
        tableData.value = res.data.records;
        const records = res.data.records || [];
        records.forEach(row => {
          row.salesContractNos = row.salesContractNo ? row.salesContractNo.split(',').filter(Boolean) : [];
          row.customerNames = row.customerName ? row.customerName.split(',').filter(Boolean) : [];
        });
        tableData.value = records;
        page.total = res.data.total;
      })
      .catch(() => {
@@ -372,6 +444,7 @@
        path: "/productionManagement/processRouteItem",
        query: {
          id: data.id,
          bomId: data.bomId,
          processRouteCode: data.processRouteCode || "",
          productName: data.productName || "",
          model: data.model || "",
@@ -455,6 +528,12 @@
  align-items: start;
}
.action-buttons {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
}
:deep(.yellow) {
  background-color: #FAF0DE;
}
@@ -470,4 +549,8 @@
:deep(.purple){
  background-color: #F4DEFA;
}
.table_list {
   margin-top: unset;
}
</style>