From d7c4759b8c5c6fb766f3b9dac1bee5fec6026f5e Mon Sep 17 00:00:00 2001 From: gaoluyang <2820782392@qq.com> Date: 星期一, 17 二月 2025 09:53:19 +0800 Subject: [PATCH] 能力范围-厂家密度联调 --- src/components/capability/bindSupplierDensityDialog.vue | 172 ++++++++++++++++++++++++++++++++++++++------------------- 1 files changed, 114 insertions(+), 58 deletions(-) diff --git a/src/components/capability/bindSupplierDensityDialog.vue b/src/components/capability/bindSupplierDensityDialog.vue index b9afe36..5e835b6 100644 --- a/src/components/capability/bindSupplierDensityDialog.vue +++ b/src/components/capability/bindSupplierDensityDialog.vue @@ -1,20 +1,14 @@ <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;"> -<!-- <ValueTable ref="bindPartComponent"--> -<!-- :url="searchUrl"--> -<!-- :upUrl="upUrl"--> -<!-- :delUrl="delUrl"--> -<!-- :componentData="bindPartComponent"--> -<!-- :key="upIndex"/>--> - </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> </span> </el-dialog> - <el-dialog title="鏂板鍘傚瀵嗗害缁戝畾" :visible.sync="addBindSupplierDensityDialog" width="400px" @close="closeBindPartDialog":close-on-click-modal="false" > + <el-dialog title="鎿嶄綔鍘傚瀵嗗害缁戝畾" :visible.sync="addBindSupplierDensityDialog" width="400px" @close="closeBindPartDialog":close-on-click-modal="false" > <div class="body" v-if="addBindSupplierDensityDialog"> <el-form label-position="right" label-width="80px" ref="bindSupplierDensityData" @@ -40,12 +34,17 @@ </template> <script> -// import ValueTable from "../../tool/value-table.vue"; +import limsTable from "@/components/Table/lims-table.vue"; +import { + addProductSupplierDensity, + deleteProductSupplierDensity, + selectSupplierDensityByProductId, updateProductSupplierDensity +} from "@/api/structural/capability"; export default { name: "bindSupplierDensityDialog", // import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢� - components: {}, + components: {limsTable}, props: { bindSupplierDensityDialog: { type: Boolean, @@ -59,40 +58,47 @@ data() { // 杩欓噷瀛樻斁鏁版嵁 return { + tableData: [], + column: [ + {label: '鍨嬪彿', prop: 'model'}, + {label: '鍘傚鍚嶇О', prop: 'supplierName'}, + {label: '瀵嗗害鍊�', prop: 'densityValue'}, + { + dataType: 'action', + fixed: 'right', + label: '鎿嶄綔', + width: '140px', + operation: [ + { + name: '缂栬緫', + type: 'text', + clickFun: (row) => { + this.editForm(row); + }, + }, + { + name: '鍒犻櫎', + type: 'text', + clickFun: (row) => { + this.delete(row); + }, + }, + ] + } + ], + page: { + total:0, + size:10, + current:1 + }, + tableLoading: false, searchUrl: '', // 鏌ヨ upUrl: '', // 缂栬緫 delUrl: '', // 鍒犻櫎 isShow: this.bindSupplierDensityDialog, - bindPartComponent: { - entity: { - orderBy: { - field: 'id', - order: 'asc' - } - }, - isPage: true, - isIndex: true, - showSelect: false, - select: true, - do: [{ - id: 'update', - font: '缂栬緫', - type: 'text', - method: 'doDiy', - field: [] - }, { - id: 'delete', - font: '鍒犻櫎', - type: 'text', - method: 'doDiy' - }], - tagField: {}, - selectField: {}, - requiredAdd: ['supplierName', 'densityValue'], - requiredUp: ['supplierName', 'densityValue'], - }, addBindSupplierDensityDialog: false, bindSupplierDensityData: { + id: '', model: '', // 鍨嬪彿 supplierName: '', // 鍘傚 densityValue: '', // 瀵嗗害 @@ -108,51 +114,101 @@ bindLoad: false, upIndex: 0, addBindLoad: false, + operationType: '' } }, mounted() { - this.$set(this.bindPartComponent.entity, 'productId', this.currentRow.id) + this.getList() }, // 鏂规硶闆嗗悎 methods: { + getList () { + this.tableLoading = true + selectSupplierDensityByProductId({...this.page, productId: this.currentRow.id}).then(res => { + this.tableLoading = false + if (res.code === 200) { + this.tableData = res.data.records + this.page.total = res.data.total + } + }).catch(err => { + this.tableLoading = false + }) + }, addBindPart () { this.addBindSupplierDensityDialog = true + this.operationType = 'add' }, - // 鎻愪氦闆朵欢缁戝畾 + editForm (row) { + this.addBindSupplierDensityDialog = true + this.bindSupplierDensityData = this.HaveJson(row) + this.operationType = 'edit' + }, + // 鎻愪氦鍘傚瀵嗗害缁戝畾 submitBind () { this.$refs['bindSupplierDensityData'].validate((valid) => { if (valid) { // 鏍规嵁绫诲瀷鍒ゆ柇鏄楠屽璞¢浂浠剁粦瀹氳繕鏄骇鍝佺淮鎶ら浂浠剁粦瀹� const params = { + id: this.bindSupplierDensityData.id, productId: this.currentRow.id, model: this.bindSupplierDensityData.model, supplierName: this.bindSupplierDensityData.supplierName, densityValue: this.bindSupplierDensityData.densityValue, } this.bindLoad = true - const url = this.$api.productSupplierDensity.addProductSupplierDensity - this.$axios.post(url, params, { - headers: { - 'Content-Type': 'application/json' - } - }).then(res => { - this.bindLoad = false - if (res.code === 200) { - this.$refs['bindSupplierDensityData'].resetFields(); - this.addBindSupplierDensityDialog = false - this.$message.success('鎿嶄綔鎴愬姛') - this.$refs.bindPartComponent.selectList() - } - }).catch(err => { - this.bindLoad = false - console.log(err) - }) + if (this.operationType === 'add') { + addProductSupplierDensity(params).then(res => { + this.bindLoad = false + if (res.code === 200) { + this.resetForm('bindSupplierDensityData') + this.addBindSupplierDensityDialog = false + this.$message.success('鏂板鎴愬姛') + this.getList() + } + }).catch(err => { + this.bindLoad = false + console.log(err) + }) + } else { + updateProductSupplierDensity(params).then(res => { + this.bindLoad = false + if (res.code === 200) { + this.resetForm('bindSupplierDensityData') + this.addBindSupplierDensityDialog = 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(() => { + deleteProductSupplierDensity({id:row.id}).then(res => { + if (res.code === 200) { + this.$message.success('鍒犻櫎鎴愬姛') + this.getList(); + } + }) + }).catch(() => { + this.$message({ + type: 'info', + message: '宸插彇娑堝垹闄�' + }); + }) + }, closeBindPartDialog () { this.$refs['bindSupplierDensityData'].resetFields(); this.addBindSupplierDensityDialog = false -- Gitblit v1.9.3