From 5bdee15c4bba881d9cb991dd18b40613375bb41e Mon Sep 17 00:00:00 2001
From: zhuo <2089219845@qq.com>
Date: 星期一, 17 二月 2025 10:06:07 +0800
Subject: [PATCH] Merge branch 'dev-licp' into dev
---
src/components/capability/bindPartDialog.vue | 144 ++++++++++++++++++++++++++++++++++++------------
1 files changed, 108 insertions(+), 36 deletions(-)
diff --git a/src/components/capability/bindPartDialog.vue b/src/components/capability/bindPartDialog.vue
index 8b876a3..5fca2f6 100644
--- a/src/components/capability/bindPartDialog.vue
+++ b/src/components/capability/bindPartDialog.vue
@@ -1,13 +1,11 @@
<template>
<div>
<el-dialog title="闆朵欢缁戝畾" :visible.sync="isShow" width="800px" @close="$emit('closeBindPartDialog')">
- <div class="body" v-if="isShow" style="height: 500px;overflow-y: auto;padding: 5px 0;">
- <lims-table :tableData="tableData" :column="column"
- :page="page" :tableLoading="tableLoading"></lims-table>
- </div>
+ <lims-table :tableData="tableData" :column="column" height="460"
+ :page="page" :tableLoading="tableLoading"></lims-table>
<span slot="footer" class="dialog-footer">
<el-button @click="$emit('closeBindPartDialog')">鍙� 娑�</el-button>
- <el-button type="primary" @click="addBindPart" :loading="addBindLoad">鏂� 澧�</el-button>
+ <el-button type="primary" @click="addBindPart('add')" :loading="addBindLoad">鏂� 澧�</el-button>
</span>
</el-dialog>
<el-dialog :title="dialogTitle" :visible.sync="addBindPartDialog" width="400px" @close="closeBindPartDialog"
@@ -20,10 +18,10 @@
<el-form-item label="闆朵欢鍙凤細" prop="partNo">
<el-input v-model="bindPartData.partNo" size="small"></el-input>
</el-form-item>
- <el-form-item label="棰滆壊锛�">
+ <el-form-item label="棰滆壊锛�" prop="color">
<el-input v-model="bindPartData.color" size="small"></el-input>
</el-form-item>
- <el-form-item label="鑹叉爣锛�">
+ <el-form-item label="鑹叉爣锛�" prop="colorCode">
<el-input v-model="bindPartData.colorCode" size="small"></el-input>
</el-form-item>
</el-form>
@@ -38,7 +36,13 @@
<script>
import limsTable from "@/components/Table/lims-table.vue";
-import {selectByProductId, selectByTestObjectId} from "@/api/structural/structureTestObjectPart";
+import {
+ addProductPart,
+ addTestObjectPart, deleteProductPart, deleteTestObjectPart,
+ selectByProductId,
+ selectByTestObjectId, updateProductPart, updateTestObjectPart
+} from "@/api/structural/structureTestObjectPart";
+import {delProduct} from "@/api/structural/capability";
export default {
name: "bindPartDialog",
@@ -63,6 +67,7 @@
return {
isShow: this.bindPartDialog,
dialogTitle: '鏂板闆朵欢缁戝畾',
+ operationType: '',
tableData: [],
tableLoading: false,
column: [
@@ -78,7 +83,7 @@
name: '缂栬緫',
type: 'text',
clickFun: (row) => {
- this.editForm(row);
+ this.addBindPart('edit', row);
},
},
{
@@ -94,7 +99,7 @@
page: {
total:0,
size:10,
- current:0
+ current:1
},
bindPartComponent: {
entity: {
@@ -149,29 +154,34 @@
this.tableLoading = true
// 鏍规嵁绫诲瀷鍒ゆ柇鏄楠屽璞¢浂浠剁粦瀹氳繕鏄骇鍝佺淮鎶ら浂浠剁粦瀹�
if (this.type === 0) {
- selectByTestObjectId(this.currentRow.id).then(res => {
+ selectByTestObjectId({testObjectId: this.currentRow.id}).then(res => {
this.tableLoading = false
if (res.code === 200) {
- this.tableData = res.data
- this.page.total = res.total
+ this.tableData = res.data.records
+ this.page.total = res.data.total
}
}).catch(err => {
this.tableLoading = false
})
} else {
- selectByProductId(this.currentRow.id).then(res => {
+ selectByProductId({productId: this.currentRow.id}).then(res => {
this.tableLoading = false
if (res.code === 200) {
- this.tableData = res.data
- this.page.total = res.total
+ this.tableData = res.data.records
+ this.page.total = res.data.total
}
}).catch(err => {
this.tableLoading = false
})
}
},
- addBindPart () {
+ addBindPart (type, row) {
this.addBindPartDialog = true
+ this.dialogTitle = type === 'add' ? '鏂板闆朵欢缁戝畾' : '淇敼闆朵欢缁戝畾'
+ this.operationType = type
+ if (type === 'edit') {
+ this.bindPartData = this.HaveJson(row)
+ }
},
// 鎻愪氦闆朵欢缁戝畾
submitBind () {
@@ -190,33 +200,95 @@
partNo: this.bindPartData.partNo,
}
this.bindLoad = true
- if (this.type === 0) {
-
+ if (this.operationType === 'add') {
+ if (this.type === 0) {
+ addTestObjectPart(params).then(res => {
+ if (res.code === 200) {
+ this.resetForm('bindPartData')
+ this.addBindPartDialog = false
+ this.$message.success('鏂板鎴愬姛')
+ this.getList()
+ }
+ }).catch(err => {
+ this.bindLoad = false
+ console.log(err)
+ })
+ } else {
+ addProductPart(params).then(res => {
+ if (res.code === 200) {
+ this.resetForm('bindPartData')
+ this.addBindPartDialog = false
+ this.$message.success('鏂板鎴愬姛')
+ this.getList()
+ }
+ }).catch(err => {
+ this.bindLoad = false
+ console.log(err)
+ })
+ }
+ } else {
+ if (this.type === 0) {
+ updateTestObjectPart(params).then(res => {
+ if (res.code === 200) {
+ this.resetForm('bindPartData')
+ this.addBindPartDialog = false
+ this.$message.success('淇敼鎴愬姛')
+ this.getList()
+ }
+ }).catch(err => {
+ this.bindLoad = false
+ console.log(err)
+ })
+ } else {
+ updateProductPart(params).then(res => {
+ if (res.code === 200) {
+ this.resetForm('bindPartData')
+ this.addBindPartDialog = false
+ this.$message.success('淇敼鎴愬姛')
+ this.getList()
+ }
+ }).catch(err => {
+ this.bindLoad = false
+ console.log(err)
+ })
+ }
}
- this.$axios.post(url, params, {
- headers: {
- 'Content-Type': 'application/json'
- }
- }).then(res => {
- this.bindLoad = false
- if (res.code === 200) {
- this.$refs['bindPartData'].resetFields();
- this.addBindPartDialog = false
- this.$message.success('鎿嶄綔鎴愬姛')
- this.getList()
- }
- }).catch(err => {
- this.bindLoad = false
- console.log(err)
- })
} else {
console.log('error submit!!');
return false;
}
})
},
+ delete (row) {
+ this.$confirm('姝ゆ搷浣滃皢鍒犻櫎璇ユ暟鎹�, 鏄惁缁х画?', '鎻愮ず', {
+ confirmButtonText: '纭畾',
+ cancelButtonText: '鍙栨秷',
+ type: 'warning'
+ }).then(() => {
+ if (this.type === 0) {
+ deleteTestObjectPart({id:row.id}).then(res => {
+ if (res.code === 200) {
+ this.$message.success('鍒犻櫎鎴愬姛')
+ this.getList();
+ }
+ })
+ } else {
+ deleteProductPart({id:row.id}).then(res => {
+ if (res.code === 200) {
+ this.$message.success('鍒犻櫎鎴愬姛')
+ this.getList();
+ }
+ })
+ }
+ }).catch(() => {
+ this.$message({
+ type: 'info',
+ message: '宸插彇娑堝垹闄�'
+ });
+ })
+ },
closeBindPartDialog () {
- this.$refs['bindPartData'].resetFields();
+ this.resetForm('bindPartData')
this.addBindPartDialog = false
},
},
--
Gitblit v1.9.3