|
|
@@ -1687,6 +1687,8 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-dialog>
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
<!-- JP机台独立页面 新增-->
|
|
|
@@ -1832,7 +1834,7 @@
|
|
|
</el-table>
|
|
|
</el-dialog>
|
|
|
|
|
|
- <!-- JP检品独立 机台机器-->
|
|
|
+ <!-- JP检品独立 新增机台机器-->
|
|
|
<el-dialog v-model="JPdialogVisible_JT" title="机台机器选择" destroy-on-close width="600px" style="height: 600px;" @keydown="JPselect_JT($event)">
|
|
|
<el-table tooltip-effect="dark" :data="JPselectData_JT" row-key="ID" highlight-current-row="true"
|
|
|
border style="width:100%" ref="table_JT" :row-style="{ height: '20px' }" :cell-style="{ padding: '0px' }"
|
|
|
@@ -1881,6 +1883,20 @@
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
|
|
|
+ <!-- JP机新增定额代号弹窗 -->
|
|
|
+ <el-dialog v-model="GetDedhVisible" id="tableFplb" @keydown="ent($event)" style="margin-top: 5%;" >
|
|
|
+ <el-form>
|
|
|
+ <el-form-item label="选择定额代号" class="mab" prop="keyOrder"></el-form-item>
|
|
|
+ <div style="border:1px solid #eee; width:100%; height: 600px; overflow-y: auto;">
|
|
|
+ <el-tree :data="GetDedhtreeData" ref="table_fplb"
|
|
|
+ @keydown="handleTreeKeydown"
|
|
|
+ :props="{ children: 'children',label: 'label'}"
|
|
|
+ node-key="id" @node-click="handleFplbClick">
|
|
|
+ </el-tree>
|
|
|
+ </div>
|
|
|
+ </el-form>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
|
|
|
<!--当日上报产量 组员及分配比例-->
|
|
|
<el-dialog v-model="blModellist" :before-close="() => blModellist = false" style="width: 20%">
|
|
|
@@ -2024,7 +2040,7 @@
|
|
|
<!-- 空列,用于对齐 -->
|
|
|
</el-col>
|
|
|
<el-col v-for="i in 10" :key="i" :span="2">
|
|
|
- <el-input v-model="JPformdataedit['组员' + i]['姓名']" :id="'xm' + i" @keydown="JPentedit($event)"/>
|
|
|
+ <el-input readonly v-model="JPformdataedit['组员' + i]['姓名']" :id="'xm' + i" @keydown="JPentedit($event)"/>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
|
|
|
@@ -2072,7 +2088,16 @@
|
|
|
<el-table-column prop="name" label="" width="560" />
|
|
|
</el-table>
|
|
|
</el-dialog>
|
|
|
-
|
|
|
+
|
|
|
+ <!-- JP检品独立 修改机台机器-->
|
|
|
+ <el-dialog v-model="JPdialogVisible_JTedit" title="机台机器选择" destroy-on-close width="600px" style="height: 600px;" @keydown="JPselect_JTedit($event)">
|
|
|
+ <el-table tooltip-effect="dark" :data="JPselectData_JTedit" row-key="ID" highlight-current-row="true"
|
|
|
+ border style="width:100%" ref="table_JTedit" :row-style="{ height: '20px' }" :cell-style="{ padding: '0px' }"
|
|
|
+ :header-row-style="{ height: '20px' }" :header-cell-style="{ padding: '0px' }" @row-dblclick="JPhandleSelectClick_JTedit">
|
|
|
+ <el-table-column prop="机台" label="机台" />
|
|
|
+ </el-table>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
|
|
|
<el-dialog v-model="JPdialogSelectVisible_LXedit" title="选择" destroy-on-close width="300px" @keydown="JPselect_jylbedit($event)">
|
|
|
<el-table
|
|
|
@@ -2088,6 +2113,20 @@
|
|
|
<el-table-column prop="type" label="类别" width="100"></el-table-column>
|
|
|
</el-table>
|
|
|
</el-dialog>
|
|
|
+
|
|
|
+ <!-- JP机修改定额代号弹窗 -->
|
|
|
+ <el-dialog v-model="GetDedhVisibleedit" id="tableFplb" @keydown="entedit($event)" style="margin-top: 5%;" >
|
|
|
+ <el-form>
|
|
|
+ <el-form-item label="选择定额代号" class="mab" prop="keyOrder"></el-form-item>
|
|
|
+ <div style="border:1px solid #eee; width:100%; height: 600px; overflow-y: auto;">
|
|
|
+ <el-tree :data="GetDedhtreeDataedit" ref="table_fplbedit"
|
|
|
+ @keydown="handleTreeKeydownedit"
|
|
|
+ :props="{ children: 'children',label: 'label'}"
|
|
|
+ node-key="id" @node-click="handleFplbClickedit">
|
|
|
+ </el-tree>
|
|
|
+ </div>
|
|
|
+ </el-form>
|
|
|
+ </el-dialog>
|
|
|
|
|
|
<!--修改 JP检品机 当日上报产量 组员及分配比例-->
|
|
|
<el-dialog v-model="JPblModellistedit" style="width: 20%" @keydown="JPselect_zyfpedit($event)" >
|
|
|
@@ -2519,6 +2558,8 @@ const JPgytableData = ref([])
|
|
|
const JPmachineDetails = async (jt, riqi) => {
|
|
|
const JPmachineDetail_data = await JPmachineDetail({machine: jt, date: riqi});
|
|
|
console.log(JPmachineDetail_data)
|
|
|
+
|
|
|
+
|
|
|
_rclsb_gdbh.value = JPmachineDetail_data.data[0]['工单编号']
|
|
|
_rclsb_yjno.value = JPmachineDetail_data.data[0]['yjno']
|
|
|
if (JPmachineDetail_data.code === 0) {
|
|
|
@@ -2529,30 +2570,17 @@ const JPmachineDetails = async (jt, riqi) => {
|
|
|
delete JPmachineDetail_data.data.totalB
|
|
|
JPgytableData.value = Object.values(JPmachineDetail_data.data)
|
|
|
console.log(totalA)
|
|
|
- if(totalA.length === 1){
|
|
|
- if(totalA){
|
|
|
- let rowA = {
|
|
|
- 工单编号: 'A班产量:',
|
|
|
- yjno: totalA[0].检验类型+ ':' +totalA[0].箱数,
|
|
|
- }
|
|
|
- JPgytableData.value.push(rowA)
|
|
|
- }
|
|
|
- if(totalB){
|
|
|
- let rowB = {
|
|
|
- 工单编号: 'B班产量:',
|
|
|
- yjno: totalB[0].检验类型+ ':' +totalB[0].箱数,
|
|
|
- }
|
|
|
- JPgytableData.value.push(rowB)
|
|
|
- }
|
|
|
- }else{
|
|
|
+ console.log(totalB)
|
|
|
+ if(totalA.length != 0){
|
|
|
if(totalA){
|
|
|
let rowA = {
|
|
|
工单编号: 'A班产量:',
|
|
|
yjno: totalA[0].检验类型+ ':' +totalA[0].箱数,
|
|
|
- 产品名称: totalA[1].检验类型+ ':' +totalA[1].箱数,
|
|
|
}
|
|
|
JPgytableData.value.push(rowA)
|
|
|
}
|
|
|
+ }
|
|
|
+ if(totalB.length != 0){
|
|
|
if(totalB){
|
|
|
let rowB = {
|
|
|
工单编号: 'B班产量:',
|
|
|
@@ -3255,15 +3283,14 @@ const JPenterDialogedit = async () => {
|
|
|
|
|
|
};
|
|
|
console.log(JPformattedData)
|
|
|
-
|
|
|
const JpChanliangEdit_edit = await JpChanliangEdit(JPformattedData);
|
|
|
console.log(JpChanliangEdit_edit)
|
|
|
if (JpChanliangEdit_edit.code === 0) {
|
|
|
JPchanliangVisibleedit.value = false
|
|
|
- JPmachineDetails();
|
|
|
- ElMessage({type: 'success',message: '添加成功'})
|
|
|
+ JPmachineDetails(JTMC,date);
|
|
|
+ ElMessage({type: 'success',message: '修改成功'})
|
|
|
} else {
|
|
|
- ElMessage({type: 'error',message: '添加失败'})
|
|
|
+ ElMessage({type: 'error',message: '修改失败'})
|
|
|
}
|
|
|
}
|
|
|
//当日上报产量取消
|
|
|
@@ -3367,12 +3394,15 @@ const JPenterDialog = async() => {
|
|
|
};
|
|
|
console.log(JPformattedData)
|
|
|
// console.log("新增了")
|
|
|
+ console.log(JTMC)
|
|
|
+ console.log(date)
|
|
|
|
|
|
const JpUploade_add = await JpUploade(JPformattedData);
|
|
|
console.log(JpUploade_add)
|
|
|
if (JpUploade_add.code === 0) {
|
|
|
// JPchanliangVisible.value = false
|
|
|
ElMessage({type: 'success',message: '添加成功'})
|
|
|
+ JPmachineDetails(JTMC+'#',date);
|
|
|
//自动聚焦光标
|
|
|
setTimeout(() => {
|
|
|
const inputElement = document.getElementById('新增工单编号');
|
|
|
@@ -3389,7 +3419,7 @@ const JPenterDialog = async() => {
|
|
|
JPformdata['异常类型'] = ''
|
|
|
JPformdata['异常补贴工时'] = ''
|
|
|
JPformdata['通电工时'] = ''
|
|
|
- JPformdata['计件箱数'] = ''
|
|
|
+ JPformdata['计件箱数'] = 0
|
|
|
} else {
|
|
|
ElMessage({type: 'error',message: '添加失败'})
|
|
|
}
|
|
|
@@ -3589,6 +3619,33 @@ const JPentedit = async (event,key,val) => {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ // 阻止回车键的默认行为
|
|
|
+ event.preventDefault();
|
|
|
+ event.stopPropagation();
|
|
|
+
|
|
|
+ // 获取所有以 "bh" 开头的输入框
|
|
|
+ const inputs = document.querySelectorAll('input[id^="bh"]');
|
|
|
+ const currentIndex = Array.from(inputs).indexOf(event.target); // 获取当前触发事件的input索引
|
|
|
+
|
|
|
+ // 判断是否是最后一个输入框
|
|
|
+ console.log(currentIndex)
|
|
|
+ if (currentIndex === inputs.length - 1) {
|
|
|
+ console.log('当前是最后一个输入框');
|
|
|
+ if(JPblModellist.value === false){
|
|
|
+ // 弹出存盘确认框
|
|
|
+ ElMessageBox.confirm('数据存盘?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ // 用户点击“确定”,执行存盘操作
|
|
|
+ JPenterDialogedit();
|
|
|
+ }).catch(() => {
|
|
|
+ console.log('用户取消了存盘操作');
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
if(event.target.id === '检验类别'){
|
|
|
JPdialogSelectVisible_LXedit.value = true
|
|
|
@@ -3647,8 +3704,53 @@ const JPentedit = async (event,key,val) => {
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
+ if (event.target.id === '机器') {
|
|
|
+ // 获取当前输入框的值
|
|
|
+ const machineInputValue = JPformdataedit['机器'];
|
|
|
+
|
|
|
+ // 调用接口获取机台数据
|
|
|
+ const MachineListdata = await gdzl_MachineList({ address: CJMC.value });
|
|
|
+ console.log("MachineListdata", MachineListdata);
|
|
|
+
|
|
|
+ //机台列表数据
|
|
|
+ JPselectData_JTedit.value = MachineListdata.data.map((item, index) => ({
|
|
|
+ ID: index + 1,
|
|
|
+ 机台: item,
|
|
|
+ }));
|
|
|
+ JPselectData_JTedit.splice(0, JPselectData_JTedit.length, ...JPselectData_JTedit.value);
|
|
|
+
|
|
|
+ // 检查输入的机器名称是否存在于接口返回的数据中
|
|
|
+ const isMachineValid = JPselectData_JTedit.value.some(item => item.机台 === machineInputValue);
|
|
|
+ //完全匹配时,输入错误在弹窗
|
|
|
+ // const isMachineValid = JPselectData_JT.value.some(item => item.机台.split('-->')[0] === machineInputValue);
|
|
|
+ if (!isMachineValid) {
|
|
|
+ // 如果机器名称无效,则弹出弹窗
|
|
|
+ JPdialogVisible_JTedit.value = true;
|
|
|
+ // console.log('输入的机器不在列表中,弹出弹窗');
|
|
|
+ } else {
|
|
|
+ // console.log('输入的机器匹配列表,弹窗不显示');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (event.target.id === '定额代号') {
|
|
|
+ if(JPformdataedit['机器'] === ''){
|
|
|
+ ElMessage({
|
|
|
+ type: 'error',
|
|
|
+ message: '请先选择机台!'
|
|
|
+ })
|
|
|
+ //自动聚焦光标
|
|
|
+ setTimeout(() => {
|
|
|
+ const inputElement = document.getElementById('机器');
|
|
|
+ if (inputElement) {
|
|
|
+ inputElement.focus();
|
|
|
+ }
|
|
|
+ }, 100);
|
|
|
+ }else{
|
|
|
+ getDedhsubmitedit();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+
|
|
|
const inputs = document.getElementsByTagName('input');
|
|
|
const currentIndex = Array.from(inputs).indexOf(event.target);
|
|
|
if (event.keyCode === 13 || event.keyCode === 40) { // Enter 或向下箭头
|
|
|
@@ -3718,59 +3820,60 @@ const JPentedit = async (event,key,val) => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
/*
|
|
|
- 机台机器选择
|
|
|
+ 机台机器选择修改
|
|
|
*/
|
|
|
-const JPdialogVisible_JT = ref(false) // 弹窗
|
|
|
-const JPselectData_JT = reactive([]) // table data
|
|
|
-const currentIndex_JT = ref(0);
|
|
|
+const JPdialogVisible_JTedit = ref(false) // 弹窗
|
|
|
+const JPselectData_JTedit = reactive([]) // table data
|
|
|
+const currentIndex_JTedit = ref(0);
|
|
|
//双击事件
|
|
|
-const JPhandleSelectClick_JT = async (row) => {
|
|
|
+const JPhandleSelectClick_JTedit = async (row) => {
|
|
|
// 使用 split() 截取 '机器' 字符串中 '-->' 前面的部分
|
|
|
const machineName = row['机台'].split('-->')[0];
|
|
|
- JPformdata['机器'] = machineName;
|
|
|
+ JPformdataedit['机器'] = machineName;
|
|
|
}
|
|
|
// 键盘事件
|
|
|
-const JPselect_JT = async (event) => {
|
|
|
+const JPselect_JTedit = async (event) => {
|
|
|
if (event.keyCode === 40) { // 向下箭头
|
|
|
- if (currentIndex_JT.value < JPselectData_JT.length - 1) {
|
|
|
- currentIndex_JT.value++;
|
|
|
- setCurrent_JT(JPselectData_JT[currentIndex_JT.value]);
|
|
|
+ if (currentIndex_JTedit.value < JPselectData_JTedit.length - 1) {
|
|
|
+ currentIndex_JTedit.value++;
|
|
|
+ setCurrent_JTedit(JPselectData_JTedit[currentIndex_JTedit.value]);
|
|
|
} else {
|
|
|
- currentIndex_JT.value = 0;
|
|
|
- setCurrent_JT(JPselectData_JT[currentIndex_JT.value]); // 到达最后一行时回到第一行
|
|
|
+ currentIndex_JTedit.value = 0;
|
|
|
+ setCurrent_JTedit(JPselectData_JTedit[currentIndex_JTedit.value]); // 到达最后一行时回到第一行
|
|
|
}
|
|
|
} else if (event.keyCode === 38) { // 向上箭头
|
|
|
- if (currentIndex_JT.value > 0) {
|
|
|
- currentIndex_JT.value--;
|
|
|
- setCurrent_JT(JPselectData_JT[currentIndex_JT.value]);
|
|
|
+ if (currentIndex_JTedit.value > 0) {
|
|
|
+ currentIndex_JTedit.value--;
|
|
|
+ setCurrent_JTedit(JPselectData_JTedit[currentIndex_JTedit.value]);
|
|
|
} else {
|
|
|
- currentIndex_JT.value = JPselectData_JT.length - 1;
|
|
|
- setCurrent_JT(JPselectData_JT[currentIndex_JT.value]); // 到达第一行时回到最后一行
|
|
|
+ currentIndex_JTedit.value = JPselectData_JTedit.length - 1;
|
|
|
+ setCurrent_JTedit(JPselectData_JTedit[currentIndex_JTedit.value]); // 到达第一行时回到最后一行
|
|
|
}
|
|
|
} else if (event.keyCode === 13) { // 回车键
|
|
|
- JPdialogVisible_JT.value = false;
|
|
|
+ JPdialogVisible_JTedit.value = false;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// ref属性
|
|
|
-const table_JT = ref();
|
|
|
+const table_JTedit = ref();
|
|
|
|
|
|
-const setCurrent_JT = (row) => {
|
|
|
+const setCurrent_JTedit = (row) => {
|
|
|
setTimeout(() => {
|
|
|
- table_JT.value?.setCurrentRow(row);
|
|
|
+ table_JTedit.value?.setCurrentRow(row);
|
|
|
// 使用 split() 截取 '机器' 字符串中 '-->' 前面的部分
|
|
|
const machineName = row['机台'].split('-->')[0];
|
|
|
- JPformdata['机器'] = machineName;
|
|
|
+ console.log(machineName)
|
|
|
+ JPformdataedit['机器'] = machineName;
|
|
|
});
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
//班组产量提报 打开新增页面
|
|
|
const onADD = async() => {
|
|
|
// function onADD(){
|
|
|
@@ -3782,11 +3885,7 @@ const onADD = async() => {
|
|
|
getTimelistss();
|
|
|
//获取产量上报数据信息接口
|
|
|
getMachineReportInfos();
|
|
|
-
|
|
|
- //默认显示清空
|
|
|
- // JPformdata['机器'] = JTMC+'#'
|
|
|
-
|
|
|
- // JPformdata['换膜补产工时'] = ''
|
|
|
+
|
|
|
} else {
|
|
|
type2.value="create"
|
|
|
//通过车间名称查询机台【机器】
|
|
|
@@ -3863,7 +3962,7 @@ const getMachineReportInfos = async () => {
|
|
|
JPformdata['bzdh'] = getMachineReportInfos.data.class.sczl_bzdh
|
|
|
JPformdata['工单编号'] = _rclsb_gdbh.value
|
|
|
JPformdata['产品名称'] = getMachineReportInfos.data.order_info.product_name
|
|
|
- JPformdata['定额代号'] = getMachineReportInfos.data.order_info.dedh
|
|
|
+ // JPformdata['定额代号'] = getMachineReportInfos.data.order_info.dedh
|
|
|
|
|
|
for (let i = 1; i <= 10; i++) {
|
|
|
JPformdata[`组员${i}`]['比例'] = getMachineReportInfos.data.class[`sczl_rate${i}`];
|
|
|
@@ -4101,29 +4200,6 @@ const JPent = async (event,key,val) => {
|
|
|
|
|
|
}
|
|
|
}
|
|
|
- // if (event.keyCode === 13 && val === '比例') {
|
|
|
- // event.preventDefault(); // 阻止回车键的默认行为
|
|
|
- // event.stopPropagation(); // 阻止事件冒泡
|
|
|
-
|
|
|
- // // 获取所有 input 元素
|
|
|
- // const inputs = document.querySelectorAll('input'); // 假设所有的input元素都在文档中
|
|
|
- // const currentIndex = Array.from(inputs).indexOf(event.target); // 获取当前触发事件的input索引
|
|
|
-
|
|
|
- // // 判断是否是最后一个 input
|
|
|
- // if (currentIndex === inputs.length - 1) {
|
|
|
- // console.log('当前是最后一个输入框');
|
|
|
- // ElMessageBox.confirm('数据存盘?', '提示', {
|
|
|
- // confirmButtonText: '确定',
|
|
|
- // cancelButtonText: '取消',
|
|
|
- // type: 'warning'
|
|
|
- // }).then(() => {
|
|
|
- // // console.log("保存");
|
|
|
- // JPenterDialog()
|
|
|
- // }).catch(() => {
|
|
|
- // console.log('用户取消了存盘操作');
|
|
|
- // });
|
|
|
- // }
|
|
|
- // }
|
|
|
|
|
|
if(event.target.id === '检验类别'){
|
|
|
JPdialogSelectVisible_LX.value = true
|
|
|
@@ -4209,6 +4285,23 @@ const JPent = async (event,key,val) => {
|
|
|
// console.log('输入的机器匹配列表,弹窗不显示');
|
|
|
}
|
|
|
}
|
|
|
+ if (event.target.id === '定额代号') {
|
|
|
+ if(JPformdata['机器'] === ''){
|
|
|
+ ElMessage({
|
|
|
+ type: 'error',
|
|
|
+ message: '请先选择机台!'
|
|
|
+ })
|
|
|
+ //自动聚焦光标
|
|
|
+ setTimeout(() => {
|
|
|
+ const inputElement = document.getElementById('机器');
|
|
|
+ if (inputElement) {
|
|
|
+ inputElement.focus();
|
|
|
+ }
|
|
|
+ }, 100);
|
|
|
+ }else{
|
|
|
+ getDedhsubmit();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
const inputs = document.getElementsByTagName('input');
|
|
|
@@ -4279,6 +4372,53 @@ const JPent = async (event,key,val) => {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /*
|
|
|
+ 机台机器选择新增
|
|
|
+*/
|
|
|
+const JPdialogVisible_JT = ref(false) // 弹窗
|
|
|
+const JPselectData_JT = reactive([]) // table data
|
|
|
+const currentIndex_JT = ref(0);
|
|
|
+//双击事件
|
|
|
+const JPhandleSelectClick_JT = async (row) => {
|
|
|
+ // 使用 split() 截取 '机器' 字符串中 '-->' 前面的部分
|
|
|
+ const machineName = row['机台'].split('-->')[0];
|
|
|
+ JPformdata['机器'] = machineName;
|
|
|
+}
|
|
|
+// 键盘事件
|
|
|
+const JPselect_JT = async (event) => {
|
|
|
+ if (event.keyCode === 40) { // 向下箭头
|
|
|
+ if (currentIndex_JT.value < JPselectData_JT.length - 1) {
|
|
|
+ currentIndex_JT.value++;
|
|
|
+ setCurrent_JT(JPselectData_JT[currentIndex_JT.value]);
|
|
|
+ } else {
|
|
|
+ currentIndex_JT.value = 0;
|
|
|
+ setCurrent_JT(JPselectData_JT[currentIndex_JT.value]); // 到达最后一行时回到第一行
|
|
|
+ }
|
|
|
+ } else if (event.keyCode === 38) { // 向上箭头
|
|
|
+ if (currentIndex_JT.value > 0) {
|
|
|
+ currentIndex_JT.value--;
|
|
|
+ setCurrent_JT(JPselectData_JT[currentIndex_JT.value]);
|
|
|
+ } else {
|
|
|
+ currentIndex_JT.value = JPselectData_JT.length - 1;
|
|
|
+ setCurrent_JT(JPselectData_JT[currentIndex_JT.value]); // 到达第一行时回到最后一行
|
|
|
+ }
|
|
|
+ } else if (event.keyCode === 13) { // 回车键
|
|
|
+ JPdialogVisible_JT.value = false;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// ref属性
|
|
|
+const table_JT = ref();
|
|
|
+
|
|
|
+const setCurrent_JT = (row) => {
|
|
|
+ setTimeout(() => {
|
|
|
+ table_JT.value?.setCurrentRow(row);
|
|
|
+ // 使用 split() 截取 '机器' 字符串中 '-->' 前面的部分
|
|
|
+ const machineName = row['机台'].split('-->')[0];
|
|
|
+ JPformdata['机器'] = machineName;
|
|
|
+ });
|
|
|
+}
|
|
|
|
|
|
/*
|
|
|
组员及分配比例弹窗
|
|
|
@@ -6180,7 +6320,320 @@ const tablebllickHandlerlist = async (row, column, event) => {
|
|
|
clickedlist.value = false;
|
|
|
}, 300); // 300毫秒内再次点击将不会触发事件,你可以根据需要调整这个延迟时间
|
|
|
};
|
|
|
-
|
|
|
+
|
|
|
+/*
|
|
|
+ JP定额代号弹窗
|
|
|
+*/
|
|
|
+const GetDedhtreeData = reactive([]);
|
|
|
+const GetDedhVisible = ref(false);
|
|
|
+const table_fplb = ref(null); // el-tree 的 ref
|
|
|
+
|
|
|
+const getDedhsubmit = async () => {
|
|
|
+ try {
|
|
|
+ const response = await productionDedh({
|
|
|
+ sczl_jtbh: JPformdata['机器'],
|
|
|
+ });
|
|
|
+ console.log(response);
|
|
|
+
|
|
|
+ if (response.code === 0) {
|
|
|
+ if (response.data.bh_mc) {
|
|
|
+ const data = [response.data];
|
|
|
+ console.log("设备编号", response.data.sys_bh);
|
|
|
+ const buildTree = (node) => {
|
|
|
+ const treeNode = {
|
|
|
+ id: node.sys_bh, // 确保有 id 属性,供 node-key 使用
|
|
|
+ label: node.sys_bh + "【" + node.sys_mc + "】",
|
|
|
+ children: [],
|
|
|
+ key: node.sys_bh, //保留 key 属性,便于自定义操作
|
|
|
+ };
|
|
|
+ if (node.bh_mc && Array.isArray(node.bh_mc)) {
|
|
|
+ node.bh_mc.forEach((childNode) => {
|
|
|
+ treeNode.children.push(buildTree(childNode));
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return treeNode;
|
|
|
+ };
|
|
|
+ // 更新树形数据
|
|
|
+ GetDedhtreeData.splice(0, GetDedhtreeData.length, ...data.map(buildTree));
|
|
|
+ // 显示树形选择框
|
|
|
+ GetDedhVisible.value = true;
|
|
|
+ // 使用 nextTick 确保树形组件渲染完成
|
|
|
+ nextTick(() => {
|
|
|
+ const tree = table_fplb.value;
|
|
|
+ if (tree) {
|
|
|
+ const firstNode = tree.getNode(0); // 获取树形的第一个节点
|
|
|
+ if (firstNode) {
|
|
|
+ firstNode.el.focus(); // 聚焦第一个节点
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ // 如果 sczl_jtbh 有值,则直接填充数据
|
|
|
+ JPformdata['定额代号'] = response.data.sys_bh;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.error(error);
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+//键盘事件
|
|
|
+const handleTreeKeydown = (event) => {
|
|
|
+ const tree = table_fplb.value; // 获取树实例
|
|
|
+ if (!tree) {
|
|
|
+ console.error("树组件未加载");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ const focusedElement = document.activeElement;
|
|
|
+ const focusedNodeId = focusedElement?.getAttribute("data-key"); // 获取 DOM 的 data-key 属性
|
|
|
+
|
|
|
+ if (event.keyCode === 13 && focusedNodeId) { // 判断是否是回车键
|
|
|
+ tree.setCurrentKey(focusedNodeId); // 设置当前节点为选中
|
|
|
+ tree.$nextTick(() => {
|
|
|
+ const currentNode = tree.getCurrentNode(); // 获取当前选中的节点
|
|
|
+ if (!currentNode) {
|
|
|
+ console.warn("没有选中的节点");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 清除上一次的选中状态
|
|
|
+ clearPreviousSelection(tree);
|
|
|
+ // 收起所有其他节点
|
|
|
+ Object.keys(tree.store.nodesMap).forEach((key) => {
|
|
|
+ tree.store.nodesMap[key].expanded = false; // 收起所有节点
|
|
|
+ });
|
|
|
+
|
|
|
+ // 展开当前节点
|
|
|
+ tree.store.nodesMap[currentNode.id].expanded = true;
|
|
|
+
|
|
|
+ // 如果当前节点有子节点,选中第一个子节点
|
|
|
+ if (currentNode.children && currentNode.children.length > 0) {
|
|
|
+ const firstChild = currentNode.children[0];
|
|
|
+ if (firstChild) {
|
|
|
+ const firstChildKey = firstChild.id.toString();
|
|
|
+ tree.setCurrentKey(firstChildKey); // 设置第一个子节点为选中
|
|
|
+ setTimeout(() => {
|
|
|
+ const firstChildDom = tree.$el.querySelector(`[data-key="${firstChildKey}"]`);
|
|
|
+ if (firstChildDom) {
|
|
|
+ firstChildDom.focus();
|
|
|
+ firstChildDom.scrollIntoView({ block: "nearest" });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ console.log("当前子节点:", currentNode.label);
|
|
|
+ // 如果节点没有子节点,打印节点名称
|
|
|
+ JPformdata['定额代号'] = currentNode.label.split("【")[0];
|
|
|
+ GetDedhVisible.value = false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else if (event.keyCode === 38 || event.keyCode === 40) { // 上下箭头键
|
|
|
+ const currentNode = tree.getCurrentNode();
|
|
|
+ if (currentNode) {
|
|
|
+ const currentNodeDom = tree.$el.querySelector(`[data-key="${currentNode.id}"]`);
|
|
|
+ if (currentNodeDom) {
|
|
|
+ currentNodeDom.focus();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+// 清除之前的选中状态
|
|
|
+const clearPreviousSelection = (tree) => {
|
|
|
+ const selectedNodes = tree.getCheckedNodes();
|
|
|
+ selectedNodes.forEach(node => {
|
|
|
+ tree.setChecked(node, false);
|
|
|
+ });
|
|
|
+ tree.setCurrentKey(null);
|
|
|
+};
|
|
|
+
|
|
|
+// 弹出框键盘事件
|
|
|
+const ent = (event) => {
|
|
|
+ if (document.activeElement.id === "tableFplb") {
|
|
|
+ if (table_fplb.value) {
|
|
|
+ const tree = table_fplb.value?.$el;
|
|
|
+ console.log(111, tree);
|
|
|
+ if (tree) {
|
|
|
+ const node = tree.querySelector("[data-key]");
|
|
|
+ console.log(222, node);
|
|
|
+ if (event.keyCode === 13) {
|
|
|
+ // GetDedhVisible.value = false;
|
|
|
+ }
|
|
|
+ if (node) {
|
|
|
+ node.scrollIntoView({ block: "nearest" }); // 确保节点可见
|
|
|
+ node.focus(); // 确保焦点正确
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+//点击事件
|
|
|
+const handleFplbClick = (nodeData, node, component) => {
|
|
|
+ //存放当前节点的nodeId
|
|
|
+ if (!nodeData.children || nodeData.children.length === 0) {
|
|
|
+ // 如果节点没有子节点,打印节点名称
|
|
|
+ JPformdata['定额代号']= nodeData.label.split("【")[0];
|
|
|
+ GetDedhVisible.value = false;
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+/*
|
|
|
+ JP修改定额代号弹窗
|
|
|
+*/
|
|
|
+const GetDedhtreeDataedit = reactive([]);
|
|
|
+const GetDedhVisibleedit = ref(false);
|
|
|
+const table_fplbedit = ref(null); // el-tree 的 ref
|
|
|
+
|
|
|
+const getDedhsubmitedit = async () => {
|
|
|
+ try {
|
|
|
+ const response = await productionDedh({
|
|
|
+ sczl_jtbh: JPformdataedit['机器'],
|
|
|
+ });
|
|
|
+ console.log(response);
|
|
|
+
|
|
|
+ if (response.code === 0) {
|
|
|
+ if (response.data.bh_mc) {
|
|
|
+ const data = [response.data];
|
|
|
+ console.log("设备编号", response.data.sys_bh);
|
|
|
+ const buildTree = (node) => {
|
|
|
+ const treeNode = {
|
|
|
+ id: node.sys_bh, // 确保有 id 属性,供 node-key 使用
|
|
|
+ label: node.sys_bh + "【" + node.sys_mc + "】",
|
|
|
+ children: [],
|
|
|
+ key: node.sys_bh, //保留 key 属性,便于自定义操作
|
|
|
+ };
|
|
|
+ if (node.bh_mc && Array.isArray(node.bh_mc)) {
|
|
|
+ node.bh_mc.forEach((childNode) => {
|
|
|
+ treeNode.children.push(buildTree(childNode));
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return treeNode;
|
|
|
+ };
|
|
|
+ // 更新树形数据
|
|
|
+ GetDedhtreeDataedit.splice(0, GetDedhtreeDataedit.length, ...data.map(buildTree));
|
|
|
+ // 显示树形选择框
|
|
|
+ GetDedhVisibleedit.value = true;
|
|
|
+ // 使用 nextTick 确保树形组件渲染完成
|
|
|
+ nextTick(() => {
|
|
|
+ const tree = table_fplbedit.value;
|
|
|
+ if (tree) {
|
|
|
+ const firstNode = tree.getNode(0); // 获取树形的第一个节点
|
|
|
+ if (firstNode) {
|
|
|
+ firstNode.el.focus(); // 聚焦第一个节点
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ // 如果 sczl_jtbh 有值,则直接填充数据
|
|
|
+ JPformdataedit['定额代号'] = response.data.sys_bh;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.error(error);
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+//键盘事件
|
|
|
+const handleTreeKeydownedit = (event) => {
|
|
|
+ const tree = table_fplbedit.value; // 获取树实例
|
|
|
+ if (!tree) {
|
|
|
+ console.error("树组件未加载");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ const focusedElement = document.activeElement;
|
|
|
+ const focusedNodeId = focusedElement?.getAttribute("data-key"); // 获取 DOM 的 data-key 属性
|
|
|
+
|
|
|
+ if (event.keyCode === 13 && focusedNodeId) { // 判断是否是回车键
|
|
|
+ tree.setCurrentKey(focusedNodeId); // 设置当前节点为选中
|
|
|
+ tree.$nextTick(() => {
|
|
|
+ const currentNode = tree.getCurrentNode(); // 获取当前选中的节点
|
|
|
+ if (!currentNode) {
|
|
|
+ console.warn("没有选中的节点");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 清除上一次的选中状态
|
|
|
+ clearPreviousSelection(tree);
|
|
|
+ // 收起所有其他节点
|
|
|
+ Object.keys(tree.store.nodesMap).forEach((key) => {
|
|
|
+ tree.store.nodesMap[key].expanded = false; // 收起所有节点
|
|
|
+ });
|
|
|
+
|
|
|
+ // 展开当前节点
|
|
|
+ tree.store.nodesMap[currentNode.id].expanded = true;
|
|
|
+
|
|
|
+ // 如果当前节点有子节点,选中第一个子节点
|
|
|
+ if (currentNode.children && currentNode.children.length > 0) {
|
|
|
+ const firstChild = currentNode.children[0];
|
|
|
+ if (firstChild) {
|
|
|
+ const firstChildKey = firstChild.id.toString();
|
|
|
+ tree.setCurrentKey(firstChildKey); // 设置第一个子节点为选中
|
|
|
+ setTimeout(() => {
|
|
|
+ const firstChildDom = tree.$el.querySelector(`[data-key="${firstChildKey}"]`);
|
|
|
+ if (firstChildDom) {
|
|
|
+ firstChildDom.focus();
|
|
|
+ firstChildDom.scrollIntoView({ block: "nearest" });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ console.log("当前子节点:", currentNode.label);
|
|
|
+ // 如果节点没有子节点,打印节点名称
|
|
|
+ JPformdataedit['定额代号'] = currentNode.label.split("【")[0];
|
|
|
+ GetDedhVisibleedit.value = false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else if (event.keyCode === 38 || event.keyCode === 40) { // 上下箭头键
|
|
|
+ const currentNode = tree.getCurrentNode();
|
|
|
+ if (currentNode) {
|
|
|
+ const currentNodeDom = tree.$el.querySelector(`[data-key="${currentNode.id}"]`);
|
|
|
+ if (currentNodeDom) {
|
|
|
+ currentNodeDom.focus();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+// 清除之前的选中状态
|
|
|
+const clearPreviousSelectionedit = (tree) => {
|
|
|
+ const selectedNodes = tree.getCheckedNodes();
|
|
|
+ selectedNodes.forEach(node => {
|
|
|
+ tree.setChecked(node, false);
|
|
|
+ });
|
|
|
+ tree.setCurrentKey(null);
|
|
|
+};
|
|
|
+
|
|
|
+// 弹出框键盘事件
|
|
|
+const entedit = (event) => {
|
|
|
+ if (document.activeElement.id === "tableFplb") {
|
|
|
+ if (table_fplbedit.value) {
|
|
|
+ const tree = table_fplbedit.value?.$el;
|
|
|
+ console.log(111, tree);
|
|
|
+ if (tree) {
|
|
|
+ const node = tree.querySelector("[data-key]");
|
|
|
+ console.log(222, node);
|
|
|
+ if (event.keyCode === 13) {
|
|
|
+ // GetDedhVisibleedit.value = false;
|
|
|
+ }
|
|
|
+ if (node) {
|
|
|
+ node.scrollIntoView({ block: "nearest" }); // 确保节点可见
|
|
|
+ node.focus(); // 确保焦点正确
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+//点击事件
|
|
|
+const handleFplbClickedit = (nodeData, node, component) => {
|
|
|
+ //存放当前节点的nodeId
|
|
|
+ if (!nodeData.children || nodeData.children.length === 0) {
|
|
|
+ // 如果节点没有子节点,打印节点名称
|
|
|
+ JPformdataedit['定额代号']= nodeData.label.split("【")[0];
|
|
|
+ GetDedhVisibleedit.value = false;
|
|
|
+ }
|
|
|
+};
|
|
|
|
|
|
|
|
|
//追加字体颜色和不可输入
|
|
|
@@ -6579,6 +7032,7 @@ if(selected.value==='难度调整系数'){
|
|
|
const ent1 = (event) => {
|
|
|
const inputs = document.getElementsByTagName('input');
|
|
|
const currentIndex = Array.from(inputs).indexOf(event.target);
|
|
|
+ console.log(event)
|
|
|
|
|
|
if (event.keyCode === 13 || event.keyCode === 40) { // Enter 或向下箭头
|
|
|
let nextIndex = currentIndex + 1;
|
|
|
@@ -7446,4 +7900,45 @@ const sbzyqdsatusCellClass = ({row, column, rowIndex, columnIndex}) =>{
|
|
|
font-size: 16px;
|
|
|
font-weight: bold;
|
|
|
}
|
|
|
+</style>
|
|
|
+<style scoped>
|
|
|
+/* :deep(.el-table td .cell) {
|
|
|
+ line-height: 20px !important;
|
|
|
+}
|
|
|
+
|
|
|
+:deep(.el-tabs__header) {
|
|
|
+ margin-bottom: 0;
|
|
|
+} */
|
|
|
+
|
|
|
+/* .search {
|
|
|
+ margin-left: 0px !important;
|
|
|
+ margin-right: 10px !important;
|
|
|
+}
|
|
|
+
|
|
|
+.bt {
|
|
|
+ margin-left: 2px !important;
|
|
|
+ padding: 3px !important;
|
|
|
+ font-size: 12px;
|
|
|
+}
|
|
|
+
|
|
|
+.el-tabs__header {
|
|
|
+ margin: 0px !important;
|
|
|
+}
|
|
|
+
|
|
|
+.gva-table-box {
|
|
|
+ padding: 0px !important;
|
|
|
+} */
|
|
|
+
|
|
|
+
|
|
|
+/* :deep(.plan-usage-low div) {
|
|
|
+ color: blue !important;
|
|
|
+ font-size: 16px;
|
|
|
+ font-weight: bold;
|
|
|
+} */
|
|
|
+
|
|
|
+
|
|
|
+/* tree组件背景高亮 */
|
|
|
+:deep(.el-tree-node:focus > .el-tree-node__content){
|
|
|
+ background: #ff80ff !important;
|
|
|
+ }
|
|
|
</style>
|