Переглянути джерело

新增客户公司资料增删改,客户资料列表

wangh 2 роки тому
батько
коміт
5f711cc517

+ 305 - 0
src/components/Crm/CustomerCompany.vue

@@ -0,0 +1,305 @@
+<template>
+    <div>
+        <div class="communal-list">
+            <div class="communal-title">
+                <div>客户公司列表</div>
+                <div class="communal-box">
+                    <el-input @input="Inquireclick()" placeholder="公司名" v-model="input" clearable style="width: 350px;">
+                    </el-input>
+
+                    <el-button type="primary" style="margin-left: 10px;" @click="AddData">新增</el-button>
+
+                </div>
+            </div>
+            <template>
+                <el-table :data="tableDatas.slice((currentPage - 1) * pageSize, currentPage * pageSize)" border
+                    style="width: 100%" v-loading="loading" element-loading-text="拼命加载中...">
+                    <el-table-column prop="num" label="序 号" width="55">
+                        <template slot-scope="scope">
+                            {{ (currentPage - 1) * pageSize + scope.$index + 1 }}
+                        </template>
+                    </el-table-column>
+                    <el-table-column prop="companyName" label="公司名称" width="150">
+                    </el-table-column>
+                    <el-table-column prop="address" label="公司地址" width="300">
+                    </el-table-column>
+                    <el-table-column prop="postCodes" label="公司邮编" width="200">
+                    </el-table-column>
+                    <el-table-column prop="userName" label="操作人" width="180">
+                    </el-table-column>
+                    <el-table-column prop="createTime" label="操作时间" width="180">
+                    </el-table-column>
+                    <el-table-column label="操作">
+                        <template slot-scope="scope">
+                            <el-button size="mini" @click="upDate(scope.$index, scope.row)">编辑</el-button>
+                            <el-button size="mini" type="danger" @click="del(scope.$index, scope.row)">删除</el-button>
+                        </template>
+                    </el-table-column>
+                </el-table>
+            </template>
+            <div class="block">
+                <el-pagination align='center' @size-change="handleSizeChange" @current-change="handleCurrentChange"
+                    :current-page="currentPage" :page-sizes="[10, 12, 15, 20]" :page-size="pageSize"
+                    layout="total, sizes, prev, pager, next" :total="tableDatas.length">
+                </el-pagination>
+            </div>
+        </div>
+        <el-dialog :title="typeName" :visible.sync="TypeVisible" width="30%" :before-close="handleClose"
+            :close-on-click-modal="false">
+            <div>
+                <el-form :model="OperationData" :rules="rules" ref="OperationData" label-width="100px"
+                    class="demo-ruleForm">
+                    <el-form-item label="公司名称" prop="companyName">
+                        <el-input placeholder="请输入内容" v-model="OperationData.companyName">
+                        </el-input>
+                    </el-form-item>
+                    <el-form-item label="公司地址" prop="address">
+                        <el-input placeholder="请输入内容" v-model="OperationData.address">
+                        </el-input>
+                    </el-form-item>
+                    <el-form-item label="公司编码" prop="postCodes">
+                        <el-input placeholder="请输入内容" v-model="OperationData.postCodes">
+                        </el-input>
+                    </el-form-item>
+                    <el-form-item label="备 注" prop="remark">
+                        <el-input type="textarea" :rows="3" placeholder="请输入内容" v-model="OperationData.remark"></el-input>
+                    </el-form-item>
+                </el-form>
+            </div>
+            <span slot="footer" class="dialog-footer">
+                <el-button @click="TypeVisible = false">取 消</el-button>
+                <el-button type="primary" @click="AddBtn">确 定</el-button>
+            </span>
+        </el-dialog>
+    </div>
+</template>
+<script>
+export default {
+    data() {
+        return {
+            loading: false,
+            tableDatas: [],
+            tableData: [],
+            currentPage: 1, // 当前页码
+            pageSize: 12,// 每页的数据条数
+            input: '',
+            token: '',
+            userId: 0,
+            OperationData: {
+                status: 0,
+                id: 0,
+                companyName: "",
+                address: "",
+                postCodes: "",
+                lastedOpUserId: 0,
+                createUserId: 0,
+                remark: ""
+            },
+            typeName: '',
+            TypeVisible: false,
+            rules: {
+                companyName: [
+                    { required: true, message: '请输入客户公司名称', trigger: 'blur' },
+                ],
+                address: [
+                    { required: true, message: '请输入客户公司地址', trigger: 'blur' },
+                ],
+                postCodes: [
+                    { required: true, message: '请输入客户公司邮编', trigger: 'blur' },
+                ],
+            },
+        }
+    },
+    methods: {
+        //每页条数改变时触发 选择一页显示多少行
+        handleSizeChange(val) {
+            this.currentPage = 1;
+            this.pageSize = val;
+        },
+        //当前页改变时触发 跳转其他页
+        handleCurrentChange(val) {
+            this.currentPage = val;
+        },
+        handleClose(done) {
+            done();
+        },
+        ClientCompany() {
+            this.loading = true
+            var url = "/api/CRM/GetClientCompanyList"
+            var that = this
+            this.$axios({
+                method: 'post',
+                url: url,
+                headers: {
+                    Authorization: 'Bearer ' + this.token
+                },
+                data: {
+                    portType: 1,
+                }
+            }).then(function (res) {
+                console.log(res)
+
+                if (res.data.code == 200) {
+
+                    that.tableData = res.data.data;
+                    that.tableDatas = that.tableData;
+                    if (that.tableDatas.slice((that.currentPage - 1) * that.pageSize, that.currentPage * that.pageSize).length == 0) {
+                        if (that.currentPage > 1) {
+                            that.currentPage = that.currentPage - 1;
+                        }
+                    }
+                }
+                that.loading = false
+            }).catch(function (error) {
+                that.loading = false
+                that.$message.error("网络错误,请稍后重试");
+            });
+        },
+        //搜索框处理
+        Inquireclick() {
+            var newarr = [];
+            if (this.input == "") {
+                newarr = this.tableData;
+            } else {
+
+                for (var i = 0; i < this.tableData.length; i++) {
+                    if (this.tableData[i].companyName.indexOf(this.input) != -1) {
+                        newarr.push(this.tableData[i]);
+                    }
+                }
+            }
+
+            this.tableDatas = newarr;
+            this.currentPage = 1;
+        },
+
+        //点击修改
+        upDate(index, row) {
+
+            this.TypeVisible = true;
+            this.typeName = "修改客户公司资料"
+            this.OperationData.status = 2
+            this.OperationData.id = row.id
+            this.OperationData.companyName = row.companyName
+            this.OperationData.address = row.address
+            this.OperationData.postCodes = row.postCodes
+            this.OperationData.lastedOpUserId = this.userId
+            this.OperationData.createUserId = this.userId
+            this.OperationData.remark = row.remark
+        },
+        //点击添加
+        AddData() {
+            this.OperationData = {
+                status: 1,
+                id: 0,
+                companyName: "",
+                address: "",
+                postCodes: "",
+                lastedOpUserId: 0,
+                createUserId: 0,
+                remark: ""
+            },
+                this.TypeVisible = true;
+            this.typeName = "添加客户公司资料"
+        },
+        AddBtn() {
+            this.$refs.OperationData.validate((valid) => {
+                if (valid) {
+                    var that = this
+                    var url = "/api/CRM/OperationClientCompany"
+                    that.$axios({
+                        method: 'post',
+                        url: url,
+                        headers: {
+                            Authorization: 'Bearer ' + that.token
+                        },
+                        data: that.OperationData
+                    }).then(function (res) {
+                        debugger
+                        if (res.data.code == 200) {
+                            that.$message({
+                                message: res.data.msg,
+                                type: 'success'
+                            });
+                            that.loading = true;
+                            that.TypeVisible = false;
+                            that.ClientCompany()
+                        } else {
+                            that.$message.error(res.data.msg);
+                        }
+                    })
+                } else {
+                    this.$message.error('请完善信息在保存!');
+                    return false;
+                }
+            })
+        },
+        del(index, row) {
+
+            var url = "/api/CRM/DelClientCompany"
+            var that = this
+            this.$axios({
+                method: 'post',
+                url: url,
+                headers: {
+                    Authorization: 'Bearer ' + this.token
+                },
+                data: {
+                    Id: row.id,
+                    DeleteUserId: this.userId
+                }
+            }).then(function (res) {
+                console.log(res)
+
+                if (res.data.code == 200) {
+
+                    that.$message({
+                        message: '删除成功',
+                        type: 'success'
+                    });
+                    that.ClientCompany()
+                } else {
+                    that.$message.error('删除失败!');
+                }
+                that.loading = false
+            }).catch(function (error) {
+                that.loading = false
+                that.$message.error("网络错误,请稍后重试");
+            });
+        }
+    },
+    mounted() {
+        this.token = JSON.parse(localStorage.getItem('userinif')).token;
+        this.userId = JSON.parse(localStorage.getItem('userinif')).userInfo.userId
+        this.ClientCompany()
+    }
+}
+</script>
+<style>
+.communal-list {
+    background-color: #fff;
+    padding: 10px;
+    box-shadow: 0 0 5px #0005;
+    border-radius: 10px;
+}
+
+.communal-title {
+    display: flex;
+    font-size: 17px;
+    font-weight: 600;
+    color: #555;
+    margin-top: 8px;
+    margin-bottom: 10px;
+    justify-content: space-between;
+    align-items: center;
+}
+
+.communal-box {
+    display: flex;
+}
+
+.communal-box>button {
+    margin-left: 10px;
+    padding: 8px 20px;
+}
+</style>

+ 229 - 0
src/components/Crm/DeleClient.vue

@@ -0,0 +1,229 @@
+<template>
+    <div>
+        <div class="communal-list">
+            <div class="communal-title">
+                <div>客户资料</div>
+                <div class="communal-box">
+                    <el-input @input="Inquireclick()" placeholder="城市/名称/联系人" v-model="input" clearable
+                        style="width: 350px;">
+                    </el-input>
+                    <router-link to="/home/DeleClientOperation">
+                        <el-button type="primary" style="margin-left: 10px;">新增</el-button>
+                    </router-link>
+
+                </div>
+            </div>
+            <template>
+                <el-table :data="tableDatas.slice((currentPage - 1) * pageSize, currentPage * pageSize)" border
+                    style="width: 100%" v-loading="loading" element-loading-text="拼命加载中...">
+                    <el-table-column prop="num" label="序 号" width="55">
+                        <template slot-scope="scope">
+                            {{ (currentPage - 1) * pageSize + scope.$index + 1 }}
+                        </template>
+                    </el-table-column>
+                    <el-table-column prop="clientName" label="客户姓名">
+                    </el-table-column>
+                    <el-table-column prop="companyName" label="所属公司">
+                    </el-table-column>
+                    <el-table-column prop="sex" label="性别" width="50">
+                        <template slot-scope="sex">
+                            <span v-if="sex.row.sex == 0">男</span>
+                            <span v-else-if="sex.row.sex == 1">女</span>
+                            <span v-else>未填写</span>
+                        </template>
+                    </el-table-column>
+                    <el-table-column prop="marriage" label="婚姻状态" width="80">
+                        <template slot-scope="marriage">
+                            <span v-if="marriage.row.marriage == 0">未设置</span>
+                            <span v-else-if="marriage.row.marriage == 1">未婚</span>
+                            <span v-else-if="marriage.row.marriage == 2">已婚</span>
+                            <span v-else-if="marriage.row.marriage == 3">离异</span>
+                            <span v-else-if="marriage.row.marriage == 4">丧偶</span>
+                            <span v-else>未设置</span>
+                        </template>
+                    </el-table-column>
+                    <el-table-column prop="landlinePhone" label="客户座机">
+                    </el-table-column>
+                    <el-table-column prop="tel" label="客户手机号" width="200">
+                    </el-table-column>
+                    <el-table-column prop="idNo" label="身份证号码" width="200">
+                    </el-table-column>
+                    <el-table-column prop="passportNo" label="护照号码" width="200">
+                    </el-table-column>
+                    <el-table-column label="操作">
+                        <template slot-scope="scope">
+                            <el-button size="mini" @click="upDate(scope.$index, scope.row)">编辑</el-button>
+                            <el-button size="mini" type="danger" @click="del(scope.$index, scope.row)">删除</el-button>
+                        </template>
+                    </el-table-column>
+                </el-table>
+            </template>
+            <div class="block">
+                <el-pagination align='center' @size-change="handleSizeChange" @current-change="handleCurrentChange"
+                    :current-page="currentPage" :page-sizes="[10, 12, 15, 20]" :page-size="pageSize"
+                    layout="total, sizes, prev, pager, next" :total="tableDatas.length">
+                </el-pagination>
+            </div>
+        </div>
+    </div>
+</template>
+<script>
+export default {
+    data() {
+        return {
+            loading: false,
+            tableDatas: [],
+            tableData: [],
+            currentPage: 1, // 当前页码
+            pageSize: 12,// 每页的数据条数
+            input: '',
+            token: '',
+            userId: 0
+        }
+    },
+    methods: {
+        //每页条数改变时触发 选择一页显示多少行
+        handleSizeChange(val) {
+            this.currentPage = 1;
+            this.pageSize = val;
+        },
+        //当前页改变时触发 跳转其他页
+        handleCurrentChange(val) {
+            this.currentPage = val;
+        },
+        DeleClient() {
+            this.loading = true
+            var url = "/api/CRM/GetClientList"
+            var that = this
+            this.$axios({
+                method: 'post',
+                url: url,
+                headers: {
+                    Authorization: 'Bearer ' + this.token
+                },
+                data: {
+                    portType: 1,
+                    PageIndex: 0,
+                    PageSize: 0,
+                    City: '',
+                    Name: '',
+                    Contact: '',
+                    ContactPhone: '',
+                }
+            }).then(function (res) {
+                console.log(res)
+                debugger
+                if (res.data.code == 200) {
+                    debugger
+                    that.tableData = res.data.data;
+                    that.tableDatas = that.tableData;
+                    if (that.tableDatas.slice((that.currentPage - 1) * that.pageSize, that.currentPage * that.pageSize).length == 0) {
+                        if (that.currentPage > 1) {
+                            that.currentPage = that.currentPage - 1;
+                        }
+                    }
+                }
+                that.loading = false
+            }).catch(function (error) {
+                that.loading = false
+                that.$message.error("网络错误,请稍后重试");
+            });
+        },
+        //搜索框处理
+        Inquireclick() {
+            var newarr = [];
+            if (this.input == "") {
+                newarr = this.tableData;
+            } else {
+                debugger
+                for (var i = 0; i < this.tableData.length; i++) {
+                    if (this.tableData[i].city.indexOf(this.input) != -1) {
+                        newarr.push(this.tableData[i]);
+                    } else if (this.tableData[i].name.indexOf(this.input) != -1) {
+                        newarr.push(this.tableData[i]);
+                    } else if (this.tableData[i].contact.indexOf(this.input) != -1) {
+                        newarr.push(this.tableData[i]);
+                    }
+                }
+            }
+            debugger
+            this.tableDatas = newarr;
+            this.currentPage = 1;
+        },
+
+        upDate(index, row) {
+            this.$router.push({
+                path: "/home/DeleClientOperation",
+                query: { id: row.id }
+            })
+        },
+
+        del(index, row) {
+            debugger
+            var url = "/api/CRM/"
+            var that = this
+            this.$axios({
+                method: 'post',
+                url: url,
+                headers: {
+                    Authorization: 'Bearer ' + this.token
+                },
+                data: {
+                    Id: row.id,
+                    DeleteUserId: this.userId
+                }
+            }).then(function (res) {
+                console.log(res)
+                debugger
+                if (res.data.code == 200) {
+                    debugger
+                    that.$message({
+                        message: '删除成功',
+                        type: 'success'
+                    });
+                    that.DeleClient();
+                } else {
+                    that.$message.error('删除失败!');
+                }
+                that.loading = false
+            }).catch(function (error) {
+                that.loading = false
+                that.$message.error("网络错误,请稍后重试");
+            });
+        }
+    },
+    mounted() {
+        this.token = JSON.parse(localStorage.getItem('userinif')).token;
+        this.userId = JSON.parse(localStorage.getItem('userinif')).userInfo.userId
+        this.DeleClient();
+    }
+}
+</script>
+<style>
+.communal-list {
+    background-color: #fff;
+    padding: 10px;
+    box-shadow: 0 0 5px #0005;
+    border-radius: 10px;
+}
+
+.communal-title {
+    display: flex;
+    font-size: 17px;
+    font-weight: 600;
+    color: #555;
+    margin-top: 8px;
+    margin-bottom: 10px;
+    justify-content: space-between;
+    align-items: center;
+}
+
+.communal-box {
+    display: flex;
+}
+
+.communal-box>button {
+    margin-left: 10px;
+    padding: 8px 20px;
+}
+</style>

+ 3 - 3
src/components/system/SetData.vue

@@ -85,7 +85,7 @@ export default {
                 status: 1,
                 id: 0,
                 name: "",
-                sTid: 0,
+                sTid: '',
                 createUserId: 0,
                 remark: ""
             },
@@ -96,7 +96,7 @@ export default {
                 ],
             },
             setDataType: [
-              
+
             ]
         }
     },
@@ -219,7 +219,7 @@ export default {
                 status: 1,
                 id: 0,
                 name: "",
-                sTid: 0,
+                sTid: '',
                 createUserId: 0,
                 remark: ""
             },

+ 13 - 1
src/router/index.js

@@ -39,6 +39,8 @@ import CountryFeeCost from '@/components/Resource/CountryFeeCost'
 import CountryFeeCostOperation from '@/components/Resource/CountryFeeCostOperation'
 import SetDataType from '@/components/system/SetDataType';
 import SetData from '@/components/system/SetData';
+import CustomerCompany from '@/components/Crm/CustomerCompany';
+import DeleClient from '@/components/Crm/DeleClient';
 Vue.use(Router)
 
 export default new Router({
@@ -220,7 +222,17 @@ export default new Router({
           path: '/home/SetData',
           name: 'SetData',
           component: SetData
-        }
+        },
+        {
+          path: '/home/CustomerCompany',
+          name: 'CustomerCompany',
+          component: CustomerCompany
+        },
+        {
+          path: '/home/DeleClient',
+          name: 'DeleClient',
+          component: DeleClient
+        },
       ]
     },
     {