|
|
@@ -699,15 +699,20 @@
|
|
|
style="height: 75%;"
|
|
|
>
|
|
|
<div style="margin-top:-12px">
|
|
|
- <el-button type="primary" class="bt" icon="edit" @click="onout">领出</el-button>
|
|
|
- <el-button type="primary" class="bt" icon="document" @click="onwithdraw">收回</el-button>
|
|
|
- <el-button @click="invertSelection" type="info">反选</el-button>
|
|
|
+ <el-button type="primary" class="bt" icon="edit" :disabled="currentSelection.length === 0" @click="onout">领出</el-button>
|
|
|
+ <el-button type="primary" class="bt" icon="document" :disabled="currentSelection.length === 0" @click="onwithdraw">收回</el-button>
|
|
|
+ <el-button @click="yinbaninvertSelection" type="info">反选</el-button>
|
|
|
</div>
|
|
|
<el-row :gutter="24" style="margin-top: 10px;">
|
|
|
<el-col :span="4">
|
|
|
<el-form-item label="工单编号" prop="id">
|
|
|
<el-input v-model="formData.工单编号" :clearable="true" />
|
|
|
</el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="4">
|
|
|
+ <el-form-item label="印件号" prop="id">
|
|
|
+ <el-input v-model="formData.印件号" :clearable="true" />
|
|
|
+ </el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="6">
|
|
|
<el-form-item prop="id">
|
|
|
@@ -733,16 +738,17 @@
|
|
|
</div>
|
|
|
<div style="flex: 1; margin: 0;">
|
|
|
<el-table
|
|
|
- tooltip-effect="dark"
|
|
|
- :data="yinbanselectData"
|
|
|
- row-key="ID"
|
|
|
- highlight-current-row="true"
|
|
|
- border
|
|
|
- style="width:1000px; height:400px;"
|
|
|
- @row-dblclick="handleSelectClick"
|
|
|
- :row-class-name="rowClassName"
|
|
|
- @selection-change="yinbanSelectionChange">
|
|
|
- <el-table-column type="selection" width="30" />
|
|
|
+ ref="yinbanmultipleTable"
|
|
|
+ tooltip-effect="dark"
|
|
|
+ :data="yinbanselectData"
|
|
|
+ row-key="ID"
|
|
|
+ highlight-current-row="true"
|
|
|
+ border
|
|
|
+ style="width:1000px; height:400px;"
|
|
|
+ @row-dblclick="handleSelectClick"
|
|
|
+ :row-class-name="rowClassName"
|
|
|
+ @selection-change="yinbanSelectionChange">
|
|
|
+ <el-table-column fixed type="selection" width="30" />
|
|
|
<el-table-column
|
|
|
prop="存货编码"
|
|
|
label="存货编码"
|
|
|
@@ -764,6 +770,13 @@
|
|
|
label="供方批号"
|
|
|
width="180"
|
|
|
/>
|
|
|
+
|
|
|
+ <el-table-column
|
|
|
+ prop="工单编号"
|
|
|
+ label="当前领用工单"
|
|
|
+ width="180"
|
|
|
+ />
|
|
|
+
|
|
|
<el-table-column
|
|
|
prop="制造日期"
|
|
|
label="制造日期"
|
|
|
@@ -802,21 +815,27 @@
|
|
|
width="180"
|
|
|
/>
|
|
|
|
|
|
- <el-table-column
|
|
|
- prop="点检方法"
|
|
|
- label="备注说明"
|
|
|
- width="180"
|
|
|
- />
|
|
|
- <el-table-column
|
|
|
- prop="点检方法"
|
|
|
- label="备注说明"
|
|
|
- width="180"
|
|
|
- />
|
|
|
-
|
|
|
</el-table>
|
|
|
</div>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
+ <!-- 退回弹窗 -->
|
|
|
+ <el-dialog
|
|
|
+ v-model="dialogwithdrawVisible"
|
|
|
+ title="印版印数"
|
|
|
+ style="width: 20%; margin: 30vh auto;"
|
|
|
+ >
|
|
|
+ <el-form-item label="印数">
|
|
|
+ <el-input v-model="Plate.印数" placeholder="请输入印数" />
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <template #footer>
|
|
|
+ <div class="dialog-footer" style="width: 100%;">
|
|
|
+ <el-button @click="rawcloseDialog" style="width: 100px; height: 40px;">关 闭</el-button>
|
|
|
+ <el-button type="primary" @click="rawenterDialog" style="width: 100px; height: 40px;">确 定</el-button>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
|
|
|
<el-dialog
|
|
|
v-model="xunchaVisible"
|
|
|
@@ -2518,6 +2537,7 @@ import {
|
|
|
MachineTeamAdd,
|
|
|
setMachineTeam,
|
|
|
PrintDetailAdd,
|
|
|
+ PrintDetailEdit
|
|
|
} from '@/api/jixiaoguanli/baogong'
|
|
|
import {
|
|
|
FieldInspectionRecord,
|
|
|
@@ -2591,6 +2611,7 @@ const handleNodeClick = (nodeData,node) => {
|
|
|
node.querySelector('.el-tree-node__label').style.color = '';
|
|
|
});
|
|
|
// 获取点击的节点
|
|
|
+ console.log(node)
|
|
|
const clickedNodeId = node['id'];
|
|
|
const clickedNode = document.querySelector(`.treecolor .el-tree-node[data-key="${clickedNodeId}"]`);
|
|
|
if (clickedNode) {
|
|
|
@@ -5277,32 +5298,55 @@ const facilityPrintDetailItem = async (value) => {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
-let currentSelection = []; // 存储选中的数据
|
|
|
+let currentSelection = ref([]); // 存储选中的数据
|
|
|
|
|
|
// 勾选回调
|
|
|
const yinbanSelectionChange = (selection) => {
|
|
|
- currentSelection = selection; // 更新选中的数据
|
|
|
- console.log("当前勾选数据:", currentSelection);
|
|
|
+ currentSelection.value = selection; // 更新选中的数据
|
|
|
+ console.log("当前勾选数据:", currentSelection.value);
|
|
|
};
|
|
|
|
|
|
const onout = async () => {
|
|
|
try {
|
|
|
- console.log("当前selection:", currentSelection); // 确保能访问到
|
|
|
-
|
|
|
- if (!currentSelection || currentSelection.length === 0) {
|
|
|
- ElMessage.warning("请先选择要领出的印版");
|
|
|
- return;
|
|
|
- }
|
|
|
+ console.log("当前选中数据:", currentSelection.value);
|
|
|
+
|
|
|
+ // 检查必填字段
|
|
|
+ const missingFields = [];
|
|
|
+ const requestData = currentSelection.value.map((item, index) => {
|
|
|
+ const 印数 = item.印数 != null ? item.印数.toString() : '0';
|
|
|
+ // 定义必填字段及其映射关系
|
|
|
+ const requiredFields = {
|
|
|
+ '工单编号': formData.value.工单编号,
|
|
|
+ '存货编码': item.存货编码,
|
|
|
+ '供方批号': item.供方批号,
|
|
|
+ '印数':印数,
|
|
|
+ '印件号': formData.value.印件号,
|
|
|
+ '系统ID': sys_id
|
|
|
+ };
|
|
|
|
|
|
- // 转换数据格式
|
|
|
- const requestData = currentSelection.map(item => ({
|
|
|
- Yb_工单编号: formData.value.工单编号 || "",
|
|
|
- Yb_存货编码: item.存货编码 || "",
|
|
|
- Yb_供方批号: item.供方批号 || "",
|
|
|
- Yb_领用机台: JTMC,
|
|
|
- Yb_印数: item.印数 ? item.印数.toString() : "0",
|
|
|
- Sys_id: sys_id || "",
|
|
|
- }));
|
|
|
+ // 检查必填字段是否为空
|
|
|
+ Object.entries(requiredFields).forEach(([fieldName, value]) => {
|
|
|
+ if (value === undefined || value === null || value === "") {
|
|
|
+ missingFields.push(`第${index + 1}条数据的${fieldName}`);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ // 构建请求数据对象
|
|
|
+ return {
|
|
|
+ Yb_工单编号: formData.value.工单编号,
|
|
|
+ Yb_存货编码: item.存货编码,
|
|
|
+ Yb_供方批号: item.供方批号,
|
|
|
+ Yb_领用机台: JTMC,
|
|
|
+ Yb_印数: 印数,
|
|
|
+ Yb_印件号: formData.value.印件号,
|
|
|
+ Sys_id: sys_id
|
|
|
+ };
|
|
|
+ });
|
|
|
+
|
|
|
+ // 如果有缺失字段,抛出错误
|
|
|
+ if (missingFields.length > 0) {
|
|
|
+ throw new Error(`以下字段为必填项且不能为空:\n${missingFields.join("\n")}`);
|
|
|
+ }
|
|
|
|
|
|
console.log("提交数据:", requestData);
|
|
|
const response = await PrintDetailAdd(requestData);
|
|
|
@@ -5317,7 +5361,84 @@ const onout = async () => {
|
|
|
ElMessage.error(`调用失败: ${error.message}`);
|
|
|
}
|
|
|
};
|
|
|
+const dialogwithdrawVisible = ref(false)
|
|
|
+const Plate = ref({ 印数: '' });
|
|
|
+const onwithdraw = async () => {
|
|
|
+ console.log(currentSelection.value);
|
|
|
+
|
|
|
+ // 检查是否有印数为 null 或 undefined
|
|
|
+ const hasInvalidUniqId = currentSelection.value.some(item => {
|
|
|
+ return item?.UniqId === null || item?.UniqId === undefined;
|
|
|
+ });
|
|
|
+
|
|
|
+ if (hasInvalidUniqId) {
|
|
|
+ ElMessage.error("选择的数据中有未领用的印版,无法收回!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 所有 UniqId 都有效,才打开弹窗
|
|
|
+ dialogwithdrawVisible.value = true;
|
|
|
+};
|
|
|
+
|
|
|
+ // 删除操作
|
|
|
+const rawenterDialog = async () => {
|
|
|
+ console.log(Plate.value.印数)
|
|
|
+ try {
|
|
|
+ await ElMessageBox.confirm('确定收回吗', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ })
|
|
|
+ console.log('收回选中的数据:', currentSelection.value)
|
|
|
+ const uniqIds = currentSelection.value.map(item => item.UniqId).join(',');
|
|
|
+ console.log(uniqIds);
|
|
|
+ // 调用收回API,假设是批量删除接口
|
|
|
+ const res = await PrintDetailEdit({ id: uniqIds,number:Plate.value.印数})
|
|
|
+
|
|
|
+ if (res.code === 0) {
|
|
|
+ ElMessage.success('收回成功')
|
|
|
+ rawcloseDialog()
|
|
|
+ // 清空选中
|
|
|
+ currentSelection.value = []
|
|
|
+ } else {
|
|
|
+ ElMessage.error(res.msg || '收回失败')
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ if (error !== 'cancel') {
|
|
|
+ console.error('收回失败:', error)
|
|
|
+ ElMessage.error('收回操作已取消')
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+const rawcloseDialog = () => {
|
|
|
+ Plate.印数 = ''
|
|
|
+ dialogwithdrawVisible.value = false
|
|
|
+}
|
|
|
+
|
|
|
+const yinbanmultipleTable = ref(null); // 表格ref
|
|
|
+const yinbaninvertSelection = () => {
|
|
|
+ // 1. 获取当前表格的所有有效数据(排除不需要的行)
|
|
|
+ const validData = yinbanselectData.value.filter(item =>
|
|
|
+ !item.isTotal &&
|
|
|
+ !(item.产品名称?.includes('A班产量:') || item.产品名称?.includes('B班产量:'))
|
|
|
+ );
|
|
|
+
|
|
|
+ // 2. 获取当前已选中的行
|
|
|
+ const currentSelected = yinbanmultipleTable.value?.getSelectionRows() || [];
|
|
|
+
|
|
|
+ // 3. 清除当前所有选择
|
|
|
+ yinbanmultipleTable.value?.clearSelection();
|
|
|
|
|
|
+ // 4. 执行反选操作
|
|
|
+ validData.forEach(row => {
|
|
|
+ yinbanmultipleTable.value?.toggleRowSelection(
|
|
|
+ row,
|
|
|
+ !currentSelected.some(selected => selected.UniqId === row.UniqId)
|
|
|
+ );
|
|
|
+ });
|
|
|
+
|
|
|
+};
|
|
|
//树形结构单机
|
|
|
const dianjianselectData = reactive([])
|
|
|
const yinbanselectData = ref([])
|
|
|
@@ -8266,6 +8387,10 @@ const yjupdateCompanyFunc = async(row) => {
|
|
|
const Procedurelist = await Procedure({ Gd_gdbh: row['工单编号|质量信息'].replace(/\|$/, '') })
|
|
|
selectData.value = Procedurelist.data;
|
|
|
cpcode.value=row.产品代号
|
|
|
+ formData.value.工单编号 = row['工单编号|质量信息'].replace(/\|$/, '')
|
|
|
+ formData.value.印件号 = row['印件号'].slice(0, 2)
|
|
|
+ formData.value.productCode = row.产品代号
|
|
|
+ formData.value.产品名称 = row.产品名称
|
|
|
_gdbhlist.value = row['工单编号|质量信息'].split('|')[0]
|
|
|
finishedcode.value=row.产品代号
|
|
|
}
|