用户管理、客户管理接口联调

dev
yujialong 3 years ago
parent 7497294cb8
commit 8f9faed1cc
  1. 4
      src/store/index.js
  2. 25
      src/utils/api.js
  3. 11
      src/utils/http.js
  4. 4
      src/views/Home.vue
  5. 314
      src/views/customer/AddCustomer.vue
  6. 169
      src/views/customer/Dashboard.vue
  7. 5
      src/views/data/Product.vue
  8. 7
      src/views/setting/Person.vue
  9. 18
      src/views/user/AddUser.vue
  10. 51
      src/views/user/User.vue

@ -3,7 +3,6 @@ import Vuex from 'vuex';
Vue.use(Vuex); Vue.use(Vuex);
const store = new Vuex.Store({ const store = new Vuex.Store({
state: { state: {
customerId:'',
courseId:'', courseId:'',
userId: '', userId: '',
roleId: '', roleId: '',
@ -21,9 +20,6 @@ const store = new Vuex.Store({
userData (state, payload) { userData (state, payload) {
state.userId = payload.user_id state.userId = payload.user_id
}, },
customerData (state, payload) {
state.customerId = payload.customer_id
},
courseData (state, payload) { courseData (state, payload) {
state.courseId = payload.course_id state.courseId = payload.course_id
}, },

@ -26,17 +26,20 @@ export default {
deletePlatform: `${host}/liuwanr/userInfo/deletePlatform`, //更新用户组织架构 deletePlatform: `${host}/liuwanr/userInfo/deletePlatform`, //更新用户组织架构
updateUserRoleId: `${host}/liuwanr/userInfo/updateUserRoleId`, //更新用户角色id接口 updateUserRoleId: `${host}/liuwanr/userInfo/updateUserRoleId`, //更新用户角色id接口
deleteCustomer: `${host}/liuwanr/customer/deleteCustomer`, //删除客户 // 客户管理
updateCustomer: `${host}/liuwanr/customer/updateCustomer`, //更新客户 deleteCustomer: `${host3}/nakadai/customer/delCustomer`,
addCustomer: `${host}/liuwanr/customer/addCustomer`, //添加客户 updateCustomer: `${host3}/nakadai/customer/updateCustomer`,
queryCustomer: `${host}/liuwanr/customer/queryCustomer`, //查询客户 addCustomer: `${host3}/nakadai/customer/addCustomer`,
queryCustomerIsExists: `${host}/liuwanr/customer/queryCustomerIsExists`, //查询客户是否存在 queryCustomer: `${host3}/nakadai/customer/queryCustomer`,
queryCustomerDetails: `${host}/liuwanr/customer/queryCustomerDetails`, //查询客户详情 queryCustomerDetails: `${host3}/nakadai/customer/queryCustomerDetails`,
queryCustomerIndustryClass: `${host}/liuwanr/customer/queryCustomerIndustryClass`, //查询行业类 resetPwdCustomer: `${host3}/nakadai/customer/resetPwd`,
queryCustomerIndustry: `${host}/liuwanr/customer/queryCustomerIndustry`, //查询行业 queryCustomerIsExists: `${host3}/nakadai/customer/queryCustomerIsExists`,
queryPhone: `${host}/liuwanr/user/queryPhone`, //查询电话 updateEnabled: `${host3}/nakadai/customer/updateEnabled`,
querySchoolData: `${host}/liuwanr/customer/querySchool`, //根据学校名称查询学校信息 queryCustomerIndustryClass: `${host}/liuwanr/customer/queryCustomerIndustryClass`,
queryPlatform: `${host}/liuwanr/userInfo/queryPlatform`, //查询系统列表 queryCustomerIndustry: `${host}/liuwanr/customer/queryCustomerIndustry`,
queryPhone: `${host}/liuwanr/user/queryPhone`,
querySchoolData: `${host}/liuwanr/customer/querySchool`,
queryPlatform: `${host}/liuwanr/userInfo/queryPlatform`,
// 用户管理 // 用户管理
delUserAccount: `${host3}/users/userAccount/delUserAccount`, delUserAccount: `${host3}/users/userAccount/delUserAccount`,

@ -133,10 +133,8 @@ export function get(url, params){
resolve(res.data); resolve(res.data);
break; break;
case 500: case 500:
this.$message.error( reject(res.data)
res.data.errmessage break
);
break;
case 300: case 300:
this.$message.error( this.$message.error(
res.data.errmessage res.data.errmessage
@ -229,6 +227,11 @@ export function post(url, params) {
res.data.errmessage res.data.errmessage
); );
break; break;
case 10001:
this.$message.error(
res.data.message
);
break;
} }
}else{ }else{
resolve(res.data) resolve(res.data)

@ -5,9 +5,9 @@
<div class="content-box" > <div class="content-box" >
<div class="content"> <div class="content">
<transition name="move" mode="out-in"> <transition name="move" mode="out-in">
<keep-alive> <!-- <keep-alive> -->
<router-view></router-view> <router-view></router-view>
</keep-alive> <!-- </keep-alive> -->
</transition> </transition>
<el-backtop target=".content"></el-backtop> <el-backtop target=".content"></el-backtop>
</div> </div>

@ -7,7 +7,7 @@
<div class="per_title" v-preventReClick @click="goback()"> <div class="per_title" v-preventReClick @click="goback()">
<i class="el-icon-arrow-left"></i> <i class="el-icon-arrow-left"></i>
<span class="per_back">返回</span> <span class="per_back">返回</span>
<span class="per_school" v-text="customerId != '' ? '编辑客户信息' : '新增客户信息'"></span> <span class="per_school" v-text="customerId ? '编辑客户信息' : '新增客户信息'"></span>
</div> </div>
<el-button type="primary" size="small" round class="mag" v-preventReClick @click="saveAdd('form')">确定</el-button> <el-button type="primary" size="small" round class="mag" v-preventReClick @click="saveAdd('form')">确定</el-button>
</div> </div>
@ -21,39 +21,36 @@
</div> </div>
<div> <div>
<el-form :model="form" :rules="rules" ref="form" label-width="120px" class="flex-start-around"> <el-form :model="form" :rules="rules" ref="form" label-width="120px" class="flex-start-around" :disabled="isDetail">
<el-col :span="6" style="margin-right: 60px;"> <el-col :span="6" style="margin-right: 60px;">
<el-form-item label="国家"> <el-form-item prop="countries" label="国家">
<el-select v-model="form.countries" clearable placeholder="请选择国家"> <el-select v-model="form.countries" clearable placeholder="请选择国家">
<el-option v-for="(item,index) in countryList" :key="index" :label="item.name" :value="item.name"></el-option> <el-option v-for="(item,index) in countryList" :key="index" :label="item.name" :value="item.name"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item prop="schoolId" label="客户名称"> <el-form-item prop="provinceId" label="省份">
<el-select v-model="form.schoolId" filterable clearable placeholder="请选择学校" <el-select v-model="form.provinceId" placeholder="" disabled>
@change="SchoolChange" @clear="clearSchool()"> <el-option v-for="(item,index) in provinceList" :key="index" :label="item.provinceName" :value="item.provinceId"></el-option>
<el-option v-for="(item,index) in schoolList" :key="index" :label="item.schoolName" :value="item.schoolId"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="省份"> <el-form-item label="到期时间">
<el-select v-model="form.provinces" placeholder="" disabled> <el-date-picker type="date" disabled v-model="form.expireDate" style="width: 100%;" value-format="yyyy-MM-dd"></el-date-picker>
<el-option v-for="(item,index) in provinceList" :key="index" :label="item.provinceName" :value="item.provinceId"></el-option>
</el-select>
</el-form-item> </el-form-item>
<el-form-item prop="adminName" label="联系人姓名"> <el-form-item prop="industryClassId" label="行业类型">
<el-input placeholder="请输入联系人姓名" v-model="form.adminName"></el-input> <el-select v-model="form.industryClassId" clearable placeholder="请选择行业类型" @change="changIndustry" @clear="clearIndustry()">
<el-option v-for="(item,index) in IndustryClassList" :key="index" :label="item.industryClassName" :value="item.industryClassId"></el-option>
</el-select>
</el-form-item> </el-form-item>
<el-form-item prop="adminName" label="账号"> <el-form-item prop="name" label="联系人姓名">
<el-input placeholder="请输入账号" v-model="form.adminName"></el-input> <el-input placeholder="请输入联系人姓名" v-model="form.name"></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="IndustryClass" label="行业类"> <el-form-item prop="account" label="账号">
<el-select v-model="form.IndustryClass" clearable placeholder="请选择行业类" @change="changIndustry" @clear="clearIndustry()"> <el-input placeholder="请输入账号" v-model="form.account"></el-input>
<el-option v-for="(item,index) in IndustryClassList" :key="index" :label="item.industryClassName" :value="item.industryClassId"></el-option>
</el-select>
</el-form-item> </el-form-item>
<el-form-item prop="email" label="邮箱"> <el-form-item prop="email" label="邮箱">
@ -62,40 +59,36 @@
</el-col> </el-col>
<el-col :span="6" style="margin-left: 60px;"> <el-col :span="6" style="margin-left: 60px;">
<el-form-item label="客户类型"> <el-form-item prop="customerType" label="客户类型">
<el-select v-model="form.customerType" disabled placeholder=""> <el-select v-model="form.customerType" placeholder="请选择客户类型">
<el-option v-for="(item,index) in customerTypeList" :key="index" :label="item.name" :value="item.value"></el-option> <el-option v-for="(item,index) in customerTypeList" :key="index" :label="item.name" :value="item.value"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="学校类型"> <el-form-item prop="cityId" label="城市">
<el-select v-model="form.level" placeholder="" disabled> <el-select v-model="form.cityId" placeholder="" disabled>
<el-option v-for="(item,index) in levelList" :key="index" :label="item.name" :value="item.value"></el-option>
</el-select>
</el-form-item>
<el-form-item label="城市">
<el-select v-model="form.city" placeholder="" disabled>
<el-option v-for="(item,index) in cityList" :key="index" :label="item.cityName" :value="item.cityId"></el-option> <el-option v-for="(item,index) in cityList" :key="index" :label="item.cityName" :value="item.cityId"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="手机号"> <el-form-item prop="customerId" label="客户名称">
<el-input placeholder="请输入联系人手机号" v-model="form.adminPhone" maxlength="11"></el-input> <el-select v-model="form.customerId" filterable clearable placeholder="请选择学校" @change="SchoolChange" @clear="clearSchool()">
</el-form-item> <el-option v-for="(item,index) in schoolList" :key="index" :label="item.schoolName" :value="item.schoolId"></el-option>
</el-select>
<el-form-item label="职务">
<el-input placeholder="请输入职务名称" v-model="form.adminPhone" maxlength="11"></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="industry" label="行业"> <el-form-item prop="industryId" label="行业">
<el-select v-model="form.industry" clearable placeholder="请选择行业" :disabled="form.IndustryClass ? false : true"> <el-select v-model="form.industryId" clearable placeholder="请选择行业" :disabled="form.industryClassId ? false : true">
<el-option v-for="(item,index) in industryList" :key="index" :label="item.industryName" :value="item.industryId"></el-option> <el-option v-for="(item,index) in industryList" :key="index" :label="item.industryName" :value="item.industryId"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="到期时间"> <el-form-item label="手机号">
<el-date-picker type="date" disabled v-model="form.stopTime" style="width: 100%;" value-format="yyyy-MM-dd"></el-date-picker> <el-input placeholder="请输入联系人手机号" v-model="form.phone" maxlength="11"></el-input>
</el-form-item>
<el-form-item label="职务">
<el-input placeholder="请输入职务名称" v-model="form.position" maxlength="11"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-form> </el-form>
@ -114,18 +107,47 @@
</el-table-column> </el-table-column>
<el-table-column prop="courseName" label="课程名称" align="center"> <el-table-column prop="courseName" label="课程名称" align="center">
</el-table-column> </el-table-column>
<el-table-column prop="usePeriod" label="使用期限(年)" align="center"> <el-table-column prop="usePeriod" label="使用期限" align="center">
</el-table-column> </el-table-column>
<el-table-column prop="usePeriod" label="起止日期" align="center"> <el-table-column prop="usePeriod" label="起止日期" align="center">
</el-table-column> </el-table-column>
<el-table-column prop="usePeriod" label="剩余期限(天)" align="center"> <el-table-column prop="usePeriod" label="剩余期限" align="center">
</el-table-column> </el-table-column>
<el-table-column prop="marketPrice" label="市场价(万)" align="center"> <el-table-column label="端口地址" align="center">
<template slot-scope="scope">
<el-button @click="configure(scope.row)">配置</el-button>
</template>
</el-table-column> </el-table-column>
<el-table-column prop="transactionPrice" label="成交价(万)" align="center"> <el-table-column label="状态" align="center">
<template slot-scope="scope">
<el-switch
v-model="scope.row.isDeliverGoods"
:active-value="1"
:inactive-value="0"
active-text="启用"
inactive-text="禁用"
disabled>
</el-switch>
</template>
</el-table-column> </el-table-column>
<el-table-column prop="discount" label="折扣率(%)" align="center"> </el-table>
</div>
</el-card>
<el-card shadow="hover" class="mgb20" v-show="customerId">
<div class="flex-center mgb20 user_header">
<p class="addhr_tag"></p>
<span>数据平台权限</span>
</div>
<div>
<el-table :data="coursePermissionss" class="orderTable" stripe header-align="center">
<el-table-column type="index" width="100" label="序号" align="center">
</el-table-column> </el-table-column>
<el-table-column prop="courseName" label="产品名称" align="center"></el-table-column>
<el-table-column prop="usePeriod" label="使用期限" align="center"></el-table-column>
<el-table-column prop="usePeriod" label="起止日期" align="center"></el-table-column>
<el-table-column prop="usePeriod" label="剩余期限" align="center"></el-table-column>
<el-table-column prop="usePeriod" label="账号数" align="center"></el-table-column>
<el-table-column label="端口地址" align="center"> <el-table-column label="端口地址" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button @click="configure(scope.row)">配置</el-button> <el-button @click="configure(scope.row)">配置</el-button>
@ -156,19 +178,21 @@
<el-table :data="contractInformations" class="table" stripe header-align="center"> <el-table :data="contractInformations" class="table" stripe header-align="center">
<el-table-column type="index" width="100" label="序号" align="center"> <el-table-column type="index" width="100" label="序号" align="center">
</el-table-column> </el-table-column>
<el-table-column prop="contractInformationNumber" label="合同编号" align="center">
</el-table-column>
<el-table-column prop="contractInformationName" label="合同名称" align="center"> <el-table-column prop="contractInformationName" label="合同名称" align="center">
</el-table-column> </el-table-column>
<el-table-column prop="contractInformationNumber" label="合同编号" align="center"> <el-table-column prop="contractInformationName" label="合同期限" align="center">
</el-table-column> </el-table-column>
<el-table-column prop="contractInformationSum" label="合同金额" align="center"> <el-table-column prop="contractInformationLink" label="产品内容" align="center">
</el-table-column> </el-table-column>
<el-table-column prop="contractInformationLink" label="合同文件" align="center"> <el-table-column prop="contractInformationSum" label="合同金额" align="center">
</el-table-column> </el-table-column>
<!-- <el-table-column prop="payamount" label="操作" align="center"> <el-table-column label="操作" align="center">
<template> <template>
<el-button type="text">配置</el-button> <el-button type="text">查看</el-button>
</template> </template>
</el-table-column> --> </el-table-column>
</el-table> </el-table>
</div> </div>
</el-card> </el-card>
@ -230,38 +254,55 @@
<script> <script>
export default { export default {
name: 'baseform',
data() { data() {
return { return {
customerId : this.$route.query.id,
isDetail : Boolean(this.$route.query.show),
customerData: [], customerData: [],
form: { form: {
schoolId: '', customerId: '',
customerName: '', customerName: '',
countries: '中国', countries: '中国',
IndustryClass: '', industryClassId: '',
industry: '', industryId: '',
provinces: '', provinceId: '',
adminName: '', account: '',
adminPhone: '', name: '',
city: '', phone: '',
position: '',
cityId: '',
customerType: '', customerType: '',
stopTime: '', expireDate: '',
email: '', email: '',
level: ''
}, },
rules: { rules: {
adminName: [ countries: [
{ required: true, message: '请输入管理员姓名', trigger: 'blur' } { required: true, message: '请输入国家', trigger: 'blur' }
],
provinceId: [
{ required: true, message: '请输入省份', trigger: 'blur' }
],
cityId: [
{ required: true, message: '请输入城市', trigger: 'blur' }
],
customerType: [
{ required: true, message: '请选择客户类型', trigger: 'change' }
],
name: [
{ required: true, message: '请输入联系人姓名', trigger: 'blur' }
],
account: [
{ required: true, message: '请输入账号', trigger: 'blur' }
], ],
adminPhone: [ phone: [
{ required: true, message: '请输入管理员手机号', trigger: 'blur' }, { required: true, message: '请输入手机号', trigger: 'blur' },
{ {
pattern: /^1[3456789]\d{9}$/, pattern: /^1[3456789]\d{9}$/,
message: '请输入正确的手机号', message: '请输入正确的手机号',
trigger: 'blur' trigger: 'blur'
} }
], ],
schoolId: [ customerId: [
{ required: true, message: '请选择客户名称', trigger: 'change' } { required: true, message: '请选择客户名称', trigger: 'change' }
], ],
email: [ email: [
@ -272,11 +313,11 @@ export default {
trigger: 'blur' trigger: 'blur'
} }
], ],
industry: [ industryId: [
{ required: true, message: '请选择行业', trigger: 'change' } { required: true, message: '请选择行业', trigger: 'change' }
], ],
IndustryClass: [ industryClassId: [
{ required: true, message: '请选择行业类', trigger: 'change' } { required: true, message: '请选择行业类', trigger: 'change' }
], ],
}, },
customerTypeList: [{ customerTypeList: [{
@ -296,30 +337,9 @@ export default {
}], }],
provinceList: this.$store.state.provinceList, provinceList: this.$store.state.provinceList,
cityList: [], cityList: [],
levelList: [{
name: '本科',
value: 1
},
{
name: '大专',
value: 2
},
{
name: '高职',
value: 3
},
{
name: '中专',
value: 4
},
{
name: '其他',
value: 5
}],
IndustryClassList: [], IndustryClassList: [],
industryList: [], industryList: [],
schoolList: [], schoolList: [],
customerId : this.$store.state.customerId,
contractInformations: [], contractInformations: [],
coursePermissionss: [], coursePermissionss: [],
ipVisible: false, ipVisible: false,
@ -351,31 +371,31 @@ export default {
mounted() { mounted() {
this.getIndustryClass() this.getIndustryClass()
if(this.customerId){ if(this.customerId){
let data = { this.$get(this.api.queryCustomerDetails,{
customerId: this.customerId customerId: this.customerId
} }).then((res) => {
this.$get(this.api.queryCustomerDetails,data).then((res) => { let customer = res.result.customer
this.form = { this.form = {
schoolId: res.message[0].customers[0].schoolId, customerId: Number(this.customerId),
countries: res.message[0].customers[0].countries, countries: customer.countries,
IndustryClass: res.message[0].customers[0].industryClassId, industryClassId: customer.industryClassId,
industry: res.message[0].customers[0].industryId, industryId: customer.industryId,
provinces: res.message[0].customers[0].provinceId, provinceId: customer.provinceId,
adminName: res.message[0].customers[0].adminName, account: customer.account,
adminPhone: res.message[0].customers[0].adminPhone, phone: customer.phone,
city: res.message[0].customers[0].cityId, cityId: customer.cityId,
level: res.message[0].customers[0].level, customerType: customer.customerType,
customerType: res.message[0].customers[0].customerType, expireDate: customer.expireDate,
stopTime: res.message[0].customers[0].stopTime, email: customer.email,
email: res.message[0].customers[0].email, name: customer.name,
position: customer.position,
} }
this.contractInformations = res.message[0].contractInformations this.contractInformations = res.result.contractInformations
this.coursePermissionss = res.message[0].coursePermissionss this.coursePermissionss = res.result.coursePermissionss
this.getCityData() this.getCityData()
this.changIndustryData() this.changIndustryData()
this.getSchoolData() this.getSchoolData()
}).catch((res) => { }).catch((res) => {})
})
}else{ }else{
this.getSchoolData() this.getSchoolData()
} }
@ -384,7 +404,7 @@ export default {
// //
getCityData(){ getCityData(){
let data = { let data = {
provinceId: this.form.provinces provinceId: this.form.provinceId
} }
this.$get(this.api.queryCity,data).then(res => { this.$get(this.api.queryCity,data).then(res => {
this.cityList = res.message this.cityList = res.message
@ -392,9 +412,8 @@ export default {
}, },
// //
clearSchool(){ clearSchool(){
this.form.provinces = '', this.form.provinceId = '',
this.form.city = '', this.form.cityId = '',
this.form.level = '',
this.form.customerName = '' this.form.customerName = ''
}, },
// / // /
@ -412,28 +431,23 @@ export default {
SchoolChange(val){ SchoolChange(val){
this.clearSchool() this.clearSchool()
if(val){ if(val){
let obj = {}; let obj = {}
obj = this.schoolList.find((item)=>{ obj = this.schoolList.find((item)=>{
return item.schoolId === val; return item.schoolId === val
}); });
this.form.customerName = obj.schoolName this.form.customerName = obj.schoolName
this.form.level = obj.level this.form.provinceId = obj.provinceId
this.form.provinces = obj.provinceId
this.getCityData() this.getCityData()
this.form.city = obj.cityId this.form.cityId = obj.cityId
let data = { this.$get(this.api.queryCustomerIsExists,{
schoolId: this.form.schoolId schoolId: this.form.customerId
} }).then(res => {
this.$get(this.api.queryCustomerIsExists,data).then(res => {
if(res.message.length != 0){
this.$message.warning('该客户已存在');
this.NoAdd = false
}else{
this.NoAdd = true this.NoAdd = true
}
}).catch(res => { }).catch(res => {
}); this.$message.warning('该客户已存在')
this.NoAdd = false
})
} }
}, },
// //
@ -444,7 +458,7 @@ export default {
}, },
// //
clearIndustry(){ clearIndustry(){
this.form.industry = '' this.form.industryId = ''
}, },
// //
changIndustry(){ changIndustry(){
@ -453,7 +467,7 @@ export default {
}, },
changIndustryData(){ changIndustryData(){
let data = { let data = {
industryClassId: this.form.IndustryClass industryClassId: this.form.industryClassId
} }
this.$get(this.api.queryCustomerIndustry,data).then(res => { this.$get(this.api.queryCustomerIndustry,data).then(res => {
this.industryList = res.message this.industryList = res.message
@ -465,44 +479,42 @@ export default {
if(this.NoAdd){ if(this.NoAdd){
let obj = {}; let obj = {};
obj = this.schoolList.find((item)=>{ obj = this.schoolList.find((item)=>{
return item.schoolId === this.form.schoolId; return item.schoolId == this.form.customerId;
}); });
this.form.customerName = obj.schoolName this.form.customerName = obj.schoolName
this.form.level = obj.level this.form.provinceId = obj.provinceId
this.form.provinces = obj.provinceId
this.getCityData() this.getCityData()
this.form.city = obj.cityId this.form.cityId = obj.cityId
let data = { let data = {
customerName: this.form.customerName, customerName: this.form.customerName,
schoolId: this.form.schoolId, customerId: this.form.customerId,
schoolId: this.form.customerId,
countries: this.form.countries, countries: this.form.countries,
industryClassId: this.form.IndustryClass, industryClassId: this.form.industryClassId,
industryId: this.form.industry, industryId: this.form.industryId,
provinceId: this.form.provinces, provinceId: this.form.provinceId,
adminName: this.form.adminName, account: this.form.account,
adminPhone: this.form.adminPhone, phone: this.form.phone,
cityId: this.form.city, cityId: this.form.cityId,
level: this.form.level,
customerType: this.form.customerType, customerType: this.form.customerType,
stopTime: this.form.stopTime, expireDate: this.form.expireDate,
email: this.form.email, email: this.form.email,
customerId: this.customerId name: this.form.name,
position: this.form.position
} }
if(this.customerId){ if(this.customerId){
this.$post(this.api.updateCustomer,data).then((res) => { this.$post(this.api.updateCustomer,data).then((res) => {
this.$message.success('编辑成功'); this.$message.success('编辑成功')
this.goback() this.goback()
}).catch((res) => { }).catch((res) => {})
})
}else{ }else{
this.$post(this.api.addCustomer,data).then((res) => { this.$post(this.api.addCustomer,data).then((res) => {
this.$message.success('添加成功'); this.$message.success('添加成功')
this.goback() this.goback()
}).catch((res) => { }).catch((res) => {})
})
} }
}else{ }else{
this.$message.warning('该客户已存在'); this.$message.warning('该客户已存在')
} }
} }
}) })
@ -520,7 +532,7 @@ export default {
}; };
</script> </script>
<style scoped> <style lang="scss" scoped>
.addhr_tag{ .addhr_tag{
background-color: #666; background-color: #666;
width: 6px; width: 6px;

@ -12,28 +12,28 @@
<el-form label-width="80px"> <el-form label-width="80px">
<el-col :span="6"> <el-col :span="6">
<el-form-item label="国家"> <el-form-item label="国家">
<el-select v-model="form.countries" clearable placeholder="请选择国家"> <el-select v-model="form.countries" placeholder="请选择国家">
<el-option v-for="(item,index) in countryList" :key="index" :label="item.name" :value="item.name"></el-option> <el-option v-for="(item,index) in countryList" :key="index" :label="item.name" :value="item.name"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
<el-form-item label="省份"> <el-form-item label="省份">
<el-select v-model="form.provinces" clearable placeholder="请选择省份" @change="getCity()" @clear="clearprovince()"> <el-select v-model="form.provinces" clearable placeholder="请选择省份" @change="getCity" @clear="clearprovince">
<el-option v-for="(item,index) in provinceList" :key="index" :label="item.provinceName" :value="item.provinceId"></el-option> <el-option v-for="(item,index) in provinceList" :key="index" :label="item.provinceName" :value="item.provinceId"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
<el-form-item label="城市"> <el-form-item label="城市">
<el-select v-model="form.city" clearable placeholder="请选择城市" :disabled="form.provinces ? false : true" @change="getData()"> <el-select v-model="form.city" clearable placeholder="请选择城市" :disabled="form.provinces ? false : true" @change="initData">
<el-option v-for="(item,index) in cityList" :key="index" :label="item.cityName" :value="item.cityId"></el-option> <el-option v-for="(item,index) in cityList" :key="index" :label="item.cityName" :value="item.cityId"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
<el-form-item> <el-form-item>
<el-input placeholder="请输入客户名称/管理员姓名/电话" prefix-icon="el-icon-search" v-model="form.keyword" clearable @keyup.enter.native="onSearch"></el-input> <el-input placeholder="请输入客户名称/管理员姓名/电话" prefix-icon="el-icon-search" v-model="form.keyword" clearable></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-form> </el-form>
@ -50,39 +50,38 @@
<span>客户列表</span> <span>客户列表</span>
</div> </div>
<div> <div>
<el-button type="primary" size="small" round class="mag" @click="addcustomer">新增客户</el-button> <el-button type="primary" size="small" round @click="addcustomer">新增客户</el-button>
<el-button type="primary" size="small" round @click="delAllSelection">批量删除</el-button> <el-button type="primary" size="small" round @click="delAllSelection">批量删除</el-button>
</div> </div>
</div> </div>
<el-table :data="customerData" class="table" stripe header-align="center" @selection-change="handleSelectionChange" :row-key="getRowKeys"> <el-table :data="listData" class="table" stripe header-align="center" @selection-change="handleSelectionChange" row-key="customerId">
<el-table-column type="selection" width="55" align="center" :reserve-selection="true"></el-table-column> <el-table-column type="selection" width="55" align="center" :reserve-selection="true"></el-table-column>
<el-table-column type="index" width="100" label="序号" align="center"> <el-table-column type="index" width="100" label="序号" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
{{scope.$index + (pageNo - 1) * pageSize + 1}} {{scope.$index + (page - 1) * pageSize + 1}}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="schoolName" label="客户名称" align="center"> <el-table-column prop="customerName" label="客户名称" align="center">
</el-table-column>
<el-table-column prop="countries" label="国家" align="center">
</el-table-column> </el-table-column>
<el-table-column label="行业" align="center"> <el-table-column label="行业" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<span class="ellipsis">{{scope.row.industryName}}</span> <span class="ellipsis">{{scope.row.industryName}}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="countries" label="国家" align="center">
</el-table-column>
<el-table-column prop="provinceName" label="省份" align="center"> <el-table-column prop="provinceName" label="省份" align="center">
</el-table-column> </el-table-column>
<el-table-column prop="cityName" label="城市" align="center"> <el-table-column prop="cityName" label="城市" align="center">
</el-table-column> </el-table-column>
<el-table-column prop="provinceName" label="联系人" align="center"> <el-table-column prop="name" label="联系人" align="center">
</el-table-column>
<el-table-column prop="adminName" label="账号" align="center">
</el-table-column> </el-table-column>
<el-table-column prop="account" label="账号" align="center">
</el-table-column> </el-table-column>
<el-table-column label="操作" width="270" align="center"> <el-table-column label="操作" width="270" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text">重置密码</el-button> <el-button type="text" @click="resetPassword(scope.row)">重置密码</el-button>
<el-button type="text">查看</el-button> <el-button type="text" @click="show(scope.row)">查看</el-button>
<el-button type="text" @click="edit(scope.row)">编辑</el-button> <el-button type="text" @click="edit(scope.row)">编辑</el-button>
<el-button type="text" @click="handleDelete(scope.row)">删除</el-button> <el-button type="text" @click="handleDelete(scope.row)">删除</el-button>
<el-button type="text" @click="permission">应用权限</el-button> <el-button type="text" @click="permission">应用权限</el-button>
@ -90,7 +89,7 @@
</el-table-column> </el-table-column>
</el-table> </el-table>
<div class="pagination"> <div class="pagination">
<el-pagination background layout="total, prev, pager, next" :total="totals" @current-change="handleCurrentChange" :current-page="pageNo"> <el-pagination background layout="total, prev, pager, next" :total="total" @current-change="handleCurrentChange" :current-page="page">
</el-pagination> </el-pagination>
</div> </div>
</el-card> </el-card>
@ -104,11 +103,11 @@ export default {
name: 'dashboard', name: 'dashboard',
data() { data() {
return { return {
name: localStorage.getItem('ms_username'), searchTimer: null,
countryList: [{ countryList: [{
name:'中国' name:'中国'
}], }],
customerData: [], listData: [],
form: { form: {
countries:'中国', countries:'中国',
provinces: '', provinces: '',
@ -118,19 +117,19 @@ export default {
multipleSelection: [], multipleSelection: [],
provinceList: [], provinceList: [],
cityList: [], cityList: [],
pageNo: 1, page: 1,
pageSize: 10, pageSize: 10,
totals: 1, total: 1,
ruleIds: [] ruleIds: []
}; };
}, },
components: { watch: {
'form.keyword': function(val) {
clearTimeout(this.searchTimer)
this.searchTimer = setTimeout(() => {
this.initData()
},500)
}, },
computed: {
role() {
return this.name === 'admin' ? '超级管理员' : '普通用户';
}
}, },
mounted() { mounted() {
this.getData() this.getData()
@ -143,29 +142,32 @@ export default {
provinceId: this.form.provinces, provinceId: this.form.provinces,
cityId: this.form.city, cityId: this.form.city,
searchContent: this.form.keyword, searchContent: this.form.keyword,
pageNo: this.pageNo, page: this.page,
pageSize: this.pageSize size: this.pageSize
} }
this.$get(this.api.queryCustomer,data).then(res => { this.$post(this.api.queryCustomer,data).then(res => {
this.customerData = res.message.rows this.listData = res.message.list
this.totals = res.message.total this.total = res.message.totalCount
}).catch(res => {}); }).catch(res => {});
}, },
initData(){
this.page = 1
this.getData()
},
getProvince(){ getProvince(){
this.$get(this.api.queryProvince).then(res => { this.$get(this.api.queryProvince).then(res => {
this.provinceList = res.message this.provinceList = res.message
this.$store.commit("provinceData", { provinceList : this.provinceList}); this.$store.commit("provinceData", { provinceList : this.provinceList});
}).catch(res => {}); }).catch(res => {});
}, },
//
clearprovince(){ clearprovince(){
this.form.city = '' this.form.city = ''
}, },
getCity(){ getCity(){
this.clearprovince() this.clearprovince()
this.getCityData() this.getCityData()
this.pageNo = 1 this.page = 1
this.getData() this.initData()
}, },
getCityData(){ getCityData(){
let data = { let data = {
@ -173,97 +175,76 @@ export default {
} }
this.$get(this.api.queryCity,data).then(res => { this.$get(this.api.queryCity,data).then(res => {
this.cityList = res.message this.cityList = res.message
}).catch(res => {}); }).catch(res => {})
}, },
permission(){ permission(){
this.$router.push('/permission') this.$router.push('/permission')
}, },
addcustomer(){ addcustomer(){
this.$store.commit("customerData", { customer_id : ''}); this.$router.push('addcustomer')
this.$router.push('/addcustomer');
}, },
edit(row){ edit(row){
this.$store.commit("customerData", { customer_id : row.customerId }); this.$router.push(`addcustomer?id=${row.customerId}`)
this.$router.push('/addcustomer'); },
show(row){
this.$router.push(`addcustomer?id=${row.customerId}&show=true`)
}, },
handleDelete(row) { handleDelete(row) {
this.$confirm('确定要删除吗?', '提示', { this.$confirm('确定要删除吗?', '提示', {
type: 'warning' type: 'warning'
}) }).then(() => {
.then(() => { this.$post(this.api.deleteCustomer,row.customerId).then(res => {
let str = ''; this.$message.success('删除成功')
str += row.customerId+',';
var deleteList = str.split(',').map(Number);
deleteList.pop()
var arr = [];
var signAgainReq = new Object();
signAgainReq.customerId = deleteList[0];
arr.push(signAgainReq);
let data = {
customer: arr
}
this.$post(this.api.deleteCustomer,data).then(res => {
this.$message.success('删除成功');
this.getData() this.getData()
}).catch(res => {}); }).catch(res => {})
}) }).catch(() => {})
.catch(() => {});
},
getRowKeys(row) {
return row.customerId;
}, },
handleSelectionChange(val) { handleSelectionChange(val) {
this.multipleSelection = val; this.multipleSelection = val
}, },
delAllSelection() { delAllSelection() {
if(this.multipleSelection.length != ''){ if(this.multipleSelection.length != ''){
const length = this.multipleSelection.length; let arr = this.multipleSelection
let str = ''; let delList = arr.map(item => {
for (let i = 0; i < length; i++) { return item.customerId
str += this.multipleSelection[i].customerId+','; })
}
var deleteList = str.split(',').map(Number);
deleteList.pop()
var arr = [];
for(var i = 0,len = deleteList.length; i < len; i++){
var signAgainReq = new Object();
signAgainReq.customerId = deleteList[i];
arr.push(signAgainReq);
}
//
this.$confirm('确定要删除吗?', '提示', { this.$confirm('确定要删除吗?', '提示', {
type: 'warning' type: 'warning'
}) }).then(() => {
.then(() => {
let data = {
customer: arr
}
this.$post(this.api.deleteCustomer,data).then(res => { this.$post(this.api.deleteCustomer,data).then(res => {
this.multipleSelection = []; this.multipleSelection = [];
this.$message.success('删除成功'); this.$message.success('删除成功')
this.getData() this.getData()
}).catch(res => {}); }).catch(res => {})
}).catch(() => {}); }).catch(() => {})
}else{ }else{
this.$message.error('请先选择客户 !'); this.$message.error('请先选择数据')
} }
}, },
onSearch(){ handleCurrentChange(val) {
this.pageNo = 1 this.page = val
this.getData() this.getData()
}, },
handleCurrentChange(val) { resetPassword(row){
this.pageNo = val; this.$confirm(`重置后的密码为:${this.$config.initialPassword},确定重置?`, '提示', {
this.getData(); }).then(() => {
this.$get(this.api.resetPwdCustomer,{
customerId: row.customerId,
}).then(res => {
if(res.message == 'success'){
this.$message.success('重置成功')
}else{
this.$message.error('重置失败')
}
}).catch(res => {});
}).catch(() => {
});
}, },
} }
}; };
</script> </script>
<style scoped> <style lang="scss" scoped>
.mag{
margin-right: 20px;
}
</style> </style>

@ -10,7 +10,7 @@
</div> </div>
<div> <div>
<el-form label-width="80px" class="flex-between"> <el-form label-width="80px" class="flex-between">
<div class="flex-center"> <div class="flex-center no-mb">
<el-form-item label="创建日期"> <el-form-item label="创建日期">
<el-date-picker v-model="date" align="right" unlink-panels type="daterange" start-placeholder="开始日期" end-placeholder="结束日期" format="yyyy-MM-dd" value-format="yyyy-MM-dd" clearable></el-date-picker> <el-date-picker v-model="date" align="right" unlink-panels type="daterange" start-placeholder="开始日期" end-placeholder="结束日期" format="yyyy-MM-dd" value-format="yyyy-MM-dd" clearable></el-date-picker>
</el-form-item> </el-form-item>
@ -531,6 +531,9 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
/deep/ .no-mb .el-form-item{
margin-bottom: 0;
}
/deep/.el-container{ /deep/.el-container{
.el-aside{ .el-aside{
padding: 15px; padding: 15px;

@ -552,8 +552,7 @@ export default {
this.$store.commit('userPhoto',{avatar:res.message}) this.$store.commit('userPhoto',{avatar:res.message})
}, },
getdata() { getdata() {
this.$get(`${this.api.userinfo}/${this.userId}`) this.$get(this.api.queryUserInfoDetails,{ userId: this.userId }).then(res => {
.then(res => {
this.personalInformation = res.data.userInfo[0] this.personalInformation = res.data.userInfo[0]
this.personalInformation.idNumber = this.personalInformation.IDNumber this.personalInformation.idNumber = this.personalInformation.IDNumber
this.originAccount = this.personalInformation.account this.originAccount = this.personalInformation.account
@ -602,9 +601,7 @@ export default {
} }
}) })
}) })
.catch(err => { .catch(err => {})
console.log(err);
});
}, },
concatArch(isLoadData) { concatArch(isLoadData) {
this.archivesList = this.archivesList.concat({ this.archivesList = this.archivesList.concat({

@ -673,23 +673,7 @@ export default {
}).catch(res => {}); }).catch(res => {});
}, },
goback(){ goback(){
if(this.clickFlag){ this.$router.back()
let msg = ''
if(this.userId){
msg = '请确定信息是否进行更新完毕,再返回用户首页。'
}else{
msg = '确定返回?未更新的信息将不会保存。'
}
this.$confirm(msg, '提示', {
type: 'warning'
})
.then(() => {
this.clickFlag = false
this.$router.go(-1)
})
.catch(() => {});
}
}, },
// //
getSubject(){ getSubject(){

@ -83,11 +83,10 @@
<span>用户列表</span> <span>用户列表</span>
</div> </div>
<div> <div>
<!-- <el-button type="primary" size="small" round @click="adduser">新增用户</el-button> -->
<el-button type="primary" size="small" round @click="delAllSelection">批量删除</el-button> <el-button type="primary" size="small" round @click="delAllSelection">批量删除</el-button>
</div> </div>
</div> </div>
<el-table :data="userData" class="table" stripe header-align="center" @selection-change="handleSelectionChange" :row-key="getRowKeys"> <el-table :data="userData" class="table" stripe header-align="center" @selection-change="handleSelectionChange" row-key="userId">
<el-table-column type="selection" width="55" align="center" :reserve-selection="true"></el-table-column> <el-table-column type="selection" width="55" align="center" :reserve-selection="true"></el-table-column>
<el-table-column type="index" width="100" label="序号" align="center"> <el-table-column type="index" width="100" label="序号" align="center">
</el-table-column> </el-table-column>
@ -266,7 +265,7 @@ export default {
} }
this.$get(this.api.queryCity,data).then(res => { this.$get(this.api.queryCity,data).then(res => {
this.cityList = res.message this.cityList = res.message
}).catch(res => {}); }).catch(res => {})
}, },
// //
clearcity(){ clearcity(){
@ -286,26 +285,26 @@ export default {
} }
this.$get(this.api.querySchool,data).then(res => { this.$get(this.api.querySchool,data).then(res => {
this.schoolList = res.message this.schoolList = res.message
}).catch(res => {}); }).catch(res => {})
}, },
currentChange(val) { currentChange(val) {
this.page = val; this.page = val
this.getData(); this.getData()
}, },
permission(){ permission(){
this.$router.push('/permission') this.$router.push('/permission')
}, },
adduser(){ adduser(){
this.$store.commit("userData", { user_id : ''}); this.$store.commit("userData", { user_id : ''})
this.$router.push('/adduser'); this.$router.push('/adduser')
}, },
edit(row){ edit(row){
this.$store.commit("userData", { user_id : row.userId}); this.$store.commit("userData", { user_id : row.userId})
this.$router.push('/adduser'); this.$router.push('/adduser')
}, },
show(row){ show(row){
this.$store.commit("userData", { user_id : row.userId}); this.$store.commit("userData", { user_id : row.userId})
this.$router.push('/adduser'); this.$router.push('/adduser')
}, },
handleDelete(row) { handleDelete(row) {
this.$confirm('确定要删除吗?', '提示', { this.$confirm('确定要删除吗?', '提示', {
@ -333,9 +332,8 @@ export default {
}else{ }else{
this.$message.error('重置失败') this.$message.error('重置失败')
} }
}).catch(res => {}); }).catch(res => {})
}).catch(() => { }).catch(() => {})
});
}, },
switchOff(val,row,index) { switchOff(val,row,index) {
let data = { let data = {
@ -347,38 +345,33 @@ export default {
}).catch((res) => { }).catch((res) => {
}) })
}, },
getRowKeys(row) {
return row.userId;
},
handleSelectionChange(val) { handleSelectionChange(val) {
this.multipleSelection = val; this.multipleSelection = val
}, },
delAllSelection() { delAllSelection() {
if(this.multipleSelection.length != ''){ if(this.multipleSelection.length != ''){
let newArr = this.multipleSelection let newArr = this.multipleSelection
let delList = newArr.map(e => e.userId) let delList = newArr.map(e => e.userId)
//
this.$confirm('确定要删除选中用户吗?', '提示', { this.$confirm('确定要删除选中用户吗?', '提示', {
type: 'warning' type: 'warning'
}) }).then(() => {
.then(() => {
this.$post(this.api.deleteUser,delList).then(res => { this.$post(this.api.deleteUser,delList).then(res => {
this.multipleSelection = []; this.multipleSelection = [];
this.$message.success('删除成功'); this.$message.success('删除成功')
this.getData() this.getData()
}).catch(res => {}); }).catch(res => {})
}).catch(() => {}); }).catch(() => {})
}else{ }else{
this.$message.error('请先选择客户 !'); this.$message.error('请先选择客户 !')
} }
}, },
} }
}; };
</script> </script>
<style scoped> <style lang="scss" scoped>
.mag{ .el-form-item{
margin-right: 20px; margin-bottom: 0;
} }
</style> </style>

Loading…
Cancel
Save