|
|
@@ -250,6 +250,8 @@
|
|
|
label-position="right"
|
|
|
:rules="rule"
|
|
|
label-width="75px"
|
|
|
+ id="detail-form"
|
|
|
+ @keyup="moveFocus"
|
|
|
>
|
|
|
<el-form-item
|
|
|
label="员工编号:"
|
|
|
@@ -258,7 +260,9 @@
|
|
|
<el-input
|
|
|
v-model="detailData.Sczl_bh"
|
|
|
:clearable="true"
|
|
|
- @keyup.enter="handleGetYg"
|
|
|
+
|
|
|
+ @blur="handleGetYg()"
|
|
|
+ @keydown="ent1($event)"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
<el-form-item prop="image">
|
|
|
@@ -266,6 +270,7 @@
|
|
|
v-model="detailData.name"
|
|
|
:clearable="true"
|
|
|
placeholder="请输入员工姓名"
|
|
|
+ @keydown="ent1($event)"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
@@ -286,8 +291,7 @@
|
|
|
:clearable="true"
|
|
|
placeholder="请输入班组"
|
|
|
/> -->
|
|
|
- <el-select v-model="detailData.sczl_bzdh" placeholder="" style="width: 70px"
|
|
|
-
|
|
|
+ <el-select v-model="detailData.sczl_bzdh" placeholder="" style="width: 70px"
|
|
|
>
|
|
|
<el-option label="A班" value="A班"></el-option>
|
|
|
<el-option label="B班" value="B班"></el-option>
|
|
|
@@ -301,6 +305,7 @@
|
|
|
v-model="detailData.Sczl_rq"
|
|
|
:clearable="true"
|
|
|
placeholder="请输入日期"
|
|
|
+ @keydown="ent1($event)"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
@@ -320,6 +325,7 @@
|
|
|
v-model="detailData.Sczl_gdbh"
|
|
|
:clearable="true"
|
|
|
placeholder="请输入工单编号"
|
|
|
+ @keydown="ent1($event)"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
<el-form-item prop="image">
|
|
|
@@ -327,6 +333,7 @@
|
|
|
v-model="detailData.Gd_cpmc"
|
|
|
:clearable="true"
|
|
|
placeholder="请输入产品名称"
|
|
|
+ @keydown="ent1($event)"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
@@ -347,6 +354,7 @@
|
|
|
:clearable="true"
|
|
|
placeholder="请输入工序名称"
|
|
|
style="width: 140px;"
|
|
|
+ @keydown="ent1($event)"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
<el-form-item prop="image">
|
|
|
@@ -355,6 +363,7 @@
|
|
|
:clearable="true"
|
|
|
placeholder="请输入工序号"
|
|
|
style="width: 140px;"
|
|
|
+ @keydown="ent1($event)"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
<el-form-item
|
|
|
@@ -366,6 +375,7 @@
|
|
|
:clearable="true"
|
|
|
placeholder="请输入流程单号"
|
|
|
style="width: 140px;"
|
|
|
+ @keydown="ent1($event)"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
@@ -386,6 +396,7 @@
|
|
|
:clearable="true"
|
|
|
placeholder="请输入抽检数量"
|
|
|
style="width: 123px;"
|
|
|
+ @keydown="ent1($event)"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
@@ -406,6 +417,7 @@
|
|
|
:clearable="true"
|
|
|
placeholder="请输入A类废品"
|
|
|
style="width: 123px;"
|
|
|
+ @keydown="ent1($event)"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
<el-form-item
|
|
|
@@ -417,6 +429,7 @@
|
|
|
:clearable="true"
|
|
|
placeholder="请输入B类废品"
|
|
|
style="width: 123px;"
|
|
|
+ @keydown="ent1($event)"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
<el-form-item
|
|
|
@@ -428,6 +441,7 @@
|
|
|
:clearable="true"
|
|
|
placeholder="请输入C类废品"
|
|
|
style="width: 123px;"
|
|
|
+ @keydown="ent1($event)"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
@@ -446,6 +460,7 @@
|
|
|
v-model="detailData.Sczl_desc"
|
|
|
:clearable="true"
|
|
|
placeholder="请输入其他备注"
|
|
|
+ @keydown="ent1($event)"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
@@ -499,10 +514,11 @@
|
|
|
import { Layout, LayoutContent, LayoutHeader, LayoutSider } from '@arco-design/web-vue'
|
|
|
import { getSpotList, getSpotTab, getSpotLocal, getSpotInfo, updateSpotData,add } from '@/api/mes/job'
|
|
|
import { createCompany, deleteCompany, deleteCompanyByIds, findCompany, updateCompany } from '@/api/company'
|
|
|
+
|
|
|
import{getYg}from '@/api/mes_api_gty/myapi'
|
|
|
// 全量引入格式化工具 请按需保留
|
|
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
|
|
-import { reactive, ref } from 'vue'
|
|
|
+import { reactive, ref,nextTick ,onMounted, onBeforeMount} from 'vue'
|
|
|
|
|
|
defineOptions({
|
|
|
name: 'Sampling'
|
|
|
@@ -661,7 +677,8 @@ const handleShowAdd = async () => {
|
|
|
res.data[0].Sczl_rq = `${sczl_rq.getFullYear()}-${sczl_rq.getMonth() + 1}-${sczl_rq.getDate()}`;
|
|
|
Object.assign(detailData, res.data[0]);
|
|
|
detailData.UniqId = currentRow.value;
|
|
|
- dialogFormVisible.value = true
|
|
|
+ // dialogFormVisible.value = true
|
|
|
+ showDialog()
|
|
|
}
|
|
|
};
|
|
|
// type.value='add'
|
|
|
@@ -681,7 +698,8 @@ const getDetailData = async(row) => {
|
|
|
if (res.code === 0) {
|
|
|
Object.assign(detailData, res.data[0])
|
|
|
detailData.UniqId = UniqId
|
|
|
- dialogFormVisible.value = true
|
|
|
+ // dialogFormVisible.value = true
|
|
|
+ showDialog()
|
|
|
}
|
|
|
}
|
|
|
const currentRow = ref()
|
|
|
@@ -842,7 +860,8 @@ const closeDetailShow = () => {
|
|
|
// 打开弹窗
|
|
|
const openDialog = () => {
|
|
|
type.value = 'create'
|
|
|
- dialogFormVisible.value = true
|
|
|
+ // dialogFormVisible.value = true
|
|
|
+ showDialog()
|
|
|
}
|
|
|
|
|
|
// 关闭弹窗
|
|
|
@@ -854,7 +873,77 @@ const closeDialog = () => {
|
|
|
name: '',
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+// 开启弹窗
|
|
|
+const showDialog = () => {
|
|
|
+ dialogFormVisible.value = true
|
|
|
+ // 在 setTimeout 中获取元素,确保在 DOM 渲染完毕后执行
|
|
|
+ // setTimeout(() => {
|
|
|
+ // formElements = document.getElementById('detail-form').elements
|
|
|
+ // formElements[0].focus()
|
|
|
+ // }, 0)
|
|
|
+}
|
|
|
+const ent1 = (event) => {
|
|
|
+ const inputs = document.getElementsByTagName('input');
|
|
|
+ const currentIndex = Array.from(inputs).indexOf(event.target);
|
|
|
+
|
|
|
+ if (event.keyCode === 13 || event.keyCode === 40) { // Enter 或向下箭头
|
|
|
+ for (let i = currentIndex + 1; i < inputs.length; i++) {
|
|
|
+ if (!inputs[i].readOnly) {
|
|
|
+ nextTick(()=>{
|
|
|
+ inputs[i].focus();
|
|
|
+ inputs[i].select();
|
|
|
+ })
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (event.keyCode === 38) { // 向上箭头
|
|
|
+ for (let i = currentIndex - 1; i >= 0; i--) {
|
|
|
+ if (!inputs[i].readOnly) {
|
|
|
+ nextTick(()=>{
|
|
|
+ inputs[i].focus();
|
|
|
+ inputs[i].select();
|
|
|
+ })
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (event.keyCode === 8) { // 删除箭头
|
|
|
+ if (event.target.selectionStart === 0) {
|
|
|
+ for (let i = currentIndex - 1; i >= 0; i--) {
|
|
|
+ if (!inputs[i].readOnly) {
|
|
|
+ nextTick(()=>{
|
|
|
+ inputs[i].focus();
|
|
|
+ inputs[i].setSelectionRange(0, 0);
|
|
|
+ })
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (event.keyCode === 37) { // 向左箭头
|
|
|
+ if (event.target.selectionStart === 0) {
|
|
|
+ for (let i = currentIndex - 1; i >= 0; i--) {
|
|
|
+ if (!inputs[i].readOnly) {
|
|
|
+ nextTick(()=>{
|
|
|
+ inputs[i].focus();
|
|
|
+ inputs[i].select();
|
|
|
+ })
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (event.keyCode === 39) { // 向右箭头
|
|
|
+ if (event.target.selectionStart === event.target.value.length) {
|
|
|
+ for (let i = currentIndex + 1; i < inputs.length; i++) {
|
|
|
+ if (!inputs[i].readOnly) {
|
|
|
+ nextTick(()=>{
|
|
|
+ inputs[i].focus();
|
|
|
+ inputs[i].select();
|
|
|
+ })
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<style scoped>
|