chengxiangling
2025-05-12 e1272fc62b4a8fc075ffb7af3d4ee3d11ab495d3
src/views/mainPlan/sheetMetalOrderManage/index.vue
@@ -8,51 +8,63 @@
      v-show="showSearch"
      :label-width="locale == 'zh' ? '110px' : '200px'"
    >
      <el-form-item :label="$t('plan.query.workOrderNo')" prop="workOrderNo">
        <el-input
          :style="{ width: locale == 'zh' ? '200px' : '280px' }"
          v-model="queryParams.workOrderNo"
          :placeholder="`${$t('common.common.placeholder')}${$t(
            'plan.query.workOrderNo'
          )}`"
          clearable
          @keyup.enter="handleQuery"
        />
      </el-form-item>
      <!-- <el-row type="flex" justify="left">
        <el-col :span="5"> -->
      <el-form-item
        :label="$t('plan.query.requireTraceID')"
        prop="requireTraceId"
      >
        <el-input
          :style="{ width: locale == 'zh' ? '200px' : '280px' }"
          v-model="queryParams.requireTraceId"
          :placeholder="`${$t('common.common.placeholder')}${$t(
            'plan.query.requireTraceID'
          )}`"
          clearable
          @keyup.enter="handleQuery"
        />
      </el-form-item>
      <!-- </el-col>
        <el-col :span="5"> -->
      <el-form-item :label="$t('plan.query.itemNumber')" prop="mainPartNumber">
        <el-input
          :style="{ width: locale == 'zh' ? '200px' : '280px' }"
          v-model="queryParams.mainPartNumber"
          :placeholder="`${$t('common.common.placeholder')}${$t(
            'plan.query.itemNumber'
          )}`"
          clearable
          @keyup.enter="handleQuery"
        />
      </el-form-item>
      <el-form-item
        :label="$t('plan.table.delayRiskIdentification')"
        prop="hasDelayRisk"
      >
        <el-input
      <el-row type="flex" justify="left">
        <el-col :span="12">
          <el-form-item
            :label="$t('plan.query.workOrderNo')"
            prop="workOrderNo"
          >
            <el-input
              :style="{ width: '280px' }"
              v-model="queryParams.workOrderNo"
              :placeholder="`${$t('common.common.placeholder')}${$t(
                'plan.query.workOrderNo'
              )}`"
              clearable
              @keyup.enter="handleQuery"
            />
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item
            :label="$t('plan.query.requireTraceID')"
            prop="requireTrackId"
          >
            <el-input
              :style="{ width: '280px' }"
              v-model="queryParams.requireTrackId"
              :placeholder="`${$t('common.common.placeholder')}${$t(
                'plan.query.requireTraceID'
              )}`"
              clearable
              @keyup.enter="handleQuery"
            />
          </el-form-item>
        </el-col>
      </el-row>
      <el-row type="flex" justify="left">
        <el-col :span="12">
          <el-form-item
            :label="$t('plan.query.itemNumber')"
            prop="mainPartNumber"
          >
            <el-input
              :style="{ width:'280px' }"
              v-model="queryParams.mainPartNumber"
              :placeholder="`${$t('common.common.placeholder')}${$t(
                'plan.query.itemNumber'
              )}`"
              clearable
              @keyup.enter="handleQuery"
            />
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item
            :label="$t('plan.table.delayRiskIdentification')"
            prop="hasDelayRisk"
          >
            <!-- <el-input
          :style="{ width: locale == 'zh' ? '200px' : '280px' }"
          v-model="queryParams.hasDelayRisk"
          :placeholder="`${$t('common.common.placeholder')}${$t(
@@ -60,20 +72,42 @@
          )}`"
          clearable
          @keyup.enter="handleQuery"
        />
      </el-form-item>
      <!-- </el-col>
        <el-col :span="14" style="text-align: right"> -->
      <el-form-item class="column-with-margin">
        <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>
      </el-form-item>
      <!-- </el-col>
      </el-row> -->
        /> -->
            <el-select
              clearable
              v-model="queryParams.hasDelayRisk"
              style="width: 280px"
            >
              <el-option
                v-for="item in delayRiskOptions"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              />
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col
          :span="24"
          style="
            display: flex;
            justify-content: flex-end;
            align-item: center;
            text-align: right;
          "
        >
          <el-form-item class="column-with-margin">
            <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>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <el-row :gutter="10" class="mb8">
@@ -84,7 +118,7 @@
          icon="Plus"
          :disabled="multiple"
          @click="handleBatchUpdatePlanDate"
          v-hasPermi="['apsPlatePlan:edit']"
          v-hasPermi="['ApsPlatOrderPlanManager:requirement:list']"
          >{{ $t("plan.btns.batchUpdateOrderDate") }}</el-button
        >
      </el-col>
@@ -93,6 +127,7 @@
          type="success"
          plain
          icon="Edit"
          :disabled="loadingGenerateList"
          @click="handleGenerateList"
          v-hasPermi="['apsPlatePlan:edit']"
          >{{ $t("plan.btns.generatePlanOrder") }}</el-button
@@ -120,7 +155,7 @@
          type="primary"
          link
          @click="handleCheckView(row)"
          v-hasPermi="['aps:calendar:update']"
          v-hasPermi="['ApsPlatOrderPlanManager:requirement:list']"
          >{{ $t("plan.btns.viewRequirement") }}</el-button
        >
      </template>
@@ -129,6 +164,7 @@
      :title="$t('plan.title.viewAssociatedRequirements')"
      v-model="openDialog"
      width="900px"
      style="height: 400px; overflow: hidden"
      append-to-body
    >
      <HxlhTable
@@ -136,13 +172,13 @@
        :columns="subGridOptions"
        :data="subList"
        :loading="loadingSub"
        :height="heightSub"
        :height="'280px'"
      >
      </HxlhTable>
      <template #footer>
        <span class="dialog-footer">
          <el-button @click="openDialog = false">{{
            $t("common.common.cancel")
            $t("common.common.close")
          }}</el-button>
        </span>
      </template>
@@ -151,11 +187,12 @@
      :title="$t('plan.btns.batchUpdateOrderDate')"
      v-model="openBatchDialog"
      width="900px"
      style="height: 400px; overflow: hidden"
      append-to-body
    >
      <div class="mode_box">
        <span>{{ $t("plan.title.setMode") }}</span>
        <el-radio-group v-model="radio">
        <el-radio-group v-model="radio" @change="changeRadioCustom">
          <el-radio :label="1">{{
            $t("plan.btns.batchUpdateOrderDate")
          }}</el-radio>
@@ -167,10 +204,17 @@
      <div class="red_color">{{ $t("plan.title.tipsBugSheetMetal") }}</div>
      <div class="mode_box" v-if="radio === 2">
        <span>{{ $t("plan.title.CustomizePlannedCompletionDate") }}</span>
        <el-date-picker
          v-model="value4"
        <!-- <el-date-picker
          v-model="customicDate"
          type="dates"
          :placeholder="$t('plan.title.CustomizePlannedCompletionDate')"
          @change="handleChangeCustomDate($event)"
        /> -->
        <el-date-picker
          v-model="customicDate"
          type="datetime"
          :placeholder="$t('plan.title.CustomizePlannedCompletionDate')"
          @change="handleChangeCustomDate($event)"
        />
      </div>
      <HxlhTable
@@ -179,7 +223,7 @@
        :columns="subUpdateGridOptions"
        :data="subUpdateList"
        :loading="loading"
        :height="heightSub"
        :height="'200px'"
      >
      </HxlhTable>
      <HxlhTable
@@ -188,7 +232,7 @@
        :columns="subUpdateCustomGridOptions"
        :data="subUpdateList"
        :loading="loading"
        :height="heightSub"
        :height="'200px'"
      >
      </HxlhTable>
      <template #footer>
@@ -196,22 +240,47 @@
          <el-button @click="openBatchDialog = false">{{
            $t("common.common.cancel")
          }}</el-button>
          <el-button
            type="primary"
            @click="hanleBatchUpdateDate"
            :disabled="loadingUpdateDate"
            v-hasPermi="['ApsPlatOrderPlanManager:requirement:list']"
            >{{ $t("common.common.batchUpdate") }}</el-button
          >
        </span>
      </template>
    </el-dialog>
  </div>
</template>
<script setup name="Calendar">
<script setup name="SheetMetalOrderManage">
import HxlhTable from "@/components/HxlhTable";
import { parseTime } from "@/utils/ruoyi.js";
import useBasicStore from "@/store/modules/request/basic/page";
import { listAll_plant } from "@/api/basicData/plant";
import { metalOrderManageList,metalOrderManageSubList,generatorPlanList } from "@/api/mainPlan/metalOrderManage.js";
import {
  metalOrderManageList,
  metalOrderManageSubList,
  generatorPlanList,
  planDateList,
} from "@/api/mainPlan/metalOrderManage.js";
import { useI18n } from "vue-i18n"; //要在js中使用国际化
import { ElMessage } from "element-plus";
const { t, locale } = useI18n();
const basicStore = useBasicStore();
const { proxy } = getCurrentInstance();
const delayRiskOptions = ref([
  {
    label: t("plan.options.hasRisk"),
    value: "1",
  },
  {
    label: t("plan.options.noRisk"),
    value: "0",
  },
]);
const radio = ref(1);
const customicDate = ref("");
const openDialog = ref(false);
const openBatchDialog = ref(false);
const subGridOptions = ref([]);
@@ -222,7 +291,9 @@
// const tableRef = ref();
const orderList = ref([]);
const loading = ref(false);
const loadingSub = ref(false)
const loadingUpdateDate = ref(false);
const loadingGenerateList = ref(false);
const loadingSub = ref(false);
const showSearch = ref(true);
const ids = ref([]);
const single = ref(true);
@@ -237,7 +308,7 @@
    pageNum: 1,
    pageSize: 10,
    workOrderNo: null,
    requireTraceId: null,
    requireTrackId: null,
    mainPartNumber: null,
    hasDelayRisk: null,
  },
@@ -247,7 +318,7 @@
const shopList = ref([]);
const allShopList = ref([]);
const processList = ref([]);
const height = ref(document.documentElement.clientHeight - 270 + "px;");
const height = ref(document.documentElement.clientHeight - 320 + "px;");
// 表格配置-列表
const columns = ref([]);
// 分页属性
@@ -260,7 +331,7 @@
  locale,
  (newLocale) => {
    columns.value = [
      { type: "checkbox", width: 60, align: "center" },
      { type: "checkbox", width: 60, align: "center", fixed: "left" },
      {
        title: t("basic.table.requirementID"),
        field: "requireId",
@@ -269,7 +340,7 @@
      },
      {
        title: t("basic.table.requirementTraceabilityID"),
        field: "requireTraceId",
        field: "requireTrackId",
        width: 200,
        align: "center",
      },
@@ -339,19 +410,19 @@
      {
        title: t("plan.table.planStartDay"),
        field: "planStartDay",
        width: 100,
        width: 200,
        align: "center",
      },
      {
        title: t("plan.table.planEndDayDate"),
        field: "planEndDay",
        width: 100,
        width: 200,
        align: "center",
      },
      {
        title: t("plan.table.workorderCreationTime"),
        field: "orderCreateTime",
        width: 100,
        width: 200,
        align: "center",
      },
      {
@@ -365,10 +436,19 @@
        field: "hasDelayRisk",
        width: 100,
        align: "center",
        formatter: ({ cellValue, row, column }) => {
          if (cellValue) {
            for (let i = 0; i < delayRiskOptions.value.length; i++) {
              if (cellValue === delayRiskOptions.value[i].value) {
                return delayRiskOptions.value[i].label;
              }
            }
          }
        },
      },
      {
        title: t("common.common.operate"),
        width: 100,
        width: 150,
        fixed: "right",
        slots: { default: "buttons" },
        align: "center",
@@ -488,6 +568,15 @@
        field: "hasDelayRisk",
        width: 100,
        align: "center",
        formatter: ({ cellValue, row, column }) => {
          if (cellValue) {
            for (let i = 0; i < delayRiskOptions.value.length; i++) {
              if (cellValue === delayRiskOptions.value[i].value) {
                return delayRiskOptions.value[i].label;
              }
            }
          }
        },
      },
    ];
    subUpdateGridOptions.value = [
@@ -499,7 +588,7 @@
      },
      {
        title: t("basic.table.requirementTraceabilityID"),
        field: "requireTraceId",
        field: "requireTrackId",
        width: 200,
        align: "center",
      },
@@ -530,25 +619,25 @@
      {
        title: t("plan.table.planStartDay"),
        field: "planStartDay",
        width: 100,
        width: 200,
        align: "center",
      },
      {
        title: t("plan.table.planEndDayDate"),
        field: "planEndDay",
        width: 100,
        width: 200,
        align: "center",
      },
      {
        title: t("plan.table.startDateOfDemandPlan"),
        field: "startDay",
        width: 100,
        field: "startDate",
        width: 200,
        align: "center",
      },
      {
        title: t("plan.table.requirementPlanCompletionDate"),
        field: "completeDay",
        width: 100,
        field: "completeDate",
        width: 200,
        align: "center",
      },
    ];
@@ -561,7 +650,7 @@
      },
      {
        title: t("basic.table.requirementTraceabilityID"),
        field: "requireTraceId",
        field: "requireTrackId",
        width: 200,
        align: "center",
      },
@@ -592,19 +681,19 @@
      {
        title: t("plan.table.planStartDay"),
        field: "planStartDay",
        width: 100,
        width: 200,
        align: "center",
      },
      {
        title: t("plan.table.planEndDayDate"),
        field: "planEndDay",
        width: 100,
        width: 200,
        align: "center",
      },
      {
        title: t("plan.table.customizePlannedCompletionDate"),
        field: "updateTime",
        width: 100,
        field: "customTime",
        width: 200,
        align: "center",
      },
    ];
@@ -614,63 +703,116 @@
    deep: true,
  }
);
function changeRadioCustom() {}
function handleBatchUpdatePlanDate() {
  openBatchDialog.value = true;
}
function handleChangeCustomDate(e) {
  customicDate.value = parseTime(e); //new Date(e).getFullYear()+ '-' + parseInt(new Date(e).getMonth()*1+1) + '-' +  new Date(e).getDate()
  console.log(customicDate.value, "chang date");
  if (radio.value == 2) {
    subUpdateList.value = subUpdateList.value.map((item) => {
      return {
        ...item,
        customTime: customicDate.value,
      };
    });
    console.log(subUpdateList.value, "changeRadioCustom");
  }
}
function handleCheckView(row) {
  openDialog.value = true;
  loadingSub.value = true;
  metalOrderManageSubList(row.workOrderNo).then((res)=>{
    subList.value = res;
    loadingSub.value = false;
    console.log(res,"metalOrderManageSubListmetalOrderManageSubList")
  }).catch(()=>{
    loadingSub.value = false;
  })
  metalOrderManageSubList(row.workOrderNo)
    .then((res) => {
      subList.value = res;
      loadingSub.value = false;
    })
    .catch(() => {
      loadingSub.value = false;
    });
}
async function handleGenerateList(){
  await generatorPlanList()
async function hanleBatchUpdateDate() {
  loadingUpdateDate.value = true;
  let planIds = subUpdateList.value.map((item) => {
    return item.id;
  });
  let res = null;
  console.log(planIds, "planIds");
  if (radio.value == 1) {
    res = await planDateList({
      isCustom: false,
      planIds,
    });
  } else {
    res = await planDateList({
      isCustom: true,
      planIds,
      customDate: customicDate.value,
    });
    console.log(res, "res planDateList");
  }
  if (res.code === 200) {
    ElMessage({
      message: t("plan.message.update"),
      type: "success",
    });
    openBatchDialog.value = false;
    loadingUpdateDate.value = false;
    getList();
  } else {
    openBatchDialog.value = true;
    loadingUpdateDate.value = false;
  }
}
async function handleGenerateList() {
  loadingGenerateList.value = true;
  const res = await generatorPlanList();
  if (res.code == 200) {
    ElMessage({
      message: t("plan.message.update"),
      type: "success",
    });
    loadingGenerateList.value = false;
    getList();
  } else {
    loadingGenerateList.value = false;
  }
}
/** 查询钣金工单计划管理列表 */
function getList() {
  loading.value = true;
  if (basicStore.sheetMetalOrderManageList&&basicStore.sheetMetalOrderManageList.rows) {
    orderList.value = basicStore.sheetMetalOrderManageList.rows;
    loading.value = false;
  } else {
    basicStore.getMetalOrderManagerList(queryParams.value).then((response) => {
  metalOrderManageList(queryParams.value)
    .then((response) => {
      orderList.value = response.rows;
      page.value.total = response.total;
      loading.value = false;
    }).catch(()=>{
    })
    .catch((res) => {
      loading.value = false;
    });
  }
  // metalOrderManageList(queryParams.value).then((response) => {
  //   orderList.value = response.rows;
  //   page.value.total = response.total;
  //   loading.value = false;
  // });
  // axios
  //   .all([
  //     /** 查询工厂列表 */
  //     listAll_plant({}),
  //     /** 查询车间列表 */
  //     listAll_shop({}),
  //   ])
  //   .then(
  //     axios.spread((response1, response2) => {
  //       plantList.value = response1.data;
  //       shopList.value = response2.data;
  //       loading.value = false;
  //     })
  //   )
  //   .catch((error) => {
  //     console.error("请求出错:", error);
  //   });
}
// axios
//   .all([
//     /** 查询工厂列表 */
//     listAll_plant({}),
//     /** 查询车间列表 */
//     listAll_shop({}),
//   ])
//   .then(
//     axios.spread((response1, response2) => {
//       plantList.value = response1.data;
//       shopList.value = response2.data;
//       loading.value = false;
//     })
//   )
//   .catch((error) => {
//     console.error("请求出错:", error);
//   });
/** 搜索按钮操作 */
function handleQuery() {
  console.log("111111");
  queryParams.value.pageNum = 1;
  getList();
}