Commit eb2d36d3 authored by Mr.Tang's avatar Mr.Tang

对应关系国内国际bug修复

parent f676ae7e
...@@ -3,7 +3,7 @@ import request from '@/utils/request' ...@@ -3,7 +3,7 @@ import request from '@/utils/request'
export function list(query) { export function list(query) {
return request({ return request({
url: '/control/lawPartMiddle/list', url: '/control/lawPartMiddle/list',
method: 'get', method: 'post',
data: query, data: query,
}) })
} }
......
...@@ -27,15 +27,6 @@ export function partDetails(query) { ...@@ -27,15 +27,6 @@ export function partDetails(query) {
}) })
} }
// 新增法规与关键件对应数据管理
export function addRelation(data) {
return request({
url: '/control/lawPartRelation/add',
method: 'post',
data: data,
})
}
// 修改法规与关键件对应数据管理 // 修改法规与关键件对应数据管理
export function updateRelation(data) { export function updateRelation(data) {
return request({ return request({
...@@ -56,8 +47,8 @@ export function addBatchRelation(query) { ...@@ -56,8 +47,8 @@ export function addBatchRelation(query) {
/** 移除对应关系 */ /** 移除对应关系 */
export function delRelation(id) { export function delRelation(id) {
return request({ return request({
url: '/control/lawPartRelation/del/' + id, url: `/control/lawPartRelation/del/${id}`,
method: 'delete', method: 'get',
}) })
} }
/**查询没有关联的零部件 */ /**查询没有关联的零部件 */
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
"source": "来源", "source": "来源",
"standardName": "标准名称", "standardName": "标准名称",
"partName": "零件名称", "partName": "零件名称",
"notice": "共5个未关联法规的CQC关键零部件", "notice": "共个未关联法规的CQC关键零部件",
"serialNumber": "序号", "serialNumber": "序号",
"correspondingParts": "对应零件", "correspondingParts": "对应零件",
"createTime": "创建时间", "createTime": "创建时间",
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
"source": "Source", "source": "Source",
"standardName": "Standard Name", "standardName": "Standard Name",
"partName": "Part Name", "partName": "Part Name",
"notice": "A total of 5 CQC key components not related to regulations", "notice": "CQC key components without associated regulations",
"serialNumber": "Serial Number", "serialNumber": "Serial Number",
"correspondingParts": "Corresponding Parts", "correspondingParts": "Corresponding Parts",
"order": "order", "order": "order",
......
...@@ -167,27 +167,35 @@ ...@@ -167,27 +167,35 @@
<!-- 维护类型描述抽屉 --> <!-- 维护类型描述抽屉 -->
<el-drawer v-model="open" :title="title" width="800px" append-to-body> <el-drawer v-model="open" :title="title" width="800px" append-to-body>
<el-form ref="middleRef" :model="form" :rules="rules" label-width="80px"> <el-form
ref="middleRef"
:model="queryParams"
:rules="rules"
label-width="80px"
>
<el-row> <el-row>
<el-form-item label="项目" prop="project"> <el-form-item label="项目" prop="typeDescription">
<el-input placeholder="请输入" style="width: 150px" /> <el-input
v-model="queryParams.typeDescription"
placeholder="请输入"
style="width: 150px"
/>
</el-form-item> </el-form-item>
<el-button <el-button
style="margin-left: 10px; width: 110px" style="margin-left: 10px; width: 110px"
class="btn-A" class="btn-A"
@click="handleQuery" @click="handleQuery2"
>{{ cn.search }}/{{ en.search }}</el-button >{{ cn.search }}/{{ en.search }}</el-button
> >
<el-button class="btn-B" @click="resetQuery" <el-button class="btn-B" @click="resetQuery2"
>{{ cn.reset }}/{{ en.reset }}</el-button >{{ cn.reset }}/{{ en.reset }}</el-button
> >
<el-button class="btn-C" @click="handleAdd" <el-button class="btn-C" @click="() => handleAdd(currentRow)"
>{{ cn.add }}/{{ en.add }}</el-button >{{ cn.add }}/{{ en.add }}</el-button
> >
</el-row> </el-row>
</el-form> </el-form>
<el-table <el-table
:key="drawerPartKey"
v-loading="loading" v-loading="loading"
:data="drawerPartList" :data="drawerPartList"
border border
...@@ -335,16 +343,19 @@ ...@@ -335,16 +343,19 @@
</el-dialog> </el-dialog>
<!-- 查看对应零件 --> <!-- 查看对应零件 -->
<el-drawer v-model="open2" :title="title" append-to-body> <el-drawer v-model="open2" :title="title" append-to-body>
<el-form ref="partRef" :model="form" label-width="70px"> <el-form ref="middleRef" :model="queryParams" label-width="70px">
<el-row> <el-row>
<el-form-item label="零件名称" prop="partName"> <el-form-item label="零件名称" prop="criticalPartNameCn">
<el-input v-model="form.partName" placeholder="请输入" /> <el-input
v-model="queryParams.criticalPartNameCn"
placeholder="请输入"
/>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button class="btn-A" @click="handleQuery" <el-button class="btn-A" @click="handleQuery1"
>{{ cn.search }}/{{ en.search }}</el-button >{{ cn.search }}/{{ en.search }}</el-button
> >
<el-button class="btn-B" @click="resetQuery" <el-button class="btn-B" @click="resetQuery1"
>{{ cn.reset }}/{{ en.reset }}</el-button >{{ cn.reset }}/{{ en.reset }}</el-button
> >
</el-form-item> </el-form-item>
...@@ -439,8 +450,22 @@ const multiple = ref(true) ...@@ -439,8 +450,22 @@ const multiple = ref(true)
const total = ref(0) const total = ref(0)
const title = ref('') const title = ref('')
const partDetailsList = ref([]) const partDetailsList = ref([])
const currentRow = ref(null) // 存储当前行的数据 const currentStandardName = ref('')
const currentStandardNo = ref('')
// 在父组件中定义当前行数据
const currentRow = ref({})
// 修改后的数据部分
const drawerData = ref({
open: false,
title: '',
currentStandardName: '',
list: [],
query: {
pageNum: 1,
pageSize: 10,
standardName: '',
},
})
const data = reactive({ const data = reactive({
form: {}, form: {},
queryParams: { queryParams: {
...@@ -478,16 +503,6 @@ function getList() { ...@@ -478,16 +503,6 @@ function getList() {
}) })
} }
function listAll() {
loading.value = true
list(queryParams.value).then((response) => {
drawerPartList.value = response
console.log('------------------', response)
total.value = response.total
loading.value = false
})
}
// 取消按钮 // 取消按钮
function cancel() { function cancel() {
open.value = false open.value = false
...@@ -506,13 +521,14 @@ function reset() { ...@@ -506,13 +521,14 @@ function reset() {
delFlag: null, delFlag: null,
partId: null, partId: null,
standardNumberId: null, standardNumberId: null,
typeDescription: null,
} }
proxy.resetForm('middleRef') proxy.resetForm('middleRef')
} }
/*查看零件详情抽屉*/ /*查看零件详情抽屉*/
function showPartDialog(row) { function showPartDialog(row) {
//currentRow.value = row // 保存当前行 currentStandardName.value = row.standardName // 保存当前行的 standardName
open2.value = true // 打开对话框 open2.value = true // 打开对话框
this.title = `查看对应零件(${row.standardNumber},共${row.partCount}个零件)` // 设置对话框标题 this.title = `查看对应零件(${row.standardNumber},共${row.partCount}个零件)` // 设置对话框标题
getPartDetail(row) getPartDetail(row)
...@@ -521,7 +537,11 @@ function getPartDetail(row) { ...@@ -521,7 +537,11 @@ function getPartDetail(row) {
// 2. 发起请求 // 2. 发起请求
loading.value = true loading.value = true
console.log('row', row) console.log('row', row)
partDetails({ standardNo: row.standardNumber }) currentStandardNo.value = row.standardNumber
partDetails({
...queryParams.value,
standardNo: currentStandardNo.value,
})
.then((response) => { .then((response) => {
partDetailsList.value = response.data || response // 兼容不同API结构 partDetailsList.value = response.data || response // 兼容不同API结构
total.value = partDetailsList.value.length total.value = partDetailsList.value.length
...@@ -545,6 +565,30 @@ function resetQuery() { ...@@ -545,6 +565,30 @@ function resetQuery() {
proxy.resetForm('middleRef') proxy.resetForm('middleRef')
handleQuery() handleQuery()
} }
function handleQuery1() {
queryParams.value.pageNum = 1
getPartDetail({
criticalPartNameCn: queryParams.value.criticalPartNameCn,
standardNo: currentStandardNo.value, // 确保此处已赋值
})
}
/** 重置按钮操作 */
function resetQuery1() {
proxy.resetForm('middleRef')
handleQuery1()
}
function handleQuery2() {
//queryParams.value.pageNum = 1
listAll()
}
/** 重置按钮操作 */
function resetQuery2() {
proxy.resetForm('middleRef')
handleQuery2()
}
// 多选框选中数据 // 多选框选中数据
function handleSelectionChange(selection) { function handleSelectionChange(selection) {
...@@ -554,10 +598,16 @@ function handleSelectionChange(selection) { ...@@ -554,10 +598,16 @@ function handleSelectionChange(selection) {
} }
/** 新增按钮操作 */ /** 新增按钮操作 */
function handleAdd() { function handleAdd(row) {
reset() reset()
open1.value = true open1.value = true
title.value = '新增类型描述' title.value = '新增类型描述'
// 确保 standardName 的来源
if (row?.standardName) {
form.value.standardName = row.standardName
} else if (currentRow.value?.standardName) {
form.value.standardName = currentRow.value.standardName
}
} }
/** 修改按钮操作 */ /** 修改按钮操作 */
...@@ -567,15 +617,55 @@ function openDialogOpen1(row) { ...@@ -567,15 +617,55 @@ function openDialogOpen1(row) {
} }
// 维护类型描述抽屉 // 维护类型描述抽屉
function handleMaintain(row) { function handleMaintain(row) {
reset() currentRow.value = row
const { id, standardName } = row console.log('main', row)
const _id = id || ids.value currentStandardName.value = row.standardName
list(_id, standardName).then((response) => {
drawerPartList.value = response
title.value = '维护类型描述' title.value = '维护类型描述'
open.value = true open.value = true
listAll(row)
}
function listAll(row = currentRow.value) {
loading.value = true
list({
// 显式声明为 URL 参数
...queryParams.value,
standardName: row?.standardName,
}).then((response) => {
drawerPartList.value = response.data || response
total.value = response.length || response.total
loading.value = false
}) })
} }
// 修改后的方法部分
/*function handleMaintain(row) {
drawerData.value = {
...drawerData.value,
open: true,
title: `维护类型描述`,
currentStandardName: row.standardName,
query: {
...drawerData.value.query,
standardName: row.standardName,
},
}
listAll() // 立即加载数据
}
// 修改后的数据获取方法
function listAll() {
loading.value = true
list({
...drawerData.value.query,
standardName: drawerData.value.currentStandardName, // 确保使用当前标准名称
})
.then((response) => {
drawerData.value.list = response.rows || response
drawerData.value.total = response.total || response.length
})
.finally(() => {
loading.value = false
})
}*/
// 编辑对话框 // 编辑对话框
function handleEdit(row) { function handleEdit(row) {
reset() reset()
...@@ -584,20 +674,28 @@ function handleEdit(row) { ...@@ -584,20 +674,28 @@ function handleEdit(row) {
open1.value = true open1.value = true
} }
/** 提交按钮 */ /** 提交按钮 */
function submitForm() { function submitForm(row) {
proxy.$refs['middleRef'].validate((valid) => { proxy.$refs['middleRef'].validate((valid) => {
if (valid) { if (valid) {
if (form.value.id != null) { if (form.value.id != null) {
updateMiddle(form.value).then((response) => { updateMiddle({
...form.value,
standardName: row.standardName,
}).then((response) => {
proxy.$modal.msgSuccess('修改成功') proxy.$modal.msgSuccess('修改成功')
open1.value = false open1.value = false
listAll() listAll()
getList()
}) })
} else { } else {
addMiddle(form.value).then((response) => { addMiddle({
...form.value,
standardName: form.value.standardName,
}).then((response) => {
proxy.$modal.msgSuccess('新增成功') proxy.$modal.msgSuccess('新增成功')
open1.value = false open1.value = false
listAll() listAll()
getList()
}) })
} }
} }
...@@ -631,7 +729,6 @@ function handleExport() { ...@@ -631,7 +729,6 @@ function handleExport() {
} }
/** 修改按钮操作 */ /** 修改按钮操作 */
const handleMoveUp = async (row) => { const handleMoveUp = async (row) => {
console.log()
try { try {
await moveUp(row.id) await moveUp(row.id)
proxy.$modal.msgSuccess('上移成功') proxy.$modal.msgSuccess('上移成功')
...@@ -659,5 +756,4 @@ function colseDialogOpen1() { ...@@ -659,5 +756,4 @@ function colseDialogOpen1() {
open1.value = false open1.value = false
} }
getList() getList()
listAll()
</script> </script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment