From c9120650b03c477c27ce5c9c492a416be21df1b0 Mon Sep 17 00:00:00 2001 From: chengxiangling <291105840@qq.com> Date: 星期五, 16 五月 2025 13:44:01 +0800 Subject: [PATCH] 提交负载统计更正 --- .env.development | 2 src/views/mainPlan/pipeProduceStatics/index.vue | 60 - src/views/demand/planManage/index.vue | 31 src/views/mainPlan/gasPlanning/index.vue | 981 +++++++++---------------------- src/utils/i18n/locales/plan/index.js | 2 package.json | 1 src/views/mainPlan/pipePlanning/index.vue | 548 +++++++++++++++++ src/api/basicData/bom/bom.js | 75 + src/views/system/dict/index.vue | 27 src/views/mainPlan/gasProduceStatics/index.vue | 103 ++ 10 files changed, 1,038 insertions(+), 792 deletions(-) diff --git a/.env.development b/.env.development index 9028dae..a4a0a7d 100644 --- a/.env.development +++ b/.env.development @@ -10,4 +10,4 @@ # 閰嶅悎鍚庣鏈嶅姟 # VITE_APP_LOCAL = 'int' # VITE_APP_LOCAL = 'zhl' -VITE_APP_LOCAL = 'int' \ No newline at end of file +VITE_APP_LOCAL = 'cxl' \ No newline at end of file diff --git a/package.json b/package.json index 5b44267..dbbebff 100644 --- a/package.json +++ b/package.json @@ -45,6 +45,7 @@ "devDependencies": { "@vitejs/plugin-vue": "5.0.5", "moment": "^2.30.1", + "qs": "^6.14.0", "sass": "1.77.5", "terser": "^5.39.0", "unplugin-auto-import": "^0.17.6", diff --git a/src/api/basicData/bom/bom.js b/src/api/basicData/bom/bom.js index 992d73b..6d5282c 100644 --- a/src/api/basicData/bom/bom.js +++ b/src/api/basicData/bom/bom.js @@ -1,67 +1,82 @@ -import request from '@/utils/request' +import request from "@/utils/request"; +import qs from "qs"; +// +export function refreshBomRouteStorageDataList() { + + return request({ + url: "/aps/refreshBomRouteStorageData", + method: "post", + headers: { + "Content-Type": "application/x-www-form-urlencoded", // 娉ㄦ剰锛氶�氬父axios浼氳嚜鍔ㄨ缃纭殑Content-Type锛岄櫎闈炰綘鐗瑰埆鎸囧畾浜唄eaders銆傚浜嶧ormData锛岄�氬父涓嶉渶瑕佹墜鍔ㄨ缃繖涓猦eader銆� + }, + data: qs.stringify({ + orgCode: "FORTUNA" + }), + }); +} // /ApsBomHeader/list export function listApsBomHeaderList(query) { return request({ - url: '/aps/ApsBomHeader/list', - method: 'get', - params: query - }) + url: "/aps/ApsBomHeader/list", + method: "get", + params: query, + }); } // /ApsBom/list export function listApsBomLineList(query) { return request({ - url: '/aps/ApsBom/list', - method: 'get', - params: query - }) + url: "/aps/ApsBom/list", + method: "get", + params: query, + }); } // /ApsBomHeader/refreshBomData export function listApsBomRefreshBomDataList() { return request({ - url: '/schedule/job/refreshBomData', - method: 'post', - }) + url: "/schedule/job/refreshBomData", + method: "post", + }); } // 鏌ヨBOM鏁版嵁绠$悊鍒楄〃 export function listApsBom(query) { return request({ - url: '/aps/ApsBom/list', - method: 'get', - params: query - }) + url: "/aps/ApsBom/list", + method: "get", + params: query, + }); } // 鏌ヨBOM鏁版嵁绠$悊璇︾粏 export function getApsBom(id) { return request({ - url: '/ApsBom/ApsBom/' + id, - method: 'get' - }) + url: "/ApsBom/ApsBom/" + id, + method: "get", + }); } // 鏂板BOM鏁版嵁绠$悊 export function addApsBom(data) { return request({ - url: '/ApsBom/ApsBom', - method: 'post', - data: data - }) + url: "/ApsBom/ApsBom", + method: "post", + data: data, + }); } // 淇敼BOM鏁版嵁绠$悊 export function updateApsBom(data) { return request({ - url: '/ApsBom/ApsBom', - method: 'put', - data: data - }) + url: "/ApsBom/ApsBom", + method: "put", + data: data, + }); } // 鍒犻櫎BOM鏁版嵁绠$悊 export function delApsBom(id) { return request({ - url: '/ApsBom/ApsBom/' + id, - method: 'delete' - }) + url: "/ApsBom/ApsBom/" + id, + method: "delete", + }); } diff --git a/src/utils/i18n/locales/plan/index.js b/src/utils/i18n/locales/plan/index.js index ca06fc2..4f6c083 100644 --- a/src/utils/i18n/locales/plan/index.js +++ b/src/utils/i18n/locales/plan/index.js @@ -58,6 +58,7 @@ selectMonth: "閫夋嫨鏈堜唤", statistical: "缁熻鏂瑰紡", selectDateRange: "閫夋嫨鍖洪棿", + selectDateMonth: "閫夋嫨鏈堜唤", requireTraceID: "闇�姹傝拷婧疘D", itemNumber: "鏂欏彿", pipelineOrderRequire: "绠¤矾璁㈠崟闇�姹�", @@ -283,6 +284,7 @@ selectMonth: "Select Month", statistical: "Statistical method", selectDateRange: "Select interval", + selectDateMonth: "Select Month", requireTraceID: "Require track ID", itemNumber: "Item number", pipelineOrderRequire: "Pipeline order requirements", diff --git a/src/views/demand/planManage/index.vue b/src/views/demand/planManage/index.vue index 790cbaf..409c6fb 100644 --- a/src/views/demand/planManage/index.vue +++ b/src/views/demand/planManage/index.vue @@ -39,7 +39,7 @@ plain icon="Plus" @click="handleAdd" - v-hasPermi="['aps:calendar:add']" + v-hasPermi="['aps:management:add']" >鏂板</el-button > </el-col> @@ -50,7 +50,7 @@ icon="Edit" :disabled="single" @click="handleUpdate(null)" - v-hasPermi="['aps:calendar:update']" + v-hasPermi="['aps:management:edit']" >淇敼</el-button > </el-col> @@ -61,7 +61,7 @@ icon="Delete" :disabled="multiple" @click="handleDelete" - v-hasPermi="['aps:calendar:remove']" + v-hasPermi="['aps:management:remove']" >鍒犻櫎</el-button > </el-col> @@ -88,27 +88,26 @@ type="primary" size="small" @click="handleUpdate(row)" - v-hasPermi="['aps:calendar:update']" + v-hasPermi="['aps:management:edit']" >淇敼</el-button > <el-button type="default" size="small" @click="handleSetCycle(row)" - v-hasPermi="['aps:calendar:remove']" + v-hasPermi="['aps:planCycle:edit']" >璁″垝鍛ㄦ湡</el-button > <el-button type="success" size="small" - v-hasPermi="['aps:calendar:remove']" >鐢熸垚璁″垝</el-button > <el-button type="danger" size="small" @click="handleDelete(row)" - v-hasPermi="['aps:calendar:remove']" + v-hasPermi="['aps:management:remove']" >鍒犻櫎</el-button > </template> @@ -264,6 +263,7 @@ const router = useRouter(); const { aps_area } = proxy.useDict("aps_area"); const { aps_plan_rule } = proxy.useDict("aps_plan_rule"); +const { aps_plan_type } = proxy.useDict("aps_plan_type"); const tableRef = ref(); const calendarList = ref([]); const open = ref(false); @@ -354,6 +354,15 @@ field: "type", width: 200, align: "center", + formatter: ({ cellValue, row, column }) => { + if (cellValue) { + for (let i = 0; i < aps_plan_type.value.length; i++) { + if (cellValue === aps_plan_type.value[i].value) { + return aps_plan_type.value[i].label; + } + } + } + }, }, { title: "璁″垝鎺掍骇鍖哄煙", @@ -511,6 +520,7 @@ // 璁″垝鍛ㄦ湡 function handleSetCycle(row) { openSetCycle.value = true; + console.log(row,row.id,"==========") if (!row.cycle) { formCycle.value = { cycle: { @@ -519,6 +529,7 @@ period: "1", periodStart: moment(Date.now()).format("YYYY-MM-DD"), periodEnd: "", + planId: row.id }, }; let nowTime = moment(formCycle.value.cycle.periodStart) @@ -530,7 +541,7 @@ } else { formCycle.value = row; } - console.log(formCycle.value, "formCycle.value"); + console.log(formCycle.value, "formCycle.value+++++==="); } function handleToggleExpand() { expand.value = !expand.value; @@ -572,14 +583,15 @@ }); } function submitFormCycle() { + console.log(formCycle.value,"formCycle.value=====") redundantOrderList({ ...formCycle.value.cycle, - planId: formCycle.value.id, }) .then((res) => { if (res.code === 200) { proxy.$modal.msgSuccess("鏇存柊鎴愬姛"); openSetCycle.value = false; + getList(); } else { openSetCycle.value = false; } @@ -587,7 +599,6 @@ .catch(() => { openSetCycle.value = false; }); - getList(); } function handleGoToCycle() { router.push({ diff --git a/src/views/mainPlan/gasPlanning/index.vue b/src/views/mainPlan/gasPlanning/index.vue index 4ec31aa..73ad321 100644 --- a/src/views/mainPlan/gasPlanning/index.vue +++ b/src/views/mainPlan/gasPlanning/index.vue @@ -9,7 +9,11 @@ > <el-row type="flex" justify="left"> <el-col :span="8"> - <el-form-item :style="{ width: '100%' }" :label="$t('plan.query.selectMonth')" prop="description"> + <el-form-item + :style="{ width: '100%' }" + :label="$t('plan.query.selectMonth')" + prop="description" + > <el-date-picker clearable v-model="queryParams.date" @@ -20,477 +24,275 @@ </el-date-picker> </el-form-item> </el-col> - <el-col :span="16" 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-col :span="8"> + <el-form-item + :label="$t('basic.table.applicableFactories')" + style="width: 100%" + prop="plant" + > + <el-select + clearable + v-model="queryParams.applicableFactory" + :placeholder="$t('basic.table.applicableFactories')" > - <el-button icon="Refresh" @click="resetQuery">{{$t("common.common.reset")}}</el-button> + <el-option + v-for="item in aps_factory" + :key="item.value" + :label="item.label" + :value="item.value" + /> + </el-select> + </el-form-item> + </el-col> + <el-col :span="8" 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-form> - <div class="box_container"> - <el-row> - <el-col :span="!clickedTableRef?22:20"> - <div class="title_text">{{$t('plan.title.pipePlanCapacity')}}</div> - </el-col> - <el-col :span="1" v-if="!clickedTableRef"> - <el-button - class="title_btn" - type="default" - @click="editRowEvent" >{{$t("common.common.edit")}}</el-button> - </el-col> - <el-col :span="1.8" v-if="clickedTableRef"> - <el-button - class="title_btn" - type="primary" - @click="saveRowEvent" - v-hasPermi="['aps:gasPipelineCapacityPlan:add']" - > - {{$t("common.common.save")}} - </el-button> - </el-col> - <el-col :span="1" v-if="clickedTableRef"> - <el-button - class="title_btn ml20" - type="default" - @click="handleCancleStaus">{{$t("common.common.cancel")}}</el-button> - </el-col> - </el-row> - - <div class="tabel_container"> - <!-- <HxlhTable + <!-- <div class="box_container"> --> + <el-row v-if="!clickedTableRefGas"> + <el-col :span="24" style="text-align: right; margin-bottom: 10px"> + <el-button class="title_btn" type="default" @click="editRowEventGas">{{ + $t("common.common.edit") + }}</el-button> + </el-col> + </el-row> + <el-row v-if="clickedTableRefGas"> + <el-col :span="24" style="text-align: right; margin-bottom: 10px"> + <el-button + class="title_btn" + type="primary" + @click="saveRowEvent1" + v-hasPermi="['aps:gasPipelineCapacityPlan:add']" + > + {{ $t("common.common.save") }} + </el-button> + <el-button + class="title_btn ml20" + type="default" + @click="handleCancleStausGas" + >{{ $t("common.common.cancel") }}</el-button + > + </el-col> + </el-row> + <!-- <div class="tabel_container"> --> + <!-- <HxlhTable style="width: 100%" :columns="columns" - :data="routePlanList" + :data="gasPlanList" :loading="loading" :height="height" - :editConfig="editConfig" > - <template #edit_role="{ row }"> - <vxe-select + </HxlhTable> --> + <vxe-table + border + ref="tableRef1" + show-overflow + size="small" + :loading="loading2" + :height="height" + :column-config="{ resizable: true, useKey: true }" + :data="gasPlanList" + > + <vxe-column + :width="locale === 'zh' ? '150px' : '200px'" + field="processName" + :title="$t('plan.table.satndardProcessName')" + fixed="left" + > + </vxe-column> + <vxe-column + field="orgCode" + :width="locale === 'zh' ? '150px' : '200px'" + :title="$t('plan.table.applicableFactories')" + fixed="left" + > + <template #default="{ row }"> + {{ formatTypeLabelPlant([row.orgCode]) }} + </template> + </vxe-column> + <vxe-column + :width="locale === 'zh' ? '150px' : '200px'" + field="dayProduceType" + :title="$t('plan.table.dayProduceType')" + > + <!-- <template #edit="{ row }"> + <el-select + clearable + v-model="row.dayProduceType" + style="width: 140px" + > + <el-option + v-for="type in dayProduceTypeOptions" + :key="type.value" + :label="type.label" + :value="type.value" + > + </el-option> + </el-select> + </template> --> + <template #default="{ row }"> + <div v-if="!clickedTableRefGas"> + <span>{{ formatTypeLabel([row.dayProduceType]) }}</span> + </div> + <div v-else> + <el-select + clearable v-model="row.dayProduceType" - :options="dayProduceTypeOptions" - filterable - ></vxe-select> - </template> - </HxlhTable> --> - <vxe-table - border - ref="tableRef" - show-overflow - :loading="loading" - :height="height" - :column-config="{ resizable: true, useKey: true }" - :data="routePlanList" - size="small" - > - <vxe-column field="processName" :width="locale === 'zh' ? '150px' : '200px'" :title="$t('plan.table.satndardProcessName')" fixed="left"> - </vxe-column> - <vxe-column - :width="locale === 'zh' ? '150px' : '200px'" - field="dayProduceType" - :title="$t('plan.table.dayProduceType')" - > - <!-- <template #edit="{ row }"> - <el-select - clearable - v-model="row.dayProduceType" - style="width: 140px" + style="width: 140px" + @change="handlechangeDayproduceType($event, row)" + > + <el-option + v-for="type in dayProduceTypeOptions" + :key="type.value" + :label="type.label" + :value="type.value" > - <el-option - v-for="type in dayProduceTypeOptions" - :key="type.value" - :label="type.label" - :value="type.value" - > - </el-option> - </el-select> - </template> --> - <template #default="{ row }"> - <div v-if="!clickedTableRef"> - <span>{{ formatTypeLabel([row.dayProduceType]) }}</span> - </div> - <div v-else> - <el-select - clearable - v-model="row.dayProduceType" - style="width: 140px" - @change="handlechangeDayproduceType($event,row)" - > - <el-option - v-for="type in dayProduceTypeOptions" - :key="type.value" - :label="type.label" - :value="type.value" - > - </el-option> - </el-select> - </div> - </template> - </vxe-column> - <vxe-column - :width="locale === 'zh' ? '180px' : '200px'" - field="dayProduceNum" - :title="$t('plan.table.dayProduceNum')" - > - <!-- <template #edit="{ row }"> + </el-option> + </el-select> + </div> + </template> + </vxe-column> + <vxe-column + :width="locale === 'zh' ? '180px' : '200px'" + field="dayProduceNum" + :title="$t('plan.table.dayProduceNum')" + > + <!-- <template #edit="{ row }"> <el-input-number v-model="row.dayProduceNum" size="mini" /> </template> --> - <template #default="{ row }"> - <div v-if="!clickedTableRef"> - <span>{{ row.dayProduceNum }}</span> - </div> - <div v-else> - <el-input-number @change="cellClickEvent($event,row)" v-model="row.dayProduceNum" size="mini" /> - </div> - </template> - </vxe-column> - <vxe-column - :width="locale === 'zh' ? '150px' : '200px'" - field="dayProduceUnit" - :title="$t('plan.table.dayProduceUnit')" - > - <!-- <template #edit="{ row }"> + <template #default="{ row }"> + <div v-if="!clickedTableRefGas"> + <span>{{ row.dayProduceNum }}</span> + </div> + <div v-else> + <el-input-number + @change="cellClickEvent($event, row)" + v-model="row.dayProduceNum" + size="mini" + /> + </div> + </template> + </vxe-column> + <vxe-column + :width="locale === 'zh' ? '150px' : '200px'" + field="dayProduceUnit" + :title="$t('plan.table.dayProduceUnit')" + > + <!-- <template #edit="{ row }"> <el-input v-model="row.dayProduceUnit" /> </template> --> - <template #default="{ row }"> - <div v-if="!clickedTableRef"> - <span>{{ row.dayProduceUnit }}</span> - </div> - <div v-else> - <el-input v-model="row.dayProduceUnit" /> - </div> - </template> - </vxe-column> - <vxe-column - :width="locale === 'zh' ? '180px' : '200px'" - field="personnelNumber" - :title="$t('plan.table.personnelNumber')" - > - <!-- <template #edit="{ row }"> + <template #default="{ row }"> + <div v-if="!clickedTableRefGas"> + <span>{{ row.dayProduceUnit }}</span> + </div> + <div v-else> + <el-input v-model="row.dayProduceUnit" /> + </div> + </template> + </vxe-column> + <vxe-column + :width="locale === 'zh' ? '180px' : '200px'" + field="personnelNumber" + :title="$t('plan.table.personnelNumber')" + > + <!-- <template #edit="{ row }"> <el-input-number v-model="row.personnelNumber" /> </template> --> - <template #default="{ row }"> - <div v-if="!clickedTableRef"> - <span>{{ row.personnelNumber }}</span> - </div> - <div v-else> - <el-input-number @change="cellClickEvent($event,row)" v-model="row.personnelNumber" /> - </div> - </template> - </vxe-column> - <vxe-column - :width="locale === 'zh' ? '180px' : '200px'" - field="dayProduceAllNum" - :title="$t('plan.table.dayProduceAllNum')" - > - <!-- <template #edit="{ row }"> + <template #default="{ row }"> + <div v-if="!clickedTableRefGas"> + <span>{{ row.personnelNumber }}</span> + </div> + <div v-else> + <el-input-number + @change="cellClickEvent($event, row)" + v-model="row.personnelNumber" + /> + </div> + </template> + </vxe-column> + <vxe-column + :width="locale === 'zh' ? '180px' : '200px'" + field="dayProduceAllNum" + :title="$t('plan.table.dayProduceAllNum')" + > + <!-- <template #edit="{ row }"> <el-input-number v-model="row.dayProduceAllNum" disabled /> </template> --> - <template #default="{ row }"> - <div v-if="!clickedTableRef"> - <span>{{ row.dayProduceAllNum }}</span> - </div> - <div v-else> - <el-input-number v-model="row.dayProduceAllNum" disabled /> - </div> - </template> - </vxe-column> - <vxe-column - :width="locale === 'zh' ? '180px' : '200px'" - field="days" - :title="$t('plan.table.days')" - > - <!-- <template #edit="{ row }"> + <template #default="{ row }"> + <div v-if="!clickedTableRefGas"> + <span>{{ row.dayProduceAllNum }}</span> + </div> + <div v-else> + <el-input-number v-model="row.dayProduceAllNum" disabled /> + </div> + </template> + </vxe-column> + <vxe-column + :width="locale === 'zh' ? '180px' : '200px'" + field="days" + :title="$t('plan.table.days')" + > + <!-- <template #edit="{ row }"> <el-input-number v-model="row.days" /> </template> --> - <template #default="{ row }"> - <div v-if="!clickedTableRef"> - <span>{{ row.days }}</span> - </div> - <div v-else> - <el-input-number @change="cellClickEvent($event,row)" v-model="row.days" /> - </div> - </template> - </vxe-column> - <vxe-column - :width="locale === 'zh' ? '180px' : '200px'" - field="monthProduceAllNum" - :title="$t('plan.table.monthProduceAllNum')" - > - <!-- <template #edit="{ row }"> + <template #default="{ row }"> + <div v-if="!clickedTableRefGas"> + <span>{{ row.days }}</span> + </div> + <div v-else> + <el-input-number + @change="cellClickEvent($event, row)" + v-model="row.days" + /> + </div> + </template> + </vxe-column> + <vxe-column + :width="locale === 'zh' ? '180px' : '200px'" + field="monthProduceAllNum" + :title="$t('plan.table.monthProduceAllNum')" + > + <!-- <template #edit="{ row }"> <el-input-number v-model="row.monthProduceAllNum" disabled /> </template> --> - <template #default="{ row }"> - <div v-if="!clickedTableRef"> - <span>{{ row.monthProduceAllNum }}</span> - </div> - <div v-else> - <el-input-number v-model="row.monthProduceAllNum" disabled/> - </div> - </template> - </vxe-column> - <vxe-column - :width="locale === 'zh' ? '150px' : '200px'" - field="remark" - :title="$t('plan.table.remark')" - > - <!-- :edit-render="{ autoFocus: 'input' }" --> - <!-- <template #edit="{ row }"> + <template #default="{ row }"> + <div v-if="!clickedTableRefGas"> + <span>{{ row.monthProduceAllNum }}</span> + </div> + <div v-else> + <el-input-number v-model="row.monthProduceAllNum" disabled /> + </div> + </template> + </vxe-column> + <vxe-column + :width="locale === 'zh' ? '150px' : '200px'" + field="remark" + :title="$t('plan.table.remark')" + > + <!-- <template #edit="{ row }"> <el-input type="text" v-model="row.remark" /> </template> --> - <template #default="{ row }"> - <div v-if="!clickedTableRef"> - <span>{{ row.remark }}</span> - </div> - <div v-else> - <el-input - type="text" - v-model="row.remark" - /> - </div> - </template> - </vxe-column> - <!-- <vxe-column title="鎿嶄綔" width="200" fixed="right"> - <template #default="{ row }"> - <template v-if="hasEditStatus(row)"> - <el-button - @click="saveRowEvent(row)" - v-hasPermi="['aps:gasPipelineCapacityPlan:add']" - >淇濆瓨</el-button - > - <el-button @click="cancelRowEvent()">鍙栨秷</el-button> - </template> - <template v-else> - <el-button @click="editRowEvent(row)">缂栬緫</el-button> - </template> - </template> - </vxe-column> --> - </vxe-table> - </div> - </div> - <div class="box_container"> - <el-row> - <el-col :span="!clickedTableRefGas?22:20"> - <div class="title_text">{{$t("plan.title.gasPlanCapacity")}}</div> - </el-col> - <el-col :span="1" v-if="!clickedTableRefGas"> - <el-button - class="title_btn" - type="default" - @click="editRowEventGas" >{{$t("common.common.edit")}}</el-button> - </el-col> - <el-col :span="1.8" v-if="clickedTableRefGas"> - <el-button - class="title_btn" - type="primary" - @click="saveRowEvent1" - v-hasPermi="['aps:gasPipelineCapacityPlan:add']" - > - {{$t("common.common.save")}} - </el-button> - </el-col> - <el-col :span="1" v-if="clickedTableRefGas"> - <el-button - class="title_btn ml20" - type="default" - @click="handleCancleStausGas">{{$t("common.common.cancel")}}</el-button> - </el-col> - </el-row> - <div class="tabel_container"> - <!-- <HxlhTable - style="width: 100%" - :columns="columns" - :data="gasPlanList" - :loading="loading" - :height="height" - > - </HxlhTable> --> - <vxe-table - border - ref="tableRef1" - show-overflow - size="small" - :loading="loading2" - :height="height" - :column-config="{ resizable: true, useKey: true }" - :data="gasPlanList" - > - <vxe-column :width="locale === 'zh' ? '150px' : '200px'" field="processName" :title="$t('plan.table.satndardProcessName')" fixed="left"> - </vxe-column> - <vxe-column - :width="locale === 'zh' ? '150px' : '200px'" - field="dayProduceType" - :title="$t('plan.table.dayProduceType')" - > - <!-- <template #edit="{ row }"> - <el-select - clearable - v-model="row.dayProduceType" - style="width: 140px" - > - <el-option - v-for="type in dayProduceTypeOptions" - :key="type.value" - :label="type.label" - :value="type.value" - > - </el-option> - </el-select> - </template> --> - <template #default="{ row }"> - <div v-if="!clickedTableRefGas"> - <span>{{ formatTypeLabel([row.dayProduceType]) }}</span> - </div> - <div v-else> - <el-select - clearable - v-model="row.dayProduceType" - style="width: 140px" - @change="handlechangeDayproduceType($event,row)" - > - <el-option - v-for="type in dayProduceTypeOptions" - :key="type.value" - :label="type.label" - :value="type.value" - > - </el-option> - </el-select> - </div> - </template> - </vxe-column> - <vxe-column - :width="locale === 'zh' ? '180px' : '200px'" - field="dayProduceNum" - :title="$t('plan.table.dayProduceNum')" - > - <!-- <template #edit="{ row }"> - <el-input-number v-model="row.dayProduceNum" size="mini" /> - </template> --> - <template #default="{ row }"> - <div v-if="!clickedTableRefGas"> - <span>{{ row.dayProduceNum }}</span> - </div> - <div v-else> - <el-input-number @change="cellClickEvent($event,row)" v-model="row.dayProduceNum" size="mini" /> - </div> - </template> - </vxe-column> - <vxe-column - :width="locale === 'zh' ? '150px' : '200px'" - field="dayProduceUnit" - :title="$t('plan.table.dayProduceUnit')" - > - <!-- <template #edit="{ row }"> - <el-input v-model="row.dayProduceUnit" /> - </template> --> - <template #default="{ row }"> - <div v-if="!clickedTableRefGas"> - <span>{{ row.dayProduceUnit }}</span> - </div> - <div v-else> - <el-input v-model="row.dayProduceUnit" /> - </div> - </template> - </vxe-column> - <vxe-column - :width="locale === 'zh' ? '180px' : '200px'" - field="personnelNumber" - :title="$t('plan.table.personnelNumber')" - > - <!-- <template #edit="{ row }"> - <el-input-number v-model="row.personnelNumber" /> - </template> --> - <template #default="{ row }"> - <div v-if="!clickedTableRefGas"> - <span>{{ row.personnelNumber }}</span> - </div> - <div v-else> - <el-input-number @change="cellClickEvent($event,row)" v-model="row.personnelNumber" /> - </div> - </template> - </vxe-column> - <vxe-column - :width="locale === 'zh' ? '180px' : '200px'" - field="dayProduceAllNum" - :title="$t('plan.table.dayProduceAllNum')" - > - <!-- <template #edit="{ row }"> - <el-input-number v-model="row.dayProduceAllNum" disabled /> - </template> --> - <template #default="{ row }"> - <div v-if="!clickedTableRefGas"> - <span>{{ row.dayProduceAllNum }}</span> - </div> - <div v-else> - <el-input-number v-model="row.dayProduceAllNum" disabled /> - </div> - </template> - </vxe-column> - <vxe-column - :width="locale === 'zh' ? '180px' : '200px'" - field="days" - :title="$t('plan.table.days')" - > - <!-- <template #edit="{ row }"> - <el-input-number v-model="row.days" /> - </template> --> - <template #default="{ row }"> - <div v-if="!clickedTableRefGas"> - <span>{{ row.days }}</span> - </div> - <div v-else> - <el-input-number @change="cellClickEvent($event,row)" v-model="row.days" /> - </div> - </template> - </vxe-column> - <vxe-column - :width="locale === 'zh' ? '180px' : '200px'" - field="monthProduceAllNum" - :title="$t('plan.table.monthProduceAllNum')" - > - <!-- <template #edit="{ row }"> - <el-input-number v-model="row.monthProduceAllNum" disabled /> - </template> --> - <template #default="{ row }"> - <div v-if="!clickedTableRefGas"> - <span>{{ row.monthProduceAllNum }}</span> - </div> - <div v-else> - <el-input-number v-model="row.monthProduceAllNum" disabled/> - </div> - </template> - </vxe-column> - <vxe-column - :width="locale === 'zh' ? '150px' : '200px'" - field="remark" - :title="$t('plan.table.remark')" - > - <!-- <template #edit="{ row }"> - <el-input - type="text" - v-model="row.remark" - /> - </template> --> - <template #default="{ row }"> - <div v-if="!clickedTableRefGas"> - <span>{{ row.remark }}</span> - </div> - <div v-else> - <el-input - type="text" - v-model="row.remark" - /> - </div> - </template> - </vxe-column> - <!-- <vxe-column title="鎿嶄綔" width="200" fixed="right"> + <template #default="{ row }"> + <div v-if="!clickedTableRefGas"> + <span>{{ row.remark }}</span> + </div> + <div v-else> + <el-input type="text" v-model="row.remark" /> + </div> + </template> + </vxe-column> + <!-- <vxe-column title="鎿嶄綔" width="200" fixed="right"> <template #default="{ row }"> <template v-if="hasEditStatus1(row)"> <el-button @@ -505,27 +307,28 @@ </template> </template> </vxe-column> --> - </vxe-table> - <!-- <div class="btn_center"> + </vxe-table> + <!-- <div class="btn_center"> <el-button type="primary" @click="handleSave2">淇濆瓨</el-button> </div> --> - </div> - </div> + <!-- </div> --> + <!-- </div> --> </div> </template> <script setup name="GasPlanning"> // import { ElMessage } from "element-plus"; import { listGasPlan, getGasPlanSave } from "@/api/mainPlan/gasPlanning"; -const height = ref(document.documentElement.clientHeight - 400 + "px;"); import { useI18n } from "vue-i18n"; //瑕佸湪js涓娇鐢ㄥ浗闄呭寲 +const height = ref(document.documentElement.clientHeight - 230 + "px;"); const { t, locale } = useI18n(); -const loading = ref(false); +const { proxy } = getCurrentInstance(); +const { aps_factory } = proxy.useDict("aps_factory"); const loading2 = ref(false); -const clickedQuery = ref(false); const clickedQuery2 = ref(false); const data = reactive({ queryParams: { date: "", + applicableFactory: "", }, }); const tableRef = ref(); @@ -552,150 +355,31 @@ } return ""; }; -// 琛ㄦ牸閰嶇疆 -// const columns = ref([ -// // { -// // title: "瑙勫垝骞翠唤", -// // field: "year", -// // width: 150, -// // }, -// // { -// // title: "瑙勫垝鏈堜唤", -// // field: "month", -// // }, -// // { -// // title: "涓撲笟", -// // field: "major", -// // width: 100, -// // }, -// { -// title: "鏍囧噯宸ュ簭鍚嶇О", -// field: "processName", -// width: 100, -// }, -// { -// title: "鏃ヤ骇鍑虹被鍨�", -// field: "dayProduceType", -// width: 140, -// editRender: {}, -// slots: { edit: "edit_role", default: "default_role" }, -// }, -// { -// title: "鏃ヤ骇鍑烘暟閲�", -// field: "dayProduceNum", -// width: 140, -// // editRender: { autoFocus: "input" }, -// // slots: { edit: "edit_name", default: "default_name" }, -// }, -// { -// title: "鏃ヤ骇鍑烘暟閲忓崟浣�", -// field: "dayProduceUnit", -// width: 140, -// }, -// { -// title: "浜哄憳鏁伴噺", -// field: "personnelNumber", -// width: 140, -// type: "html", -// }, -// { -// title: "鏃ヤ骇鍑烘�绘暟閲�", -// field: "dayProduceAllNum", -// width: 140, -// type: "html", -// }, -// { -// title: "澶╂暟", -// field: "days", -// width: 120, -// // format: 'YYYY-MM-DD' -// }, -// { -// title: "鏈堜骇鍑烘�绘暟閲�", -// field: "monthProduceAllNum", -// width: 140, -// type: "html", -// }, -// { -// title: "澶囨敞", -// field: "remark", -// width: 140, -// type: "html", -// }, -// ]); -// const hasEditStatus = (row) => { -// const $table = tableRef.value; -// if ($table) { -// return $table.isEditByRow(row); -// } -// }; -const editRowEvent = () => { - clickedTableRef.value = true; +const formatTypeLabelPlant = (list) => { + if (list) { + return list + .map((type) => { + const item = aps_factory.value.find( + (item) => item.value === type + ); + return item ? item.label : type; + }) + .join(""); + } + return ""; }; const editRowEventGas = () => { clickedTableRefGas.value = true; }; -const saveRowEvent = (row) => { - if (!queryParams.value.date) { - ElMessage({ - message: "璇烽�夋嫨骞存湀", - type: "error", - }); - return; - } - const $table = tableRef.value; - if ($table) { - $table.clearEdit().then(() => { - loading.value = true - // setTimeout(() => { - // loading.value = false - // VxeUI.modal.message({ content: `淇濆瓨鎴愬姛锛乶ame=${row.name}`, status: 'success' }) - // }, 300) - handleSave("绠¤矾"); - clickedTableRef.value = false; - }); - } -}; -const handleCancelAllStatus = ()=>{ - handleCancleStaus(); - handleCancleStausGas(); -} -const handleCancleStaus = () => { - clickedTableRef.value = false; - if(!clickedQuery.value){ - return - } - const year = queryParams.value.date.split("-")[0]; - const month = parseInt(queryParams.value.date.split("-")[1]); - getRouteList(year, month); -}; const handleCancleStausGas = () => { clickedTableRefGas.value = false; - if(!clickedQuery2.value){ - return + if (!clickedQuery2.value) { + return; } const year = queryParams.value.date.split("-")[0]; const month = parseInt(queryParams.value.date.split("-")[1]); getGasList(year, month); -} -// const cancelRowEvent = () => { -// const $table = tableRef.value; -// if ($table) { -// $table.clearEdit(); -// } -// }; -// const hasEditStatus1 = (row) => { -// const $table = tableRef1.value; -// if ($table) { -// return $table.isEditByRow(row); -// } -// }; -// const editRowEvent1 = (row) => { -// const $table = tableRef1.value; -// if ($table) { -// $table.setEditRow(row); -// } -// }; +}; const saveRowEvent1 = (row) => { if (!queryParams.value.date) { ElMessage({ @@ -723,50 +407,19 @@ // $table.clearEdit(); // } // }; -async function getRouteList(year, month) { - loading.value = true; - const res = await listGasPlan({ - major: "绠¤矾", - year, - month, - }); - routePlanList.value = res.rows; - routePlanList.value = routePlanList.value.map((item, index) => { - return { - ...item, - dayProduceType: - item.dayProduceType == null ? "1" : item.dayProduceType, - dayProduceNum: item.dayProduceNum == null ? "0" : item.dayProduceNum, - dayProduceUnit: - item.dayProduceUnit == null ? "灏忔椂" : item.dayProduceUnit, - personnelNumber: - item.personnelNumber == null ? "1" : item.personnelNumber, - dayProduceAllNum: - item.dayProduceAllNum == null - ? "0" - : item.dayProduceNum * item.personnelNumber, - days: item.days == null ? "22" : item.days, - monthProduceAllNum: - item.monthProduceAllNum == null - ? "0" - : item.dayProduceAllNum * item.days, - }; - }); - loading.value = false; -} async function getGasList(year, month) { loading2.value = true; const res = await listGasPlan({ major: "姘旀煖", year, month, + orgCode: queryParams.value.applicableFactory, }); gasPlanList.value = res.rows; gasPlanList.value = gasPlanList.value.map((item, index) => { return { ...item, - dayProduceType: - item.dayProduceType == null ? "1" : item.dayProduceType, + dayProduceType: item.dayProduceType == null ? "1" : item.dayProduceType, dayProduceNum: item.dayProduceNum == null ? "0" : item.dayProduceNum, dayProduceUnit: item.dayProduceUnit == null ? "灏忔椂" : item.dayProduceUnit, @@ -790,27 +443,26 @@ // if(row.dayProduceType==="1"){ // row.dayProduceAllNum = row.dayProduceNum * row.personnelNumber; // }else{ - + // row.dayProduceAllNum = row.dayProduceNum // } // row.monthProduceAllNum = row.dayProduceAllNum * row.days; // } function cellClickEvent(e, row) { - if(row.dayProduceType==="1"){ + if (row.dayProduceType === "1") { row.dayProduceAllNum = row.dayProduceNum * row.personnelNumber; - }else{ - - row.dayProduceAllNum = row.dayProduceNum + } else { + row.dayProduceAllNum = row.dayProduceNum; } row.monthProduceAllNum = row.dayProduceAllNum * row.days; } -function handlechangeDayproduceType(e,row){ +function handlechangeDayproduceType(e, row) { row.dayProduceAllNum = "0"; row.monthProduceAllNum = "0"; - if(e=="1"){ + if (e == "1") { row.dayProduceAllNum = row.dayProduceNum * row.personnelNumber; - }else if(e=="2"){ - row.dayProduceAllNum = row.dayProduceNum + } else if (e == "2") { + row.dayProduceAllNum = row.dayProduceNum; } row.monthProduceAllNum = row.dayProduceAllNum * row.days; } @@ -824,14 +476,13 @@ } const year = queryParams.value.date.split("-")[0]; const month = parseInt(queryParams.value.date.split("-")[1]); - getRouteList(year, month); + // getRouteList(year, month); getGasList(year, month); - clickedQuery.value = true; - clickedQuery2.value = true + clickedQuery2.value = true; } function resetQuery() { queryParams.value.date = ""; - clickedQuery.value = false; + queryParams.value.applicableFactory = ""; clickedQuery2.value = false; gasPlanList.value = []; routePlanList.value = []; @@ -839,71 +490,27 @@ async function handleSave(major) { const year = queryParams.value.date.split("-")[0]; const month = parseInt(queryParams.value.date.split("-")[1]); - if (major === "绠¤矾") { - routePlanList.value = routePlanList.value.map((item) => { - return { - ...item, - major: "绠¤矾", - year, - month, - }; - }); - await getGasPlanSave([...routePlanList.value]); - } else { + if (major === "姘旀煖") { gasPlanList.value = gasPlanList.value.map((item) => { return { ...item, major: "姘旀煖", year, month, + orgCode: queryParams.value.applicableFactory, }; }); - await getGasPlanSave([...gasPlanList.value]); + const res = await getGasPlanSave([...gasPlanList.value]); + if (res.code == 200) { + ElMessage({ + message: "鏁版嵁淇濆瓨鎴愬姛", + type: "success", + }); + loading2.value = false; + handleQuery(); + } } - - ElMessage({ - message: "鏁版嵁淇濆瓨鎴愬姛", - type: "success", - }); - loading.value = false; - loading2.value = false; - handleQuery(); } -// async function handleSave2(row) { -// const year = queryParams.value.date.split("-")[0]; -// const month = parseInt(queryParams.value.date.split("-")[1]); -// console.log(row, "baocun"); -// // gasPlanList.value = gasPlanList.value.map((item) => { -// // return { -// // ...item, -// // major: "姘斾綋", -// // year, -// // month, -// // }; -// // }); -// // routePlanList.value = routePlanList.value.map((item) => { -// // return { -// // ...item, -// // major: "绠¤矾", -// // year, -// // month, -// // }; -// // }); -// const res = await getGasPlanSave([ -// { -// ...row, -// major: "姘旀煖", -// year, -// month, -// }, -// ]); -// ElMessage({ -// message: "鏁版嵁淇濆瓨鎴愬姛", -// type: "success", -// }); -// handleQuery(); -// console.log(res, "akiwjciwj"); -// } </script> <style lang="scss" scoped> .column-with-margin { @@ -921,8 +528,8 @@ } .title_btn { margin-top: 20px; - &.ml20{ - margin-left:20px; + &.ml20 { + margin-left: 20px; } } .tabel_container { diff --git a/src/views/mainPlan/gasProduceStatics/index.vue b/src/views/mainPlan/gasProduceStatics/index.vue index b3a5a46..3bb1eee 100644 --- a/src/views/mainPlan/gasProduceStatics/index.vue +++ b/src/views/mainPlan/gasProduceStatics/index.vue @@ -10,11 +10,12 @@ > <el-row :gutter="20"> <el-col :span="8"> - <el-form-item :label="$t('plan.query.statistical')" :style="{ width: '100%' }"> + <el-form-item :label="$t('plan.query.statistical')" > <el-select v-model="queryParams.searchType" placeholder="Select" @change="handleChangeSelectType" + :style="{ width: '270px' }" > <el-option v-for="item in options" @@ -26,9 +27,10 @@ </el-form-item> </el-col> <el-col :span="8"> - <el-form-item :label="$t('plan.query.selectDateRange')" :style="{ width: '100%' }"> + <el-form-item :label="!dayCom?$t('plan.query.selectDateRange'):$t('plan.query.selectDateMonth')"> <div v-if="!dayCom"> <el-date-picker + :style="{ width: '240px' }" v-model="queryParams.monthRange" type="monthrange" :range-separator="$t('plan.placeholder.to')" @@ -38,6 +40,7 @@ </div> <div v-else> <el-date-picker + :style="{ width: '200px' }" v-model="queryParams.monthDays" type="month" :placeholder="$t('plan.placeholder.selectMonth')" @@ -45,7 +48,27 @@ </div> </el-form-item> </el-col> - <el-col :span="8" style="text-align:right;"> + <el-col :span="8" v-if="!dayCom"> + <el-form-item + :label="$t('basic.table.applicableFactories')" + prop="plant" + > + <el-select + :style="{ width: '300px' }" + clearable + v-model="queryParams.applicableFactory" + :placeholder="$t('basic.table.applicableFactories')" + > + <el-option + v-for="item in aps_factory" + :key="item.value" + :label="item.label" + :value="item.value" + /> + </el-select> + </el-form-item> + </el-col> + <!-- <el-col :span="8" style="text-align:right;"> <el-form-item class="column-with-margin"> <el-button type="primary" icon="Search" @click="handleQuery">{{ $t("common.common.query") @@ -54,7 +77,7 @@ $t("common.common.reset") }}</el-button> </el-form-item> - </el-col> + </el-col> --> </el-row> </el-form> <el-row :gutter="10" class="mb8"> @@ -80,7 +103,7 @@ >{{ $t("common.common.update") }}</el-button > </el-col> - <right-toolbar @queryTable="handleQuery" :search="false"></right-toolbar> + <right-toolbar @queryTable="handleQuery"></right-toolbar> </el-row> <vxe-grid ref="gridRef" v-bind="gridOptions" :loading="loading"></vxe-grid> </div> @@ -97,12 +120,12 @@ import { useI18n } from "vue-i18n"; //瑕佸湪js涓娇鐢ㄥ浗闄呭寲 const { t, locale } = useI18n(); const { proxy } = getCurrentInstance(); - +const { aps_factory } = proxy.useDict("aps_factory"); const loading = ref(false); const gridRef = ref(); const height = ref(document.documentElement.clientHeight - 180 + "px;"); const headers = ref([]); -const exportData = ref([]); +// const exportData = ref([]); const showSearch = ref(true); const data = reactive({ queryParams: { @@ -139,7 +162,7 @@ const dayCom = ref(false); let tableColumn = []; let tableData = []; -let merges = []; +// let merges = []; watch( locale, (newLocale) => { @@ -196,11 +219,24 @@ eYearMonth: `${eYear}-${eMonth.toString().padStart(2, "0")}`, }; } +const formatTypeLabelPlant = (list) => { + if (list) { + return list + .map((type) => { + const item = aps_factory.value.find( + (item) => item.value === type + ); + return item ? item.label : type; + }) + .join(""); + } + return ""; +}; function getGasList() { let rowKey = 0; let colKey = 0; headers.value = []; - exportData.value = []; + // exportData.value = []; tableColumn = []; tableData = []; loading.value = true; @@ -222,8 +258,10 @@ loading.value = false; return; } - headersOne.push(t("plan.table.dateYearMonth")); - headersTwo.push(t("plan.table.processName")); + // headersOne.push("");//t("plan.table.dateYearMonth") + // headersOne.push(""); + // headersTwo.push(t("plan.table.processName")); + // headersTwo.push(t("plan.table.applicableFactories")); colList.push({ field: "dateCol", title: t("plan.table.dateYearMonth"), @@ -235,16 +273,22 @@ width: 250, type: "html", }, + { + field: `resourceGroupName`, + title: t("plan.table.applicableFactories"), + width: 250, + type: "html", + }, ], width: 160, }); response.data.planTitle.forEach((item) => { - headersOne.push(item); - headersOne.push(""); - headersOne.push(""); - headersTwo.push(t("plan.table.designWorkingHours")); - headersTwo.push(t("plan.table.requiredWorkingHours")); - headersTwo.push(t("plan.table.capacityLoad")); + // headersOne.push(item); + // headersOne.push(""); + // headersOne.push(""); + // headersTwo.push(t("plan.table.designWorkingHours")); + // headersTwo.push(t("plan.table.requiredWorkingHours")); + // headersTwo.push(t("plan.table.capacityLoad")); colKey++; colList.push({ field: `dateColTime${colKey}`, @@ -271,25 +315,25 @@ }); }); - headers.value.push(headersOne); - headers.value.push(headersTwo); + // headers.value.push(headersOne); + // headers.value.push(headersTwo); const columnList = [...tableColumn, ...colList]; const dataList = []; - let startCol = 1; + // let startCol = 1; //鑾峰彇map response.data.planTable.map((mapItem) => { rowKey++; - let lastCol = startCol + 2; - merges.push({ s: { r: 0, c: startCol }, e: { r: 0, c: lastCol } }); - startCol = lastCol + 1; + // let lastCol = startCol + 2; + // merges.push({ s: { r: 0, c: startCol }, e: { r: 0, c: lastCol } }); + // startCol = lastCol + 1; let data = []; const item = { id: `${rowKey}`, }; for (const [key, listValue] of Object.entries(mapItem)) { - data.push(key); + // data.push(key); let tableKey = 0; let flag = false; @@ -302,9 +346,9 @@ listItem.requireTimes, listItem.capacityLoad ); - data.push(listItem.designTimes); - data.push(listItem.requireTimes); - data.push(listItem.capacityLoad + "%"); + // data.push(listItem.designTimes); + // data.push(listItem.requireTimes); + // data.push(listItem.capacityLoad + "%"); // if (listItem.capacityLoad > 100) { // flag = true; // } @@ -313,9 +357,10 @@ // item[`resourceName`] = flag // ? `<div class='el-badge'><sup class="el-badge__content is-fixed is-dot"></sup>${key}</div>` // : key; - item[`resourceName`] = key; + item[`resourceName`] = key.split("_")[0]; + item[`resourceGroupName`] = formatTypeLabelPlant([key.split("_")[1]]); } - exportData.value.push(data); + // exportData.value.push(data); dataList.push(item); }); diff --git a/src/views/mainPlan/pipePlanning/index.vue b/src/views/mainPlan/pipePlanning/index.vue new file mode 100644 index 0000000..359c764 --- /dev/null +++ b/src/views/mainPlan/pipePlanning/index.vue @@ -0,0 +1,548 @@ +<template> + <div class="app-container"> + <el-form + class="responsive-form" + :model="queryParams" + ref="queryRef" + :inline="true" + label-position="left" + > + <el-row type="flex" justify="left"> + <el-col :span="8"> + <el-form-item + :style="{ width: '100%' }" + :label="$t('plan.query.selectMonth')" + prop="description" + > + <el-date-picker + clearable + v-model="queryParams.date" + type="month" + value-format="YYYY-MM" + :placeholder="$t('plan.query.selectMonth')" + > + </el-date-picker> + </el-form-item> + </el-col> + <el-col :span="8"> + <el-form-item :label="$t('basic.table.applicableFactories')" style="width: 100%" prop="plant"> + <el-select + clearable + v-model="queryParams.applicableFactory" + :placeholder="$t('basic.table.applicableFactories')" + > + <el-option + v-for="item in aps_factory" + :key="item.value" + :label="item.label" + :value="item.value" + /> + </el-select> + </el-form-item> + </el-col> + <el-col :span="8" 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-form> + <!-- <div class="box_container"> --> + <el-row v-if="!clickedTableRef"> + <!-- <el-col :span="!clickedTableRef?22:20"> + <div class="title_text">{{$t('plan.title.pipePlanCapacity')}}</div> + </el-col> --> + <el-col + :span="24" + style="text-align: right; margin-bottom: 10px" + > + <el-button class="title_btn" type="default" @click="editRowEvent">{{ + $t("common.common.edit") + }}</el-button> + </el-col> + </el-row> + <el-row v-if="clickedTableRef"> + <el-col :span="24" style="text-align: right; margin-bottom: 10px" > + <el-button + class="title_btn" + type="primary" + @click="saveRowEvent" + v-hasPermi="['aps:gasPipelineCapacityPlan:add']" + > + {{ $t("common.common.save") }} + </el-button> + <el-button + class="title_btn ml20" + type="default" + @click="handleCancleStaus" + >{{ $t("common.common.cancel") }}</el-button + > + </el-col> + </el-row> + <vxe-table + border + ref="tableRef" + show-overflow + :loading="loading" + :height="height" + :column-config="{ resizable: true, useKey: true }" + :data="routePlanList" + size="small" + > + <vxe-column + field="processName" + :width="locale === 'zh' ? '150px' : '200px'" + :title="$t('plan.table.satndardProcessName')" + fixed="left" + > + </vxe-column> + <vxe-column + field="orgCode" + :width="locale === 'zh' ? '150px' : '200px'" + :title="$t('plan.table.applicableFactories')" + fixed="left" + > + <template #default="{ row }"> + {{ formatTypeLabelPlant([row.orgCode]) }} + </template> + </vxe-column> + <vxe-column + :width="locale === 'zh' ? '150px' : '200px'" + field="dayProduceType" + :title="$t('plan.table.dayProduceType')" + > + <!-- <template #edit="{ row }"> + <el-select + clearable + v-model="row.dayProduceType" + style="width: 140px" + > + <el-option + v-for="type in dayProduceTypeOptions" + :key="type.value" + :label="type.label" + :value="type.value" + > + </el-option> + </el-select> + </template> --> + <template #default="{ row }"> + <div v-if="!clickedTableRef"> + <span>{{ formatTypeLabel([row.dayProduceType]) }}</span> + </div> + <div v-else> + <el-select + clearable + v-model="row.dayProduceType" + style="width: 140px" + @change="handlechangeDayproduceType($event, row)" + > + <el-option + v-for="type in dayProduceTypeOptions" + :key="type.value" + :label="type.label" + :value="type.value" + > + </el-option> + </el-select> + </div> + </template> + </vxe-column> + <vxe-column + :width="locale === 'zh' ? '180px' : '200px'" + field="dayProduceNum" + :title="$t('plan.table.dayProduceNum')" + > + <!-- <template #edit="{ row }"> + <el-input-number v-model="row.dayProduceNum" size="mini" /> + </template> --> + <template #default="{ row }"> + <div v-if="!clickedTableRef"> + <span>{{ row.dayProduceNum }}</span> + </div> + <div v-else> + <el-input-number + @change="cellClickEvent($event, row)" + v-model="row.dayProduceNum" + size="mini" + /> + </div> + </template> + </vxe-column> + <vxe-column + :width="locale === 'zh' ? '150px' : '200px'" + field="dayProduceUnit" + :title="$t('plan.table.dayProduceUnit')" + > + <!-- <template #edit="{ row }"> + <el-input v-model="row.dayProduceUnit" /> + </template> --> + <template #default="{ row }"> + <div v-if="!clickedTableRef"> + <span>{{ row.dayProduceUnit }}</span> + </div> + <div v-else> + <el-input v-model="row.dayProduceUnit" /> + </div> + </template> + </vxe-column> + <vxe-column + :width="locale === 'zh' ? '180px' : '200px'" + field="personnelNumber" + :title="$t('plan.table.personnelNumber')" + > + <!-- <template #edit="{ row }"> + <el-input-number v-model="row.personnelNumber" /> + </template> --> + <template #default="{ row }"> + <div v-if="!clickedTableRef"> + <span>{{ row.personnelNumber }}</span> + </div> + <div v-else> + <el-input-number + @change="cellClickEvent($event, row)" + v-model="row.personnelNumber" + /> + </div> + </template> + </vxe-column> + <vxe-column + :width="locale === 'zh' ? '180px' : '200px'" + field="dayProduceAllNum" + :title="$t('plan.table.dayProduceAllNum')" + > + <!-- <template #edit="{ row }"> + <el-input-number v-model="row.dayProduceAllNum" disabled /> + </template> --> + <template #default="{ row }"> + <div v-if="!clickedTableRef"> + <span>{{ row.dayProduceAllNum }}</span> + </div> + <div v-else> + <el-input-number v-model="row.dayProduceAllNum" disabled /> + </div> + </template> + </vxe-column> + <vxe-column + :width="locale === 'zh' ? '180px' : '200px'" + field="days" + :title="$t('plan.table.days')" + > + <!-- <template #edit="{ row }"> + <el-input-number v-model="row.days" /> + </template> --> + <template #default="{ row }"> + <div v-if="!clickedTableRef"> + <span>{{ row.days }}</span> + </div> + <div v-else> + <el-input-number + @change="cellClickEvent($event, row)" + v-model="row.days" + /> + </div> + </template> + </vxe-column> + <vxe-column + :width="locale === 'zh' ? '180px' : '200px'" + field="monthProduceAllNum" + :title="$t('plan.table.monthProduceAllNum')" + > + <!-- <template #edit="{ row }"> + <el-input-number v-model="row.monthProduceAllNum" disabled /> + </template> --> + <template #default="{ row }"> + <div v-if="!clickedTableRef"> + <span>{{ row.monthProduceAllNum }}</span> + </div> + <div v-else> + <el-input-number v-model="row.monthProduceAllNum" disabled /> + </div> + </template> + </vxe-column> + <vxe-column + :width="locale === 'zh' ? '150px' : '200px'" + field="remark" + :title="$t('plan.table.remark')" + > + <!-- :edit-render="{ autoFocus: 'input' }" --> + <!-- <template #edit="{ row }"> + <el-input + type="text" + v-model="row.remark" + /> + </template> --> + <template #default="{ row }"> + <div v-if="!clickedTableRef"> + <span>{{ row.remark }}</span> + </div> + <div v-else> + <el-input type="text" v-model="row.remark" /> + </div> + </template> + </vxe-column> + <!-- <vxe-column title="鎿嶄綔" width="200" fixed="right"> + <template #default="{ row }"> + <template v-if="hasEditStatus(row)"> + <el-button + @click="saveRowEvent(row)" + v-hasPermi="['aps:gasPipelineCapacityPlan:add']" + >淇濆瓨</el-button + > + <el-button @click="cancelRowEvent()">鍙栨秷</el-button> + </template> + <template v-else> + <el-button @click="editRowEvent(row)">缂栬緫</el-button> + </template> + </template> + </vxe-column> --> + </vxe-table> + <!-- </div> --> + <!-- </div> --> + </div> +</template> +<script setup name="GasPlanning"> +// import { ElMessage } from "element-plus"; +import { listGasPlan, getGasPlanSave } from "@/api/mainPlan/gasPlanning"; +const height = ref(document.documentElement.clientHeight - 230 + "px;"); +import { useI18n } from "vue-i18n"; //瑕佸湪js涓娇鐢ㄥ浗闄呭寲 +const { t, locale } = useI18n(); +const { proxy } = getCurrentInstance(); +const { aps_factory } = proxy.useDict("aps_factory"); +const loading = ref(false); +const clickedQuery = ref(false); +const clickedQuery2 = ref(false); +const data = reactive({ + queryParams: { + date: "", + applicableFactory:"" + }, +}); +const tableRef = ref(); +const tableRef1 = ref(); +const { queryParams } = toRefs(data); +const gasPlanList = ref([]); +const routePlanList = ref([]); +const dayProduceTypeOptions = ref([ + { label: "鍗曚汉鏃ヤ骇鍑�", value: "1" }, + { label: "鍥哄畾鏃ヤ骇鍑�", value: "2" }, +]); +const clickedTableRef = ref(false); +const clickedTableRefGas = ref(false); +const formatTypeLabel = (list) => { + if (list) { + return list + .map((type) => { + const item = dayProduceTypeOptions.value.find( + (item) => item.value === type + ); + return item ? item.label : type; + }) + .join(""); + } + return ""; +}; +const formatTypeLabelPlant = (list) => { + if (list) { + return list + .map((type) => { + const item = aps_factory.value.find( + (item) => item.value === type + ); + return item ? item.label : type; + }) + .join(""); + } + return ""; +}; +const editRowEvent = () => { + clickedTableRef.value = true; +}; +const saveRowEvent = (row) => { + if (!queryParams.value.date) { + ElMessage({ + message: "璇烽�夋嫨骞存湀", + type: "error", + }); + return; + } + const $table = tableRef.value; + if ($table) { + $table.clearEdit().then(() => { + loading.value = true; + // setTimeout(() => { + // loading.value = false + // VxeUI.modal.message({ content: `淇濆瓨鎴愬姛锛乶ame=${row.name}`, status: 'success' }) + // }, 300) + handleSave("绠¤矾"); + clickedTableRef.value = false; + }); + } +}; +// const handleCancelAllStatus = () => { +// handleCancleStaus(); +// handleCancleStausGas(); +// }; +const handleCancleStaus = () => { + clickedTableRef.value = false; + if (!clickedQuery.value) { + return; + } + const year = queryParams.value.date.split("-")[0]; + const month = parseInt(queryParams.value.date.split("-")[1]); + getRouteList(year, month); +}; +// const handleCancleStausGas = () => { +// clickedTableRefGas.value = false; +// if (!clickedQuery2.value) { +// return; +// } +// const year = queryParams.value.date.split("-")[0]; +// const month = parseInt(queryParams.value.date.split("-")[1]); +// getGasList(year, month); +// }; +async function getRouteList(year, month) { + loading.value = true; + const res = await listGasPlan({ + major: "绠¤矾", + year, + month, + orgCode:queryParams.value.applicableFactory + }); + routePlanList.value = res.rows; + routePlanList.value = routePlanList.value.map((item, index) => { + return { + ...item, + dayProduceType: item.dayProduceType == null ? "1" : item.dayProduceType, + dayProduceNum: item.dayProduceNum == null ? "0" : item.dayProduceNum, + dayProduceUnit: + item.dayProduceUnit == null ? "灏忔椂" : item.dayProduceUnit, + personnelNumber: + item.personnelNumber == null ? "1" : item.personnelNumber, + dayProduceAllNum: + item.dayProduceAllNum == null + ? "0" + : item.dayProduceNum * item.personnelNumber, + days: item.days == null ? "22" : item.days, + monthProduceAllNum: + item.monthProduceAllNum == null + ? "0" + : item.dayProduceAllNum * item.days, + }; + }); + loading.value = false; +} +// function cellClickEvent({ row, column }) { +// console.log(row,column,"cellClickEvent") +// if(row.dayProduceType==="1"){ +// row.dayProduceAllNum = row.dayProduceNum * row.personnelNumber; +// }else{ + +// row.dayProduceAllNum = row.dayProduceNum +// } +// row.monthProduceAllNum = row.dayProduceAllNum * row.days; +// } +function cellClickEvent(e, row) { + if (row.dayProduceType === "1") { + row.dayProduceAllNum = row.dayProduceNum * row.personnelNumber; + } else { + row.dayProduceAllNum = row.dayProduceNum; + } + row.monthProduceAllNum = row.dayProduceAllNum * row.days; +} +function handlechangeDayproduceType(e, row) { + row.dayProduceAllNum = "0"; + row.monthProduceAllNum = "0"; + if (e == "1") { + row.dayProduceAllNum = row.dayProduceNum * row.personnelNumber; + } else if (e == "2") { + row.dayProduceAllNum = row.dayProduceNum; + } + row.monthProduceAllNum = row.dayProduceAllNum * row.days; +} +function handleQuery() { + if (!queryParams.value.date) { + ElMessage({ + message: "璇烽�夋嫨骞存湀", + type: "error", + }); + return; + } + const year = queryParams.value.date.split("-")[0]; + const month = parseInt(queryParams.value.date.split("-")[1]); + getRouteList(year, month); + // getGasList(year, month); + clickedQuery.value = true; + // clickedQuery2.value = true; +} +function resetQuery() { + queryParams.value.date = ""; + queryParams.value.applicableFactory = ""; + clickedQuery.value = false; + // clickedQuery2.value = false; + gasPlanList.value = []; + routePlanList.value = []; +} +async function handleSave(major) { + const year = queryParams.value.date.split("-")[0]; + const month = parseInt(queryParams.value.date.split("-")[1]); + if (major === "绠¤矾") { + routePlanList.value = routePlanList.value.map((item) => { + return { + ...item, + major: "绠¤矾", + year, + month, + orgCode: queryParams.value.applicableFactory, + }; + }); + const res = await getGasPlanSave([...routePlanList.value]); + if(res.code == 200){ + ElMessage({ + message: "鏁版嵁淇濆瓨鎴愬姛", + type: "success", + }); + loading.value = false; + handleQuery(); + } + } +} +</script> +<style lang="scss" scoped> +.column-with-margin { + margin-right: 0px; +} +.box_container { + width: 100%; + margin: 20px auto; + background: #fff; + border-radius: 5px; + box-shadow: 1px 1px 1px 4px#f1f1f1; + .title_text { + padding-top: 20px; + margin-left: 20px; + } + .title_btn { + margin-top: 20px; + &.ml20 { + margin-left: 20px; + } + } + .tabel_container { + width: 98%; + margin: 20px auto; + } +} +.btn_center { + display: flex; + justify-content: center; + align-items: center; + margin-top: 20px; + padding-bottom: 20px; +} +</style> diff --git a/src/views/mainPlan/pipeProduceStatics/index.vue b/src/views/mainPlan/pipeProduceStatics/index.vue index d99e07c..1e9835d 100644 --- a/src/views/mainPlan/pipeProduceStatics/index.vue +++ b/src/views/mainPlan/pipeProduceStatics/index.vue @@ -101,7 +101,7 @@ import { useI18n } from "vue-i18n"; //瑕佸湪js涓娇鐢ㄥ浗闄呭寲 const { t, locale } = useI18n(); const { proxy } = getCurrentInstance(); - +const { aps_factory } = proxy.useDict("aps_factory"); const loading = ref(false); const gridRef = ref(); const height = ref(document.documentElement.clientHeight - 180 + "px;"); @@ -200,6 +200,19 @@ eYearMonth: `${eYear}-${eMonth.toString().padStart(2, "0")}`, }; } +const formatTypeLabelPlant = (list) => { + if (list) { + return list + .map((type) => { + const item = aps_factory.value.find( + (item) => item.value === type + ); + return item ? item.label : type; + }) + .join(""); + } + return ""; +}; /** 鏌ヨ闆朵欢缁熻琛ㄥ垪琛� */ function getPipeList() { let rowKey = 0; @@ -220,15 +233,15 @@ major: "piping", }).then((response) => { const colList = []; - let headersOne = []; - let headersTwo = []; + // let headersOne = []; + // let headersTwo = []; if (response.code == "200") { if (!response.data.planTitle) { loading.value = false; return; } - headersOne.push(t("plan.table.dateYearMonth")); - headersTwo.push(t("plan.table.processName")); + // headersOne.push(t("plan.table.dateYearMonth")); + // headersTwo.push(t("plan.table.processName")); colList.push({ field: "dateCol", title: t("plan.table.dateYearMonth"), @@ -240,16 +253,16 @@ width: 250, type: "html", }, + { + field: `resourceGroupName`, + title: t("plan.table.applicableFactories"), + width: 250, + type: "html", + }, ], width: 160, }); response.data.planTitle.forEach((item) => { - headersOne.push(item); - headersOne.push(""); - headersOne.push(""); - headersTwo.push(t("plan.table.designWorkingHours")); - headersTwo.push(t("plan.table.requiredWorkingHours")); - headersTwo.push(t("plan.table.capacityLoad")); colKey++; colList.push({ field: `dateColTime${colKey}`, @@ -275,27 +288,16 @@ width: 160, }); }); - - headers.value.push(headersOne); - headers.value.push(headersTwo); - const columnList = [...tableColumn, ...colList]; const dataList = []; - let startCol = 1; //鑾峰彇map response.data.planTable.map((mapItem) => { rowKey++; - let lastCol = startCol + 2; - merges.push({ s: { r: 0, c: startCol }, e: { r: 0, c: lastCol } }); - startCol = lastCol + 1; - let data = []; const item = { id: `${rowKey}`, }; for (const [key, listValue] of Object.entries(mapItem)) { - data.push(key); - let tableKey = 0; let flag = false; listValue.forEach((listItem) => { @@ -307,24 +309,14 @@ listItem.requireTimes, listItem.capacityLoad ); - // 0-100 缁胯壊锛�101-120榛勮壊锛屽ぇ浜�120绾㈣壊 - // listItem.capacityLoad <= 100 - // ? `<font color="red">${listItem.capacityLoad}%</font>` - // : listItem.capacityLoad + "%"; - data.push(listItem.designTimes); - data.push(listItem.requireTimes); - data.push(listItem.capacityLoad + "%"); - // if (listItem.capacityLoad > 100) { - // flag = true; - // } }); // item[`resourceName`] = flag // ? `<div class='el-badge'><sup class="el-badge__content is-fixed is-dot"></sup>${key}</div>` // : key; - item[`resourceName`] = key; + item[`resourceName`] = key.split("_")[0]; + item[`resourceGroupName`] = formatTypeLabelPlant([key.split("_")[1]]); } - exportData.value.push(data); dataList.push(item); }); diff --git a/src/views/system/dict/index.vue b/src/views/system/dict/index.vue index 1c84014..396a3e5 100644 --- a/src/views/system/dict/index.vue +++ b/src/views/system/dict/index.vue @@ -122,6 +122,17 @@ >鏇存柊鎺掍骇鍖哄煙</el-button > </el-col> + <el-col :span="1.5"> + <el-button + type="success" + plain + icon="Refresh" + :disabled="loadingRefresh" + @click="handleRefreshData" + v-hasPermi="['system:dict:remove']" + >鍒锋柊缂撳瓨BOM銆佸伐鑹鸿矾绾裤�佸簱瀛樻暟鎹�</el-button + > + </el-col> <right-toolbar v-model:showSearch="showSearch" @queryTable="getList" @@ -259,13 +270,14 @@ refreshCache, refreshApsArea } from "@/api/system/dict/type"; - +import { refreshBomRouteStorageDataList } from "@/api/basicData/bom/bom.js" const { proxy } = getCurrentInstance(); const { sys_normal_disable } = proxy.useDict("sys_normal_disable"); const typeList = ref([]); const open = ref(false); const loading = ref(true); +const loadingRefresh = ref(false); const showSearch = ref(true); const ids = ref([]); const single = ref(true); @@ -426,5 +438,18 @@ }); handleQuery(); } +function handleRefreshData() { + loadingRefresh.value = true; + refreshBomRouteStorageDataList().then(res=>{ + if(res.code==200){ + proxy.$modal.msgSuccess("鏇存柊鎴愬姛"); + loadingRefresh.value = false; + }else{ + loadingRefresh.value = false; + } + }).catch(()=>{ + loadingRefresh.value = false; + }) +} getList(); </script> -- Gitblit v1.9.3