bugfix
This commit is contained in:
@ -24,6 +24,7 @@
|
||||
"@wangeditor/editor-for-vue": "^5.1.12",
|
||||
"ant-design-vue": "4.x",
|
||||
"axios": "0.27.2",
|
||||
"docx": "^8.2.3",
|
||||
"echarts": "5.4.0",
|
||||
"element-plus": "2.2.27",
|
||||
"file-saver": "2.0.5",
|
||||
|
@ -1,11 +1,14 @@
|
||||
<template>
|
||||
<a-config-provider :locale="zhCN">
|
||||
<router-view />
|
||||
</a-config-provider>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import useSettingsStore from "@/store/modules/settings";
|
||||
import { handleThemeStyle } from "@/utils/theme";
|
||||
|
||||
import zhCN from "ant-design-vue/es/locale/zh_CN";
|
||||
import { ConfigProvider as AConfigProvider } from "ant-design-vue";
|
||||
onMounted(() => {
|
||||
nextTick(() => {
|
||||
// 初始化主题样式
|
||||
|
@ -13,3 +13,10 @@ export const loadStockList = (params) =>
|
||||
method: "GET",
|
||||
params,
|
||||
});
|
||||
|
||||
export const loadProductSerialList = (params) =>
|
||||
request({
|
||||
url: "/product/serial/list",
|
||||
method: "GET",
|
||||
params,
|
||||
});
|
||||
|
44
src/api/sales/contract.js
Normal file
44
src/api/sales/contract.js
Normal file
@ -0,0 +1,44 @@
|
||||
import request from "@/utils/request";
|
||||
|
||||
// 查询contract列表
|
||||
export function listContract(query) {
|
||||
return request({
|
||||
url: "/sales/contract/list",
|
||||
method: "get",
|
||||
params: query,
|
||||
});
|
||||
}
|
||||
|
||||
// 查询contract详细
|
||||
export function getContract(contractId) {
|
||||
return request({
|
||||
url: "/sales/contract/" + contractId,
|
||||
method: "get",
|
||||
});
|
||||
}
|
||||
|
||||
// 新增contract
|
||||
export function addContract(data) {
|
||||
return request({
|
||||
url: "/sales/contract",
|
||||
method: "post",
|
||||
data: data,
|
||||
});
|
||||
}
|
||||
|
||||
// 修改contract
|
||||
export function updateContract(data) {
|
||||
return request({
|
||||
url: "/sales/contract",
|
||||
method: "put",
|
||||
data: data,
|
||||
});
|
||||
}
|
||||
|
||||
// 删除contract
|
||||
export function delContract(contractId) {
|
||||
return request({
|
||||
url: "/sales/contract/" + contractId,
|
||||
method: "delete",
|
||||
});
|
||||
}
|
44
src/api/sales/person.js
Normal file
44
src/api/sales/person.js
Normal file
@ -0,0 +1,44 @@
|
||||
// 查询person列表
|
||||
import request from "@/utils/request";
|
||||
|
||||
export function listPerson(query) {
|
||||
return request({
|
||||
url: "/sales/person/list",
|
||||
method: "get",
|
||||
params: query,
|
||||
});
|
||||
}
|
||||
|
||||
// 查询person详细
|
||||
export function getPerson(personId) {
|
||||
return request({
|
||||
url: "/sales/person/" + personId,
|
||||
method: "get",
|
||||
});
|
||||
}
|
||||
|
||||
// 新增person
|
||||
export function addPerson(data) {
|
||||
return request({
|
||||
url: "/sales/person",
|
||||
method: "post",
|
||||
data: data,
|
||||
});
|
||||
}
|
||||
|
||||
// 修改person
|
||||
export function updatePerson(data) {
|
||||
return request({
|
||||
url: "/sales/person",
|
||||
method: "put",
|
||||
data: data,
|
||||
});
|
||||
}
|
||||
|
||||
// 删除person
|
||||
export function delPerson(personId) {
|
||||
return request({
|
||||
url: "/sales/person/" + personId,
|
||||
method: "delete",
|
||||
});
|
||||
}
|
44
src/api/sales/team.js
Normal file
44
src/api/sales/team.js
Normal file
@ -0,0 +1,44 @@
|
||||
import request from "@/utils/request";
|
||||
|
||||
// 查询销售团队列表
|
||||
export function listTeam(query) {
|
||||
return request({
|
||||
url: "/sales/team/list",
|
||||
method: "get",
|
||||
params: query,
|
||||
});
|
||||
}
|
||||
|
||||
// 查询销售团队详细
|
||||
export function getTeam(teamId) {
|
||||
return request({
|
||||
url: "/sales/team/" + teamId,
|
||||
method: "get",
|
||||
});
|
||||
}
|
||||
|
||||
// 新增销售团队
|
||||
export function addTeam(data) {
|
||||
return request({
|
||||
url: "/sales/team",
|
||||
method: "post",
|
||||
data: data,
|
||||
});
|
||||
}
|
||||
|
||||
// 修改销售团队
|
||||
export function updateTeam(data) {
|
||||
return request({
|
||||
url: "/sales/team",
|
||||
method: "put",
|
||||
data: data,
|
||||
});
|
||||
}
|
||||
|
||||
// 删除销售团队
|
||||
export function delTeam(teamId) {
|
||||
return request({
|
||||
url: "/sales/team/" + teamId,
|
||||
method: "delete",
|
||||
});
|
||||
}
|
@ -214,3 +214,16 @@ export const excel_flag_dict = [
|
||||
elTagType: "success",
|
||||
},
|
||||
];
|
||||
|
||||
export const sales_person_dict = [
|
||||
{
|
||||
label: "主管",
|
||||
value: "0",
|
||||
elTagType: "primary",
|
||||
},
|
||||
{
|
||||
label: "销售",
|
||||
value: "1",
|
||||
elTagType: "success",
|
||||
},
|
||||
];
|
||||
|
@ -119,7 +119,7 @@
|
||||
{
|
||||
title: '操作',
|
||||
dataIndex: 'operation',
|
||||
width: '260px',
|
||||
width: '320px',
|
||||
},
|
||||
]"
|
||||
@expand="handleExpandTable"
|
||||
@ -128,7 +128,7 @@
|
||||
<template #bodyCell="{ column, text, record }">
|
||||
<template v-if="column.dataIndex === 'pic'">
|
||||
<image-preview
|
||||
v-if="record.specId"
|
||||
v-if="record.modelId"
|
||||
:src="record.pic"
|
||||
:width="50"
|
||||
:height="50"
|
||||
@ -136,15 +136,13 @@
|
||||
</template>
|
||||
<template v-else-if="column.dataIndex === 'operation'">
|
||||
<el-button
|
||||
v-if="!record.specId"
|
||||
v-if="!record.modelId"
|
||||
link
|
||||
type="primary"
|
||||
icon="Plus"
|
||||
@click="handleAdd(record)"
|
||||
v-hasPermi="['product:product:add']"
|
||||
>新增{{
|
||||
record.modelId ? "规格" : record.productId ? "型号" : "规格"
|
||||
}}
|
||||
>新增{{ record.productId && "型号规格" }}
|
||||
</el-button>
|
||||
<el-button
|
||||
link
|
||||
@ -181,7 +179,8 @@
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
v-if="
|
||||
(editMode === 1 && form.specId) || (editMode === 0 && form.modelId)
|
||||
(editMode === 1 && form.modelId) ||
|
||||
(editMode === 0 && form.productId)
|
||||
"
|
||||
label="图片"
|
||||
prop="pic"
|
||||
@ -285,16 +284,7 @@ const handleExpandTable = (expanded, record) => {
|
||||
};
|
||||
|
||||
const loadChildren = (row) => {
|
||||
console.log(tableRef.value);
|
||||
if (row.modelId) {
|
||||
/*加载规格*/
|
||||
listSpec({ modelId: row.modelId }).then(({ rows }) => {
|
||||
row.children = rows.map((el) => ({
|
||||
...el,
|
||||
key: el.specId,
|
||||
}));
|
||||
});
|
||||
} else if (row.productId) {
|
||||
if (row.productId) {
|
||||
/*加载型号*/
|
||||
modelList({
|
||||
productId: row.productId,
|
||||
@ -302,7 +292,6 @@ const loadChildren = (row) => {
|
||||
row.children = rows.map((el) => ({
|
||||
...el,
|
||||
key: el.modelId,
|
||||
children: [],
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
@ -1,8 +1,13 @@
|
||||
<script setup>
|
||||
import { loadStockList, loadStockLogList } from "@/api/product/stock";
|
||||
import { reactive, toRefs } from "vue";
|
||||
import { dayjs } from "element-plus";
|
||||
import {
|
||||
loadProductSerialList,
|
||||
loadStockList,
|
||||
loadStockLogList,
|
||||
} from "@/api/product/stock";
|
||||
import {computed, reactive, ref, toRefs} from "vue";
|
||||
import {dayjs} from "element-plus";
|
||||
import ImagePreview from "@/components/ImagePreview/index.vue";
|
||||
import {Table as ATable} from "ant-design-vue";
|
||||
|
||||
const queryRef = ref();
|
||||
const showSearch = ref(false);
|
||||
@ -14,19 +19,74 @@ const data = reactive({
|
||||
},
|
||||
});
|
||||
const total = ref(0);
|
||||
const { queryParams } = toRefs(data);
|
||||
const {queryParams} = toRefs(data);
|
||||
const expandedRowKeys = ref([]);
|
||||
const columns = [
|
||||
{
|
||||
title: "产品",
|
||||
dataIndex: "productName",
|
||||
key: "productName",
|
||||
},
|
||||
{
|
||||
title: "型号规格",
|
||||
dataIndex: "modelName",
|
||||
key: "modelName",
|
||||
},
|
||||
{
|
||||
title: "库存",
|
||||
dataIndex: "stock",
|
||||
key: "stock",
|
||||
},
|
||||
{
|
||||
title: "数量",
|
||||
dataIndex: "total",
|
||||
key: "total",
|
||||
},
|
||||
{
|
||||
title: "图片",
|
||||
dataIndex: "provePic",
|
||||
key: "provePic",
|
||||
},
|
||||
{
|
||||
title: "日期",
|
||||
dataIndex: "date",
|
||||
key: "date",
|
||||
},
|
||||
];
|
||||
|
||||
const columnsFilter = computed(() => {
|
||||
if (queryParams.value.type === 0) {
|
||||
return columns.filter(
|
||||
({dataIndex}) => !["total", "provePic", "date"].includes(dataIndex)
|
||||
);
|
||||
} else if (queryParams.value.type === 1) {
|
||||
return columns.filter(({dataIndex}) => !["stock"].includes(dataIndex));
|
||||
} else if (queryParams.value.type === 2) {
|
||||
return columns.filter(({dataIndex}) => !["stock"].includes(dataIndex));
|
||||
} else {
|
||||
return columns;
|
||||
}
|
||||
});
|
||||
const stockLogList = ref([]);
|
||||
const getStockList = () => {
|
||||
expandedRowKeys.value = [];
|
||||
if (queryParams.value.type === 0) {
|
||||
loadStockList(queryParams.value).then((resp) => {
|
||||
total.value = resp.total;
|
||||
stockLogList.value = resp.rows;
|
||||
stockLogList.value = resp.rows.map((el) => ({
|
||||
...el,
|
||||
key: el.modelId,
|
||||
children: [],
|
||||
}));
|
||||
});
|
||||
} else {
|
||||
loadStockLogList(queryParams.value).then((resp) => {
|
||||
total.value = resp.total;
|
||||
stockLogList.value = resp.rows;
|
||||
stockLogList.value = resp.rows.map((el) => ({
|
||||
...el,
|
||||
key: el.logId,
|
||||
children: [],
|
||||
}));
|
||||
});
|
||||
}
|
||||
};
|
||||
@ -42,6 +102,27 @@ function resetQuery() {
|
||||
handleQuery();
|
||||
}
|
||||
|
||||
const loadChildren = (row) => {
|
||||
if (queryParams.value.type === 0) {
|
||||
loadProductSerialList({modelId: row.modelId, type: '1'}).then((resp) => {
|
||||
row.series = resp.data.map((el) => ({
|
||||
...el,
|
||||
key: el.serialId,
|
||||
}));
|
||||
});
|
||||
} else if (queryParams.value.type === 1 || queryParams.value.type === 2) {
|
||||
loadProductSerialList({logId: row.logId}).then((resp) => {
|
||||
row.series = resp.data.map((el) => ({
|
||||
...el,
|
||||
key: el.serialId,
|
||||
}));
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const handleExpandTable = (expanded, record) => {
|
||||
expanded && loadChildren(record);
|
||||
};
|
||||
getStockList();
|
||||
</script>
|
||||
|
||||
@ -56,15 +137,15 @@ getStockList();
|
||||
>
|
||||
<el-form-item label="类型" prop="type">
|
||||
<el-select v-model="queryParams.type">
|
||||
<el-option label="库存" :value="0" />
|
||||
<el-option label="入库" :value="1" />
|
||||
<el-option label="出库" :value="2" />
|
||||
<el-option label="库存" :value="0"/>
|
||||
<el-option label="入库" :value="1"/>
|
||||
<el-option label="出库" :value="2"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="handleQuery"
|
||||
>搜索</el-button
|
||||
>
|
||||
>搜索
|
||||
</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
@ -81,38 +162,69 @@ getStockList();
|
||||
@queryTable="getStockList"
|
||||
></right-toolbar>
|
||||
</el-row>
|
||||
<el-table :data="stockLogList">
|
||||
<el-table-column align="center" label="产品" prop="productName" />
|
||||
<el-table-column align="center" label="型号" prop="modelName" />
|
||||
<el-table-column align="center" label="规格" prop="specName" />
|
||||
<el-table-column
|
||||
align="center"
|
||||
v-if="queryParams.type === 0"
|
||||
label="库存"
|
||||
prop="stock"
|
||||
/>
|
||||
<el-table-column align="center" v-else label="数量" prop="total" />
|
||||
<el-table-column
|
||||
v-if="queryParams.type > 0"
|
||||
align="center"
|
||||
label="图片"
|
||||
prop="date"
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button icon="plus" type="primary">添加入库</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<a-table
|
||||
v-model:expanded-row-keys="expandedRowKeys"
|
||||
:pagination="false"
|
||||
:columns="columnsFilter"
|
||||
:data-source="stockLogList"
|
||||
@expand="handleExpandTable"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<image-preview :width="50" :height="50" :src="row.provePic" />
|
||||
<template #expandedRowRender="{ record }">
|
||||
<a-table
|
||||
:row-selection="{}"
|
||||
:pagination="false"
|
||||
:columns="[
|
||||
{
|
||||
title: '产品编号',
|
||||
dataIndex: 'serialNumber',
|
||||
key: 'serialNumber',
|
||||
},
|
||||
]"
|
||||
:data-source="record.series"
|
||||
></a-table>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="queryParams.type > 0"
|
||||
align="center"
|
||||
label="日期"
|
||||
prop="date"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
{{ row.date ? dayjs(row.date).format("YYYY-MM-DD") : "-" }}
|
||||
<template #bodyCell="{ column, text, record }">
|
||||
<template v-if="column.dataIndex === 'provePic'">
|
||||
<image-preview :width="50" :height="50" :src="record.provePic"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</template>
|
||||
</a-table>
|
||||
<!-- <el-table :data="stockLogList">-->
|
||||
<!-- <el-table-column align="center" label="产品" prop="productName" />-->
|
||||
<!-- <el-table-column align="center" label="型号规格" prop="modelName" />-->
|
||||
<!-- <el-table-column-->
|
||||
<!-- align="center"-->
|
||||
<!-- v-if="queryParams.type === 0"-->
|
||||
<!-- label="库存"-->
|
||||
<!-- prop="stock"-->
|
||||
<!-- />-->
|
||||
<!-- <el-table-column align="center" v-else label="数量" prop="total" />-->
|
||||
<!-- <el-table-column-->
|
||||
<!-- v-if="queryParams.type > 0"-->
|
||||
<!-- align="center"-->
|
||||
<!-- label="图片"-->
|
||||
<!-- prop="date"-->
|
||||
<!-- >-->
|
||||
<!-- <template #default="{ row }">-->
|
||||
<!-- <image-preview :width="50" :height="50" :src="row.provePic" />-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<!-- <el-table-column-->
|
||||
<!-- v-if="queryParams.type > 0"-->
|
||||
<!-- align="center"-->
|
||||
<!-- label="日期"-->
|
||||
<!-- prop="date"-->
|
||||
<!-- >-->
|
||||
<!-- <template #default="{ row }">-->
|
||||
<!-- {{ row.date ? dayjs(row.date).format("YYYY-MM-DD") : "-" }}-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<!-- </el-table>-->
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
|
347
src/views/sales/contract/index.vue
Normal file
347
src/views/sales/contract/index.vue
Normal file
@ -0,0 +1,347 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form
|
||||
:model="queryParams"
|
||||
ref="queryRef"
|
||||
:inline="true"
|
||||
v-show="showSearch"
|
||||
label-width="68px"
|
||||
>
|
||||
<el-form-item label="客户" prop="customer">
|
||||
<el-input
|
||||
v-model="queryParams.customer"
|
||||
placeholder="请输入客户"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="税点" prop="taxPoint">
|
||||
<el-input
|
||||
v-model="queryParams.taxPoint"
|
||||
placeholder="请输入税点"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="时间" prop="date">
|
||||
<el-date-picker
|
||||
clearable
|
||||
v-model="queryParams.date"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
placeholder="请选择时间"
|
||||
>
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="handleQuery"
|
||||
>搜索
|
||||
</el-button
|
||||
>
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="Plus"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['sales:contract:add']"
|
||||
>新增
|
||||
</el-button
|
||||
>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="Edit"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['sales:contract:edit']"
|
||||
>修改
|
||||
</el-button
|
||||
>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="Delete"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['sales:contract:remove']"
|
||||
>删除
|
||||
</el-button
|
||||
>
|
||||
</el-col>
|
||||
<right-toolbar
|
||||
v-model:showSearch="showSearch"
|
||||
@queryTable="getList"
|
||||
></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="contractList"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<el-table-column type="selection" width="55" align="center"/>
|
||||
<el-table-column label="客户" align="center" prop="customer"/>
|
||||
<el-table-column label="总额" align="center" prop="amount"/>
|
||||
<el-table-column label="税点" align="center" prop="taxPoint"/>
|
||||
<el-table-column label="地点" align="center" prop="location"/>
|
||||
<el-table-column label="时间" align="center" prop="date" width="180">
|
||||
<template #default="{ row }">
|
||||
<span>{{ row.date }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="创建时间"
|
||||
align="center"
|
||||
prop="createTime"
|
||||
width="180"
|
||||
>
|
||||
<template #default="{row}">
|
||||
<span>{{ row.createTime }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
align="center"
|
||||
class-name="small-padding fixed-width"
|
||||
>
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
icon="Edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['sales:contract:edit']"
|
||||
>修改
|
||||
</el-button
|
||||
>
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
icon="Delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['sales:contract:remove']"
|
||||
>删除
|
||||
</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNum"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改contract对话框 -->
|
||||
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
||||
<el-form
|
||||
ref="contractRef"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
label-width="80px"
|
||||
>
|
||||
<el-form-item label="地点" prop="location">
|
||||
<el-input v-model="form.location" placeholder="请输入地点"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="客户" prop="customer">
|
||||
<el-input v-model="form.customer" placeholder="请输入客户"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="总额" prop="amount">
|
||||
<el-input v-model="form.amount" placeholder="请输入总额"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="税点" prop="taxPoint">
|
||||
<el-input v-model="form.taxPoint" placeholder="请输入税点"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="时间" prop="date">
|
||||
<el-date-picker
|
||||
clearable
|
||||
v-model="form.date"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
placeholder="请选择时间"
|
||||
>
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="Contract">
|
||||
import {
|
||||
listContract,
|
||||
getContract,
|
||||
delContract,
|
||||
addContract,
|
||||
updateContract,
|
||||
} from "@/api/sales/contract";
|
||||
|
||||
const {proxy} = getCurrentInstance();
|
||||
|
||||
const contractList = ref([]);
|
||||
const open = ref(false);
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const ids = ref([]);
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
const title = ref("");
|
||||
|
||||
const data = reactive({
|
||||
form: {},
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
contractId: null,
|
||||
location: null,
|
||||
customer: null,
|
||||
amount: null,
|
||||
taxPoint: null,
|
||||
date: null,
|
||||
createDate: null,
|
||||
createUser: null,
|
||||
},
|
||||
rules: {
|
||||
contractId: [{required: true, message: "不能为空", trigger: "blur"}],
|
||||
location: [{required: true, message: "地点不能为空", trigger: "blur"}],
|
||||
customer: [{required: true, message: "客户不能为空", trigger: "blur"}],
|
||||
amount: [{required: true, message: "总额不能为空", trigger: "blur"}],
|
||||
taxPoint: [{required: true, message: "税点不能为空", trigger: "blur"}],
|
||||
date: [{required: true, message: "时间不能为空", trigger: "blur"}],
|
||||
createDate: [
|
||||
{required: true, message: "创建时间不能为空", trigger: "blur"},
|
||||
],
|
||||
createUser: [
|
||||
{required: true, message: "创建人不能为空", trigger: "blur"},
|
||||
],
|
||||
},
|
||||
});
|
||||
|
||||
const {queryParams, form, rules} = toRefs(data);
|
||||
|
||||
/** 查询contract列表 */
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
listContract(queryParams.value).then((response) => {
|
||||
contractList.value = response.rows;
|
||||
total.value = response.total;
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
// 取消按钮
|
||||
function cancel() {
|
||||
open.value = false;
|
||||
reset();
|
||||
}
|
||||
|
||||
// 表单重置
|
||||
function reset() {
|
||||
form.value = {
|
||||
contractId: null,
|
||||
location: null,
|
||||
customer: null,
|
||||
amount: null,
|
||||
taxPoint: null,
|
||||
date: null,
|
||||
createDate: null,
|
||||
};
|
||||
proxy.resetForm("contractRef");
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef");
|
||||
handleQuery();
|
||||
}
|
||||
|
||||
// 多选框选中数据
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map((item) => item.contractId);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
}
|
||||
|
||||
/** 新增按钮操作 */
|
||||
function handleAdd() {
|
||||
reset();
|
||||
open.value = true;
|
||||
title.value = "添加销售合同";
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
function handleUpdate(row) {
|
||||
reset();
|
||||
const _contractId = row.contractId || ids.value;
|
||||
getContract(_contractId).then((response) => {
|
||||
form.value = response.data;
|
||||
open.value = true;
|
||||
title.value = "修改销售合同";
|
||||
});
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
function submitForm() {
|
||||
proxy.$refs["contractRef"].validate((valid) => {
|
||||
if (valid) {
|
||||
if (form.value.contractId != null) {
|
||||
updateContract(form.value).then((response) => {
|
||||
proxy.$modal.msgSuccess("修改成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
} else {
|
||||
addContract(form.value).then((response) => {
|
||||
proxy.$modal.msgSuccess("新增成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const _contractIds = row.contractId || ids.value;
|
||||
proxy.$modal
|
||||
.confirm('是否确认删除contract编号为"' + _contractIds + '"的数据项?')
|
||||
.then(function () {
|
||||
return delContract(_contractIds);
|
||||
})
|
||||
.then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("删除成功");
|
||||
})
|
||||
.catch(() => {
|
||||
});
|
||||
}
|
||||
|
||||
getList();
|
||||
</script>
|
287
src/views/sales/team/index.vue
Normal file
287
src/views/sales/team/index.vue
Normal file
@ -0,0 +1,287 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form
|
||||
:model="queryParams"
|
||||
ref="queryRef"
|
||||
:inline="true"
|
||||
v-show="showSearch"
|
||||
label-width="120px"
|
||||
>
|
||||
<el-form-item label="销售团队名称" prop="name">
|
||||
<el-input
|
||||
v-model="queryParams.name"
|
||||
placeholder="请输入销售团队名称"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="handleQuery"
|
||||
>搜索</el-button
|
||||
>
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd"
|
||||
>新增
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="Edit"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
>修改
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="Delete"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['sales:team:remove']"
|
||||
>删除
|
||||
</el-button>
|
||||
</el-col>
|
||||
<right-toolbar
|
||||
v-model:showSearch="showSearch"
|
||||
@queryTable="getList"
|
||||
></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<a-table
|
||||
:pagination="false"
|
||||
:columns="[
|
||||
{
|
||||
title: '名称',
|
||||
dataIndex: 'name',
|
||||
key: 'name',
|
||||
},
|
||||
{
|
||||
title: '角色',
|
||||
dataIndex: 'role',
|
||||
key: 'role',
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
dataIndex: 'operation',
|
||||
width: '320px',
|
||||
},
|
||||
]"
|
||||
@expand="handleExpandTable"
|
||||
:data-source="teamList"
|
||||
>
|
||||
<template #bodyCell="{ column, text, record }">
|
||||
<template v-if="column.dataIndex === 'role'">
|
||||
<dict-tag :options="sales_person_dict" :value="record.role" />
|
||||
</template>
|
||||
<template
|
||||
v-else-if="column.dataIndex === 'operation' && !record.personId"
|
||||
>
|
||||
<el-button link type="primary" icon="plus">添加销售</el-button>
|
||||
<el-button link type="primary" icon="plus">添加主管</el-button>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNum"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改销售团队对话框 -->
|
||||
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
||||
<el-form ref="teamRef" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="团队名称" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入团队名称" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="Team">
|
||||
import {
|
||||
listTeam,
|
||||
getTeam,
|
||||
delTeam,
|
||||
addTeam,
|
||||
updateTeam,
|
||||
} from "@/api/sales/team";
|
||||
import { getCurrentInstance, reactive, ref, toRefs } from "vue";
|
||||
import { Table as ATable } from "ant-design-vue";
|
||||
import { modelList } from "@/api/product/product";
|
||||
import { listPerson } from "@/api/sales/person";
|
||||
import DictTag from "@/components/DictTag/index.vue";
|
||||
import { sales_person_dict } from "@/constant/dict";
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
|
||||
const teamList = ref([]);
|
||||
const open = ref(false);
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const ids = ref([]);
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
const title = ref("");
|
||||
|
||||
const data = reactive({
|
||||
form: {},
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
teamId: null,
|
||||
name: null,
|
||||
},
|
||||
rules: {
|
||||
teamId: [
|
||||
{ required: true, message: "销售团队id不能为空", trigger: "blur" },
|
||||
],
|
||||
name: [
|
||||
{ required: true, message: "销售团队名称不能为空", trigger: "blur" },
|
||||
],
|
||||
},
|
||||
});
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
|
||||
/** 查询销售团队列表 */
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
listTeam(queryParams.value).then((response) => {
|
||||
teamList.value = response.rows.map((el) => ({
|
||||
...el,
|
||||
key: el.teamId,
|
||||
children: [],
|
||||
}));
|
||||
total.value = response.total;
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
const loadChildren = (row) => {
|
||||
if (row.teamId) {
|
||||
/*加载型号*/
|
||||
listPerson({
|
||||
teamId: row.teamId,
|
||||
}).then(({ rows }) => {
|
||||
row.children = rows.map((el) => ({
|
||||
...el,
|
||||
key: el.personId,
|
||||
}));
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const handleExpandTable = (expanded, record) => {
|
||||
expanded && loadChildren(record);
|
||||
};
|
||||
|
||||
// 取消按钮
|
||||
function cancel() {
|
||||
open.value = false;
|
||||
reset();
|
||||
}
|
||||
|
||||
// 表单重置
|
||||
function reset() {
|
||||
form.value = {
|
||||
teamId: null,
|
||||
name: null,
|
||||
};
|
||||
proxy.resetForm("teamRef");
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef");
|
||||
handleQuery();
|
||||
}
|
||||
|
||||
// 多选框选中数据
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map((item) => item.teamId);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
}
|
||||
|
||||
/** 新增按钮操作 */
|
||||
function handleAdd() {
|
||||
reset();
|
||||
open.value = true;
|
||||
title.value = "添加销售团队";
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
function handleUpdate(row) {
|
||||
reset();
|
||||
const _teamId = row.teamId || ids.value;
|
||||
getTeam(_teamId).then((response) => {
|
||||
form.value = response.data;
|
||||
open.value = true;
|
||||
title.value = "修改销售团队";
|
||||
});
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
function submitForm() {
|
||||
proxy.$refs["teamRef"].validate((valid) => {
|
||||
if (valid) {
|
||||
if (form.value.teamId != null) {
|
||||
updateTeam(form.value).then((response) => {
|
||||
proxy.$modal.msgSuccess("修改成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
} else {
|
||||
addTeam(form.value).then((response) => {
|
||||
proxy.$modal.msgSuccess("新增成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const _teamIds = row.teamId || ids.value;
|
||||
proxy.$modal
|
||||
.confirm('是否确认删除销售团队编号为"' + _teamIds + '"的数据项?')
|
||||
.then(function () {
|
||||
return delTeam(_teamIds);
|
||||
})
|
||||
.then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("删除成功");
|
||||
})
|
||||
.catch(() => {});
|
||||
}
|
||||
|
||||
getList();
|
||||
</script>
|
@ -25,13 +25,12 @@ export default defineConfig(({ mode, command }) => {
|
||||
},
|
||||
// vite 相关配置
|
||||
server: {
|
||||
port: 80,
|
||||
port: 5173,
|
||||
host: true,
|
||||
open: false,
|
||||
proxy: {
|
||||
// https://cn.vitejs.dev/config/#server-proxy
|
||||
"/dev-api": {
|
||||
// target: "http://192.168.0.201:8080",
|
||||
target: "http://127.0.0.1:8080",
|
||||
// target: "https://nine.motse.com.cn/api",
|
||||
changeOrigin: true,
|
||||
|
Reference in New Issue
Block a user