From b25e5611ece8d25a6605a1ec66916db0942a5ed5 Mon Sep 17 00:00:00 2001 From: spring <2396852758@qq.com> Date: 星期一, 17 二月 2025 14:45:24 +0800 Subject: [PATCH] 完成标准库联调 --- src/views/system/customer/index.vue | 53 ++++++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 44 insertions(+), 9 deletions(-) diff --git a/src/views/system/customer/index.vue b/src/views/system/customer/index.vue index bdd5b8f..6e24596 100644 --- a/src/views/system/customer/index.vue +++ b/src/views/system/customer/index.vue @@ -18,7 +18,7 @@ </div> </div> <div> - <lims-table :tableData="tableData" :column="column" :page="page" :tableLoading="tableLoading"></lims-table> + <lims-table :tableData="tableData" :column="column" :page="page" :tableLoading="tableLoading" @pagination="pagination"></lims-table> </div> <el-dialog :title="formTitle" :visible.sync="addDia" width="450px"> <el-form ref="userForm" :model="user" :rules="userRules" label-position="right" label-width="100px"> @@ -59,7 +59,7 @@ <script> import limsTable from '@/components/Table/lims-table.vue' -import {addCustom, selectCustomPageList, upCustom} from "@/api/system/customer"; +import {addCustom, delCustomById, selectCustomPageList, upCustom} from "@/api/system/customer"; export default { components: { limsTable @@ -90,6 +90,12 @@ clickFun: (row) => { this.openFormDia('edit', row); }, + },{ + name: '鍒犻櫎', + type: 'text', + clickFun: (row) => { + this.delete(row); + }, }, ] } @@ -106,7 +112,7 @@ addDia: false, addPower: true, user: { - name: null + company: '' }, userRules: { company: [{ required: true, message: '璇疯緭鍏ュ鎴峰悕绉�', trigger: 'blur' }], @@ -130,8 +136,8 @@ selectCustomPageList({...this.queryParams, ...this.page}).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 @@ -142,10 +148,17 @@ this.queryParams.company = '' this.getList() }, + pagination () { + + }, openFormDia (type, row) { this.addDia = true + this.user = {} this.formTitle = type === 'add' ? '鏂板瀹㈡埛' : '缂栬緫瀹㈡埛' this.operationType = type + if (type === 'edit') { + this.user = this.HaveJson(row) + } }, customAdd() { this.$refs['userForm'].validate((valid) => { @@ -153,27 +166,49 @@ this.loading = true if (this.operationType === 'add') { addCustom(this.user).then(res => { - if (res.code === 201) return + this.loading = false + if (res.code !== 200) return this.$message.success('鏂板鎴愬姛') this.getList() - this.loading = false this.reset() + }).catch(err => { + this.loading = false }) } else { upCustom(this.user).then(res => { - if (res.code === 201) return + this.loading = false + if (res.code !== 200) return this.$message.success('淇敼鎴愬姛') this.getList() - this.loading = false this.reset() + }).catch(err => { + this.loading = false }) } } }) }, reset () { + this.user = {} this.addDia = false this.resetForm("userForm"); + }, + delete (row) { + this.$confirm('鏄惁鍒犻櫎褰撳墠鏁版嵁?', "璀﹀憡", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning" + }).then(() => { + delCustomById({id: row.id}).then(res => { + if (res.code === 500) { + return + } + this.$message.success('鍒犻櫎鎴愬姛') + this.getList() + }).catch(e => { + this.$message.error('鍒犻櫎澶辫触') + }) + }).catch(() => {}) } } } -- Gitblit v1.9.3