tty 1 rok pred
rodič
commit
cdd54c79e5

+ 9 - 0
src/api/mes_api_gty/timesheet.js

@@ -66,3 +66,12 @@ export const deleteData = (params) => {
     params
   })
 }
+
+// 查询员工名称
+export const getYg = (params) => {
+  return service({
+    url: '/mes_server/packaging_count_document/getYg',
+    method: 'get',
+    params
+  })
+}

+ 3 - 3
src/view/performance/07-otherDocuments/index.vue

@@ -129,7 +129,7 @@
                 label="工艺流程"
               >
                 <el-input
-                  v-model="detailData.jyGx"
+                  v-model="detailData.Sczl_gxmc"
                   style="width: 300px"
                   @keyup.enter="handleGylcEnter"
                 />
@@ -517,7 +517,7 @@ const handleGylcEnter = async() => {
 }
 
 const handleSelectGylc = (node, check) => {
-  detailData.jyGx = node['jyGx']
+  detailData.Sczl_gxmc = node['jyGx']
   detailData.sczl_gxh = node['Gy0_gxh']
   dialogGylc.value = false
 }
@@ -607,7 +607,7 @@ const updateDetailData = async() => {
     sczl_Type: detailData.sczl_Type,
     Sczl_rq: detailData.Sczl_rq,
     Sczl_gdbh: detailData.sczl_gdbh,
-    Sczl_gxmc: '',
+    Sczl_gxmc: detailData.Sczl_gxmc,
     sczl_gxh: detailData.sczl_gxh,
     Sczl_cl: detailData.Sczl_cl,
     Sczl_dedh: '',

+ 182 - 81
src/view/performance/08-timesheet/index.vue

@@ -1,6 +1,5 @@
 <template>
   <div>
-
     <layout>
       <layout-header>
         <!-- 按钮 -->
@@ -44,16 +43,17 @@
           <el-dialog
             v-model="dialogFormVisible"
             :before-close="closeDialog"
-            title="计件工计时单维护"
+            :title="type === 'add' ? '新增' : '修改'"
             destroy-on-close
             width="800px"
           >
             <!-- <el-scrollbar height="500px"> -->
             <el-form
+              id="detail-form"
               ref="elFormRef"
               :model="detailData"
               label-position="left"
-              :rules="rule"
+              @keyup="moveFocus"
             >
 
               <!-- 日期 -->
@@ -64,7 +64,6 @@
                 >
                   <el-input
                     v-model="detailData.wgjs_rq"
-                    :clearable="true"
                     style="width: 100px;"
                   />
                 </el-form-item>
@@ -97,32 +96,43 @@
                 <el-col :span="3">
                   <el-input
                     v-model="detailData.wgjs_bh1"
-                    :clearable="true"
+                    :formatter="val => val.toUpperCase()"
                   />
                 </el-col>
                 <el-col :span="3">
                   <el-input
                     v-model="detailData.name1"
-                    :clearable="true"
+                    readonly
                   />
                 </el-col>
                 <el-col :span="3">
                   <el-input
                     v-model="detailData.wgjs_js1"
-                    :clearable="true"
                   />
                 </el-col>
                 <el-col :span="12">
                   <el-input
                     v-model="detailData.wgjs_yy1"
-                    :clearable="true"
                   />
                 </el-col>
                 <el-col :span="3">
-                  <el-input
+                  <!-- <el-input
                     v-model="detailData.wgjs_冲定额1"
-                    :clearable="true"
-                  />
+
+                  /> -->
+                  <el-select
+                    v-model="detailData.wgjs_冲定额1"
+                    placeholder=" "
+                  >
+                    <el-option
+                      label=""
+                      value=""
+                    />
+                    <el-option
+                      label="是"
+                      value="是"
+                    />
+                  </el-select>
                 </el-col>
               </el-row>
 
@@ -134,32 +144,39 @@
                 <el-col :span="3">
                   <el-input
                     v-model="detailData.wgjs_bh2"
-                    :clearable="true"
+                    :formatter="val => val.toUpperCase()"
                   />
                 </el-col>
                 <el-col :span="3">
                   <el-input
                     v-model="detailData.name2"
-                    :clearable="true"
+                    readonly
                   />
                 </el-col>
                 <el-col :span="3">
                   <el-input
                     v-model="detailData.wgjs_js2"
-                    :clearable="true"
                   />
                 </el-col>
                 <el-col :span="12">
                   <el-input
                     v-model="detailData.wgjs_yy2"
-                    :clearable="true"
                   />
                 </el-col>
                 <el-col :span="3">
-                  <el-input
+                  <el-select
                     v-model="detailData.wgjs_冲定额2"
-                    :clearable="true"
-                  />
+                    placeholder=" "
+                  >
+                    <el-option
+                      label=""
+                      value=""
+                    />
+                    <el-option
+                      label="是"
+                      value="是"
+                    />
+                  </el-select>
                 </el-col>
               </el-row>
 
@@ -171,32 +188,39 @@
                 <el-col :span="3">
                   <el-input
                     v-model="detailData.wgjs_bh3"
-                    :clearable="true"
+                    :formatter="val => val.toUpperCase()"
                   />
                 </el-col>
                 <el-col :span="3">
                   <el-input
                     v-model="detailData.name3"
-                    :clearable="true"
+                    readonly
                   />
                 </el-col>
                 <el-col :span="3">
                   <el-input
                     v-model="detailData.wgjs_js3"
-                    :clearable="true"
                   />
                 </el-col>
                 <el-col :span="12">
                   <el-input
                     v-model="detailData.wgjs_yy3"
-                    :clearable="true"
                   />
                 </el-col>
                 <el-col :span="3">
-                  <el-input
+                  <el-select
                     v-model="detailData.wgjs_冲定额3"
-                    :clearable="true"
-                  />
+                    placeholder=" "
+                  >
+                    <el-option
+                      label=""
+                      value=""
+                    />
+                    <el-option
+                      label="是"
+                      value="是"
+                    />
+                  </el-select>
                 </el-col>
               </el-row>
 
@@ -208,32 +232,39 @@
                 <el-col :span="3">
                   <el-input
                     v-model="detailData.wgjs_bh4"
-                    :clearable="true"
+                    :formatter="val => val.toUpperCase()"
                   />
                 </el-col>
                 <el-col :span="3">
                   <el-input
                     v-model="detailData.name4"
-                    :clearable="true"
+                    readonly
                   />
                 </el-col>
                 <el-col :span="3">
                   <el-input
                     v-model="detailData.wgjs_js4"
-                    :clearable="true"
                   />
                 </el-col>
                 <el-col :span="12">
                   <el-input
                     v-model="detailData.wgjs_yy4"
-                    :clearable="true"
                   />
                 </el-col>
                 <el-col :span="3">
-                  <el-input
+                  <el-select
                     v-model="detailData.wgjs_冲定额4"
-                    :clearable="true"
-                  />
+                    placeholder=" "
+                  >
+                    <el-option
+                      label=""
+                      value=""
+                    />
+                    <el-option
+                      label="是"
+                      value="是"
+                    />
+                  </el-select>
                 </el-col>
               </el-row>
 
@@ -245,32 +276,39 @@
                 <el-col :span="3">
                   <el-input
                     v-model="detailData.wgjs_bh5"
-                    :clearable="true"
+                    :formatter="val => val.toUpperCase()"
                   />
                 </el-col>
                 <el-col :span="3">
                   <el-input
                     v-model="detailData.name5"
-                    :clearable="true"
+                    readonly
                   />
                 </el-col>
                 <el-col :span="3">
                   <el-input
                     v-model="detailData.wgjs_js5"
-                    :clearable="true"
                   />
                 </el-col>
                 <el-col :span="12">
                   <el-input
                     v-model="detailData.wgjs_yy5"
-                    :clearable="true"
                   />
                 </el-col>
                 <el-col :span="3">
-                  <el-input
+                  <el-select
                     v-model="detailData.wgjs_冲定额5"
-                    :clearable="true"
-                  />
+                    placeholder=" "
+                  >
+                    <el-option
+                      label=""
+                      value=""
+                    />
+                    <el-option
+                      label="是"
+                      value="是"
+                    />
+                  </el-select>
                 </el-col>
               </el-row>
 
@@ -282,32 +320,39 @@
                 <el-col :span="3">
                   <el-input
                     v-model="detailData.wgjs_bh6"
-                    :clearable="true"
+                    :formatter="val => val.toUpperCase()"
                   />
                 </el-col>
                 <el-col :span="3">
                   <el-input
                     v-model="detailData.name6"
-                    :clearable="true"
+                    readonly
                   />
                 </el-col>
                 <el-col :span="3">
                   <el-input
                     v-model="detailData.wgjs_js6"
-                    :clearable="true"
                   />
                 </el-col>
                 <el-col :span="12">
                   <el-input
                     v-model="detailData.wgjs_yy6"
-                    :clearable="true"
                   />
                 </el-col>
                 <el-col :span="3">
-                  <el-input
+                  <el-select
                     v-model="detailData.wgjs_冲定额6"
-                    :clearable="true"
-                  />
+                    placeholder=" "
+                  >
+                    <el-option
+                      label=""
+                      value=""
+                    />
+                    <el-option
+                      label="是"
+                      value="是"
+                    />
+                  </el-select>
                 </el-col>
               </el-row>
 
@@ -352,7 +397,7 @@
         <layout-content>
           <!-- 数据展示 -->
           <el-table
-            ref="multipleTable"
+            ref="table"
             style="width: 100%"
             tooltip-effect="dark"
             :data="tableData"
@@ -365,8 +410,9 @@
             :header-row-style="{ height: '20px' }"
             :header-cell-style="{ padding: '0px' }"
             @selection-change="handleSelectionChange"
-            @row-dblclick="doubleClick"
+            @row-dblclick="handleShowDetail"
             @row-click="Click"
+            @current-change="(row, oldRow) => { currentRow = row}"
           >
             <el-table-column
               type="selection"
@@ -405,9 +451,9 @@
 <script setup>
 // 全量引入格式化工具 请按需保留
 import { Layout, LayoutContent, LayoutHeader, LayoutSider } from '@arco-design/web-vue'
-import { ElMessage } from 'element-plus'
+import { ElMessage, dayjs } from 'element-plus'
 import { ref, reactive } from 'vue'
-import { getSide, getTable, getDetail, updateData, getLocate, createData } from '@/api/mes_api_gty/timesheet'
+import { getSide, getTable, getDetail, updateData, getLocate, createData, getYg } from '@/api/mes_api_gty/timesheet'
 
 defineOptions({
   name: '08Timesheet'
@@ -429,10 +475,6 @@ const getSideData = async() => {
 }
 getSideData()
 
-// 验证规则
-const rule = reactive({
-})
-
 const elFormRef = ref()
 // const elSearchFormRef = ref()
 
@@ -465,6 +507,7 @@ const tableColumns = [
   { prop: 'wgjs_js6', label: '计时6', width: 100 },
   { prop: 'wgjs_yy6', label: '原因6', width: 100 },
 ]
+const table = ref(null)
 const tableData = reactive([])
 const page = ref(1)
 const total = ref(0)
@@ -481,6 +524,7 @@ const getTableData = async(params) => {
   if (response.code === 0) {
     total.value = response.data.total
     tableData.splice(0, tableData.length, ...response.data.rows)
+    table.value?.setCurrentRow(tableData[0])
   }
 }
 
@@ -490,6 +534,7 @@ const getLocateData = async(params) => {
   if (res.code === 0) {
     total.value = res.data.total
     tableData.splice(0, tableData.length, ...res.data.rows)
+    table.value?.setCurrentRow(tableData[0])
   }
 }
 
@@ -535,15 +580,7 @@ const handleNodeClick = (node, check) => {
     handleCurrentChange()
   }
 }
-// 新增数据
-const handleShowAdd = async() => {
-  const res = await getDetail({ wgjs_rq: value1.value, wgjs_bh1: value2.value })
-  if (res.code === 0) {
-    type.value = 'add'
-    Object.assign(detailData, res.data)
-    dialogFormVisible.value = true
-  }
-}
+
 // 搜索
 function handleSearch() {
   params.search = searchInfo.value
@@ -554,37 +591,40 @@ function handleSearch() {
 
 // ============== 详情页面 ==============
 const detailData = reactive({})
+const currentRow = ref()
 
 // 行为控制标记(弹窗内部需要增还是改)
 const type = ref('')
 // 弹窗控制标记
 const dialogFormVisible = ref(false)
 
-// 双击表格操作
-async function doubleClick(row, column, event) {
+// 查改
+const handleShowDetail = async() => {
   type.value = 'update'
-  const { wgjs_rq, wgjs_bh1 } = row
+  const { wgjs_rq, wgjs_bh1 } = currentRow.value
   const res = await getDetail({ wgjs_rq, wgjs_bh1 })
   if (res.code === 0) {
     Object.assign(detailData, res.data)
-    dialogFormVisible.value = true
+    // dialogFormVisible.value = true
+    showDialog()
   }
 }
-const value1 = ref()
-const value2 = ref()
-// 单击表格操作
-async function Click(row, column, event) {
-  const { wgjs_rq, wgjs_bh1 } = row
-  value1.value = wgjs_rq
-  value2.value = wgjs_bh1
-  // console.log(wgjs_rq)
-  // console.log(wgjs_bh1)
-  // const res = await getDetail({ wgjs_rq, wgjs_bh1 })
-  // if (res.code === 0) {
-  //   Object.assign(detailData, res.data)
-  //   dialogFormVisible.value = true
-  // }
+
+// 新增数据
+const handleShowAdd = async() => {
+  const { wgjs_rq, wgjs_bh1 } = currentRow.value
+  const res = await getDetail({ wgjs_rq, wgjs_bh1 })
+  if (res.code === 0) {
+    type.value = 'add'
+    Object.assign(detailData, res.data)
+
+    detailData['wgjs_rq'] = dayjs().format('YYYY-MM-DD')
+
+    // dialogFormVisible.value = true
+    showDialog()
+  }
 }
+
 // 更新数据
 const enterDialog = async() => {
   if (type.value === 'update') {
@@ -664,11 +704,72 @@ const updateDetailData = async() => {
   }
 }
 
+// 开启弹窗
+const showDialog = () => {
+  dialogFormVisible.value = true
+  // 在 setTimeout 中获取元素,确保在 DOM 渲染完毕后执行
+  setTimeout(() => {
+    formElements = document.getElementById('detail-form').elements
+    formElements[0].focus()
+  }, 0)
+}
+
 // 关闭弹窗
 const closeDialog = () => {
   dialogFormVisible.value = false
 }
 
+let formElements
+const moveFocus = async(event) => {
+  console.log(event)
+  const index = Array.from(formElements).indexOf(event.target)
+  const key = event.key
+  event.preventDefault()
+
+  // 切换焦点
+  const focusNext = (step) => {
+    const nextIndex = (index + step + formElements.length) % formElements.length
+    formElements[nextIndex].focus()
+  }
+
+  switch (index) {
+    case 1:
+    case 6:
+    case 11:
+    case 16:
+    case 21:
+    case 26:
+      if (key === 'ArrowDown') {
+        formElements[index + 1].focus()
+      } else if (key === 'ArrowUp') {
+        formElements[index - 1].focus()
+      } else if (key === 'Enter') {
+        formElements[index + 1].focus()
+        const sczl_bh = formElements[index]?.value
+        if (sczl_bh === '') {
+          detailData[`name${(index - 1) / 5 + 1}`] = ''
+          break
+        }
+        const res = await getYg({ sczl_bh })
+        if (res.code === 0) {
+          const { data: { ygxm }} = res
+          detailData[`name${(index - 1) / 5 + 1}`] = ygxm
+        }
+      }
+      break
+
+    default:
+      if (key === 'ArrowDown') {
+        focusNext(1)
+      } else if (key === 'ArrowUp') {
+        focusNext(-1)
+      } else if (key === 'Enter') {
+        focusNext(1)
+      }
+      break
+  }
+}
+
 </script>
 
 <style scoped>

+ 1 - 1
src/view/performance/12-orderAccounting/index.vue

@@ -267,7 +267,7 @@ const tableCols1 = [
   { label: '实际投料', prop: '实际投料', width: '100' },
   { label: '计量单位', prop: '计量单位', width: '100' },
   { label: '入仓日期', prop: 'warehousing_date', width: '120' },
-  { label: '入仓数量', prop: '', width: '100' },
+  { label: '入仓数量', prop: 'warehousing_num', width: '100' },
   { label: '目标合格率', prop: 'target_rate', width: '100' },
   { label: '实际合格率', prop: 'real_rate', width: '100' },
   { label: '奖惩系数', prop: '', width: '100' },