From e5454b769d44a34af423bf87ac8a740bf8c20341 Mon Sep 17 00:00:00 2001 From: Crunchy <3114200645@qq.com> Date: 星期二, 29 四月 2025 13:25:29 +0800 Subject: [PATCH] Merge branch 'dev' into dev_tides --- src/views/system/customer/index.vue | 109 ++++++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 81 insertions(+), 28 deletions(-) diff --git a/src/views/system/customer/index.vue b/src/views/system/customer/index.vue index bdd5b8f..28f4d95 100644 --- a/src/views/system/customer/index.vue +++ b/src/views/system/customer/index.vue @@ -1,24 +1,26 @@ <template> <div class="app-container"> - <div class="search"> - <div> - <el-form :model="queryParams" ref="queryForm" size="small" :inline="true"> - <el-form-item label="瀹㈡埛鍚嶇О" prop="company"> - <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="queryParams.company" - @keyup.enter.native="getList"></el-input> - </el-form-item> - <el-form-item> - <el-button type="primary" icon="el-icon-search" size="mini" @click="getList">鏌� 璇�</el-button> - <el-button icon="el-icon-refresh" size="mini" @click="refresh">閲� 缃�</el-button> - </el-form-item> - </el-form> + <div style="display: flex;justify-content: space-between"> + <div class="search_box"> + <div class="search_item"> + <span class="search_label">瀹㈡埛鍚嶇О</span> + <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="queryParams.company" + @keyup.enter.native="getList"></el-input> + </div> + <div class="search_button"> + <el-button type="primary" size="mini" @click="getList">鏌ヨ</el-button> + <el-button size="mini" @click="refresh">閲嶇疆</el-button> + </div> </div> <div> <el-button size="small" type="primary" @click="openFormDia('add')" icon="el-icon-plus">鏂板</el-button> </div> </div> <div> - <lims-table :tableData="tableData" :column="column" :page="page" :tableLoading="tableLoading"></lims-table> + <lims-table :tableData="tableData" :column="column" + :height="'calc(100vh - 250px)'" + :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,8 +61,9 @@ <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 { + name: 'Customer', components: { limsTable }, @@ -90,14 +93,20 @@ clickFun: (row) => { this.openFormDia('edit', row); }, + },{ + name: '鍒犻櫎', + type: 'text', + clickFun: (row) => { + this.delete(row); + }, }, ] } ], page: { total:0, - size:10, - current:0 + size:20, + current:1 }, tableLoading: false, // 缂栬緫瀹㈡埛寮规 @@ -106,13 +115,13 @@ addDia: false, addPower: true, user: { - name: null + company: '' }, userRules: { company: [{ required: true, message: '璇疯緭鍏ュ鎴峰悕绉�', trigger: 'blur' }], companyEn: [{ required: true, message: '璇疯緭鍏ュ鎴峰悕绉癊N', trigger: 'blur' }], address: [{ required: true, message: '璇疯緭鍏ュ崟浣嶅湴鍧�', trigger: 'blur' }], - addressEn: [{ required: true, message: '璇疯緭鍗曚綅鍦板潃EN', trigger: 'blur' }], + addressEn: [{ required: true, message: '璇疯緭鍏ュ崟浣嶅湴鍧�EN', trigger: 'blur' }], num: [{ required: true, message: '璇疯緭鍏ュ姞鎬ラ搴�', trigger: 'blur' }], code2: [{ required: true, message: '璇疯緭鍏ュ鎴风紪鍙�', trigger: 'blur' }], }, @@ -130,8 +139,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 +151,18 @@ this.queryParams.company = '' this.getList() }, + pagination (page) { + this.page.size = page.limit + this.getList() + }, 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,36 +170,72 @@ 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.addDia = false + this.user = {} this.resetForm("userForm"); + this.addDia = false + }, + 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(() => {}) } } } </script> <style scoped> -.search { - height: 46px; +.search_box { display: flex; - justify-content: space-between; +} +.search_item { + margin-bottom: 18px; + margin-right: 10px; + display: flex; + align-items: center; + line-height: 32px; +} +.search_label { + width: 88px; + font-size: 14px; + font-weight: 700; + color: #606266; +} +.search_button { + line-height: 30px; } </style> -- Gitblit v1.9.3