feat:完成客户列表模块
This commit is contained in:
parent
7f92ded86d
commit
62c3a9f28b
@ -0,0 +1,177 @@
|
||||
<template>
|
||||
<el-dialog v-model="dialogVisible" title="添加客户" width="900px" @closed="closeDialog" @open="openDialog">
|
||||
<el-form ref="formRef" :model="formData" :rules="rules">
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label-width="labelWidth" label="客户昵称" prop="customer_name">
|
||||
<el-input v-model='formData.customer_name' type="text" placeholder='请输入客户昵称'></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label-width="labelWidth" label="客户账号" prop="customer_account">
|
||||
<el-input v-model='formData.customer_account' type="text" placeholder='请输入客户账号'></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label-width="labelWidth" label="客户密码" prop="customer_password">
|
||||
<el-input v-model='formData.customer_password' type="text" placeholder='请输入客户密码'></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label-width="labelWidth" label="客户手机号" prop="customer_phone">
|
||||
<el-input v-model='formData.customer_phone' type="text" placeholder='请输入客户手机号'></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label-width="labelWidth" label="客户邮箱" prop="customer_email">
|
||||
<el-input v-model='formData.customer_email' type="text" placeholder='请输入客户邮箱'></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="客户性别" prop="customer_sex">
|
||||
<el-select v-model="formData.customer_sex" clearable placeholder="请选择">
|
||||
<el-option v-for="item in sex" :key="item.dictionary_guid" :label="item.dictionary_name"
|
||||
:value="item.dictionary_value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button type="primary" @click="handleAddClick(formRef)">添加</el-button>
|
||||
<el-button @click="handleResetClick(formRef)">重置</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive, ref, watch } from "vue";
|
||||
import { addCustomer, getDictionary } from "~/service/customer";
|
||||
import { useLoginStore } from "~/store";
|
||||
|
||||
// --业务参数
|
||||
|
||||
|
||||
|
||||
// --业务方法
|
||||
|
||||
// 字典获取
|
||||
const sex = ref([]);
|
||||
async function get_sex() {
|
||||
await getDictionary({ dictionary_value: 'sex' }).then((res) => {
|
||||
sex.value = res
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// --基础参数
|
||||
const store = useLoginStore();
|
||||
const headers = {
|
||||
Accept: "application/json",
|
||||
...store.headers,
|
||||
};
|
||||
|
||||
const isBtnLod = ref(false);
|
||||
const formRef = ref();
|
||||
const labelWidth = 90;
|
||||
const props = defineProps({
|
||||
modelValue: Boolean,
|
||||
done: Function,
|
||||
});
|
||||
const emits = defineEmits(["update:modelValue"]);
|
||||
const dialogVisible = ref(props.modelValue);
|
||||
const formData = reactive({});
|
||||
|
||||
const uoloadData = ref({
|
||||
dirName: "Customer"
|
||||
})
|
||||
|
||||
watch(props, (v) => {
|
||||
dialogVisible.value = v.modelValue;
|
||||
});
|
||||
|
||||
const rules = reactive({
|
||||
customer_name: [
|
||||
{
|
||||
required: true,
|
||||
message: '客户昵称不能为空'
|
||||
}
|
||||
],
|
||||
customer_account: [
|
||||
{
|
||||
required: true,
|
||||
message: '客户账号不能为空'
|
||||
}
|
||||
],
|
||||
customer_password: [
|
||||
{
|
||||
required: true,
|
||||
message: '客户密码不能为空'
|
||||
}
|
||||
],
|
||||
// customer_phone: [
|
||||
// {
|
||||
// required: true,
|
||||
// message: '客户手机号不能为空'
|
||||
// }
|
||||
// ],
|
||||
// customer_email: [
|
||||
// {
|
||||
// required: true,
|
||||
// message: '客户邮箱不能为空'
|
||||
// }
|
||||
// ],
|
||||
// customer_sex: [
|
||||
// {
|
||||
// required: true,
|
||||
// message: '客户性别不能为空'
|
||||
// }
|
||||
// ],
|
||||
|
||||
});
|
||||
|
||||
|
||||
// --基础方法
|
||||
|
||||
// 打开弹窗时执行
|
||||
const openDialog = () => {
|
||||
get_sex()
|
||||
|
||||
};
|
||||
|
||||
const closeDialog = () => {
|
||||
handleResetClick(formRef.value);
|
||||
dialogVisible.value = false;
|
||||
emits("update:modelValue", false);
|
||||
};
|
||||
|
||||
const handleAddClick = async (formEl) => {
|
||||
if (!formEl) return;
|
||||
formEl.validate(async (valid) => {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
isBtnLod.value = true;
|
||||
|
||||
|
||||
const { code } = await addCustomer(formData);
|
||||
if (code == 0) {
|
||||
closeDialog();
|
||||
props.done();
|
||||
}
|
||||
isBtnLod.value = flase;
|
||||
});
|
||||
};
|
||||
|
||||
const handleResetClick = async (formEl) => {
|
||||
if (!formEl) return;
|
||||
formEl.resetFields();
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
@ -0,0 +1,99 @@
|
||||
<template>
|
||||
<el-dialog v-model="props.modelValue" title="客户详情" width="900px" @closed="closeDialog" @open="openDialog">
|
||||
<el-form ref="formRef" :model="formData" :disabled="true">
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label-width="labelWidth" label="客户昵称" prop="customer_name">
|
||||
<el-input v-model='formData.customer_name' type="text" placeholder='请输入客户昵称'></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label-width="labelWidth" label="客户账号" prop="customer_account">
|
||||
<el-input v-model='formData.customer_account' type="text" placeholder='请输入客户账号'></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label-width="labelWidth" label="客户密码" prop="customer_password">
|
||||
<el-input v-model='formData.customer_password' type="text" placeholder='请输入客户密码'></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label-width="labelWidth" label="客户手机号" prop="customer_phone">
|
||||
<el-input v-model='formData.customer_phone' type="text" placeholder='请输入客户手机号'></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label-width="labelWidth" label="客户邮箱" prop="customer_email">
|
||||
<el-input v-model='formData.customer_email' type="text" placeholder='请输入客户邮箱'></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="客户性别" prop="customer_sex">
|
||||
<el-select v-model="formData.customer_sex" clearable placeholder="请选择">
|
||||
<el-option v-for="item in sex" :key="item.dictionary_guid" :label="item.dictionary_name"
|
||||
:value="item.dictionary_value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
</el-form>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive, ref, watch } from "vue";
|
||||
import { isEmptyObject } from "~/utils/index";
|
||||
import { getDictionary } from '~/service/customer';
|
||||
|
||||
// --业务参数
|
||||
|
||||
|
||||
|
||||
// --业务方法
|
||||
|
||||
// 字典获取
|
||||
const sex = ref([]);
|
||||
async function get_sex() {
|
||||
await getDictionary({ dictionary_value: 'sex' }).then((res) => {
|
||||
sex.value = res
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
// --基础参数
|
||||
const formRef = ref();
|
||||
const labelWidth = 100;
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: Boolean,
|
||||
data: Object,
|
||||
done: Function,
|
||||
});
|
||||
const emits = defineEmits(["update:modelValue"]);
|
||||
const formData = ref({
|
||||
...props.data,
|
||||
});
|
||||
|
||||
|
||||
// --基础方法
|
||||
watch(props, (v) => {
|
||||
formData.value = v.data;
|
||||
|
||||
|
||||
});
|
||||
|
||||
// 打开弹窗时执行
|
||||
const openDialog = () => {
|
||||
|
||||
get_sex()
|
||||
|
||||
};
|
||||
|
||||
const closeDialog = () => {
|
||||
emits("update:modelValue", false);
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
@ -0,0 +1,176 @@
|
||||
<template>
|
||||
<el-dialog v-model="props.modelValue" title="编辑客户" width="900px" @closed="closeDialog" @open="openDialog">
|
||||
<el-form ref="formRef" :model="formData" :rules="rules">
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label-width="labelWidth" label="客户昵称" prop="customer_name">
|
||||
<el-input v-model='formData.customer_name' type="text" placeholder='请输入客户昵称'></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label-width="labelWidth" label="客户账号" prop="customer_account">
|
||||
<el-input v-model='formData.customer_account' type="text" placeholder='请输入客户账号'></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label-width="labelWidth" label="客户密码" prop="customer_password">
|
||||
<el-input v-model='formData.customer_password' type="text" placeholder='请输入客户密码'></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label-width="labelWidth" label="客户手机号" prop="customer_phone">
|
||||
<el-input v-model='formData.customer_phone' type="text" placeholder='请输入客户手机号'></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label-width="labelWidth" label="客户邮箱" prop="customer_email">
|
||||
<el-input v-model='formData.customer_email' type="text" placeholder='请输入客户邮箱'></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="客户性别" prop="customer_sex">
|
||||
<el-select v-model="formData.customer_sex" clearable placeholder="请选择">
|
||||
<el-option v-for="item in sex" :key="item.dictionary_guid" :label="item.dictionary_name"
|
||||
:value="item.dictionary_value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button type="primary" @click="handleEditClick(formRef)" :loading="isBtnLod">编辑</el-button>
|
||||
<el-button @click="handleResetClick(formRef)">重置</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive, ref, watch } from "vue";
|
||||
import { editCustomer, getDictionary } from "~/service/customer";
|
||||
import { useLoginStore } from "~/store";
|
||||
|
||||
// --业务参数
|
||||
|
||||
|
||||
|
||||
// --业务方法
|
||||
|
||||
// 字典获取
|
||||
const sex = ref([]);
|
||||
async function get_sex() {
|
||||
await getDictionary({ dictionary_value: 'sex' }).then((res) => {
|
||||
sex.value = res
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// --基础参数
|
||||
const store = useLoginStore();
|
||||
const headers = {
|
||||
Accept: "application/json",
|
||||
...store.headers,
|
||||
};
|
||||
const isBtnLod = ref(false);
|
||||
const formRef = ref();
|
||||
const labelWidth = 100;
|
||||
const props = defineProps({
|
||||
modelValue: Boolean,
|
||||
data: Object,
|
||||
done: Function,
|
||||
});
|
||||
const emits = defineEmits(["update:modelValue"]);
|
||||
const formData = ref({
|
||||
...props.data,
|
||||
});
|
||||
const uoloadData = ref({
|
||||
dirName: "Customer"
|
||||
})
|
||||
|
||||
|
||||
// --基础方法
|
||||
watch(props, (v) => {
|
||||
formData.value = v.data;
|
||||
|
||||
|
||||
});
|
||||
|
||||
// 打开弹窗时执行
|
||||
const openDialog = () => {
|
||||
get_sex()
|
||||
|
||||
};
|
||||
|
||||
const closeDialog = () => {
|
||||
props.done();
|
||||
emits("update:modelValue", false);
|
||||
};
|
||||
|
||||
const rules = reactive({
|
||||
customer_name: [
|
||||
{
|
||||
required: true,
|
||||
message: '客户昵称不能为空'
|
||||
}
|
||||
],
|
||||
customer_account: [
|
||||
{
|
||||
required: true,
|
||||
message: '客户账号不能为空'
|
||||
}
|
||||
],
|
||||
// customer_password: [
|
||||
// {
|
||||
// required: true,
|
||||
// message: '客户密码不能为空'
|
||||
// }
|
||||
// ],
|
||||
// customer_phone: [
|
||||
// {
|
||||
// required: true,
|
||||
// message: '客户手机号不能为空'
|
||||
// }
|
||||
// ],
|
||||
// customer_email: [
|
||||
// {
|
||||
// required: true,
|
||||
// message: '客户邮箱不能为空'
|
||||
// }
|
||||
// ],
|
||||
// customer_sex: [
|
||||
// {
|
||||
// required: true,
|
||||
// message: '客户性别不能为空'
|
||||
// }
|
||||
// ],
|
||||
|
||||
});
|
||||
|
||||
const handleEditClick = async (formEl) => {
|
||||
console.log(formData.value);
|
||||
if (!formEl) return;
|
||||
formEl.validate(async (valid) => {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
isBtnLod.value = true;
|
||||
|
||||
|
||||
const { code } = await editCustomer(formData.value);
|
||||
if (code == 0) {
|
||||
closeDialog();
|
||||
props.done();
|
||||
}
|
||||
isBtnLod.value = false;
|
||||
});
|
||||
};
|
||||
const handleResetClick = async (formEl) => {
|
||||
if (!formEl) return;
|
||||
formEl.resetFields();
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
217
src/pages/index/customer/customer_list/index.vue
Normal file
217
src/pages/index/customer/customer_list/index.vue
Normal file
@ -0,0 +1,217 @@
|
||||
<template>
|
||||
<!-- 面包屑 -->
|
||||
<el-breadcrumb>
|
||||
<el-breadcrumb-item>客户管理</el-breadcrumb-item>
|
||||
<el-breadcrumb-item to="/customer/list">客户列表</el-breadcrumb-item>
|
||||
</el-breadcrumb>
|
||||
<!-- 搜索 -->
|
||||
<el-form inline :model="params">
|
||||
<el-form-item label="客户昵称">
|
||||
<el-input v-model='params.customer_name' placeholder='请输入客户昵称'></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="客户账号">
|
||||
<el-input v-model='params.customer_account' placeholder='请输入客户账号'></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="客户手机号">
|
||||
<el-input v-model='params.customer_phone' placeholder='请输入客户手机号'></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="客户邮箱">
|
||||
<el-input v-model='params.customer_email' placeholder='请输入客户邮箱'></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="客户性别">
|
||||
<el-select v-model="params.customer_sex" clearable placeholder="请选择">
|
||||
<el-option v-for="item in sex" :key="item.dictionary_guid" :label="item.dictionary_name"
|
||||
:value="item.dictionary_value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="tableRef.reload()" icon="ElIconSearch">
|
||||
搜索
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-space style="margin-bottom: 10px;">
|
||||
<!-- 添加客户 -->
|
||||
<el-col :span="1">
|
||||
<el-button type="primary" @click="addCustomerDialogVisible = true"> 添加 </el-button>
|
||||
</el-col>
|
||||
<!-- 下拉操作 -->
|
||||
<el-dropdown v-if="selectionData.length">
|
||||
<el-button type="primary">
|
||||
批量操作<el-icon class="el-icon--right"><arrow-down /></el-icon>
|
||||
</el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item @click="handleDelete(selectionData)">
|
||||
批量删除
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</el-space>
|
||||
<!-- 数据表格 -->
|
||||
<DataTable ref="tableRef" style="width: 100%" :onSelectionChange="data => (selectionData = data)" :column="column"
|
||||
:params="params" :request="params => getCustomerList(params)">
|
||||
|
||||
|
||||
<template #customer_sex='scope'>
|
||||
<dict-tag :options='sex' :value='scope.row.customer_sex' />
|
||||
</template>
|
||||
|
||||
|
||||
|
||||
|
||||
<template #chaoz="scope">
|
||||
<el-space>
|
||||
<el-button size="small" @click="handleUpdate(scope.row)">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-dropdown @command="handleCommand">
|
||||
<el-button type="primary" size="small">
|
||||
更多<el-icon class="el-icon--right"><arrow-down /></el-icon>
|
||||
</el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item :command="{ type: 'detail', row: scope.row }">
|
||||
详情
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item :command="{ type: 'delete', row: scope.row }">
|
||||
删除
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</el-space>
|
||||
</template>
|
||||
</DataTable>
|
||||
|
||||
<!-- 添加客户 -->
|
||||
<AddCustomerDialog v-model="addCustomerDialogVisible" :done="() => tableRef.reload()"></AddCustomerDialog>
|
||||
<!-- 编辑客户 -->
|
||||
<EditCustomerDialog v-model="EditCustomerDialogVisible" :data="EditCustomerDialogRow" :done="() => tableRef.reload()">
|
||||
</EditCustomerDialog>
|
||||
<!-- 客户详情 -->
|
||||
<DetailCustomerDialog v-model="DetailCustomerDialogVisible" :data="DetailCustomerDialogRow"></DetailCustomerDialog>
|
||||
</template>
|
||||
<script setup>
|
||||
import { ArrowDown } from '@element-plus/icons-vue';
|
||||
import { ref, reactive, watch } from 'vue';
|
||||
import { useLoginStore } from "~/store";
|
||||
import { getCustomerList, editCustomer, deleteCustomer, getDictionary } from '~/service/customer';
|
||||
import AddCustomerDialog from './components/AddCustomerDialog.vue';
|
||||
import EditCustomerDialog from './components/EditCustomerDialog.vue';
|
||||
import DetailCustomerDialog from './components/DetailCustomerDialog.vue';
|
||||
|
||||
const tableRef = ref();
|
||||
const selectionData = ref([]);
|
||||
const store = useLoginStore();
|
||||
|
||||
const addCustomerDialogVisible = ref(false);
|
||||
const EditCustomerDialogVisible = ref(false);
|
||||
const EditCustomerDialogRow = ref({});
|
||||
const DetailCustomerDialogVisible = ref(false);
|
||||
const DetailCustomerDialogRow = ref({});
|
||||
|
||||
const headers = {
|
||||
Accept: "application/json",
|
||||
...store.headers,
|
||||
};
|
||||
|
||||
// 查询参数
|
||||
const params = reactive({
|
||||
customer_name: "",
|
||||
customer_account: "",
|
||||
customer_phone: "",
|
||||
customer_email: "",
|
||||
customer_sex: "",
|
||||
|
||||
});
|
||||
const column = [
|
||||
|
||||
{
|
||||
fixed: true,
|
||||
type: 'selection'
|
||||
},
|
||||
{
|
||||
prop: "customer_name",
|
||||
label: '客户昵称',
|
||||
width: '150'
|
||||
},
|
||||
{
|
||||
prop: "customer_account",
|
||||
label: '客户账号',
|
||||
width: '150'
|
||||
},
|
||||
{
|
||||
prop: "customer_phone",
|
||||
label: '客户手机号',
|
||||
width: '150'
|
||||
},
|
||||
{
|
||||
prop: "customer_email",
|
||||
label: '客户邮箱',
|
||||
width: '150'
|
||||
},
|
||||
{
|
||||
prop: "customer_sex",
|
||||
label: '客户性别',
|
||||
width: '150'
|
||||
},
|
||||
{
|
||||
label: '操作',
|
||||
prop: 'chaoz',
|
||||
width: '250',
|
||||
fixed: 'right'
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
const handleCommand = ({ type, row }) => {
|
||||
switch (type) {
|
||||
case "detail":
|
||||
handleDetail(row);
|
||||
break;
|
||||
case 'delete':
|
||||
handleDelete([row]);
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
// 删除数据
|
||||
const handleDelete = data => {
|
||||
ElMessageBox.confirm(`您确定要删除该客户吗?`).then(async () => {
|
||||
const res = await deleteCustomer({
|
||||
customer_guid: data.map(v => v.customer_guid).join()
|
||||
});
|
||||
if (res) {
|
||||
tableRef.value.reload();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// 修改
|
||||
function handleUpdate(row) {
|
||||
EditCustomerDialogVisible.value = true
|
||||
EditCustomerDialogRow.value = row
|
||||
}
|
||||
|
||||
// 详情
|
||||
function handleDetail(row) {
|
||||
DetailCustomerDialogVisible.value = true
|
||||
DetailCustomerDialogRow.value = row
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 字典获取
|
||||
const sex = ref([]);
|
||||
async function get_sex() {
|
||||
await getDictionary({ dictionary_value: 'sex' }).then((res) => {
|
||||
sex.value = res
|
||||
})
|
||||
}
|
||||
get_sex()
|
||||
</script>
|
61
src/service/customer.js
Normal file
61
src/service/customer.js
Normal file
@ -0,0 +1,61 @@
|
||||
import {
|
||||
api,
|
||||
downloadFile,
|
||||
createApiUrl
|
||||
} from '~/utils/axios';
|
||||
|
||||
/**
|
||||
* 获取字典值
|
||||
* @param {Object} data
|
||||
* @return {Promise} api
|
||||
*/
|
||||
export function getDictionary(data) {
|
||||
return api.post('Dictionary.Dictionary/getDictionary', data, {});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取客户列表
|
||||
* @param {Object} data
|
||||
* @return {Promise} api
|
||||
*/
|
||||
export function getCustomerList(data) {
|
||||
return api.post('Customer.Customer/getCustomerList', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除客户
|
||||
* @param {Object} data
|
||||
* @return {Promise} api
|
||||
*/
|
||||
export function deleteCustomer(data) {
|
||||
return api.post('Customer.Customer/deleteCustomer', data, {
|
||||
isTransformResponse: true,
|
||||
isShowSuccessMessage: true,
|
||||
errorMessageText: '删除失败'
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加客户
|
||||
* @param {Object} data
|
||||
* @return {Promise} api
|
||||
*/
|
||||
export function addCustomer(data) {
|
||||
return api.post('Customer.Customer/addCustomer', data, {
|
||||
isTransformResponse: true,
|
||||
isShowSuccessMessage: true,
|
||||
errorMessageText: '添加失败'
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 编辑客户
|
||||
* @param {Object} data
|
||||
* @return {Promise} api
|
||||
*/
|
||||
export function editCustomer(data) {
|
||||
return api.post('Customer.Customer/editCustomer', data, {
|
||||
isTransformResponse: true,
|
||||
isShowSuccessMessage: true,
|
||||
errorMessageText: '编辑失败'
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue
Block a user