From b429921369229f0df5babd6f377c0311c41a7a76 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期六, 15 二月 2025 16:36:05 +0800
Subject: [PATCH] 能力范围-产品维护联调
---
src/components/capability/bindPartDialog.vue | 136 +++++++++++++++++++++++++++++++++++----------
1 files changed, 105 insertions(+), 31 deletions(-)
diff --git a/src/components/capability/bindPartDialog.vue b/src/components/capability/bindPartDialog.vue
index 8b876a3..011bffa 100644
--- a/src/components/capability/bindPartDialog.vue
+++ b/src/components/capability/bindPartDialog.vue
@@ -7,7 +7,7 @@
</div>
<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 +20,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 +38,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 +69,7 @@
return {
isShow: this.bindPartDialog,
dialogTitle: '鏂板闆朵欢缁戝畾',
+ operationType: '',
tableData: [],
tableLoading: false,
column: [
@@ -78,7 +85,7 @@
name: '缂栬緫',
type: 'text',
clickFun: (row) => {
- this.editForm(row);
+ this.addBindPart('edit', row);
},
},
{
@@ -149,29 +156,34 @@
this.tableLoading = true
// 鏍规嵁绫诲瀷鍒ゆ柇鏄楠屽璞¢浂浠剁粦瀹氳繕鏄骇鍝佺淮鎶ら浂浠剁粦瀹�
if (this.type === 0) {
- selectByTestObjectId(this.currentRow.id).then(res => {
+ selectByTestObjectId({id: 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({id: 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 = row
+ }
},
// 鎻愪氦闆朵欢缁戝畾
submitBind () {
@@ -190,33 +202,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