You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
udiwms-vue-frame/src/views/purchase/company/supCompanyAdd.vue

255 lines
8.1 KiB
Vue

<template>
<div>
<el-card>
<el-form :model="filterQuery" class="query-form" label-width="100px" v-show="showSearch">
<el-row>
<el-col span="6">
<el-form-item label="企业名称">
2 years ago
<el-input v-model="filterQuery.companyName" style="width: 90%" placeholder="请输入企业名称" clearable></el-input>
</el-form-item>
</el-col>
<el-col span="6">
<el-form-item label="社会信用号">
2 years ago
<el-input v-model="filterQuery.creditNum" style="width: 90%" placeholder="请输入社会信用号" clearable></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div class="top-right-btn">
<el-button-group style="display:flex;">
<el-button icon="el-icon-view" type="primary" @click="hideSearch">/</el-button>
<el-button type="primary" icon="el-icon-refresh" @click="onReset"></el-button>
<el-button type="primary" icon="el-icon-search" @click="onSubmit"></el-button>
<el-button type="primary" icon="el-icon-plus" @click="addCompany"></el-button>
</el-button-group>
</div>
<el-divider style="margin: 15px"></el-divider>
<el-table v-loading="loading" :data="list" style="width: 100%" border highlight-current-row>
<el-table-column type="index" label="序号" width="50"></el-table-column>
<el-table-column label="企业名称" prop="companyName" show-overflow-tooltip></el-table-column>
<el-table-column label="社会信用号" prop="creditNum"></el-table-column>
<el-table-column label="企业法人" prop="contacts"></el-table-column>
<el-table-column label="所属地区" prop="area"></el-table-column>
<el-table-column label="详细地址" prop="detailAddr" :show-overflow-tooltip="true"></el-table-column>
<el-table-column label="审核状态" prop="auditStatus" width="120">
<template slot-scope="scope">
<el-tag :type="(scope.row.auditStatus) | statusFilterType">
{{ checkFlag[scope.row.auditStatus] }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" width="120">
<template slot-scope="scope">
<el-button type="text" @click.native.stop="editCompany(scope.row)">编辑</el-button>
<el-button type="text" @click.native.stop="deleteDialog(scope.row)">删除</el-button>
<el-button type="text" v-if="scope.row.auditStatus === 2" @click.native.stop="rejectInfo(scope.row)"></el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="filterQuery.page"
:limit.sync="filterQuery.limit"
@pagination="handleCurrentChange"
></pagination>
</el-card>
<el-dialog
:title="formMap[formName]"
:visible.sync="supCompanyVisible"
width="80%"
v-if="supCompanyVisible"
@close='closeDialog'
:close-on-click-modal="false"
:close-on-press-escape="false"
2 years ago
:before-close="handleClose"
>
<supCompanyEdit
:closeDialog="closeDialog"
:inputEdit="inputQuery"
:editType="editType"
></supCompanyEdit>
</el-dialog>
</div>
</template>
<script>
import {getSupComapnys, delSupComapnys} from "@/api/purchase/supCompany";
import supCompanyEdit from "./supCompanyEditDialog";
export default {
data() {
return {
showSearch:true,
filterQuery: {
companyName: "",
checkType: "",
creditNum: "",
auditStatus: "20",
page: 1,
limit: 20,
},
loading: false,
list: [],
total: 0,
formName: "add",
formMap: {
add: "新增配送企业资质信息",
update: "编辑配送企业资质信息",
},
checkFlag: {
0: "草稿",
1: "已通过",
2: "已拒绝",
3: "变更未审核",
6: "未审核",
},
supCompanyVisible: false,
inputQuery: {},
editType: 0, //0:新增1编辑
};
},
filters: {
statusFilterType(status) {
const statusMap = {
0: "warning",
1: "success",
2: "danger",
6: "success",
};
return statusMap[status];
},
statusFilterName(status) {
const statusMap = {
0: "禁用",
1: "正常",
2: "未验证",
};
return statusMap[status];
},
},
methods: {
onReset() {
this.$router.push({
path: "",
});
this.filterQuery = {
companyName: "",
creditNum: "",
auditStatus: "20",
page: 1,
limit: 20,
};
this.getList();
this.productList = [];
this.salesmanList = [];
},
hideSearch() {
this.showSearch = !this.showSearch;
},
2 years ago
handleClose(){
this.supCompanyVisible=false;
this. getList();
},
getList() {
this.loading = true;
getSupComapnys(this.filterQuery)
.then((response) => {
console.log(response)
this.loading = false;
this.list = response.data.list || [];
this.total = response.data.total || 0;
})
.catch(() => {
this.loading = false;
this.list = [];
this.total = 0;
});
},
onSubmit() {
this.getList();
},
addCompany() {
this.supCompanyVisible = true;
this.formName = "add";
this.editType = 0;
this.inputQuery = {};
},
editCompany(row) {
this.supCompanyVisible = true;
this.formName = "update";
this.editType = 1;
this.inputQuery = row;
},
rejectInfo(row) {
this.$confirm(row.auditComment, "驳回说明", {
confirmButtonText: "确定",
type: "warning",
showCancelButton: false,
})
.then(() => {
});
},
handleCurrentChange(val) {
this.filterQuery.page = val.page;
this.getList();
},
deleteDialog(row) {
this.$confirm("删除后将清空该供应商以及所有关联信息?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
let tQuery = {
id: row.customerId,
};
delSupComapnys(tQuery).then(() => {
this.getList();
});
})
.catch(() => {
});
},
closeDialog() {
this.supCompanyVisible = false;
2 years ago
this.getList();
},
},
components: {
supCompanyEdit,
}
,
mounted() {
},
created() {
this.getList();
},
};
</script>