|
@@ -34,7 +34,7 @@
|
|
|
<div class="gva-table-box">
|
|
<div class="gva-table-box">
|
|
|
<div class="gva-btn-list">
|
|
<div class="gva-btn-list">
|
|
|
<el-row :span="6">
|
|
<el-row :span="6">
|
|
|
- <el-input v-model="searchInfo" placeholder="输入工单编号或产品名称" />
|
|
|
|
|
|
|
+ <el-input v-model="searchInfo" placeholder="输入员工编号或姓名缩写" @keyup.enter.native="onSearch" />
|
|
|
</el-row>
|
|
</el-row>
|
|
|
<el-button type="primary" :icon="Search" class="bt" @click="onSearch">搜索</el-button>
|
|
<el-button type="primary" :icon="Search" class="bt" @click="onSearch">搜索</el-button>
|
|
|
<!-- <el-button type="primary" :icon="Refresh">重置</el-button> -->
|
|
<!-- <el-button type="primary" :icon="Refresh">重置</el-button> -->
|
|
@@ -305,6 +305,18 @@
|
|
|
</template>
|
|
</template>
|
|
|
</el-dialog>
|
|
</el-dialog>
|
|
|
|
|
|
|
|
|
|
+ <!-- 员工选择 -->
|
|
|
|
|
+ <el-dialog v-model="YgbhVisible" title="选择"
|
|
|
|
|
+ destroy-on-close width="200px" @keydown="selectYgbh($event)" >
|
|
|
|
|
+ <el-table tooltip-effect="dark" :data="YgbhselectData" row-key="ID"
|
|
|
|
|
+ highlight-current-row="true" border style="width:100%"
|
|
|
|
|
+ :row-style="{ height: '30px' }"
|
|
|
|
|
+ @row-dblclick="YgbhSelectClick"
|
|
|
|
|
+ ref="tableYgbh"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-table-column prop="ygxm" label="" width="160" />
|
|
|
|
|
+ </el-table>
|
|
|
|
|
+ </el-dialog>
|
|
|
|
|
|
|
|
<el-dialog v-model="positioningVisibleshow" :before-close="closepositioningVisible" :title="type==='create'?'添加':'修改'" destroy-on-close>
|
|
<el-dialog v-model="positioningVisibleshow" :before-close="closepositioningVisible" :title="type==='create'?'添加':'修改'" destroy-on-close>
|
|
|
<el-card>
|
|
<el-card>
|
|
@@ -344,7 +356,8 @@ import {
|
|
|
dailygetList,
|
|
dailygetList,
|
|
|
dailygetAllList,
|
|
dailygetAllList,
|
|
|
dailygetDetail,
|
|
dailygetDetail,
|
|
|
- dailysearch
|
|
|
|
|
|
|
+ dailysearch,
|
|
|
|
|
+ getYg
|
|
|
} from '@/api/jixiaoguanli/jitairibaobiao'
|
|
} from '@/api/jixiaoguanli/jitairibaobiao'
|
|
|
|
|
|
|
|
// 全量引入格式化工具 请按需保留
|
|
// 全量引入格式化工具 请按需保留
|
|
@@ -494,7 +507,8 @@ const getTableData = async () => {
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
- // console.log(combinedData)
|
|
|
|
|
|
|
+ //插入最后一个员工的合计
|
|
|
|
|
+ combinedData.push(summaryData[0]);
|
|
|
// 更新表格数据
|
|
// 更新表格数据
|
|
|
tableData.splice(0, tableData.length, ...combinedData);
|
|
tableData.splice(0, tableData.length, ...combinedData);
|
|
|
}
|
|
}
|
|
@@ -578,34 +592,113 @@ const enterpositioning = async () => {
|
|
|
positioningVisibleshow.value=false
|
|
positioningVisibleshow.value=false
|
|
|
}
|
|
}
|
|
|
let positionvalue=ref()
|
|
let positionvalue=ref()
|
|
|
-const Getlocate = async (value) => {
|
|
|
|
|
-
|
|
|
|
|
- // const response = await locate(locatevalue);
|
|
|
|
|
- // console.log(locatevalue)
|
|
|
|
|
- // console.log(response)
|
|
|
|
|
- // if (response.code === 0) {
|
|
|
|
|
- // tableData.splice(0, tableData.length, ...response.data.rows);
|
|
|
|
|
- // }
|
|
|
|
|
|
|
+const Getlocate = async () => {
|
|
|
const response = await dailysearch({
|
|
const response = await dailysearch({
|
|
|
- date: value,
|
|
|
|
|
- search:positionvalue.value
|
|
|
|
|
|
|
+ date: params.date,
|
|
|
|
|
+ search:searchInfo.value
|
|
|
})
|
|
})
|
|
|
if (response.code === 0) {
|
|
if (response.code === 0) {
|
|
|
- tableData.splice(0, tableData.length, ...response.data)
|
|
|
|
|
|
|
+ if(response.data.length == 0){
|
|
|
|
|
+ const originalData = []
|
|
|
|
|
+ tableData.splice(0, tableData.length, ...originalData)
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ const originalData = response.data;
|
|
|
|
|
+
|
|
|
|
|
+ // // 将合计数据插入到原始数据中
|
|
|
|
|
+ // const combinedData = [];
|
|
|
|
|
+ // originalData.forEach((item, index) => {
|
|
|
|
|
+ // combinedData.push(item);
|
|
|
|
|
+ // const nextItem = originalData[index + 1];
|
|
|
|
|
+ // if (nextItem && nextItem['员工姓名'] !== item['员工姓名']) {
|
|
|
|
|
+ // // 如果下一个员工姓名与当前不同,插入合计数据
|
|
|
|
|
+ // const currentSummary = summaryData.shift();
|
|
|
|
|
+ // combinedData.push(currentSummary);
|
|
|
|
|
+
|
|
|
|
|
+ // }
|
|
|
|
|
+ // });
|
|
|
|
|
+ // //插入最后一个员工的合计
|
|
|
|
|
+ // combinedData.push(summaryData[0]);
|
|
|
|
|
+ // // 更新表格数据
|
|
|
|
|
+ // tableData.splice(0, tableData.length, ...combinedData);
|
|
|
|
|
+ const summaryData = generateSummaryData(originalData);
|
|
|
|
|
+ originalData.push(summaryData[0]);
|
|
|
|
|
+ tableData.splice(0, tableData.length, ...originalData)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
// 搜索
|
|
// 搜索
|
|
|
function onSearch() {
|
|
function onSearch() {
|
|
|
- let parts = params.date.split('-')
|
|
|
|
|
-
|
|
|
|
|
- // # 截取第一个"-"之前的内容并赋值给新变量1
|
|
|
|
|
- let new_variable1 = parts[0]
|
|
|
|
|
|
|
+ if(!params.date){
|
|
|
|
|
+ ElMessage({
|
|
|
|
|
+ type: 'warning',
|
|
|
|
|
+ message: '请先选择车间'
|
|
|
|
|
+ })
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ if(searchInfo.value){
|
|
|
|
|
+ getYg({sczl_bh:searchInfo.value}).then(res=>{
|
|
|
|
|
+ if (res.code === 0) {
|
|
|
|
|
+ if(res.data.length === 0){
|
|
|
|
|
+ const originalData = []
|
|
|
|
|
+ tableData.splice(0, tableData.length, ...originalData)
|
|
|
|
|
+ return
|
|
|
|
|
+ }else if(res.data.length === 1){
|
|
|
|
|
+ searchInfo.value = res.data[0]['员工编号']
|
|
|
|
|
+ Getlocate()
|
|
|
|
|
+ }else{
|
|
|
|
|
+ YgbhselectData.splice(0, YgbhselectData.length, ...res.data)
|
|
|
|
|
+ setYgbhCurrent(YgbhselectData[0])
|
|
|
|
|
+ YgbhVisible.value=true
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }else{
|
|
|
|
|
+ getTableData();
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- // # 截取第一个"-"之后到第二个"-"之前的内容并赋值给新变量2
|
|
|
|
|
- let new_variable2 = parts[1]
|
|
|
|
|
- Getlocate(new_variable1+new_variable2)
|
|
|
|
|
- // positioningVisibleshow.value=false
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+const YgbhVisible = ref(false)
|
|
|
|
|
+const YgbhselectData = reactive([])
|
|
|
|
|
+//选择
|
|
|
|
|
+const YgbhSelectClick = (row, column, event) => {
|
|
|
|
|
+ searchInfo.value = row['员工编号']
|
|
|
|
|
+ YgbhVisible.value = false
|
|
|
|
|
+ Getlocate()
|
|
|
|
|
+}
|
|
|
|
|
+const tableYgbh=ref()
|
|
|
|
|
+const setYgbhCurrent = (row) => {
|
|
|
|
|
+ setTimeout(()=>{
|
|
|
|
|
+ tableYgbh.value?.setCurrentRow(row)
|
|
|
|
|
+ searchInfo.value = row['员工编号']
|
|
|
|
|
+ })
|
|
|
|
|
+}
|
|
|
|
|
+const YgbhIndex = ref(0);
|
|
|
|
|
+const YgbhCurrent = ref(0);
|
|
|
|
|
+const selectYgbh = (event) => {
|
|
|
|
|
+ if (event.keyCode === 40) { // 向下箭头
|
|
|
|
|
+ if (YgbhIndex.value < YgbhselectData.length - 1) {
|
|
|
|
|
+ YgbhIndex.value++;
|
|
|
|
|
+ setYgbhCurrent(YgbhselectData[YgbhIndex.value]);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ YgbhIndex.value = 0;
|
|
|
|
|
+ setYgbhCurrent(YgbhselectData[YgbhIndex.value]); // 到达最后一行时回到第一行
|
|
|
|
|
+ }
|
|
|
|
|
+ } else if (event.keyCode === 38) { // 向上箭头
|
|
|
|
|
+ if (YgbhIndex.value > 0) {
|
|
|
|
|
+ YgbhIndex.value--;
|
|
|
|
|
+ setYgbhCurrent(YgbhselectData[YgbhIndex.value]);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ YgbhIndex.value = YgbhselectData.length - 1;
|
|
|
|
|
+ setYgbhCurrent(YgbhselectData[YgbhIndex.value]); // 到达第一行时回到最后一行
|
|
|
|
|
+ }
|
|
|
|
|
+ } else if (event.keyCode === 13) { // 回车键
|
|
|
|
|
+ YgbhVisible.value = false
|
|
|
|
|
+ Getlocate()
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
// ============== 表格控制部分结束 ===============
|
|
// ============== 表格控制部分结束 ===============
|
|
|
|
|
|
|
|
// 获取需要的字典 可能为空 按需保留
|
|
// 获取需要的字典 可能为空 按需保留
|