|
|
@@ -66,7 +66,7 @@
|
|
|
>
|
|
|
<el-table-column align="center" label="小组" prop="sys_id" :width="90" show-overflow-tooltip />
|
|
|
<el-table-column align="center" label="订单编号" prop="work_order" :width="100" />
|
|
|
- <el-table-column align="center" label="工序编号" prop="process_code" :width="90" />
|
|
|
+ <el-table-column align="center" label="工序号" prop="process_code" :width="90" />
|
|
|
<el-table-column align="left" label="工序名称" prop="process_name" min-width="200" show-overflow-tooltip />
|
|
|
<el-table-column align="center" label="员工姓名" prop="staff_name" :width="120">
|
|
|
<template #header>
|
|
|
@@ -95,8 +95,9 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column align="center" label="数量" prop="number" :width="90" />
|
|
|
<el-table-column align="center" label="报工时间" prop="sys_rq" :width="180" show-overflow-tooltip />
|
|
|
- <el-table-column align="center" label="操作" :width="100" fixed="right">
|
|
|
+ <el-table-column align="center" label="操作" :width="160" fixed="right">
|
|
|
<template #default="scope">
|
|
|
+ <el-button type="primary" size="small" @click.stop="openEditReportingQty(scope.row)">修改</el-button>
|
|
|
<el-button type="danger" size="small" @click.stop="deleteReportingWork(scope.row)">删除</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
@@ -280,7 +281,7 @@
|
|
|
<el-table-column prop="工艺编号" label="工序号" width="72" align="center" />
|
|
|
<el-table-column prop="工艺名称" label="工序名称" min-width="240" />
|
|
|
<el-table-column prop="本组完成数" label="本组完成数" min-width="88" align="center" />
|
|
|
- <el-table-column prop="累计完成数" label="累计完成数" min-width="60" align="center" />
|
|
|
+ <el-table-column prop="累计完成数" label="累计完成数" min-width="70" align="center" />
|
|
|
<el-table-column prop="未完成数" label="未完成数" min-width="60" align="center" />
|
|
|
<el-table-column label="完工人员" width="120">
|
|
|
<template #default="scope">
|
|
|
@@ -314,21 +315,23 @@
|
|
|
<div v-if="getReportingData(selectedPartIndex, scope.$index).staffList">
|
|
|
<div v-for="(staff, staffIndex) in getReportingData(selectedPartIndex, scope.$index).staffList" :key="staffIndex" class="work-score-staff-row">
|
|
|
<el-input
|
|
|
- v-model.number="staff.number"
|
|
|
- type="number"
|
|
|
+ :model-value="staff.number"
|
|
|
+ inputmode="numeric"
|
|
|
class="work-score-qty-input"
|
|
|
+ :class="{ 'work-score-qty-over': isQtyOverUnfinished(selectedPartIndex, scope.$index) }"
|
|
|
:disabled="isReportingFillDisabled(selectedPartIndex, scope.$index, staffIndex)"
|
|
|
- @input="autoFillStaffOnQuantityInput(selectedPartIndex, scope.$index, staffIndex)"
|
|
|
+ @update:model-value="(v) => onQtyInput(selectedPartIndex, scope.$index, staffIndex, v)"
|
|
|
/>
|
|
|
</div>
|
|
|
</div>
|
|
|
<el-input
|
|
|
v-else
|
|
|
- v-model.number="getReportingData(selectedPartIndex, scope.$index).number"
|
|
|
- type="number"
|
|
|
+ :model-value="getReportingData(selectedPartIndex, scope.$index).number"
|
|
|
+ inputmode="numeric"
|
|
|
class="work-score-qty-input"
|
|
|
+ :class="{ 'work-score-qty-over': isQtyOverUnfinished(selectedPartIndex, scope.$index) }"
|
|
|
:disabled="isReportingFillDisabled(selectedPartIndex, scope.$index)"
|
|
|
- @input="autoFillStaffOnQuantityInput(selectedPartIndex, scope.$index)"
|
|
|
+ @update:model-value="(v) => onQtyInput(selectedPartIndex, scope.$index, null, v)"
|
|
|
/>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
@@ -366,30 +369,80 @@
|
|
|
<el-dialog
|
|
|
v-model="workScoreConfirmVisible"
|
|
|
title="确认报工"
|
|
|
- width="760px"
|
|
|
+ width="1040px"
|
|
|
+ top="8vh"
|
|
|
append-to-body
|
|
|
destroy-on-close
|
|
|
class="work-score-confirm-dialog"
|
|
|
+ :close-on-click-modal="false"
|
|
|
>
|
|
|
- <p class="work-score-confirm-tip">请核对以下报工数据,确认无误后提交</p>
|
|
|
+ <p class="work-score-confirm-tip">请核对以下报工数据,确认无误后再提交</p>
|
|
|
<el-table
|
|
|
:data="workScoreConfirmRows"
|
|
|
border
|
|
|
stripe
|
|
|
- max-height="420"
|
|
|
+ height="512"
|
|
|
:span-method="workScoreConfirmSpanMethod"
|
|
|
+ :cell-class-name="workScoreConfirmCellClass"
|
|
|
+ class="work-score-confirm-table"
|
|
|
style="width: 100%"
|
|
|
>
|
|
|
- <el-table-column label="工序编号" prop="工序编号" width="90" align="center" />
|
|
|
- <el-table-column label="工序名称" prop="工序名称" min-width="260" show-overflow-tooltip />
|
|
|
- <el-table-column label="员工姓名" prop="员工姓名" width="120" align="center" />
|
|
|
- <el-table-column label="完工数量" prop="完工数量" width="100" align="center" />
|
|
|
+ <el-table-column label="部件" prop="部件" width="88" align="center" show-overflow-tooltip />
|
|
|
+ <el-table-column label="工序号" prop="工序编号" width="68" align="center" />
|
|
|
+ <el-table-column label="工序名称" prop="工序名称" min-width="150" align="left" show-overflow-tooltip />
|
|
|
+ <el-table-column label="本组完成数" prop="本组完成数" width="96" align="center" />
|
|
|
+ <el-table-column label="累计完成数" prop="累计完成数" width="96" align="center" />
|
|
|
+ <el-table-column label="未完成数" prop="未完成数量" width="88" align="center" />
|
|
|
+ <el-table-column label="完工人员" prop="员工姓名" width="88" align="center" />
|
|
|
+ <el-table-column label="完工数量" prop="完工数量" width="88" align="center" />
|
|
|
+ <el-table-column label="超出数量" prop="超出数量" width="88" align="center" />
|
|
|
</el-table>
|
|
|
<template #footer>
|
|
|
<el-button @click="workScoreConfirmVisible = false">返回修改</el-button>
|
|
|
<el-button type="primary" :loading="workScoreSubmitting" @click="confirmSubmitWorkScore">确认报工</el-button>
|
|
|
</template>
|
|
|
</el-dialog>
|
|
|
+
|
|
|
+ <!-- 当天报工记录:修改数量 -->
|
|
|
+ <el-dialog
|
|
|
+ v-model="editReportingQtyVisible"
|
|
|
+ title="修改数量"
|
|
|
+ width="420px"
|
|
|
+ top="32vh"
|
|
|
+ append-to-body
|
|
|
+ destroy-on-close
|
|
|
+ :close-on-click-modal="false"
|
|
|
+ class="edit-reporting-qty-dialog"
|
|
|
+ @opened="focusEditReportingQtyInput"
|
|
|
+ >
|
|
|
+ <el-form label-width="88px">
|
|
|
+ <el-form-item label="工序号">
|
|
|
+ <el-input :model-value="editReportingQtyForm.process_code" disabled />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="工序名称">
|
|
|
+ <el-input :model-value="editReportingQtyForm.process_name" disabled />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="未完成数">
|
|
|
+ <el-input :model-value="editReportingQtyForm.unfinished" disabled />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="数量" required>
|
|
|
+ <el-input
|
|
|
+ ref="editReportingQtyInputRef"
|
|
|
+ :model-value="editReportingQtyForm.number"
|
|
|
+ inputmode="numeric"
|
|
|
+ maxlength="5"
|
|
|
+ placeholder="请输入修正后的数量"
|
|
|
+ :class="{ 'edit-reporting-qty-over': isEditReportingQtyOver }"
|
|
|
+ @update:model-value="(v) => { editReportingQtyForm.number = filterQtyDigits(v) }"
|
|
|
+ @keyup.enter="submitEditReportingQty"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <template #footer>
|
|
|
+ <el-button @click="editReportingQtyVisible = false">取消</el-button>
|
|
|
+ <el-button type="primary" :loading="editReportingQtyLoading" @click="submitEditReportingQty">确定</el-button>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
</layout-content>
|
|
|
</layout>
|
|
|
<SubOrderPage ref="SubOrderPageRef" />
|
|
|
@@ -457,7 +510,7 @@ import $ from 'jquery';
|
|
|
import LuckyExcel from 'luckyexcel';
|
|
|
import { Layout, LayoutSider, LayoutContent } from '@arco-design/web-vue';
|
|
|
import {ref, reactive, computed, watch, nextTick, onUnmounted} from 'vue';
|
|
|
-import {getSpotList,getInfo,OrderAttachments,WorkOrderList,DeleteReportingWork} from '@/api/mes/job';
|
|
|
+import {getSpotList,getInfo,OrderAttachments,WorkOrderList,DeleteReportingWork,UpdateReportingWork} from '@/api/mes/job';
|
|
|
import {getMac,getMajorprocessAndPerson,GetOrderProcess,GetCarProcess,ReportingWork,GetReportingWorkRecord} from '@/api/jixiaoguanli/baogong'
|
|
|
import {getMachineMac} from '@/api/jixiaoguanli/jitairibaobiao'
|
|
|
import {ElMessage,ElMessageBox} from "element-plus";
|
|
|
@@ -491,10 +544,22 @@ const add_searchInfo = ref('')
|
|
|
const gongfenHistoryData = ref([])
|
|
|
const gongfenHistoryTableRef = ref()
|
|
|
const staffNameFilter = ref([])
|
|
|
+const currentOrderNo = ref('')
|
|
|
+
|
|
|
+/** 当天报工记录:仅当前查询订单 */
|
|
|
+const orderScopedGongfenHistoryData = computed(() => {
|
|
|
+ const list = gongfenHistoryData.value || []
|
|
|
+ const orderNo = String(currentOrderNo.value || '').trim()
|
|
|
+ if (!orderNo) return []
|
|
|
+ return list.filter((row) => {
|
|
|
+ const rowOrder = String(row.work_order ?? row['订单编号'] ?? '').trim()
|
|
|
+ return rowOrder === orderNo
|
|
|
+ })
|
|
|
+})
|
|
|
|
|
|
const staffNameFilterOptions = computed(() => {
|
|
|
const names = [...new Set(
|
|
|
- (gongfenHistoryData.value || [])
|
|
|
+ (orderScopedGongfenHistoryData.value || [])
|
|
|
.map(item => String(item.staff_name || '').trim())
|
|
|
.filter(Boolean)
|
|
|
)]
|
|
|
@@ -532,7 +597,7 @@ const syncStaffNameFilterAfterDataChange = () => {
|
|
|
}
|
|
|
|
|
|
const filteredGongfenHistoryData = computed(() => {
|
|
|
- const list = gongfenHistoryData.value || []
|
|
|
+ const list = orderScopedGongfenHistoryData.value || []
|
|
|
const options = staffNameFilterOptions.value
|
|
|
const selected = staffNameFilter.value
|
|
|
if (!selected.length) return []
|
|
|
@@ -542,7 +607,7 @@ const filteredGongfenHistoryData = computed(() => {
|
|
|
})
|
|
|
|
|
|
watch(
|
|
|
- () => gongfenHistoryData.value,
|
|
|
+ () => [gongfenHistoryData.value, currentOrderNo.value],
|
|
|
() => {
|
|
|
syncStaffNameFilterAfterDataChange()
|
|
|
},
|
|
|
@@ -1011,6 +1076,35 @@ const fillSelectedEmployee = (row, partIndex, processIndex, staffIndex = null) =
|
|
|
}
|
|
|
|
|
|
// 表格内输入完工数量时,若上方已选人员且本格人员为空,则自动填入
|
|
|
+const filterQtyDigits = (val) => String(val ?? '').replace(/[^\d]/g, '').slice(0, 5)
|
|
|
+
|
|
|
+const onQtyInput = (partIndex, processIndex, staffIndex, val) => {
|
|
|
+ const digits = filterQtyDigits(val)
|
|
|
+ const item = getReportingData(partIndex, processIndex)
|
|
|
+ if (item.staffList?.length) {
|
|
|
+ const idx = staffIndex !== null && staffIndex !== undefined ? staffIndex : 0
|
|
|
+ if (item.staffList[idx]) item.staffList[idx].number = digits
|
|
|
+ } else {
|
|
|
+ item.number = digits
|
|
|
+ }
|
|
|
+ autoFillStaffOnQuantityInput(partIndex, processIndex, staffIndex)
|
|
|
+}
|
|
|
+
|
|
|
+/** 本工序已填完工合计是否超出未完成数 */
|
|
|
+const isQtyOverUnfinished = (partIndex, processIndex) => {
|
|
|
+ const process = partProcesses.value?.[partIndex]?.[processIndex]
|
|
|
+ const unfinished = Number(process?.未完成数)
|
|
|
+ if (!Number.isFinite(unfinished)) return false
|
|
|
+ const item = getReportingData(partIndex, processIndex)
|
|
|
+ let sum = 0
|
|
|
+ if (item.staffList?.length) {
|
|
|
+ sum = item.staffList.reduce((s, st) => s + (Number(st.number) || 0), 0)
|
|
|
+ } else {
|
|
|
+ sum = Number(item.number) || 0
|
|
|
+ }
|
|
|
+ return sum > unfinished
|
|
|
+}
|
|
|
+
|
|
|
const isReportingStaffEmpty = (partIndex, processIndex, staffIndex = null) => {
|
|
|
const item = getReportingData(partIndex, processIndex)
|
|
|
if (item.staffList?.length) {
|
|
|
@@ -1271,10 +1365,16 @@ const recomputeWorkScoreConfirmRowSpan = (rows) => {
|
|
|
const result = []
|
|
|
let i = 0
|
|
|
while (i < rows.length) {
|
|
|
+ const partLabel = rows[i].部件
|
|
|
const processCode = rows[i].工序编号
|
|
|
const processName = rows[i].工序名称
|
|
|
let j = i
|
|
|
- while (j < rows.length && rows[j].工序编号 === processCode && rows[j].工序名称 === processName) {
|
|
|
+ while (
|
|
|
+ j < rows.length &&
|
|
|
+ rows[j].部件 === partLabel &&
|
|
|
+ rows[j].工序编号 === processCode &&
|
|
|
+ rows[j].工序名称 === processName
|
|
|
+ ) {
|
|
|
j++
|
|
|
}
|
|
|
const group = rows.slice(i, j)
|
|
|
@@ -1286,18 +1386,73 @@ const recomputeWorkScoreConfirmRowSpan = (rows) => {
|
|
|
return result
|
|
|
}
|
|
|
|
|
|
+/** 左侧部件展示文案:编号-名称 */
|
|
|
+const resolvePartLabel = (partCode) => {
|
|
|
+ const code = String(partCode ?? '').trim()
|
|
|
+ const part = (processParts.value || []).find((p) => String(p?.['部件编号'] ?? '').trim() === code)
|
|
|
+ if (!part) return code
|
|
|
+ const name = String(part['部件名称'] ?? '').trim()
|
|
|
+ return name ? `${code}-${name}` : code
|
|
|
+}
|
|
|
+
|
|
|
+/** 从当前已加载工艺行取未完成数等 */
|
|
|
+const findProcessProgressByCode = (processCode, processName) => {
|
|
|
+ const code = String(processCode ?? '').trim()
|
|
|
+ const name = String(processName ?? '').trim()
|
|
|
+ for (const list of partProcesses.value || []) {
|
|
|
+ for (const p of list || []) {
|
|
|
+ const pCode = String(p?.工艺编号 ?? '').trim()
|
|
|
+ const pName = String(p?.工艺名称 ?? '').trim()
|
|
|
+ if (code && pCode === code && (!name || pName === name)) {
|
|
|
+ return {
|
|
|
+ unfinished: Number(p?.未完成数),
|
|
|
+ totalComplete: Number(p?.累计完成数),
|
|
|
+ groupComplete: Number(p?.本组完成数),
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return { unfinished: NaN, totalComplete: NaN, groupComplete: NaN }
|
|
|
+}
|
|
|
+
|
|
|
const buildWorkScoreConfirmRows = (reportData) => {
|
|
|
- const rows = reportData.map(item => ({
|
|
|
- 工序编号: item.process_code,
|
|
|
- 工序名称: item.process_name,
|
|
|
- 员工姓名: item.staff_name,
|
|
|
- 完工数量: item.number,
|
|
|
- }))
|
|
|
+ // 同一部件+工序多人报工时,按合计完工数再算超出
|
|
|
+ const processQtySum = {}
|
|
|
+ for (const item of reportData) {
|
|
|
+ const key = `${item.part_code}||${item.process_code}||${item.process_name}`
|
|
|
+ processQtySum[key] = (processQtySum[key] || 0) + (Number(item.number) || 0)
|
|
|
+ }
|
|
|
+
|
|
|
+ const rows = reportData.map((item) => {
|
|
|
+ const key = `${item.part_code}||${item.process_code}||${item.process_name}`
|
|
|
+ const progress = findProcessProgressByCode(item.process_code, item.process_name)
|
|
|
+ const unfinished = progress.unfinished
|
|
|
+ const groupComplete = progress.groupComplete
|
|
|
+ const totalComplete = progress.totalComplete
|
|
|
+ const hasUnfinished = Number.isFinite(unfinished)
|
|
|
+ const hasGroupComplete = Number.isFinite(groupComplete)
|
|
|
+ const hasTotalComplete = Number.isFinite(totalComplete)
|
|
|
+ const sumQty = processQtySum[key] || 0
|
|
|
+ const excess = hasUnfinished ? Math.max(0, sumQty - unfinished) : 0
|
|
|
+ return {
|
|
|
+ 部件: resolvePartLabel(item.part_code),
|
|
|
+ 工序编号: item.process_code,
|
|
|
+ 工序名称: item.process_name,
|
|
|
+ 本组完成数: hasGroupComplete ? groupComplete : '',
|
|
|
+ 累计完成数: hasTotalComplete ? totalComplete : '',
|
|
|
+ 未完成数量: hasUnfinished ? unfinished : '',
|
|
|
+ 员工姓名: item.staff_name,
|
|
|
+ 完工数量: item.number,
|
|
|
+ 超出数量: excess > 0 ? excess : '',
|
|
|
+ _isOver: excess > 0,
|
|
|
+ }
|
|
|
+ })
|
|
|
return recomputeWorkScoreConfirmRowSpan(rows)
|
|
|
}
|
|
|
|
|
|
const workScoreConfirmSpanMethod = ({ row, column }) => {
|
|
|
- if (column.property !== '工序编号' && column.property !== '工序名称') {
|
|
|
+ const mergeProps = ['部件', '工序编号', '工序名称', '本组完成数', '累计完成数', '未完成数量', '超出数量']
|
|
|
+ if (!mergeProps.includes(column.property)) {
|
|
|
return { rowspan: 1, colspan: 1 }
|
|
|
}
|
|
|
const rowspan = row._processRowSpan || 0
|
|
|
@@ -1307,6 +1462,12 @@ const workScoreConfirmSpanMethod = ({ row, column }) => {
|
|
|
return { rowspan: 0, colspan: 0 }
|
|
|
}
|
|
|
|
|
|
+const workScoreConfirmCellClass = ({ row, column }) => {
|
|
|
+ if (column.property === '超出数量' && row._isOver) return 'work-score-confirm-over-cell'
|
|
|
+ if (column.property === '完工数量' && row._isOver) return 'work-score-confirm-over-cell'
|
|
|
+ return ''
|
|
|
+}
|
|
|
+
|
|
|
const submitWorkScore = () => {
|
|
|
const reportData = buildWorkScoreReportData()
|
|
|
if (!reportData) return
|
|
|
@@ -1420,7 +1581,6 @@ const _list = ref('');
|
|
|
//订单信息数据
|
|
|
const orderInfoList = reactive([]);
|
|
|
/** 当前已加载订单编号(红框订单信息区,与搜索 input 解耦) */
|
|
|
-const currentOrderNo = ref('')
|
|
|
const processProductionRef = ref(null)
|
|
|
const processProductionRefreshKey = ref(0)
|
|
|
|
|
|
@@ -1547,6 +1707,156 @@ const deleteReportingWork = async (row) => {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+const editReportingQtyVisible = ref(false)
|
|
|
+const editReportingQtyLoading = ref(false)
|
|
|
+const editReportingQtyInputRef = ref(null)
|
|
|
+const editReportingQtyForm = ref({
|
|
|
+ id: '',
|
|
|
+ number: '',
|
|
|
+ original_number: '',
|
|
|
+ process_code: '',
|
|
|
+ process_name: '',
|
|
|
+ part_code: '',
|
|
|
+ unfinished: '',
|
|
|
+ standard_hour: '',
|
|
|
+ standard_score: '',
|
|
|
+ production_hour: '',
|
|
|
+ production_score: '',
|
|
|
+})
|
|
|
+
|
|
|
+const isEditReportingQtyOver = computed(() => {
|
|
|
+ const unfinished = Number(editReportingQtyForm.value.unfinished)
|
|
|
+ const original = Number(editReportingQtyForm.value.original_number) || 0
|
|
|
+ const qty = Number(editReportingQtyForm.value.number)
|
|
|
+ if (!Number.isFinite(unfinished) || !Number.isFinite(qty) || !qty) return false
|
|
|
+ // 未完成数已扣除本条原数量,可改上限 = 未完成数 + 原数量
|
|
|
+ return qty > unfinished + original
|
|
|
+})
|
|
|
+
|
|
|
+const focusEditReportingQtyInput = () => {
|
|
|
+ nextTick(() => {
|
|
|
+ const comp = editReportingQtyInputRef.value
|
|
|
+ const el = comp?.input || comp?.textarea || comp?.$el?.querySelector?.('input')
|
|
|
+ if (el && typeof el.focus === 'function') {
|
|
|
+ el.focus()
|
|
|
+ const len = String(el.value ?? '').length
|
|
|
+ try {
|
|
|
+ el.setSelectionRange(len, len)
|
|
|
+ } catch (_) { /* ignore */ }
|
|
|
+ return
|
|
|
+ }
|
|
|
+ comp?.focus?.()
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+const resolveUnfinishedForEditRow = async (row) => {
|
|
|
+ const processCode = String(row.process_code ?? row['工序编号'] ?? row['工序号'] ?? '').trim()
|
|
|
+ const processName = String(row.process_name ?? row['工序名称'] ?? '').trim()
|
|
|
+ const fromRow = Number(row.未完成数 ?? row.unfinished ?? row['未完成数量'])
|
|
|
+ if (Number.isFinite(fromRow)) return fromRow
|
|
|
+
|
|
|
+ const loaded = findProcessProgressByCode(processCode, processName)
|
|
|
+ if (Number.isFinite(loaded.unfinished)) return loaded.unfinished
|
|
|
+
|
|
|
+ const partCode = String(row.part_code ?? row['部件编号'] ?? '').trim()
|
|
|
+ if (!partCode || !getActiveOrderNo()) return ''
|
|
|
+
|
|
|
+ try {
|
|
|
+ const carParams = {
|
|
|
+ workorder: getActiveOrderNo(),
|
|
|
+ part_code: partCode,
|
|
|
+ majorprocess: add_formData['工序'],
|
|
|
+ }
|
|
|
+ const sysId = String(add_formData['组别'] || '').trim()
|
|
|
+ if (sysId) carParams.sys_id = sysId
|
|
|
+ const response = await GetCarProcess(carParams)
|
|
|
+ if (response.code !== 0 || !response.data) return ''
|
|
|
+ const processList = normalizeWorkScoreProcessList(response.data)
|
|
|
+ const hit = (processList || []).find((p) => {
|
|
|
+ const pCode = String(p?.['工艺编号'] ?? '').trim()
|
|
|
+ const pName = String(p?.['工艺名称'] ?? '').trim()
|
|
|
+ return processCode && pCode === processCode && (!processName || pName === processName)
|
|
|
+ })
|
|
|
+ const unfinished = Number(hit?.['未完成数'])
|
|
|
+ return Number.isFinite(unfinished) ? unfinished : ''
|
|
|
+ } catch (e) {
|
|
|
+ console.error('获取未完成数失败:', e)
|
|
|
+ return ''
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+const openEditReportingQty = async (row) => {
|
|
|
+ const id = row?.id ?? row?.ID
|
|
|
+ if (id === undefined || id === null || id === '') {
|
|
|
+ ElMessage.warning('缺少报工记录ID,无法修改')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ const number = filterQtyDigits(String(row.number ?? row['数量'] ?? ''))
|
|
|
+ editReportingQtyForm.value = {
|
|
|
+ id,
|
|
|
+ number,
|
|
|
+ original_number: number,
|
|
|
+ process_code: String(row.process_code ?? row['工序编号'] ?? row['工序号'] ?? ''),
|
|
|
+ process_name: String(row.process_name ?? row['工序名称'] ?? ''),
|
|
|
+ part_code: String(row.part_code ?? row['部件编号'] ?? ''),
|
|
|
+ unfinished: '',
|
|
|
+ standard_hour: row.standard_hour ?? row['标准工时'] ?? '',
|
|
|
+ standard_score: row.standard_score ?? row['标准工分'] ?? row['标准分数'] ?? '',
|
|
|
+ production_hour: row.production_hour ?? row['生产工时'] ?? '',
|
|
|
+ production_score: row.production_score ?? row['生产分数'] ?? row['生产工分'] ?? '',
|
|
|
+ }
|
|
|
+ editReportingQtyVisible.value = true
|
|
|
+ const unfinished = await resolveUnfinishedForEditRow(row)
|
|
|
+ if (editReportingQtyForm.value.id === id) {
|
|
|
+ editReportingQtyForm.value.unfinished = unfinished === '' ? '' : String(unfinished)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+const submitEditReportingQty = async () => {
|
|
|
+ const numberStr = String(editReportingQtyForm.value.number ?? '').trim()
|
|
|
+ const qty = Number(numberStr)
|
|
|
+ if (!numberStr || Number.isNaN(qty) || qty <= 0) {
|
|
|
+ ElMessage.warning('请输入大于 0 的数量')
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ const stdHour = Number(editReportingQtyForm.value.standard_hour)
|
|
|
+ const stdScore = Number(editReportingQtyForm.value.standard_score)
|
|
|
+ let production_hour = String(editReportingQtyForm.value.production_hour ?? '')
|
|
|
+ let production_score = String(editReportingQtyForm.value.production_score ?? '')
|
|
|
+ if (Number.isFinite(stdHour) && stdHour > 0) {
|
|
|
+ production_hour = (qty * stdHour).toFixed(2)
|
|
|
+ }
|
|
|
+ if (Number.isFinite(stdScore) && stdScore > 0) {
|
|
|
+ production_score = (qty * stdScore).toFixed(2)
|
|
|
+ }
|
|
|
+
|
|
|
+ const mod_id = userStore.userInfo?.nickName || userStore.userInfo?.userName || ''
|
|
|
+
|
|
|
+ editReportingQtyLoading.value = true
|
|
|
+ try {
|
|
|
+ const res = await UpdateReportingWork({
|
|
|
+ id: editReportingQtyForm.value.id,
|
|
|
+ number: String(qty),
|
|
|
+ production_hour,
|
|
|
+ production_score,
|
|
|
+ mod_id,
|
|
|
+ })
|
|
|
+ if (res?.code === 0) {
|
|
|
+ ElMessage.success(res.msg || '修改成功')
|
|
|
+ editReportingQtyVisible.value = false
|
|
|
+ await getGongfenHistory()
|
|
|
+ } else {
|
|
|
+ ElMessage.error(res?.msg || '修改失败')
|
|
|
+ }
|
|
|
+ } catch (e) {
|
|
|
+ console.error(e)
|
|
|
+ ElMessage.error(e?.response?.data?.msg || e?.message || '修改失败')
|
|
|
+ } finally {
|
|
|
+ editReportingQtyLoading.value = false
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
// 复选框选择
|
|
|
const fjSelectionChange = (selection) => {
|
|
|
console.log('选中的附件:', selection);
|
|
|
@@ -2226,8 +2536,9 @@ const warningres = (arr) => {
|
|
|
font-size: 15px;
|
|
|
color: #606266;
|
|
|
}
|
|
|
-:deep(.work-score-confirm-dialog .el-dialog__body) {
|
|
|
- padding-top: 8px;
|
|
|
+:deep(.work-score-confirm-over-cell) {
|
|
|
+ color: #f56c6c !important;
|
|
|
+ font-weight: 600;
|
|
|
}
|
|
|
.work-score-process-table-wrap :deep(.work-score-process-table .el-input__inner) {
|
|
|
height: 30px;
|
|
|
@@ -2235,11 +2546,14 @@ const warningres = (arr) => {
|
|
|
}
|
|
|
.work-score-process-table-wrap :deep(.work-score-qty-input .el-input__inner) {
|
|
|
height: 30px;
|
|
|
- font-size: 15px;
|
|
|
+ font-size: 18px;
|
|
|
font-weight: 600;
|
|
|
text-align: center;
|
|
|
color: #303133;
|
|
|
}
|
|
|
+.work-score-process-table-wrap :deep(.work-score-qty-over .el-input__inner) {
|
|
|
+ color: #f56c6c !important;
|
|
|
+}
|
|
|
.work-score-process-table-wrap :deep(.work-score-staff-input .el-input__inner) {
|
|
|
height: 30px;
|
|
|
font-size: 14px;
|
|
|
@@ -2698,6 +3012,113 @@ const warningres = (arr) => {
|
|
|
</style>
|
|
|
|
|
|
<style>
|
|
|
+/* 确认报工弹窗:固定尺寸 + 内容居中放大(append-to-body 用全局样式) */
|
|
|
+.work-score-confirm-dialog.el-dialog,
|
|
|
+.work-score-confirm-dialog {
|
|
|
+ width: 1040px !important;
|
|
|
+ margin-top: 8vh !important;
|
|
|
+}
|
|
|
+.work-score-confirm-dialog .el-dialog__header {
|
|
|
+ padding: 12px 12px 6px;
|
|
|
+}
|
|
|
+.work-score-confirm-dialog .el-dialog__title {
|
|
|
+ font-size: 20px;
|
|
|
+ font-weight: 600;
|
|
|
+}
|
|
|
+.work-score-confirm-dialog .el-dialog__body {
|
|
|
+ padding: 4px 12px 4px;
|
|
|
+ height: 556px;
|
|
|
+ box-sizing: border-box;
|
|
|
+ overflow: hidden;
|
|
|
+}
|
|
|
+.work-score-confirm-dialog .work-score-confirm-tip {
|
|
|
+ margin: 0 0 6px;
|
|
|
+ text-align: center;
|
|
|
+ font-size: 18px;
|
|
|
+ font-weight: 600;
|
|
|
+ color: #303133;
|
|
|
+ line-height: 1.3;
|
|
|
+}
|
|
|
+.work-score-confirm-dialog .work-score-confirm-table {
|
|
|
+ font-size: 15px;
|
|
|
+ width: 100% !important;
|
|
|
+}
|
|
|
+.work-score-confirm-dialog .work-score-confirm-table .el-table__inner-wrapper::before {
|
|
|
+ display: none;
|
|
|
+}
|
|
|
+.work-score-confirm-dialog .work-score-confirm-table .el-table__header-wrapper,
|
|
|
+.work-score-confirm-dialog .work-score-confirm-table .el-table__body-wrapper {
|
|
|
+ overflow-x: hidden !important;
|
|
|
+}
|
|
|
+.work-score-confirm-dialog .work-score-confirm-table .el-scrollbar__bar.is-horizontal {
|
|
|
+ display: none !important;
|
|
|
+}
|
|
|
+.work-score-confirm-dialog .work-score-confirm-table .el-table__header th {
|
|
|
+ color: #000 !important;
|
|
|
+ font-weight: 600;
|
|
|
+ font-size: 15px;
|
|
|
+ padding: 4px 0 !important;
|
|
|
+ height: 32px !important;
|
|
|
+}
|
|
|
+.work-score-confirm-dialog .work-score-confirm-table .el-table__header th .cell {
|
|
|
+ color: #000 !important;
|
|
|
+ font-weight: 600;
|
|
|
+ line-height: 22px;
|
|
|
+ padding: 0 6px !important;
|
|
|
+}
|
|
|
+.work-score-confirm-dialog .work-score-confirm-table .el-table__body td {
|
|
|
+ font-size: 15px;
|
|
|
+ padding: 2px 0 !important;
|
|
|
+ height: 32px !important;
|
|
|
+}
|
|
|
+.work-score-confirm-dialog .work-score-confirm-table .cell {
|
|
|
+ line-height: 22px;
|
|
|
+ padding: 0 6px !important;
|
|
|
+}
|
|
|
+.work-score-confirm-dialog .work-score-confirm-table .el-table__header th.is-center,
|
|
|
+.work-score-confirm-dialog .work-score-confirm-table .el-table__body td.is-center {
|
|
|
+ text-align: center !important;
|
|
|
+}
|
|
|
+.work-score-confirm-dialog .work-score-confirm-table .el-table__header th.is-center .cell,
|
|
|
+.work-score-confirm-dialog .work-score-confirm-table .el-table__body td.is-center .cell {
|
|
|
+ text-align: center !important;
|
|
|
+ justify-content: center;
|
|
|
+}
|
|
|
+.work-score-confirm-dialog .work-score-confirm-table .el-table__header th.is-left,
|
|
|
+.work-score-confirm-dialog .work-score-confirm-table .el-table__body td.is-left {
|
|
|
+ text-align: left !important;
|
|
|
+}
|
|
|
+.work-score-confirm-dialog .work-score-confirm-table .el-table__header th.is-left .cell,
|
|
|
+.work-score-confirm-dialog .work-score-confirm-table .el-table__body td.is-left .cell {
|
|
|
+ text-align: left !important;
|
|
|
+ justify-content: flex-start;
|
|
|
+}
|
|
|
+.work-score-confirm-dialog .work-score-confirm-over-cell {
|
|
|
+ color: #f56c6c !important;
|
|
|
+ font-weight: 600;
|
|
|
+ font-size: 17px !important;
|
|
|
+}
|
|
|
+.work-score-confirm-dialog .el-dialog__footer {
|
|
|
+ padding: 8px 12px 12px;
|
|
|
+}
|
|
|
+.work-score-confirm-dialog .el-dialog__footer .el-button {
|
|
|
+ min-width: 100px;
|
|
|
+ font-size: 15px;
|
|
|
+}
|
|
|
+.work-score-confirm-dialog .el-table__body tr:hover > td {
|
|
|
+ background-color: var(--el-table-tr-bg-color, #fff) !important;
|
|
|
+}
|
|
|
+.work-score-confirm-dialog .el-table__body tr.el-table__row--striped:hover > td {
|
|
|
+ background-color: var(--el-fill-color-lighter, #fafafa) !important;
|
|
|
+}
|
|
|
+
|
|
|
+/* 修改数量弹窗:超出未完成数时数量变红 */
|
|
|
+.edit-reporting-qty-dialog .edit-reporting-qty-over .el-input__inner,
|
|
|
+.edit-reporting-qty-dialog .edit-reporting-qty-over .el-input__wrapper input {
|
|
|
+ color: #f56c6c !important;
|
|
|
+ font-weight: 600;
|
|
|
+}
|
|
|
+
|
|
|
.custom-warning-message {
|
|
|
background: transparent !important;
|
|
|
border: none !important;
|