CD配唱片
2025-05-07 4079d1c5a3efb6b31879d9f80dd067cc01b11e91
src/views/basicData/processRouteDataPreparate/index.vue
@@ -15,9 +15,9 @@
              <el-input
                style="width: 240px"
                v-model="queryParams.itemCode"
                 :placeholder="`${$t('common.common.placeholder')}${$t(
                'plan.query.itemNumber'
              )}`"
                :placeholder="`${$t('common.common.placeholder')}${$t(
                  'plan.query.itemNumber'
                )}`"
                clearable
                @keyup.enter="handleQuery"
              />
@@ -25,14 +25,12 @@
          </el-col>
          <el-col :span="18" style="text-align: right">
            <el-form-item>
              <el-button type="primary" icon="Search" @click="handleQuery"
                >{{
              $t("common.common.query")
            }}</el-button
              >
              <el-button type="primary" icon="Search" @click="handleQuery">{{
                $t("common.common.query")
              }}</el-button>
              <el-button icon="Refresh" @click="resetQuery">{{
              $t("common.common.reset")
            }}</el-button>
                $t("common.common.reset")
              }}</el-button>
            </el-form-item>
          </el-col>
        </el-row>
@@ -46,7 +44,7 @@
          icon="Refresh"
          @click="handleRefresh"
          v-hasPermi="['apsPartRouteStat:edit']"
          >{{$t("common.common.update")}}</el-button
          >{{ $t("common.common.update") }}</el-button
        >
      </el-col>
      <right-toolbar
@@ -65,10 +63,33 @@
      :page="page"
      @changePageNo="changePageNo"
      @changePageSize="changePageSize"
      :expand-config="expandConfig"
      :subGridOptions="subGridOptions"
    >
      <!--       :expand-config="expandConfig"
      :subGridOptions="subGridOptions" -->
      <template #buttons="{ row }">
        <el-button
          type="primary"
          link
          @click="handleCheckView(row)"
          v-hasPermi="['aps:calendar:update']"
          >查看</el-button
        >
      </template>
    </HxlhTable>
    <el-dialog :title="title" v-model="openDialog" width="900px" append-to-body>
      <HxlhTable
        style="width: 100%"
        :columns="subGridOptions"
        :data="subList"
        :loading="loading"
        :height="heightSub"
        @on-checkbox="handleCheckboxChange"
        :page="page"
        @changePageNo="changePageNo"
        @changePageSize="changePageSize"
      >
      </HxlhTable>
    </el-dialog>
  </div>
</template>
@@ -83,13 +104,14 @@
import { ref } from "vue";
import { getToken } from "@/utils/auth.js";
import { ElMessage } from "element-plus";
import { useI18n } from "vue-i18n"; //要在js中使用国际化
const { t, locale } = useI18n();
const { proxy } = getCurrentInstance();
// 分页属性
const page = ref({
  total: 0,
  current: 1,
  size: 10
  size: 10,
});
const {
  aps_is_suspended,
@@ -103,264 +125,18 @@
  "aps_business_type"
);
const exampleList = ref([]);
const planList = ref([]);
const subList = ref([]);
const loading = ref(true);
const showSearch = ref(true);
const single = ref(true);
const total = ref(0);
const daterangePlanStartDay = ref([]);
const daterangePlanEndDay = ref([]);
const height = ref(document.documentElement.clientHeight - 270 + "px;");
const isVisible = ref(false);
const isError = ref(false);
const planned = ref(true);
const batchNumber = ref(null);
const exampleHeight = ref("500px");
const uploadRef = ref();
/*** 用户导入参数 */
const upload = reactive({
  // 是否显示弹出层(用户导入)
  open: false,
  // 弹出层标题(用户导入)
  title: "",
  // 是否禁用上传
  isUploading: false,
  // 是否更新已经存在的用户数据
  updateSupport: 0,
  // 设置上传的请求头部
  headers: { Authorization: "Bearer " + getToken(), local: "zhl" },
  // 上传的地址
  url: import.meta.env.VITE_APP_BASE_API + "/aps/apsPlatePlan/importData",
});
const heightSub = ref(document.documentElement.clientHeight - 320 + "px;");
// 表格配置
const exampleColumns = ref([
  { type: "seq", title: "序号", width: 60 },
  {
    title: "主计划员",
    field: "masterPlanner",
    width: 100,
  },
  {
    title: "周日",
    field: "weekDay",
    width: 100,
    formatter: ({ cellValue, row, column }) => {
      if (cellValue) {
        const weekDay = new Date(cellValue);
        const year = weekDay.getFullYear();
        const month = String(weekDay.getMonth() + 1).padStart(2, "0");
        const day = String(weekDay.getDate()).padStart(2, "0");
        return `${month}-${day}`;
      }
      return "";
    },
  },
  {
    title: "周度",
    field: "weekCycle",
    width: 80,
  },
  {
    title: "主件料号",
    field: "mainPartNumber",
    width: 150,
  },
  {
    title: "主件图号",
    field: "mainPartDrawingNumber",
    width: 150,
  },
  {
    title: "客户名称",
    field: "customer",
    width: 200,
  },
  {
    title: "业务类型",
    field: "businessType",
    width: 150,
  },
  {
    title: "单据号",
    field: "documentNumber",
    width: 150,
  },
  {
    title: "需求分类",
    field: "requirementType",
    width: 150,
  },
  {
    title: "单据状态",
    field: "documentStatus",
    width: 100,
  },
  {
    title: "料号",
    field: "itemNumber",
    width: 150,
  },
  {
    title: "图号",
    field: "drawingNo",
    width: 150,
  },
  {
    title: "版本号",
    field: "versionNumber",
    width: 100,
  },
  {
    title: "生产数量",
    field: "productionQuantity",
    width: 100,
  },
  {
    title: "良品数量",
    field: "goodProductsQuantity",
    width: 100,
  },
  {
    title: "工序号",
    field: "processNumber",
    width: 150,
  },
  {
    title: "工作中心",
    field: "workCenter",
    width: 150,
  },
  {
    title: "所属部门",
    field: "department",
    width: 100,
  },
  {
    title: "计划开工日",
    field: "planStartDay",
    width: 100,
  },
  {
    title: "计划完工日",
    field: "planEndDay",
    width: 100,
  },
  {
    title: "备料料号",
    field: "standbyNumber",
    width: 100,
  },
  {
    title: "备料名称",
    field: "standbyName",
    width: 200,
  },
  {
    title: "备料库存",
    field: "standbyStock",
    width: 100,
  },
  {
    title: "下道工序所属部门",
    field: "nextProcessDeparment",
    width: 180,
  },
  {
    title: "是否挂起",
    field: "isSuspended",
    width: 100,
  },
  {
    title: "外协标识",
    field: "isOutsourcing",
    width: 100,
  },
  {
    title: "账套",
    field: "account",
    width: 100,
  },
  // {
  //   title: '上阶物料',
  //   field: 'advancedMaterials',
  //   width: 100,
  // },
  // {
  //   title: '上阶单据号',
  //   field: 'advancedDocumentNumber',
  //   width: 100,
  // },
  // {
  //   title: '上阶需求日期',
  //   field: 'advancedRequirementDay',
  //   width: 150,
  // },
  // {
  //   title: '计划齐套',
  //   field: 'isPlanComplete',
  //   width: 100,
  // },
  // {
  //   title: '库存齐套',
  //   field: 'isStockComplete',
  //   width: 100,
  // },
  // {
  //   title: '是否有折返工序',
  //   field: 'hasTurnback',
  //   width: 150,
  // },
  // {
  //   title: '风险标识',
  //   field: 'hasRisk',
  //   width: 100,
  // },
]);
// 表格配置
const columns = ref([
  {
    field: "expand",
    type: "expand",
    width: 60,
    align: "center",
    slots: { content: "expandContent" },
  },
  { type: "checkbox", width: 60, align: "center" },
  {
    title: "工艺路线ID",
    field: "mainPartNumber",
  },
  {
    title: "工艺路线版本",
    field: "businessType",
  },
  {
    title: "料号",
    field: "documentNumber",
  },
  {
    title: "生效日期",
    field: "requirementType",
  },
  {
    title: "失效日期",
    field: "documentStatus",
  },
  {
    title: "集成日期",
    field: "itemNumber",
  },
  {
    title: "适用工厂",
    field: "drawingNo",
  },
]);
const columns = ref([]);
const openDialog = ref(false);
const data = reactive({
  form: {},
  queryParams: {
@@ -371,11 +147,70 @@
    itemCode: null,
  },
  rules: {
    itemCode: [{ required: true, message: "请输入料号", trigger: "blur" }],
    itemCode: [
      {
        required: true,
        message: `${t("common.common.placeholder")}${t(
          "plan.query.itemNumber"
        )}`,
        trigger: "blur",
      },
    ],
  },
});
const { queryParams, form, rules } = toRefs(data);
watch(
  locale,
  (newLocale) => {
    columns.value = [
      // {
      //   field: "expand",
      //   type: "expand",
      //   width: 60,
      //   align: "center",
      //   slots: { content: "expandContent" },
      // },
      // { type: "checkbox", width: 60, align: "center" },
      {
        title: t("basic.table.processRouteVersion"),
        field: "mainPartNumber",
      },
      {
        title: t("basic.table.processRouteVersion"),
        field: "businessType",
      },
      {
        title: t("plan.table.itemNumber"),
        field: "documentNumber",
      },
      {
        title: t("basic.table.effectiveDate"),
        field: "requirementType",
      },
      {
        title: t("basic.table.expiringDate"),
        field: "documentStatus",
      },
      {
        title: t("basic.table.integrationDate"),
        field: "itemNumber",
      },
      {
        title: t("basic.table.applicableFactories"),
        field: "drawingNo",
      },
      {
        title: "操作",
        width: 100,
        fixed: "right",
        slots: { default: "buttons" },
        align: "center",
      },
    ];
  },
  { immediate: true, deep: true }
);
function changePageNo(currentPage) {
  queryParams.value.pageNum = currentPage;
  page.value.current = currentPage;
@@ -387,32 +222,11 @@
  queryParams.value.pageSize = pageSize;
  getList();
}
/** 查询钣金计划临时管理列表 */
function getExampleList() {
  loading.value = true;
  queryParams.value = {};
  queryParams.value.batchNumber = batchNumber.value;
  examplePlan(queryParams.value).then((response) => {
    exampleList.value = response.rows;
    total.value = response.total;
    loading.value = false;
  });
}
/** 查询零件计划管理列表 */
function getList() {
  loading.value = true;
  queryParams.value.params = {};
  if (null != daterangePlanStartDay && "" !== daterangePlanStartDay) {
    queryParams.value.params["beginPlanStartDay"] =
      daterangePlanStartDay.value[0];
    queryParams.value.params["endPlanStartDay"] =
      daterangePlanStartDay.value[1];
  }
  if (null != daterangePlanEndDay && "" !== daterangePlanEndDay) {
    queryParams.value.params["beginPlanEndDay"] = daterangePlanEndDay.value[0];
    queryParams.value.params["endPlanEndDay"] = daterangePlanEndDay.value[1];
  }
  listPlan(queryParams.value).then((response) => {
    planList.value = response.rows;
    loading.value = false;
@@ -430,117 +244,21 @@
/** 重置按钮操作 */
function resetQuery() {
  daterangePlanStartDay.value = [];
  daterangePlanEndDay.value = [];
  proxy.resetForm("queryRef");
  handleQuery();
}
// 多选框选中数据
const handleCheckboxChange = (data) => {
  console.log(data);
};
/** 批量修改计划开工日按钮操作 */
function plannedStart() {}
/** 批量修改计划完工日按钮操作 */
function plannedEnd() {}
/** 导入按钮操作 */
function handleImport() {
  upload.title = "钣金计划数据上传";
  upload.open = true;
function handleCheckView(row) {
  openDialog.value = true;
  listProcessRoute({ workOrderNo: row.documentNumber }).then(
      (data) => {
        subList.value = data.rows;
      })
}
/** 导出按钮操作 */
function handleExport() {
  proxy.download(
    "aps/apsPlatePlan/export",
    {
      ...queryParams.value,
    },
    `plan_${new Date().getTime()}.xlsx`
  );
}
// /*定义下拉二级表*/
/** 下载模板操作 */
function importTemplate() {
  proxy.download(
    "system/user/importTemplate",
    {},
    `user_template_${new Date().getTime()}.xlsx`
  );
}
/** buildEexample */
function buildEexample() {
  proxy.$refs["uploadRef"].submit();
}
/**文件上传中处理 */
const handleFileUploadProgress = (event, file, fileList) => {
  upload.isUploading = true;
};
/** 文件上传成功处理 */
const handleFileSuccess = (response, file, fileList) => {
  if (response.code == "200") {
    batchNumber.value = response.data;
    isVisible.value = true;
    planned.value = false;
    isError.value = false;
    getExampleList();
  } else {
    isError.value = true;
    proxy.$alert(
      "<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
        response.msg +
        "</div>",
      "导入结果",
      { dangerouslyUseHTMLString: true }
    );
  }
  proxy.$refs["uploadRef"].handleRemove(file);
  upload.isUploading = false;
};
/** 上传并解析按钮操作 */
function uploadParse() {
  queryParams.value.params = {};
  queryParams.value.params["batchNumber"] = batchNumber.value;
  confirmPart(queryParams.value).then((response) => {
    exampleList.value = response.rows;
    loading.value = false;
    isVisible.value = false;
    isError.value = false;
    planned.value = true;
    upload.open = false;
    ElMessage({
      message: "气体管路计划数据已成功上传和解析",
      type: "success",
    });
    getList();
  });
}
/** dialog取消 */
function dialogCancel() {
  if (uploadRef.value) {
    uploadRef.value.clearFiles();
  }
  isVisible.value = false;
  isError.value = false;
  planned.value = true;
  upload.open = false;
  upload.isUploading = false;
}
/*定义下拉二级表*/
const subGridOptions = reactive({
  border: true,
  showOverflow: true,
  columns: [
const subGridOptions = ref([
    {
      title: "工艺路线ID",
      field: "itemNo",
@@ -601,19 +319,18 @@
      width: 160,
      align: "center",
    },
  ],
});
const expandConfig = ref({
  lazy: true,
  loadMethod({ row }) {
    // 调用接口
    return listProcessRoute({ workOrderNo: row.documentNumber }).then(
      (data) => {
        row.subList = data.rows;
      }
    );
  },
});
  ])
// const expandConfig = ref({
//   lazy: true,
//   loadMethod({ row }) {
//     // 调用接口
//     return listProcessRoute({ workOrderNo: row.documentNumber }).then(
//       (data) => {
//         row.subList = data.rows;
//       }
//     );
//   },
// });
getList();
</script>