Commit 06a011f8 authored by zhengke's avatar zhengke

1

parent 0692a8d7
......@@ -477,5 +477,43 @@ export function RemoveStage(data) {
}
/**
* 获取客户类型列表
*/
export function GetStudentTypeList(data) {
return request({
url: '/CustomerStudent/GetStudentTypeList',
method: 'post',
data
});
}
/**
* 新增修改客户类型
*/
export function SetStudentType(data) {
return request({
url: '/CustomerStudent/SetStudentType',
method: 'post',
data
});
}
/**
* 删除客户类型
*/
export function RemodeStudentType(data) {
return request({
url: '/CustomerStudent/RemodeStudentType',
method: 'post',
data
});
}
<template>
<q-dialog v-model="persistent" content-class="bg-grey-1" persistent transition-show="scale" transition-hide="scale">
<q-card style="width: 400px;max-width:400px;">
<q-card-section>
<div class="text-h6">{{optionTitle}}</div>
</q-card-section>
<q-card-section class="q-pt-none scroll" style="max-height: 70vh">
<div class="row wrap">
<q-input filled stack-label maxlength="30" :dense="false" v-model="objOption.Name" ref="Name"
class="col-12 q-pb-lg" label="类型名称" :rules="[val => !!val || '请填写阶段名称']" />
</div>
<div class="row wrap">
<q-input filled stack-label maxlength="5" :dense="false" v-model="objOption.No" ref="No"
class="col-12 q-pb-lg" label="编号" :rules="[val => !!val || '请填写编号']" @keyup.native="checkInteger(objOption,'No')" />
</div>
<div class="row wrap">
<q-input filled type="textarea" :rows="3" stack-label :dense="false" v-model="objOption.Info" ref="Info"
class="col-12 q-pb-lg" label="描述" />
</div>
</q-card-section>
<q-separator />
<q-card-actions align="right" class="bg-white">
<q-btn label="取消" flat color="grey-10" style="font-weight:400 !important" @click="closeSaveForm" />
<q-btn label="立即提交" color="accent q-px-md" style="font-weight:400 !important" :loading="saveLoading"
@click="saveStage" />
</q-card-actions>
</q-card>
</q-dialog>
</template>
<script>
import {
SetStudentType
} from '../../api/system/index'
export default {
props: {
saveObj: {
type: Object,
default: null
}
},
data() {
return {
persistent: true,
saveLoading: false,
objOption: {
Id: 0,
Name: '', //A类客户
Info: '', //描述
No: '' //编号
},
optionTitle: "",
}
},
mounted() {
this.initObj();
},
methods: {
//初始化表单
initObj() {
if (this.saveObj && this.saveObj.Id > 0) {
this.objOption.Id = this.saveObj.Id;
this.objOption.Name = this.saveObj.Name;
this.objOption.Info = this.saveObj.Info;
this.objOption.No = this.saveObj.No;
this.optionTitle = "修改客户类型信息"
} else {
this.optionTitle = "新增客户类型信息"
this.objOption.Id = 0;
this.objOption.Name = '';
this.objOption.Info = '';
this.objOption.No = '';
}
},
//关闭弹窗
closeSaveForm() {
this.$emit('close')
},
//保存菜单
saveStage() {
this.$refs.Name.validate();
this.$refs.No.validate();
if (!this.$refs.Name.hasError&&!this.$refs.No.hasError) {
this.saveLoading = true
SetStudentType(this.objOption).then(res => {
this.saveLoading = false;
if (res.Code == 1) {
this.$q.notify({
icon: 'iconfont icon-chenggong',
color: 'accent',
timeout: 2000,
message: '数据保存成功!',
position: 'top'
})
this.$emit("success")
this.closeSaveForm()
}
})
}
}
}
}
</script>
<template>
<div class="page-body">
<div class="page-content">
<q-table :pagination="msg" :loading="loading" no-data-label="暂无相关数据" flat
class="sticky-column-table no-bottom-table" separator="none" :data="dataList" :columns="columns"
row-key="name">
<template v-slot:top="props">
<div class="col-2 q-table__title">客户类型</div>
<q-space />
<div class="page-option">
<q-btn color="accent" size="sm" class="q-mr-md" icon="add" label="新增客户类型" @click="addObj(null)" />
</div>
</template>
<template v-slot:body-cell-Group_Id="props">
<q-td :props="props">
<div>
<q-btn flat size="xs" icon="edit" color="accent" style="font-weight:400" label="编辑"
@click="addObj(props.row)" />
<q-btn flat size="xs" icon="delete" color="negative" class="q-mr-xs" label="删除"
@click="deleteCustom(props.row.Id)" />
</div>
</q-td>
</template>
</q-table>
</div>
<custom-form v-if="isShowCustomForm" :save-obj="customObj" @close="closeCustomForm" @success="refreshPage">
</custom-form>
</div>
</template>
<script>
import {
GetStudentTypeList,
RemodeStudentType
} from '../../api/system/index'
import customForm from '../../components/system/custom-form'
export default {
meta: {
title: "客户类型管理"
},
components: {
customForm
},
data() {
return {
columns: [{
name: 'Id',
label: 'Id',
field: row => row.Id,
align: 'left'
},{
name: 'No',
label: '编号',
field: 'No',
align: 'left'
},{
name: 'Name',
required: true,
label: '客户类型',
align: 'left',
field: row => row.Name
},{
name: 'Group_Id',
label: '操作',
field: 'Group_Id'
}
],
msg:{
rowsPerPage: 100
},
dataList: [],
loading: true,
isShowCustomForm: false,
customObj: {}
}
},
mounted() {
this.getList()
},
methods: {
deleteCustom(Id) {
let delMsg = {
Id: Id
};
this.$q.dialog({
title: '提示信息',
message: '是否确定删除该类型?',
cancel: true,
persistent: true,
ok: "确定",
cancel: "取消",
}).onOk(() => {
RemodeStudentType(delMsg).then(res => {
if (res.Code == 1) {
this.$q.notify({
icon: 'iconfont icon-chenggong',
color: 'accent',
timeout: 2000,
message: '删除成功!',
position: 'top'
})
this.getList();
}
})
}).onCancel(() => {
});
},
getList() {
this.loading = true;
GetStudentTypeList({}).then(res => {
this.loading = false;
console.log(res,'数据');
if(res.Code==1){
this.dataList = res.Data;
}
})
},
closeCustomForm() {
this.isShowCustomForm = false
},
refreshPage(){
this.getList();
},
addObj(obj){
if (obj) {
this.customObj = obj
} else {
this.customObj = null
}
this.isShowCustomForm = true;
}
},
}
</script>
<style lang="sass">
@import url('~assets/css/table.sass')
</style>
......@@ -83,6 +83,11 @@ const routes = [{
component: () =>
import("pages/system/stage.vue")
},
{
path: "/system/customType", //客户类型
component: () =>
import("pages/system/customType.vue")
},
{
path: "/system/area", //地区管理
component: () =>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment