From e1272fc62b4a8fc075ffb7af3d4ee3d11ab495d3 Mon Sep 17 00:00:00 2001 From: chengxiangling <291105840@qq.com> Date: 星期一, 12 五月 2025 10:00:42 +0800 Subject: [PATCH] 有风险无风险i18n字段 --- src/views/mainPlan/sheetMetalOrderManage/index.vue | 583 +++++++++++++++++++++++++++++++++++++++------------------ 1 files changed, 395 insertions(+), 188 deletions(-) diff --git a/src/views/mainPlan/sheetMetalOrderManage/index.vue b/src/views/mainPlan/sheetMetalOrderManage/index.vue index e2efa66..ddd90c4 100644 --- a/src/views/mainPlan/sheetMetalOrderManage/index.vue +++ b/src/views/mainPlan/sheetMetalOrderManage/index.vue @@ -6,58 +6,108 @@ ref="queryRef" :inline="true" v-show="showSearch" - :label-width="locale=='zh'?'110px':'200px'" + :label-width="locale == 'zh' ? '110px' : '200px'" > - <el-form-item :label="$t('plan.query.workOrderNo')" prop="description"> - <el-input - :style="{width:locale=='zh'? '200px':'280px'}" - v-model="queryParams.description" - :placeholder="`${$t('common.common.placeholder')}${$t('plan.query.workOrderNo')}`" + <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( + 'plan.table.delayRiskIdentification' + )}`" 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="description"> - <el-input - :style="{width:locale=='zh'? '200px':'280px'}" - v-model="queryParams.description" - :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="description"> - <el-input - :style="{width:locale=='zh'? '200px':'280px'}" - v-model="queryParams.description" - :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="description"> - <el-input - :style="{width:locale=='zh'? '200px':'280px'}" - v-model="queryParams.description" - :placeholder="`${$t('common.common.placeholder')}${$t('plan.table.delayRiskIdentification')}`" - 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-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-button icon="Refresh" @click="resetQuery">{{$t('common.common.reset')}}</el-button> - </el-form-item> - <!-- </el-col> - </el-row> --> + <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"> @@ -68,8 +118,8 @@ icon="Plus" :disabled="multiple" @click="handleBatchUpdatePlanDate" - v-hasPermi="['apsPlatePlan:edit']" - >{{$t('plan.btns.batchUpdateOrderDate')}}</el-button + v-hasPermi="['ApsPlatOrderPlanManager:requirement:list']" + >{{ $t("plan.btns.batchUpdateOrderDate") }}</el-button > </el-col> <el-col :span="1.5"> @@ -77,9 +127,10 @@ type="success" plain icon="Edit" - @click="handleUpdate" + :disabled="loadingGenerateList" + @click="handleGenerateList" v-hasPermi="['apsPlatePlan:edit']" - >{{$t('plan.btns.generatePlanOrder')}}</el-button + >{{ $t("plan.btns.generatePlanOrder") }}</el-button > </el-col> <right-toolbar @@ -90,7 +141,7 @@ <HxlhTable style="width: 100%" :columns="columns" - :data="calendarList" + :data="orderList" :loading="loading" :height="height" ref="tableRef" @@ -104,8 +155,8 @@ type="primary" link @click="handleCheckView(row)" - v-hasPermi="['aps:calendar:update']" - >{{$t('plan.btns.viewRequirement')}}</el-button + v-hasPermi="['ApsPlatOrderPlanManager:requirement:list']" + >{{ $t("plan.btns.viewRequirement") }}</el-button > </template> </HxlhTable> @@ -113,78 +164,123 @@ :title="$t('plan.title.viewAssociatedRequirements')" v-model="openDialog" width="900px" + style="height: 400px; overflow: hidden" append-to-body > <HxlhTable style="width: 100%" :columns="subGridOptions" :data="subList" - :loading="loading" - :height="heightSub" + :loading="loadingSub" + :height="'280px'" > </HxlhTable> + <template #footer> + <span class="dialog-footer"> + <el-button @click="openDialog = false">{{ + $t("common.common.close") + }}</el-button> + </span> + </template> </el-dialog> <el-dialog :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 :label="1">{{$t('plan.btns.batchUpdateOrderDate')}}</el-radio> - <el-radio :label="2">{{$t('plan.title.CustomizePlannedCompletionDate')}}</el-radio> + <span>{{ $t("plan.title.setMode") }}</span> + <el-radio-group v-model="radio" @change="changeRadioCustom"> + <el-radio :label="1">{{ + $t("plan.btns.batchUpdateOrderDate") + }}</el-radio> + <el-radio :label="2">{{ + $t("plan.title.CustomizePlannedCompletionDate") + }}</el-radio> </el-radio-group> </div> - <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" + <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="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 - v-if="radio===1" + v-if="radio === 1" style="width: 100%" :columns="subUpdateGridOptions" :data="subUpdateList" :loading="loading" - :height="heightSub" + :height="'200px'" > </HxlhTable> <HxlhTable - v-if="radio===2" + v-if="radio === 2" style="width: 100%" :columns="subUpdateCustomGridOptions" :data="subUpdateList" :loading="loading" - :height="heightSub" + :height="'200px'" > </HxlhTable> + <template #footer> + <span class="dialog-footer"> + <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 { - listCalendar, - getCalendar, - delCalendar, - addCalendar, - updateCalendar, -} from "@/api/basicData/calendar"; -import axios from "axios"; +import { parseTime } from "@/utils/ruoyi.js"; +import useBasicStore from "@/store/modules/request/basic/page"; import { listAll_plant } from "@/api/basicData/plant"; -import { listAll_shop, listAps_shop } from "@/api/basicData/shop"; -import { selectProcessNameList } from "@/api/basicData/processRoute.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([]); @@ -193,8 +289,11 @@ const subList = ref([]); const subUpdateList = ref([]); // const tableRef = ref(); -const calendarList = ref([]); -const loading = ref(true); +const orderList = ref([]); +const loading = 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); @@ -208,23 +307,18 @@ queryParams: { pageNum: 1, pageSize: 10, - description: null, - type: null, - effectiveDate: null, - expiringDate: null, - content: null, - applicableFactory: null, - applicableWorkshop: null, - applicableProcess: null, + workOrderNo: null, + requireTrackId: null, + mainPartNumber: null, + hasDelayRisk: null, }, }); const { queryParams, form, rules } = toRefs(data); -const typeRadioNumber = ref(1); const plantList = ref([]); const shopList = ref([]); const allShopList = ref([]); const processList = ref([]); -const height = ref(document.documentElement.clientHeight - 220 + "px;"); +const height = ref(document.documentElement.clientHeight - 320 + "px;"); // 琛ㄦ牸閰嶇疆-鍒楄〃 const columns = ref([]); // 鍒嗛〉灞炴�� @@ -237,64 +331,64 @@ locale, (newLocale) => { columns.value = [ - { type: "checkbox", width: 60, align: "center" }, + { type: "checkbox", width: 60, align: "center", fixed: "left" }, { title: t("basic.table.requirementID"), - field: "description", + field: "requireId", width: 150, align: "center", }, { title: t("basic.table.requirementTraceabilityID"), - field: "type", + field: "requireTrackId", width: 200, align: "center", }, { title: t("plan.table.workOrderNo"), - field: "effectiveDate", + field: "workOrderNo", width: 200, align: "center", }, { title: t("basic.table.matchQuantity"), - field: "expiringDate", + field: "deductionAmount", width: 200, align: "center", }, { title: t("basic.table.workOrderType"), - field: "expiringDate", + field: "workOrderType", width: 200, align: "center", }, { title: t("plan.table.itemNumber"), - field: "createTime", + field: "mainPartNumber", width: 200, align: "center", }, { title: t("plan.table.mainPartDrawingNumber"), - field: "createTime", + field: "mainPartDrawingNumber", width: 200, align: "center", }, { title: t("basic.table.mainCustomer"), - field: "createTime", + field: "customer", width: 200, align: "center", }, { title: t("plan.table.productionQuantity"), - field: "updateTime", + field: "productionQuantity", width: 100, align: "center", }, { title: t("basic.table.applicableFactories"), - field: "applicableFactory", + field: "applicableFactories", width: 200, align: "center", formatter: ({ cellValue, row, column }) => { @@ -309,43 +403,52 @@ }, { title: t("plan.table.productionBase"), - field: "updateTime", + field: "productionBase", width: 100, align: "center", }, { title: t("plan.table.planStartDay"), - field: "updateTime", - width: 100, + field: "planStartDay", + width: 200, align: "center", }, { title: t("plan.table.planEndDayDate"), - field: "updateTime", - width: 100, + field: "planEndDay", + width: 200, align: "center", }, { title: t("plan.table.workorderCreationTime"), - field: "updateTime", - width: 100, + field: "orderCreateTime", + width: 200, align: "center", }, { title: t("plan.table.mismatchedProductionQuantity"), - field: "updateTime", + field: "unmatchedQuantity", width: 100, align: "center", }, { title: t("plan.table.delayRiskIdentification"), - field: "updateTime", + 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", @@ -354,258 +457,362 @@ subGridOptions.value = [ { title: t("basic.table.requirementID"), - field: "description", + field: "id", width: 150, align: "center", }, { title: t("basic.table.requirementTraceabilityID"), - field: "type", + field: "requireId", width: 200, align: "center", }, { title: t("plan.table.itemNumber"), - field: "effectiveDate", + field: "bomLineCode", width: 200, align: "center", }, { title: t("plan.table.bomLowCode"), - field: "expiringDate", + field: "bomLineLevel", width: 200, align: "center", }, { title: t("plan.table.bomUsage"), - field: "expiringDate", + field: "bomUseAmount", width: 200, align: "center", }, { title: t("basic.table.processRouteID"), - field: "createTime", + field: "processRouteId", width: 200, align: "center", }, { title: t("plan.table.processRouteWorkingHours"), - field: "updateTime", + field: "processRouteHours", width: 100, align: "center", }, { title: t("plan.table.demandQuantity"), - field: "updateTime", + field: "requireAmount", width: 100, align: "center", }, { title: t("plan.table.netRequirement"), - field: "updateTime", + field: "netRequirement", width: 100, align: "center", }, { title: t("plan.table.planStartDay"), - field: "updateTime", + field: "startDate", width: 100, align: "center", }, { title: t("plan.table.planEndDayDate"), - field: "updateTime", + field: "completeDate", width: 100, align: "center", }, { title: t("plan.table.requirementDate"), - field: "updateTime", + field: "demandDate", width: 100, align: "center", }, { title: t("basic.table.applicableFactories"), - field: "updateTime", + field: "orgCode", width: 100, align: "center", }, { title: t("plan.table.productionBase"), - field: "updateTime", + field: "productionBase", width: 100, align: "center", }, { title: t("plan.table.matchState"), - field: "updateTime", + field: "matchState", width: 100, align: "center", + }, + { + title: t("plan.table.matchPattern"), + field: "matchMode", + width: 100, + align: "center", + }, + { + title: t("plan.table.unmatchedDemandQuantity"), + field: "unmatchedDemandAmount", + width: 100, + align: "center", + }, + { + title: t("plan.table.suggestedCompletionDate"), + field: "suggestedCompletionDate", + width: 100, + align: "center", + }, + { + title: t("plan.table.delayRiskIdentification"), + 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 = [ { title: t("basic.table.requirementID"), - field: "description", + field: "requireId", width: 150, align: "center", }, { title: t("basic.table.requirementTraceabilityID"), - field: "type", + field: "requireTrackId", width: 200, align: "center", }, { title: t("plan.table.workOrderNo"), - field: "effectiveDate", + field: "workOrderNo", width: 200, align: "center", }, { title: t("basic.table.matchQuantity"), - field: "expiringDate", + field: "deductionAmount", width: 200, align: "center", }, { title: t("basic.table.workOrderType"), - field: "expiringDate", + field: "workOrderType", width: 200, align: "center", }, { title: t("plan.table.itemNumber"), - field: "createTime", + field: "mainPartNumber", width: 200, align: "center", }, { title: t("plan.table.planStartDay"), - field: "updateTime", - width: 100, + field: "planStartDay", + width: 200, align: "center", }, { title: t("plan.table.planEndDayDate"), - field: "updateTime", - width: 100, + field: "planEndDay", + width: 200, align: "center", }, { title: t("plan.table.startDateOfDemandPlan"), - field: "updateTime", - width: 100, + field: "startDate", + width: 200, align: "center", }, { title: t("plan.table.requirementPlanCompletionDate"), - field: "updateTime", - width: 100, + field: "completeDate", + width: 200, align: "center", }, ]; subUpdateCustomGridOptions.value = [ { title: t("basic.table.requirementID"), - field: "description", + field: "requireId", width: 150, align: "center", }, { title: t("basic.table.requirementTraceabilityID"), - field: "type", + field: "requireTrackId", width: 200, align: "center", }, { title: t("plan.table.workOrderNo"), - field: "effectiveDate", + field: "workOrderNo", width: 200, align: "center", }, { title: t("basic.table.matchQuantity"), - field: "expiringDate", + field: "deductionAmount", width: 200, align: "center", }, { title: t("basic.table.workOrderType"), - field: "expiringDate", + field: "workOrderType", width: 200, align: "center", }, { title: t("plan.table.itemNumber"), - field: "createTime", + field: "mainPartNumber", width: 200, align: "center", }, { title: t("plan.table.planStartDay"), - field: "updateTime", - width: 100, + field: "planStartDay", + width: 200, align: "center", }, { title: t("plan.table.planEndDayDate"), - field: "updateTime", - width: 100, + field: "planEndDay", + width: 200, align: "center", }, { title: t("plan.table.customizePlannedCompletionDate"), - field: "updateTime", - width: 100, + field: "customTime", + width: 200, align: "center", }, - ] + ]; }, { immediate: true, 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; + }) + .catch(() => { + loadingSub.value = false; + }); } -/** 鏌ヨ鏃ュ巻绠$悊鍒楄〃 */ +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; + } +} +/** 鏌ヨ閽i噾宸ュ崟璁″垝绠$悊鍒楄〃 */ function getList() { loading.value = true; - listCalendar(queryParams.value).then((response) => { - calendarList.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); - // }); -} -// 琛ㄥ崟閲嶇疆 -function reset() { - proxy.resetForm("calendarRef"); + metalOrderManageList(queryParams.value) + .then((response) => { + orderList.value = response.rows; + page.value.total = response.total; + loading.value = false; + }) + .catch((res) => { + 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); +// }); /** 鎼滅储鎸夐挳鎿嶄綔 */ function handleQuery() { + console.log("111111"); queryParams.value.pageNum = 1; getList(); } @@ -642,16 +849,16 @@ .column-with-margin { margin-right: 0px; } -.mode_box{ +.mode_box { margin-left: 30px; margin-bottom: 10px; - & span{ + & span { padding-right: 20px; } } -.red_color{ - color:#f56c6c; - margin-bottom:10px; +.red_color { + color: #f56c6c; + margin-bottom: 10px; } .mart5 { margin-top: 5px; -- Gitblit v1.9.3