From 42f135086753fc6784e1b4894a4fcc6164a06669 Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期三, 05 三月 2025 11:20:26 +0800
Subject: [PATCH] Merge branch 'refs/heads/dev'
---
src/views/system/customer/index.vue | 140 +++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 123 insertions(+), 17 deletions(-)
diff --git a/src/views/system/customer/index.vue b/src/views/system/customer/index.vue
index 7c98547..8a9b5a5 100644
--- a/src/views/system/customer/index.vue
+++ b/src/views/system/customer/index.vue
@@ -2,26 +2,62 @@
<div class="app-container">
<div class="search">
<div>
- <el-form :model="queryParams" ref="queryForm" size="small" :inline="true">
+ <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-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-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>
<div>
- <el-button size="small" type="primary" @click="openFormDia('add')" icon="el-icon-plus">鏂板</el-button>
+ <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"
+ @pagination="pagination"
+ :column="column"
+ :page="page"
+ :tableLoading="tableLoading"
+ ></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">
+ <el-form
+ ref="userForm"
+ :model="user"
+ :rules="userRules"
+ label-position="right"
+ label-width="100px"
+ >
<el-form-item label="瀹㈡埛鍚嶇О" prop="company">
<el-input v-model="user.company" size="small" clearable></el-input>
</el-form-item>
@@ -29,18 +65,33 @@
<el-input v-model="user.companyEn" size="small" clearable></el-input>
</el-form-item>
<el-form-item label="鍗曚綅鍦板潃" prop="address">
- <el-input type="textarea" v-model="user.address" size="small" clearable
- :autosize="{ minRows: 2, maxRows: 4 }"></el-input>
+ <el-input
+ type="textarea"
+ v-model="user.address"
+ size="small"
+ clearable
+ :autosize="{ minRows: 2, maxRows: 4 }"
+ ></el-input>
</el-form-item>
<el-form-item label="鍗曚綅鍦板潃EN" prop="addressEn">
- <el-input type="textarea" v-model="user.addressEn" size="small" clearable
- :autosize="{ minRows: 2, maxRows: 4 }"></el-input>
+ <el-input
+ type="textarea"
+ v-model="user.addressEn"
+ size="small"
+ clearable
+ :autosize="{ minRows: 2, maxRows: 4 }"
+ ></el-input>
</el-form-item>
<el-form-item label="鍗曚綅鐢佃瘽" prop="phone">
<el-input v-model="user.phone" size="small" clearable></el-input>
</el-form-item>
<el-form-item label="鍔犳�ラ搴�" prop="num">
- <el-input v-model="user.num" size="small" clearable></el-input>
+ <el-input-number
+ v-model="user.num"
+ size="small"
+ clearable
+ :min="0"
+ ></el-input-number>
</el-form-item>
<el-form-item label="瀹㈡埛缂栧彿" prop="code2">
<el-input v-model="user.code2" size="small" clearable></el-input>
@@ -51,7 +102,9 @@
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="reset">鍙� 娑�</el-button>
- <el-button type="primary" @click="customAdd" :loading="loading">纭� 瀹�</el-button>
+ <el-button type="primary" @click="customAdd" :loading="loading"
+ >纭� 瀹�</el-button
+ >
</span>
</el-dialog>
</div>
@@ -62,6 +115,7 @@
import {
addCustom,
selectCustomPageList,
+ delCustomById,
upCustom,
} from "@/api/system/customer";
export default {
@@ -89,10 +143,31 @@
label: "鎿嶄綔",
operation: [
{
+ name: "濮旀墭璁板綍",
+ type: "text",
+ clickFun: (row) => {
+ console.log(row);
+ },
+ },
+ {
+ name: "鍗忚璁板綍",
+ type: "text",
+ clickFun: (row) => {
+ console.log(row);
+ },
+ },
+ {
name: "缂栬緫",
type: "text",
clickFun: (row) => {
this.openFormDia("edit", row);
+ },
+ },
+ {
+ name: "鍒犻櫎",
+ type: "text",
+ clickFun: (row) => {
+ this.delCustomRow(row);
},
},
],
@@ -133,7 +208,19 @@
mounted() {
this.getList();
},
+ watch: {
+ addDia(newVal) {
+ if (!newVal) {
+ this.user = {};
+ }
+ },
+ },
methods: {
+ pagination({ page, limit }) {
+ this.page.current = page;
+ this.page.size = limit;
+ this.getList();
+ },
// 鏌ヨ瀹㈡埛鍒楄〃
getList() {
this.tableLoading = true;
@@ -141,8 +228,8 @@
.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) => {
@@ -155,9 +242,28 @@
this.getList();
},
openFormDia(type, row) {
- this.addDia = true;
this.formTitle = type === "add" ? "鏂板瀹㈡埛" : "缂栬緫瀹㈡埛";
this.operationType = type;
+ if (row) {
+ this.user = this.HaveJson(row);
+ }
+ this.addDia = true;
+ },
+ delCustomRow(row) {
+ this.$confirm("纭鍒犻櫎璇ユ潯瀹㈡埛璁板綍鍚�?", "鎻愮ず", {
+ confirmButtonText: "纭畾",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ })
+ .then(() => {
+ delCustomById({ id: row.id }).then((res) => {
+ if (res.status === 200) {
+ this.$message.success("鍒犻櫎鎴愬姛");
+ }
+ this.getList();
+ });
+ })
+ .catch(() => {});
},
customAdd() {
this.$refs["userForm"].validate((valid) => {
--
Gitblit v1.9.3