bug修复以及数据分离操作

This commit is contained in:
zyh
2026-02-09 20:22:46 +08:00
parent ab3efaa405
commit 5555d6a747
11 changed files with 975 additions and 448 deletions

View File

@@ -90,10 +90,8 @@
</el-select>
</el-form-item>
<el-form-item label="技术员" prop="technician">
<el-select v-model="queryParams.technician" filterable allow-create clearable placeholder="请输入或选择技术员"
style="min-width:150px">
<!-- 如果有字典可以放开下面这行没有就纯输入 -->
<!-- <el-option v-for="item in technicianOptions" :key="item" :label="item" :value="item" /> -->
<el-select v-model="queryParams.technician" placeholder="请选择技术员" clearable filterable style="min-width:150px">
<el-option v-for="item in technicalOptions" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item label="是否在群" prop="isDelete">
@@ -112,7 +110,7 @@
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="Plus" @click="handleAdd"
v-hasPermi="['transition_info:transition_info:add']">新增</el-button>
v-hasPermi="['produce:transition_info:add']">新增</el-button>
</el-col>
<!-- <el-col :span="1.5">
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate"
@@ -120,11 +118,11 @@
</el-col> -->
<el-col :span="1.5">
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete"
v-hasPermi="['transition_info:transition_info:remove']">删除</el-button>
v-hasPermi="['produce:transition_info:remove']">删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="Download" @click="handleExport"
v-hasPermi="['transition_info:transition_info:export']">导出</el-button>
v-hasPermi="['produce:transition_info:export']">导出</el-button>
</el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList" />
</el-row>
@@ -167,9 +165,9 @@
<el-table-column label="操作" align="center" min-width="180" fixed="right">
<template #default="scope">
<el-button link type="primary" icon="Edit" @click="handleApprove(scope.row)"
v-hasPermi="['transition_info:transition_info:approve']" :disabled="scope.row.status !== 0">审批</el-button>
v-hasPermi="['produce:transition_info:approve']" :disabled="scope.row.status !== 0">审批</el-button>
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"
v-hasPermi="['transition_info:transition_info:remove']">删除</el-button>
v-hasPermi="['produce:transition_info:remove']">删除</el-button>
</template>
</el-table-column>
</el-table>
@@ -231,7 +229,13 @@
</el-form-item>
<el-form-item label="技术员" prop="technician">
<el-input v-model="form.technician" placeholder="请输入技术员" />
<el-select v-model="form.technician" placeholder="请选择技术员" clearable filterable style="width: 100%">
<el-option v-for="item in technicalOptions" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item label="备注" prop="comment">
<el-input v-model="form.comment" placeholder="请填写备注" type="textarea" rows="2" />
</el-form-item>
</el-form>
@@ -296,10 +300,29 @@ import { listTransition_info, getTransition_info, delTransition_info, addTransit
import { checkSheepByManageTags, getSheepBySheepfoldId } from '@/api/produce/other/fixHoof'
import request from '@/utils/request'
import dayjs from 'dayjs'
import { getUserByPost } from '@/api/common/user'
const { proxy } = getCurrentInstance()
const { status, trans_type } = proxy.useDict('status', 'trans_type')
// 技术员下拉选项
const technicalOptions = ref([])
// 获取技术员列表岗位编码techs
const fetchTechnicalList = () => {
getUserByPost({ postCode: "techs" })
.then(res => {
if (res.code === 200 && Array.isArray(res.data)) {
technicalOptions.value = res.data.map(item => ({
value: item.nickName,
label: item.nickName
}))
} else {
technicalOptions.value = []
}
})
.catch(() => {
technicalOptions.value = []
})
}
const transition_infoList = ref([])
const open = ref(false)
const loading = ref(true)
@@ -341,6 +364,7 @@ const data = reactive({
transType: null,
transitionDate: null,
technician: null,
comment: null,
tagDetails: {}
},
queryParams: {
@@ -415,6 +439,7 @@ function reset() {
transType: null,
technician: null,
createBy: null,
comment: null,
tagDetails: {}
};
batchTags.value = [];
@@ -667,7 +692,8 @@ async function handleUpdate(row) {
getTransition_info(_id).then(response => {
form.value = {
...response.data,
manageTags: [response.data.manageTags]
manageTags: [response.data.manageTags],
comment: response.data.comment || ''
};
open.value = true;
title.value = "修改转场";
@@ -700,7 +726,7 @@ async function submitForm() {
eventType: form.value.eventType,
transitionDate: form.value.transitionDate,
technician: form.value.technician,
comment: batchSheep.value[idx].comment || '',
comment: form.value.comment || '',
status: 0,
}))
@@ -746,7 +772,9 @@ function searchEarNumber(query) {
async function handleRanchChange(ranchName) {
if (!ranchName) {
sheepOptions.value = [];
form.value.manageTags = [];
batchTags.value = []; // 清空
batchSheep.value = []; // 清空
form.value.manageTags = '';
return;
}
@@ -754,9 +782,23 @@ async function handleRanchChange(ranchName) {
if (!matched) return;
const res = await getSheepByRanchId(matched.id);
sheepOptions.value = (res.data || []).map(s => ({ id: s.id, manageTags: s.manageTags }));
form.value.manageTags = (res.data || []).map(s => s.manageTags);
await loadSheepInfo();
const sheepList = (res.data || []).map(s => ({
id: s.id,
manageTags: s.manageTags,
varietyId: s.varietyId, // 确保有品种ID
varietyName: s.varietyName || '', // 确保有品种名
ranchId: s.ranchId
}));
// 关键修改:填充 batchTags 和 batchSheep和手动输入保持一致
batchTags.value = sheepList.map(s => s.manageTags);
batchSheep.value = sheepList;
form.value.manageTags = batchTags.value.join(' ');
// 自动填充转出牧场(当前选中的牧场)
form.value.transFrom = ranchName;
sheepOptions.value = sheepList;
}
/* 粘贴事件 */
function handlePaste() {
@@ -888,6 +930,7 @@ onMounted(() => {
getVarietyOptions();
loadSheepOptions();
loadSheepTypeList();
fetchTechnicalList();
getList();
});
</script>