增加客户维护
This commit is contained in:
parent
deb73d972c
commit
febd3ae210
@ -161,6 +161,36 @@ export default {
|
||||
},
|
||||
}
|
||||
},
|
||||
customer:{
|
||||
add: {
|
||||
url: `${config.API_URL}/customer.add`,
|
||||
name: "客户新增配置",
|
||||
post: async function (data) {
|
||||
return await http.post(this.url, data);
|
||||
},
|
||||
},
|
||||
delete: {
|
||||
url: `${config.API_URL}/customer.delete`,
|
||||
name: "客户删除",
|
||||
post: async function (data) {
|
||||
return await http.post(this.url, data);
|
||||
},
|
||||
},
|
||||
status:{
|
||||
url: `${config.API_URL}/customer.status`,
|
||||
name: "客户状态",
|
||||
post: async function (data) {
|
||||
return await http.post(this.url, data);
|
||||
},
|
||||
},
|
||||
list: {
|
||||
url: `${config.API_URL}/customer.list`,
|
||||
name: "客户列表",
|
||||
get: async function (data) {
|
||||
return await http.post(this.url, data);
|
||||
},
|
||||
},
|
||||
},
|
||||
bom:{
|
||||
list:{
|
||||
url: `${config.API_URL}/bom.list`,
|
||||
|
||||
@ -3,8 +3,8 @@ import config from "@/config"
|
||||
//系统路由
|
||||
const routes = [
|
||||
{
|
||||
name: "layout",
|
||||
path: "/",
|
||||
name: "layout",
|
||||
component: () => import(/* webpackChunkName: "layout" */ '@/layout'),
|
||||
redirect: config.DASHBOARD_URL || '/dashboard',
|
||||
children: []
|
||||
|
||||
@ -47,6 +47,7 @@ export default {
|
||||
interface: defineAsyncComponent(() => import('./setup/interface')),
|
||||
cost: defineAsyncComponent(() => import('./setup/cost')),
|
||||
material: defineAsyncComponent(() => import('./setup/material')),
|
||||
company: defineAsyncComponent(() => import('./setup/company')),
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@ -85,6 +86,12 @@ export default {
|
||||
component: "regularTime",
|
||||
actions:'crontabAdd'
|
||||
},
|
||||
{
|
||||
icon: "sc-icon-RegularTime",
|
||||
title: "客户资料维护",
|
||||
component: "company",
|
||||
actions:'crontabAdd'
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
132
src/views/setting/advanced/setup/company.vue
Normal file
132
src/views/setting/advanced/setup/company.vue
Normal file
@ -0,0 +1,132 @@
|
||||
<template>
|
||||
<el-container class="mainBox">
|
||||
<el-main class="nopadding">
|
||||
<div class="searchMain">
|
||||
<scSearch ref="scSearch" :searchList="searchList" @fetchSelectData="getSelectData"></scSearch>
|
||||
|
||||
<div class="searchItem searchBtn">
|
||||
<el-button :size="size" type="primary" @click="save">保存配置</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<scTable ref="table" :apiObj="list.apiObj" :column="list.column" stripe :size="size" highlightCurrentRow :hideDo="true" >
|
||||
<sc-table-column label="序号" align="center" type="index"></sc-table-column>
|
||||
<el-table-column width="380" label="客户名称" prop="customer_name">
|
||||
<template #default="scope">
|
||||
<div v-if="scope.row.$edit_show">
|
||||
<el-input type="text" :size="size" v-model="scope.row.customer_name" @change="customerInput(scope.row)" @mouseout="customerOut(scope.row)"></el-input>
|
||||
</div>
|
||||
<span class="customerView" @click="customerEdit(scope.row)" v-else>{{scope.row.customer_name}} <el-icon class="iconBtn"><sc-icon-edit/></el-icon></span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column width="100" label="状态" prop="active_status">
|
||||
<template #default="scope">
|
||||
<el-switch :size="size" v-model="scope.row.active_status" @change="changeSwitch($event, scope.row)" :loading="scope.row.$switch_status" :active-value="true" :inactive-value="false"></el-switch>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" fixed="right" align="center" width="160">
|
||||
<template #default="scope">
|
||||
<el-dropdown>
|
||||
<el-button class="noBorderBtn" icon="el-icon-more" :size="size"></el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item @click="table_del(scope.row, 'delete')" icon="sc-icon-Delete">删除配置</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</scTable>
|
||||
</el-main>
|
||||
</el-container>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "",
|
||||
data(){
|
||||
return{
|
||||
size:'small',
|
||||
list:{
|
||||
apiObj: this.$API.setup.customer.list,
|
||||
column:[]
|
||||
},
|
||||
params: {},
|
||||
searchList:[
|
||||
{customer_name:'客户名称',type:'text',code:'customer_name', placeholder:"请输入客户名称",show:true},
|
||||
],
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
||||
},
|
||||
methods:{
|
||||
getSelectData(item){
|
||||
let {params} = item;
|
||||
this.params = params;
|
||||
},
|
||||
// 状态
|
||||
changeSwitch(val, row) {
|
||||
row.$switch_yx = true;
|
||||
setTimeout(async () => {
|
||||
let params = {
|
||||
id: row.id,
|
||||
active_status: row.active_status,
|
||||
};
|
||||
const res = await this.$API.setup.customer.status.post(params);
|
||||
if(res.code !=200){
|
||||
row.active_status = !row.active_status;
|
||||
}
|
||||
delete row.$switch_status;
|
||||
delete row.$switch_yx;
|
||||
}, 500);
|
||||
},
|
||||
// 编辑名称
|
||||
customerEdit(row){
|
||||
row.$edit_show = !row.$edit_show;
|
||||
},
|
||||
customerOut(row){
|
||||
setTimeout(()=>{
|
||||
row.$edit_show = false;
|
||||
},1000)
|
||||
},
|
||||
async customerInput(row) {
|
||||
let params = {
|
||||
id:row.id,
|
||||
customer_name:row.customer_name
|
||||
}
|
||||
const res = await this.$API.setup.customer.add.post(params);
|
||||
if(res.code == 200){
|
||||
this.$refs.table.refresh();
|
||||
}
|
||||
},
|
||||
async save() {
|
||||
const res = await this.$API.setup.customer.add.post(this.params);
|
||||
if(res.code == 200){
|
||||
this.$refs.table.refresh();
|
||||
}
|
||||
},
|
||||
async table_del(row){
|
||||
this.$confirm(`确定删除 ${row.customer_name} 吗?`, '提示', {
|
||||
type: 'warning'
|
||||
}).then(async () => {
|
||||
const reqData = {id: row.id};
|
||||
const res = await this.$API.setup.customer.delete.post(reqData);
|
||||
if(res.code == 200){
|
||||
this.$refs.table.refresh();
|
||||
this.$message.success("删除成功")
|
||||
}
|
||||
}).catch(()=>{})
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.customerView{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.iconBtn{
|
||||
margin-left: 6px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@ -1,15 +1,5 @@
|
||||
<template>
|
||||
<el-container class="mainBox">
|
||||
<!-- <el-aside width="200px" v-loading="showGroupLoading">-->
|
||||
<!-- <el-container>-->
|
||||
<!-- <el-header>-->
|
||||
<!-- <el-input placeholder="输入关键字进行过滤" :size="size" v-model="groupFilterText" clearable></el-input>-->
|
||||
<!-- </el-header>-->
|
||||
<!-- <el-main class="treeMain nopadding">-->
|
||||
<!-- <el-tree ref="group" class="menu" node-key="id" :data="group" :current-node-key="''" :highlight-current="true" :expand-on-click-node="false" :filter-node-method="groupFilterNode" @node-click="groupClick"></el-tree>-->
|
||||
<!-- </el-main>-->
|
||||
<!-- </el-container>-->
|
||||
<!-- </el-aside>-->
|
||||
<el-container class="mainHeaderNoBorderPadding">
|
||||
<el-header style="padding-left: 10px;">
|
||||
<div class="left-panel">
|
||||
|
||||
@ -9,15 +9,23 @@
|
||||
<el-button :size="size" type="info" icon="el-icon-RefreshRight" @click="reset">重置</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<scTable ref="table" :apiObj="list.apiObj" :column="list.column" row-key="id" stripe :size="size">
|
||||
<scTable ref="table" :apiObj="list.apiObj" :column="list.column" row-key="id" stripe :size="size" @row-click="rowClick">
|
||||
<sc-table-column label="序号" type="index"></sc-table-column>
|
||||
</scTable>
|
||||
</el-main>
|
||||
</el-card>
|
||||
|
||||
<el-drawer v-model="infoDrawer" title="日志详情" :size="600" destroy-on-close>
|
||||
<info ref="info"></info>
|
||||
</el-drawer>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import info from '../../setting/log/info'
|
||||
export default {
|
||||
components:{
|
||||
info
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
size:"small",
|
||||
@ -25,6 +33,7 @@
|
||||
apiObj: this.$API.user.log,
|
||||
column: [],
|
||||
},
|
||||
infoDrawer: false,
|
||||
|
||||
searchList:[
|
||||
{name:'操作日期',type:'date',code:'created_at'},
|
||||
@ -68,6 +77,12 @@
|
||||
this.$refs.scSearch.reload();
|
||||
this.$refs.table.reload();
|
||||
},
|
||||
rowClick(row){
|
||||
this.infoDrawer = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.info.setData(row)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user