feat: 调整

This commit is contained in:
Czw996 2022-03-13 13:45:50 +08:00
parent 4f41dea39a
commit 0e2fbb4e1b
6 changed files with 1 additions and 320 deletions

View file

@ -1,64 +0,0 @@
<template>
<div>
<div style="float: right;">
<a-dropdown :trigger="['click']">
<span class="trigger">
{{warehouse || '全部仓库'}}
<a-icon type="down" />
</span>
<a-menu slot="overlay">
<template v-for="(item,index) in items" >
<a-menu-item :key="index" @click="itemClick(item)">
<span>{{item.name}}</span>
</a-menu-item>
</template>
</a-menu>
</a-dropdown>
</div>
</div>
</template>
<script>
import { warehouseOption } from '@/api/option';
export default {
name: 'WarehouseHeadbar',
data() {
return {
items:[],
warehouse:'',
};
},
created(){
warehouseOption(this.searchForm).then(data => {
this.items = data.results;
}).finally(() => {
});
},
methods:{
itemClick(item){
this.setWarehouse(item);
},
setWarehouse(item){
this.warehouse = item.name;
window.localStorage.setItem('warehouse',item.id);
this.$router.go(0);
},
}
}
</script>
<style scoped>
.trigger {
font-size: 18px;
line-height: 64px;
padding: 0 24px;
cursor: pointer;
transition: color 0.3s;
}
.trigger:hover {
color: #1890ff;
}
</style>

View file

@ -1,6 +1,6 @@
<template>
<div style="height: 100vh;">
<div class="logo" @click="$router.push('/inventory_report')" style="width: 256px">
<div class="logo" @click="$router.push('/')" style="width: 256px">
<img :src="logo" width="36" style="margin-top: -6px; margin-left: 8px;" />
<span v-if="!collapsed" style="color: #1890ff; margin-left: 6px;">海鸥云</span>
<span v-if="!collapsed" style="color: #1890ff; margin-left: 6px; font-size: 18px;">ERP</span>

View file

@ -37,7 +37,6 @@ export default [
{ key: '/sale/sale_record', name: '销售记录' },
{ key: '/sale/sale_return_create', name: '销售退货' },
{ key: '/sale/sale_return_record', name: '退货记录' },
{ key: '/sale/sale_task', name: '销售任务' },
]
},
{

View file

@ -34,10 +34,5 @@ export default {
meta: { title: '退货记录详情', permission: 'sale_return_detail' },
component: () => import('@/views/sale/saleReturnDetail/index'),
},
{
path: 'sale_task',
meta: { title: '销售任务', permission: 'sale_task' },
component: () => import('@/views/sale/saleTask/index'),
},
],
}

View file

@ -1,99 +0,0 @@
<template>
<div>
<a-modal v-model="visible" :confirmLoading="loading" :maskClosable="false" @cancel="cancel" @ok="confirm">
<div slot="title">{{form.id ? '编辑销售任务' : '新增销售任务' }}</div>
<div>
<a-form-model ref="form" :model="form" :rules="rules" :label-col="{ span: 4 }" :wrapper-col="{ span: 16 }">
<a-form-model-item prop="name" label="任务商品">
{{ form.name }}
<a-button type="primary" icon="plus" @click="materialsSelectModalVisible = true" />
</a-form-model-item>
<a-form-model-item prop="number" label="商品编号">
{{ form.number }}
</a-form-model-item>
<a-form-model-item prop="warehouse" label="仓库">
<a-select v-model="form.warehouse" style="width: 100%">
<a-select-option v-for="item in warehouseItems" :key="item.id" :value="item.id">
{{ item.name }}
</a-select-option>
</a-select>
</a-form-model-item>
<a-form-model-item prop="salesperson" label="销售员">
<a-select v-model="form.salesperson" style="width: 100%">
<a-select-option v-for="item in clientsItems" :key="item.id" :value="item.id">
{{ item.name }}
</a-select-option>
</a-select>
</a-form-model-item>
<a-form-model-item prop="total_quantity" label="任务总量">
<a-input-number v-model="form.total_quantity" style="width: 100%;" />
</a-form-model-item>
<a-form-model-item prop="start_time" label="开始时间">
<a-date-picker v-model="form.start_time" valueFormat="YYYY-MM-DD" style="width: 100%" />
</a-form-model-item>
<a-form-model-item prop="end_time" label="结算时间">
<a-date-picker v-model="form.end_time" valueFormat="YYYY-MM-DD" style="width: 100%" />
</a-form-model-item>
</a-form-model>
</div>
<goods-select-modal v-model="materialsSelectModalVisible" :warehouse="form.warehouse" @select="onSelectMaterial"></goods-select-modal>
</a-modal>
</div>
</template>
<script>
import { saleTaskCreate } from '@/api/sale'
export default {
name: 'FormModal',
props: ['visible', 'form', 'warehouseItems', 'clientsItems'],
model: { prop: 'visible', event: 'cancel' },
components: {
GoodsSelectModal: () => import('@/components/GoodsSelectModal/index'),
},
data() {
return {
goods: null,
materialsSelectModalVisible: false,
rules: {
name: [{ required: true, message: '请选择任务商品', trigger: 'change' }],
warehouse: [{ required: true, message: '请选择仓库', trigger: 'change' }],
salesperson: [{ required: true, message: '请选择销售员', trigger: 'change' }],
total_quantity: [{ required: true, message: '请输入任务总量', trigger: 'change' }],
start_time: [{ required: true, message: '请选择开始时间', trigger: 'change' }],
end_time: [{ required: true, message: '请选择结束时间', trigger: 'change' }]
},
loading: false,
};
},
methods: {
confirm() {
this.$refs.form.validate(valid => {
if (valid) {
this.loading = true;
let func = this.form.id ? saleTaskCreate : saleTaskCreate;
func({...this.form, goods: this.goods }).then(data => {
this.$message.success(this.form.id ? '修改成功' : '新增成功');
this.$emit(this.form.id ? 'update' : 'create', data);
this.cancel();
}).finally(() => {
this.loading = false;
});
}
});
},
cancel() {
this.$emit('cancel', false);
this.$refs.form.resetFields();
},
onSelectMaterial(item) {
this.goods = item.id;
this.$set(this.form,'name',item.name);
this.$set(this.form,'number',item.number);
},
},
}
</script>
<style scoped>
</style>

View file

@ -1,150 +0,0 @@
<template>
<div>
<a-card title="销售任务">
<a-row gutter="16">
<a-col :span="24" :md="6" :xl="4" style="max-width: 256px; margin-bottom: 12px;">
<a-input-search v-model="searchForm.search" placeholder="名称, 备注" allowClear @search="search" />
</a-col>
<div style="margin-bottom: 12px; float: right;">
<a-button type="primary" icon="plus" style="margin: 0 8px;" @click="openFormModal(form)">新增任务</a-button>
</div>
</a-row>
<a-row style="margin-top: 12px;">
<a-table size="small" :columns="columns" :dataSource="items" rowKey="id" :loading="loading" :pagination="pagination"
@change="tableChange">
<div slot="is_active" slot-scope="value">
<a-tag :color="value ? 'green' : 'red'">{{value ? '激活' : '冻结'}}</a-tag>
</div>
<div slot="action" slot-scope="value, item">
<a-button-group>
<a-popconfirm title="确定删除吗" @confirm="destroy(item.id)">
<a-button type="danger" icon="delete" size="small">删除</a-button>
</a-popconfirm>
</a-button-group>
</div>
</a-table>
</a-row>
</a-card>
<form-modal v-model="visible" :form="targetItem" :warehouseItems="warehouseItems" :clientsItems="clientsItems" @create="create" @update="update" />
</div>
</template>
<script>
import { clientsOption, warehousesOption } from '@/api/option'
import { saleTaskList, saleTaskDestroy } from '@/api/sale'
export default {
name: 'Warehouse',
components: {
FormModal: () => import('./FormModal.vue'),
},
data() {
return {
columns: [
{
title: '序号',
dataIndex: 'index',
key: 'index',
customRender: (value, item, index) => {
return index + 1
},
},
{
title: '任务商品',
dataIndex: 'goods_name',
sorter: true,
},
{
title: '商品编号',
dataIndex: 'goods_number'
},
{
title: '仓库',
dataIndex: 'warehouse_name'
},
{
title: '销售员',
dataIndex: 'salesperson_name'
},
{
title: '任务总量',
dataIndex: 'total_quantity'
},
{
title: '开始时间',
dataIndex: 'start_time'
},
{
title: '结束',
dataIndex: 'end_time'
},
{
title: '操作',
dataIndex: 'action',
scopedSlots: { customRender: 'action' },
width: '156px'
},
],
searchForm: { search: '', page: 1 },
pagination: { current: 1, total: 0, pageSize: 15 },
loading: false,
items: [],
warehouseItems: [],
clientsItems: [],
visible: false,
targetItem: {},
form: {},
importLoading: false,
};
},
computed: {
},
methods: {
initialize() {
this.list();
},
list() {
this.loading = true;
saleTaskList(this.searchForm).then(data => {
this.pagination.total = data.count;
this.items = data.results;
}).finally(() => {
this.loading = false;
});
},
create(item) {
this.items.splice(0, 0, item);
},
update(item) {
this.items.splice(this.items.findIndex(i => i.id == item.id), 1, item);
},
search() {
this.searchForm.page = 1;
this.pagination.current = 1;
this.list();
},
openFormModal(item) {
this.targetItem = { ...item };
warehousesOption({ page_size: 999999, is_active: true }).then(data => {
this.warehouseItems = data.results;
});
clientsOption({ page_size: 999999, is_active: true }).then(data => {
this.clientsItems = data.results;
});
this.visible = true;
},
destroy(id) {
saleTaskDestroy({ id }).then(() => {
this.items.splice(this.items.findIndex(item => item.id == id), 1);
this.$message.success('删除成功');
});
},
},
mounted() {
this.initialize();
},
}
</script>