CD配唱片
2025-05-07 1e3797178d05b111b901a005827189ee63d6f8f6
src/views/mainPlan/sheetMetalOrderManage/index.vue
@@ -66,8 +66,8 @@
          type="primary"
          plain
          icon="Plus"
          :disabled="single"
          @click="handleUpdate"
          :disabled="multiple"
          @click="handleBatchUpdatePlanDate"
          v-hasPermi="['apsPlatePlan:edit']"
          >批量更新工单计划日期</el-button
        >
@@ -77,7 +77,6 @@
          type="success"
          plain
          icon="Edit"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['apsPlatePlan:edit']"
          >生成钣金计划工单</el-button
@@ -111,17 +110,18 @@
        >
      </template>
    </HxlhTable>
    <el-dialog :title="title" v-model="openDialog" width="900px" append-to-body>
    <el-dialog
      :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>
@@ -141,10 +141,12 @@
import { listAll_plant } from "@/api/basicData/plant";
import { listAll_shop, listAps_shop } from "@/api/basicData/shop";
import { selectProcessNameList } from "@/api/basicData/processRoute.js";
import { useI18n } from "vue-i18n"; //要在js中使用国际化
const { t, locale } = useI18n();
const { proxy } = getCurrentInstance();
const openDialog = ref(false);
const subGridOptions = ref([]);
const tableRef = ref();
// const tableRef = ref();
const calendarList = ref([]);
const loading = ref(true);
const showSearch = ref(true);
@@ -178,103 +180,238 @@
const processList = ref([]);
const height = ref(document.documentElement.clientHeight - 220 + "px;");
// 表格配置-列表
const columns = ref([
  { type: "checkbox", width: 60, align: "center" },
  {
    title: "需求ID",
    field: "description",
    width: 150,
    align: "center",
  },
  {
    title: "需求追溯ID",
    field: "type",
    width: 200,
    align: "center",
  },
  {
    title: "工单号",
    field: "effectiveDate",
    width: 200,
    align: "center",
  },
  {
    title: "匹配数量",
    field: "expiringDate",
    width: 200,
    align: "center",
  },
  {
    title: "工单类型",
    field: "expiringDate",
    width: 200,
    align: "center",
  },
  {
    title: "料号",
    field: "createTime",
    width: 200,
    align: "center",
  },
  {
    title: "主件图号",
    field: "createTime",
    width: 200,
    align: "center",
  },
  {
    title: "主件客户",
    field: "createTime",
    width: 200,
    align: "center",
  },
  {
    title: "生产数量",
    field: "updateTime",
    width: 100,
    align: "center",
  },
  {
    title: "需求日期",
    field: "updateTime",
    width: 100,
    align: "center",
  },
  {
    title: "适用工厂",
    field: "applicableFactory",
    width: 200,
    align: "center",
    formatter: ({ cellValue, row, column }) => {
      if (cellValue) {
        for (let i = 0; i < plantList.value.length; i++) {
          if (cellValue === plantList.value[i].plantCode) {
            return plantList.value[i].plantName;
          }
        }
      }
    },
  },
  {
    title: "生产基地",
    field: "updateTime",
    width: 100,
    align: "center",
  },
  {
    title: "操作",
    width: 100,
    fixed: "right",
    slots: { default: "buttons" },
    align: "center",
  },
]);
const columns = ref([]);
// 分页属性
const page = ref({
  total: 0,
  current: 1,
  size: 10,
});
watch(
  locale,
  (newLocale) => {
    columns.value = [
      { type: "checkbox", width: 60, align: "center" },
      {
        title: t("basic.table.requirementID"),
        field: "description",
        width: 150,
        align: "center",
      },
      {
        title: t("basic.table.requirementTraceabilityID"),
        field: "type",
        width: 200,
        align: "center",
      },
      {
        title: t("plan.table.workOrderNo"),
        field: "effectiveDate",
        width: 200,
        align: "center",
      },
      {
        title: t("basic.table.matchQuantity"),
        field: "expiringDate",
        width: 200,
        align: "center",
      },
      {
        title: t("basic.table.workOrderType"),
        field: "expiringDate",
        width: 200,
        align: "center",
      },
      {
        title: t("plan.table.itemNumber"),
        field: "createTime",
        width: 200,
        align: "center",
      },
      {
        title: t("plan.table.mainPartDrawingNumber"),
        field: "createTime",
        width: 200,
        align: "center",
      },
      {
        title: t("basic.table.mainCustomer"),
        field: "createTime",
        width: 200,
        align: "center",
      },
      {
        title: t("plan.table.productionQuantity"),
        field: "updateTime",
        width: 100,
        align: "center",
      },
      {
        title: t("basic.table.applicableFactories"),
        field: "applicableFactory",
        width: 200,
        align: "center",
        formatter: ({ cellValue, row, column }) => {
          if (cellValue) {
            for (let i = 0; i < plantList.value.length; i++) {
              if (cellValue === plantList.value[i].plantCode) {
                return plantList.value[i].plantName;
              }
            }
          }
        },
      },
      {
        title: t("plan.table.productionBase"),
        field: "updateTime",
        width: 100,
        align: "center",
      },
      {
        title: t("plan.table.planStartDay"),
        field: "updateTime",
        width: 100,
        align: "center",
      },
      {
        title: t("plan.table.planEndDayDate"),
        field: "updateTime",
        width: 100,
        align: "center",
      },
      {
        title: t("plan.table.workorderCreationTime"),
        field: "updateTime",
        width: 100,
        align: "center",
      },
      {
        title: t("plan.table.mismatchedProductionQuantity"),
        field: "updateTime",
        width: 100,
        align: "center",
      },
      {
        title: t("plan.table.delayRiskIdentification"),
        field: "updateTime",
        width: 100,
        align: "center",
      },
      {
        title: "操作",
        width: 100,
        fixed: "right",
        slots: { default: "buttons" },
        align: "center",
      },
    ];
    subGridOptions.value = [
      {
        title: t("basic.table.requirementID"),
        field: "description",
        width: 150,
        align: "center",
      },
      {
        title: t("basic.table.requirementTraceabilityID"),
        field: "type",
        width: 200,
        align: "center",
      },
      {
        title: t("plan.table.itemNumber"),
        field: "effectiveDate",
        width: 200,
        align: "center",
      },
      {
        title: t("plan.table.bomLowCode"),
        field: "expiringDate",
        width: 200,
        align: "center",
      },
      {
        title: t("plan.table.bomUsage"),
        field: "expiringDate",
        width: 200,
        align: "center",
      },
      {
        title: t("basic.table.processRouteID"),
        field: "createTime",
        width: 200,
        align: "center",
      },
      {
        title: t("plan.table.processRouteWorkingHours"),
        field: "updateTime",
        width: 100,
        align: "center",
      },
      {
        title: t("plan.table.demandQuantity"),
        field: "updateTime",
        width: 100,
        align: "center",
      },
      {
        title: t("plan.table.netRequirement"),
        field: "updateTime",
        width: 100,
        align: "center",
      },
      {
        title: t("plan.table.requirementPlanCompletionDate"),
        field: "updateTime",
        width: 100,
        align: "center",
      },
      {
        title: t("plan.table.planStartDay"),
        field: "updateTime",
        width: 100,
        align: "center",
      },
      {
        title: t("plan.table.planEndDayDate"),
        field: "updateTime",
        width: 100,
        align: "center",
      },
      {
        title: t("plan.table.requirementDate"),
        field: "updateTime",
        width: 100,
        align: "center",
      },
      {
        title: t("basic.table.applicableFactories"),
        field: "updateTime",
        width: 100,
        align: "center",
      },
      {
        title: t("plan.table.productionBase"),
        field: "updateTime",
        width: 100,
        align: "center",
      },
      {
        title: t("plan.table.matchState"),
        field: "updateTime",
        width: 100,
        align: "center",
      },
    ];
  },
  {
    immediate: true,
    deep: true,
  }
);
function handleBatchUpdatePlanDate(){
}
function handleCheckView(row) {
  openDialog.value = true;
  // listProcessRoute({ workOrderNo: row.documentNumber }).then((data) => {
@@ -367,122 +504,6 @@
  selectProcessNameList({ orgCode: plant }).then((response) => {
    processList.value = response.rows;
  });
}
/** 修改按钮操作 */
function handleUpdate(row) {
  reset();
  const _id = row.id || ids.value;
  getCalendar(_id).then((response) => {
    form.value = response.data;
    // form.value.content = JSON.parse(response.data.content.value);
    if (form.value.type === "1") {
      weekDaysSettingList.value = JSON.parse(
        response.data.content.value
      ).weekdays;
    } else if (form.value.type === "2") {
      holidays.value = JSON.parse(response.data.content.value).holidays;
    }
    open.value = true;
    title.value = "修改日历管理";
  });
}
/** 提交按钮 */
function submitForm() {
  proxy.$refs["calendarRef"].validate((valid) => {
    if (valid) {
      if (form.value.id != null) {
        if (form.value.type === "1") {
          updateCalendar({
            ...form.value,
            content: {
              weekdays: weekDaysSettingList.value,
            },
            applicableWorkshop: form.value.applicableWorkshop,
            applicableProcess: form.value.applicableProcess,
          }).then((response) => {
            proxy.$modal.msgSuccess("修改成功");
            open.value = false;
            getList();
          });
        } else if (form.value.type === "2") {
          updateCalendar({
            ...form.value,
            content: {
              holidays: holidays.value,
            },
            applicableWorkshop: form.value.applicableWorkshop,
            applicableProcess: form.value.applicableProcess,
          }).then((response) => {
            proxy.$modal.msgSuccess("修改成功");
            open.value = false;
            getList();
          });
        }
      } else {
        if (form.value.type === "1") {
          addCalendar({
            ...form.value,
            content: {
              weekdays: weekDaysSettingList.value,
            },
          }).then((response) => {
            proxy.$modal.msgSuccess("新增成功");
            open.value = false;
            getList();
          });
        } else if (form.value.type === "2") {
          addCalendar({
            ...form.value,
            content: {
              holidays: holidays.value,
            },
          }).then((response) => {
            proxy.$modal.msgSuccess("新增成功");
            open.value = false;
            getList();
          });
        }
      }
    }
  });
}
/** 删除按钮操作 */
function handleDelete(row) {
  const _ids = row.id || ids.value;
  proxy.$modal
    .confirm('是否确认删除日历管理编号为"' + _ids + '"的数据项?')
    .then(function () {
      return delCalendar(_ids);
    })
    .then(() => {
      getList();
      proxy.$modal.msgSuccess("删除成功");
    })
    .catch(() => {});
}
/** 导出按钮操作 */
function handleExport() {
  proxy.download(
    "core/calendar/export",
    {
      ...queryParams.value,
    },
    `calendar_${new Date().getTime()}.xlsx`
  );
}
function handleSwitchType(e) {
  typeRadioNumber.value = e;
  form.value.type = e;
  form.value.effectiveDate = null;
  form.value.expiringDate = null;
  form.value.content = null;
  form.value.applicableFactory = null;
  form.value.applicableWorkshop = null;
  form.value.applicableProcess = null;
}
function changePageNo(currentPage) {
  queryParams.value.pageNum = currentPage;