|
@@ -1,137 +1,48 @@
|
|
|
-<!-- 经销商授权信息管理--列表 -->
|
|
|
-<template>
|
|
|
- <el-card class="dealerAuthorization" v-loading="loading" :body-style="{ padding: 0 }">
|
|
|
-
|
|
|
- <authprivAdd ref="addDialogRef" @close="handleRefresh"></authprivAdd>
|
|
|
- <authprivSee ref="seeDialogRef"></authprivSee>
|
|
|
-
|
|
|
- <!-- 检索区 -->
|
|
|
- <el-form :inline="true" size="mini" label-position="right" label-width="100px" :model="searchParams"
|
|
|
- style="padding: 10px 0 0 0">
|
|
|
-
|
|
|
- <el-form-item v-for="column in searchColumns " :label="column.title" :key="column.key">
|
|
|
-
|
|
|
- <el-input v-if="column.type == 'Input'" v-model="searchParams[column.key]" clearable></el-input>
|
|
|
-
|
|
|
- <el-select v-else-if="column.type == 'Select'" v-model="searchParams[column.key]" clearable>
|
|
|
- <el-option v-for="op in column.options" :label="op.label" :value="op.value"></el-option>
|
|
|
- </el-select>
|
|
|
-
|
|
|
- <el-date-picker v-else-if="column.type == 'DateRange'" v-model="searchParams[column.key]" clearable
|
|
|
- type="daterange" format="yyyy-MM-dd " value-format="yyyy-MM-dd" range-separator="至" start-placeholder="开始日期"
|
|
|
- end-placeholder="结束日期">
|
|
|
- </el-date-picker>
|
|
|
-
|
|
|
- <el-date-picker v-else-if="column.type == 'Date'" v-model="searchParams[column.key]" format="yyyy-MM-dd "
|
|
|
- clearable value-format="yyyy-MM-dd" type="date" :placeholder="column.config.placeholder" style="width: 192px;">
|
|
|
- </el-date-picker>
|
|
|
- </el-form-item>
|
|
|
-
|
|
|
- <el-form-item>
|
|
|
- <el-button type="primary" icon="el-icon-search" @click="handelSearch"
|
|
|
- v-hasPermi="['pu:authorization:list']">查询</el-button>
|
|
|
- <el-button icon="el-icon-refresh" @click="handelResetSearch">重置</el-button>
|
|
|
- </el-form-item>
|
|
|
-
|
|
|
- </el-form>
|
|
|
-
|
|
|
- <!-- 操作区 -->
|
|
|
- <el-row :gutter="24" style="padding: 0 10px">
|
|
|
- <el-col :span="24" style="text-align: right">
|
|
|
- <el-button size="mini" type="primary" @click="handleOpenAddDialog"
|
|
|
- v-hasPermi="['pu:authorization:add']">新增</el-button>
|
|
|
- <!-- <el-button size="mini" @click="handleSubmit">提交</el-button> -->
|
|
|
- <!-- <el-button size="mini" @click="handleDownload">下载授权书</el-button> -->
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
-
|
|
|
- <!-- 数据展示 -->
|
|
|
- <el-table class="da-table" @row-dblclick="handleOpenSeeDialog" @select="handleSelect" :data="tableData"
|
|
|
- highlight-current-row max-height="500">
|
|
|
- <el-table-column type="selection" width="45"></el-table-column>
|
|
|
- <el-table-column type="index" width="55" label="序号"></el-table-column>
|
|
|
- <el-table-column v-for="column in tableColumns" :label="column.title" v-if="column.show"
|
|
|
- :width="column.width || 120" show-overflow-tooltip>
|
|
|
- <template slot-scope="scope">
|
|
|
- {{ column.key == 'status' ? judgeStatus(scope.row[column.key]) : scope.row[column.key] }}
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column fixed="right" label="操作" width="120">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-button type="text" size="mini" @click="handleOpenAddDialog(scope.row)"
|
|
|
- v-if="scope.row.status == '0' || scope.row.status == '3'"
|
|
|
- v-hasPermi="['pu:authorization:edit']">编辑</el-button>
|
|
|
- <el-button type="text" size="mini" @click="handleDelDialog(scope.row)"
|
|
|
- v-if="scope.row.status == '0' || scope.row.status == '3'"
|
|
|
- v-hasPermi="['pu:authorization:remove']">删除</el-button>
|
|
|
- <!-- <el-button @click="handleOpenSeeDialog(scope.row)" type="text" size="small">查看</el-button> -->
|
|
|
- <el-button type="text" size="mini" v-if="scope.row.status == '0' || scope.row.status == '3'"
|
|
|
- @click="handleSubmit(scope.row)">提交</el-button>
|
|
|
- <el-button type="text" size="mini" v-if="scope.row.status == '2'"
|
|
|
- @click="handleDownload(scope.row)">下载授权书</el-button>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
-
|
|
|
- <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :total="page.total"
|
|
|
- :page-sizes="pageSizes" :page-size="page.pageSize" :current-page="page.pageNum" hide-on-single-page
|
|
|
- :layout="layout">
|
|
|
- </el-pagination>
|
|
|
-
|
|
|
- </el-card>
|
|
|
-</template>
|
|
|
-
|
|
|
<script>
|
|
|
-import dealerApi from '@/api/marketing/dealer-authorization';
|
|
|
-import { TableColumns, SearchColumns } from './column';
|
|
|
-import { initParams } from '../utils/init';
|
|
|
+import dealerApi from "@/api/marketing/dealer-authorization";
|
|
|
+import useColumns from "./columns";
|
|
|
+import { dicts } from "./dicts";
|
|
|
|
|
|
export default {
|
|
|
-
|
|
|
- name: 'dealerAuthorization',
|
|
|
+ name: "dealerAuthorization",
|
|
|
+ dicts: [...dicts],
|
|
|
components: {
|
|
|
- authprivAdd: () => import('./authprivAdd.vue'),
|
|
|
- authprivSee: () => import('./authprivSee.vue'),
|
|
|
+ authprivAdd: () => import("./add/index.vue"),
|
|
|
+ // authprivAdd: () => import("./authprivAdd.vue"),
|
|
|
+ authprivSee: () => import("./authprivSee.vue"),
|
|
|
+ ElSuperUxTable: () => import("@/components/super-ux-table/index.vue"),
|
|
|
+ ElSuperSearch: () => import("@/components/super-search/index.vue"),
|
|
|
},
|
|
|
|
|
|
data() {
|
|
|
-
|
|
|
+ const { TableColumns, SearchColumns } = useColumns();
|
|
|
+ const page = this.$init.page();
|
|
|
+ const params = this.$init.params(SearchColumns);
|
|
|
return {
|
|
|
+ params: params,
|
|
|
loading: false,
|
|
|
- searchColumns: SearchColumns,
|
|
|
- searchParams: {
|
|
|
- ...initParams(SearchColumns),
|
|
|
- },
|
|
|
- tableColumns: TableColumns,
|
|
|
+ size: "mini",
|
|
|
+ SearchColumns: SearchColumns,
|
|
|
+ TableColumns: TableColumns,
|
|
|
tableData: [],
|
|
|
checkedList: [],
|
|
|
- page: {
|
|
|
- pageNum: 1,
|
|
|
- pageSize: 25,
|
|
|
- total: 0
|
|
|
- },
|
|
|
- pageSizes: [10, 20, 50, 100],
|
|
|
- layout: 'total, prev, pager, next, sizes, jumper',
|
|
|
- }
|
|
|
+ page: page,
|
|
|
+ };
|
|
|
},
|
|
|
methods: {
|
|
|
// 查询---列表查询
|
|
|
- async handelSearch() {
|
|
|
+ async useQuery() {
|
|
|
this.loading = true;
|
|
|
- console.log(this.searchParams, '查询');
|
|
|
- // let isTime = this.searchParams.time && this.searchParams.time != '' && this.searchParams.time.length;
|
|
|
- let { pageNum, pageSize } = this.page;
|
|
|
- let params = {
|
|
|
- ...this.searchParams,
|
|
|
- // startTime: isTime ? this.searchParams.time[0] : '',
|
|
|
- // endTime: isTime ? this.searchParams.time[1] : '',
|
|
|
- pageNum: pageNum,
|
|
|
- pageSize: pageSize,
|
|
|
- }
|
|
|
- delete params['time']
|
|
|
- console.log(params, 'params--------');
|
|
|
|
|
|
try {
|
|
|
+ let { privilegedTime } = this.params;
|
|
|
+ let params = {
|
|
|
+ ...this.params,
|
|
|
+ startTime: privilegedTime && privilegedTime[0],
|
|
|
+ endTime: privilegedTime && privilegedTime[1],
|
|
|
+ ...this.page,
|
|
|
+ };
|
|
|
+ delete params["privilegedTime"];
|
|
|
let { code, rows, total } = await dealerApi.list(params);
|
|
|
if (code == 200) {
|
|
|
this.tableData = rows;
|
|
@@ -142,55 +53,16 @@ export default {
|
|
|
} finally {
|
|
|
this.loading = false;
|
|
|
}
|
|
|
-
|
|
|
},
|
|
|
// 重置
|
|
|
- handelResetSearch() {
|
|
|
-
|
|
|
- console.log('重置');
|
|
|
- this.searchParams = {
|
|
|
- ...initParams(SearchColumns),
|
|
|
- }
|
|
|
- },
|
|
|
- // 判断状态
|
|
|
- judgeStatus(status) {
|
|
|
- // 单据状态0=自由态,1=审批中,2=已审核,3=已驳回
|
|
|
- let statusName = '';
|
|
|
- switch (status) {
|
|
|
- case '0':
|
|
|
- statusName = '自由态';
|
|
|
- break;
|
|
|
- case '1':
|
|
|
- statusName = '审批中';
|
|
|
- break;
|
|
|
- case '2':
|
|
|
- statusName = '已审核';
|
|
|
- break;
|
|
|
- case '3':
|
|
|
- statusName = '已驳回';
|
|
|
- break;
|
|
|
- default:
|
|
|
- break;
|
|
|
- }
|
|
|
-
|
|
|
- return statusName;
|
|
|
- },
|
|
|
- // 刷新
|
|
|
- handleRefresh() {
|
|
|
- this.handelSearch();
|
|
|
- },
|
|
|
- handleSizeChange(e) {
|
|
|
- this.page.pageSize = e;
|
|
|
- this.handelSearch();
|
|
|
- },
|
|
|
- handleCurrentChange(e) {
|
|
|
- this.page.pageNum = e;
|
|
|
- this.handelSearch();
|
|
|
+ reset() {
|
|
|
+ this.page = this.$init.page();
|
|
|
+ this.params = this.$init.params(this.SearchColumns);
|
|
|
+ this.useQuery();
|
|
|
},
|
|
|
|
|
|
// 选择列表
|
|
|
handleSelect(selection, row) {
|
|
|
- console.log('selection/////////', selection, 'row/////////', row);
|
|
|
this.checkedList = [...selection];
|
|
|
},
|
|
|
// 新增、编辑授权信息
|
|
@@ -198,7 +70,6 @@ export default {
|
|
|
const { setVisible, setFormData } = this.$refs.addDialogRef;
|
|
|
setFormData(rows);
|
|
|
setVisible(true);
|
|
|
-
|
|
|
},
|
|
|
// 查看
|
|
|
handleOpenSeeDialog(rows) {
|
|
@@ -210,29 +81,30 @@ export default {
|
|
|
handleDelDialog(rows) {
|
|
|
let { id } = rows;
|
|
|
|
|
|
- this.$confirm('此操作将删除该条数据, 是否继续?', '提示', {
|
|
|
- confirmButtonText: '确定',
|
|
|
- cancelButtonText: '取消',
|
|
|
- type: 'warning'
|
|
|
- }).then(async () => {
|
|
|
- try {
|
|
|
- this.loading = true;
|
|
|
- let { code, msg } = await dealerApi.remove({ id });
|
|
|
- if (code == 200) {
|
|
|
- this.handleRefresh();
|
|
|
+ this.$confirm("此操作将删除该条数据, 是否继续?", "提示", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning",
|
|
|
+ })
|
|
|
+ .then(async () => {
|
|
|
+ try {
|
|
|
+ this.loading = true;
|
|
|
+ let { code, msg } = await dealerApi.remove({ id });
|
|
|
+ if (code == 200) {
|
|
|
+ this.useQuery();
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.log(error);
|
|
|
+ } finally {
|
|
|
+ this.loading = false;
|
|
|
}
|
|
|
- } catch (error) {
|
|
|
- console.log(error);
|
|
|
- } finally {
|
|
|
- this.loading = false;
|
|
|
- }
|
|
|
- }).catch(() => {
|
|
|
- this.$message({
|
|
|
- type: 'info',
|
|
|
- message: '已取消删除'
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ this.$message({
|
|
|
+ type: "info",
|
|
|
+ message: "已取消删除",
|
|
|
+ });
|
|
|
});
|
|
|
- });
|
|
|
-
|
|
|
},
|
|
|
// 提交OA
|
|
|
async handleSubmit(row) {
|
|
@@ -240,7 +112,13 @@ export default {
|
|
|
// name:工号 nickName:名字
|
|
|
const { name, nickName } = this.$store.state.user;
|
|
|
|
|
|
- const { id, authorizedProductsCode,dealerName,authorizedProductsName,authorizedAreaName } = row;
|
|
|
+ const {
|
|
|
+ id,
|
|
|
+ authorizedProductsCode,
|
|
|
+ dealerName,
|
|
|
+ authorizedProductsName,
|
|
|
+ authorizedAreaName,
|
|
|
+ } = row;
|
|
|
|
|
|
let data = {
|
|
|
authorizedProductsCode,
|
|
@@ -250,29 +128,31 @@ export default {
|
|
|
date: new Date().Format(),
|
|
|
dealerName,
|
|
|
authorizedProductsName,
|
|
|
- authorizedAreaName
|
|
|
- }
|
|
|
+ authorizedAreaName,
|
|
|
+ };
|
|
|
|
|
|
this.loading = true;
|
|
|
let { code, msg } = await dealerApi.submitOA(data);
|
|
|
if (code == 200) {
|
|
|
- this.handleRefresh();
|
|
|
+ this.useQuery();
|
|
|
}
|
|
|
} catch (error) {
|
|
|
console.log(error);
|
|
|
} finally {
|
|
|
this.loading = false;
|
|
|
-
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
},
|
|
|
// 下载
|
|
|
async handleDownload(row) {
|
|
|
- console.log('下载', row);
|
|
|
+ console.log("下载", row);
|
|
|
try {
|
|
|
- const { id, authorizedProductsCode, dealerName, authorizedAreaName, authorizedProductsName } = row;
|
|
|
+ const {
|
|
|
+ id,
|
|
|
+ authorizedProductsCode,
|
|
|
+ dealerName,
|
|
|
+ authorizedAreaName,
|
|
|
+ authorizedProductsName,
|
|
|
+ } = row;
|
|
|
|
|
|
const data = {
|
|
|
dealerName,
|
|
@@ -280,12 +160,12 @@ export default {
|
|
|
authorizedProductsName,
|
|
|
id,
|
|
|
authorizedProductsCode,
|
|
|
- }
|
|
|
+ };
|
|
|
|
|
|
// await this.download('/dealer/download', data, `授权书${new Date().getTime()}.doc`);
|
|
|
- let file = await dealerApi.download(data)
|
|
|
+ let file = await dealerApi.download(data);
|
|
|
let blob = new Blob([file], {
|
|
|
- type: `application/msword` //word文档为msword,pdf文档为pdf,msexcel 为excel
|
|
|
+ type: `application/msword`, //word文档为msword,pdf文档为pdf,msexcel 为excel
|
|
|
});
|
|
|
let objectUrl = URL.createObjectURL(blob);
|
|
|
let link = document.createElement("a");
|
|
@@ -294,32 +174,119 @@ export default {
|
|
|
link.setAttribute("download", fname);
|
|
|
document.body.appendChild(link);
|
|
|
link.click();
|
|
|
-
|
|
|
} catch (error) {
|
|
|
console.log(error);
|
|
|
- } finally { }
|
|
|
+ } finally {
|
|
|
+ }
|
|
|
},
|
|
|
-
|
|
|
},
|
|
|
created() {
|
|
|
- this.handelSearch();
|
|
|
- console.log(this.$store.state.user, 'this.$store.state.user');
|
|
|
- }
|
|
|
-
|
|
|
-}
|
|
|
+ this.useQuery();
|
|
|
+ console.log(this.$store.state.user, "this.$store.state.user");
|
|
|
+ },
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
-<style lang="scss" scoped>
|
|
|
-.dealerAuthorization {
|
|
|
- width: calc(100% - 24px);
|
|
|
- height: 100%;
|
|
|
- margin: 10px;
|
|
|
- padding: 10px;
|
|
|
- box-sizing: border-box;
|
|
|
+<!-- 经销商授权信息管理--列表 -->
|
|
|
+<template>
|
|
|
+ <el-card
|
|
|
+ v-loading="loading"
|
|
|
+ :body-style="{
|
|
|
+ height: '100%',
|
|
|
+ padding: 0,
|
|
|
+ display: 'flex',
|
|
|
+ 'flex-direction': 'column',
|
|
|
+ }"
|
|
|
+ >
|
|
|
+ <authprivAdd
|
|
|
+ ref="addDialogRef"
|
|
|
+ :dict="dict"
|
|
|
+ @close="useQuery"
|
|
|
+ ></authprivAdd>
|
|
|
+ <authprivSee ref="seeDialogRef"></authprivSee>
|
|
|
+ <el-super-search
|
|
|
+ v-model="params"
|
|
|
+ :size="size"
|
|
|
+ :dict="dict"
|
|
|
+ :columns="SearchColumns"
|
|
|
+ @reset="reset"
|
|
|
+ @submit="useQuery"
|
|
|
+ ></el-super-search>
|
|
|
+
|
|
|
+ <!-- 操作区 -->
|
|
|
+ <el-row :gutter="24" style="margin: 16px 0px">
|
|
|
+ <el-col :span="24" style="text-align: right">
|
|
|
+ <el-button
|
|
|
+ size="mini"
|
|
|
+ type="primary"
|
|
|
+ @click="handleOpenAddDialog"
|
|
|
+ v-hasPermi="['pu:authorization:add']"
|
|
|
+ >新增</el-button
|
|
|
+ >
|
|
|
+ <!-- <el-button size="mini" @click="handleSubmit">提交</el-button> -->
|
|
|
+ <!-- <el-button size="mini" @click="handleDownload">下载授权书</el-button> -->
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
|
|
|
- .da-table {
|
|
|
- width: 100%;
|
|
|
- margin: 20px 0 0 0;
|
|
|
- }
|
|
|
+ <el-super-ux-table
|
|
|
+ v-model="tableData"
|
|
|
+ :dict="dict"
|
|
|
+ :columns="TableColumns"
|
|
|
+ :size="size"
|
|
|
+ pagination
|
|
|
+ index
|
|
|
+ checkbox
|
|
|
+ convenitentOperation
|
|
|
+ :page="page"
|
|
|
+ storage-key="DealerAuthorizationSuperTable"
|
|
|
+ @pagination="useQuery"
|
|
|
+ @row-dblclick="handleOpenSeeDialog"
|
|
|
+ @select="handleSelect"
|
|
|
+ >
|
|
|
+ <ux-table-column fixed="right" title="操作" align="center" width="180">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button
|
|
|
+ type="text"
|
|
|
+ size="mini"
|
|
|
+ @click="handleOpenAddDialog(scope.row)"
|
|
|
+ v-if="scope.row.status == '0' || scope.row.status == '3'"
|
|
|
+ v-hasPermi="['pu:authorization:edit']"
|
|
|
+ >编辑</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ type="text"
|
|
|
+ size="mini"
|
|
|
+ @click="handleDelDialog(scope.row)"
|
|
|
+ v-if="scope.row.status == '0' || scope.row.status == '3'"
|
|
|
+ v-hasPermi="['pu:authorization:remove']"
|
|
|
+ >删除</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ type="text"
|
|
|
+ size="mini"
|
|
|
+ v-if="scope.row.status == '0' || scope.row.status == '3'"
|
|
|
+ @click="handleSubmit(scope.row)"
|
|
|
+ >提交</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ type="text"
|
|
|
+ size="mini"
|
|
|
+ v-if="scope.row.status == '2'"
|
|
|
+ @click="handleDownload(scope.row)"
|
|
|
+ >下载授权书</el-button
|
|
|
+ >
|
|
|
+ </template>
|
|
|
+ </ux-table-column>
|
|
|
+ </el-super-ux-table>
|
|
|
+ </el-card>
|
|
|
+</template>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+.el-card {
|
|
|
+ width: calc(100% - 32px);
|
|
|
+ height: calc(100vh - 32px);
|
|
|
+ margin: 16px;
|
|
|
+ padding: 16px;
|
|
|
+ border-radius: 8px;
|
|
|
}
|
|
|
-</style>
|
|
|
+</style>
|