|
@@ -2,7 +2,7 @@
|
|
|
<template>
|
|
|
<el-card class="dealerAuthorization" v-loading="loading" :body-style="{ padding: 0 }">
|
|
|
|
|
|
- <authprivAdd ref="addDialogRef"></authprivAdd>
|
|
|
+ <authprivAdd ref="addDialogRef" @close="handleRefresh"></authprivAdd>
|
|
|
<authprivSee ref="seeDialogRef"></authprivSee>
|
|
|
|
|
|
<!-- 检索区 -->
|
|
@@ -13,14 +13,18 @@
|
|
|
|
|
|
<el-input v-if="column.type == 'Input'" v-model="searchParams[column.key]" clearable></el-input>
|
|
|
|
|
|
- <el-select v-if="column.type == 'Select'" v-model="searchParams[column.key]" clearable>
|
|
|
+ <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-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="开始日期"
|
|
|
+ <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>
|
|
@@ -36,7 +40,7 @@
|
|
|
<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="handleSubmit">提交</el-button> -->
|
|
|
<el-button size="mini" @click="handleDownload">下载授权书</el-button>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
@@ -44,147 +48,102 @@
|
|
|
<!-- 数据展示 -->
|
|
|
<el-table class="da-table" @row-dblclick="handleOpenSeeDialog" @select="handleSelect" :data="tableData"
|
|
|
highlight-current-row max-height="500">
|
|
|
- <el-table-column type="selection" width="35"></el-table-column>
|
|
|
+ <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 || 180">
|
|
|
+ :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="small" @click="handleOpenAddDialog(scope.row)"
|
|
|
+ <el-button type="text" size="mini" @click="handleOpenAddDialog(scope.row)"
|
|
|
v-hasPermi="['pu:authorization:edit']">编辑</el-button>
|
|
|
- <el-button type="text" size="small" @click="handleDelDialog(scope.row)"
|
|
|
+ <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 @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>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
|
|
|
- <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :total="total"
|
|
|
+ <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="total, prev, pager, next, sizes, jumper">
|
|
|
+ :layout="layout">
|
|
|
</el-pagination>
|
|
|
|
|
|
</el-card>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import authprivAdd from './authprivAdd.vue';
|
|
|
-import authprivSee from './authprivSee.vue';
|
|
|
-import dealerApi from '@/api/marketing/dealer-authorization'
|
|
|
+import dealerApi from '@/api/marketing/dealer-authorization';
|
|
|
+import { TableColumns, SearchColumns } from './column';
|
|
|
+import { initParams } from '../utils/init';
|
|
|
|
|
|
export default {
|
|
|
|
|
|
name: 'dealerAuthorization',
|
|
|
components: {
|
|
|
- authprivAdd,
|
|
|
- authprivSee,
|
|
|
+ authprivAdd: () => import('./authprivAdd.vue'),
|
|
|
+ authprivSee: () => import('./authprivSee.vue'),
|
|
|
},
|
|
|
|
|
|
data() {
|
|
|
- const arr2Obj = function (data, keyName, valueName) {
|
|
|
- return Object.fromEntries(
|
|
|
- data.map((item) => [item[keyName], item[valueName]])
|
|
|
- );
|
|
|
- };
|
|
|
- // 查询条件列
|
|
|
- const searchColumns = [
|
|
|
- { key: "dealerName", title: "经销商名称", type: "Input" },
|
|
|
- { key: "authorizedAreaName", title: "授权区域/医院", type: "Input" },
|
|
|
- { key: "authorizedProductsName", title: "授权产品", type: "Input" },
|
|
|
- // 单据状态0=自由态,1=审批中,2=已审核,3=已驳回
|
|
|
- {
|
|
|
- key: "status", title: "状态", type: "Select", options: [
|
|
|
- { value: 0, label: '自由态' },
|
|
|
- { value: 1, label: '审批中' },
|
|
|
- { value: 2, label: '已审核' },
|
|
|
- { value: 3, label: '已驳回' },
|
|
|
- ]
|
|
|
- },
|
|
|
- { title: "授权时间", key: "time", type: "DateRange" },
|
|
|
- ];
|
|
|
-
|
|
|
- // 表列
|
|
|
- const tableColumns = [
|
|
|
- { key: "authorizedProductsCode", title: "授权产品 编码", show: true },
|
|
|
- { key: "dealerName", title: "经销商名称", show: true },
|
|
|
- { key: "authorizedAreaCode", title: "授权区域/医院 编码", show: false },
|
|
|
- { key: "authorizedAreaName", title: "授权区域/医院 名称", show: true },
|
|
|
- { key: "authorizedProductsName", title: "授权产品 名称", show: true },
|
|
|
- { key: "status", title: "状态", show: true },
|
|
|
- { key: "createPerson", title: "创建人", show: true },
|
|
|
- { key: "createTime", title: "创建时间", show: true },
|
|
|
- { key: "updatePerson", title: "最后修改人", show: true },
|
|
|
- { key: "updateTime", title: "最后修改时间", show: true },
|
|
|
- { key: "id", title: "主键id----该值不显示", show: false },
|
|
|
- { key: "startTime", title: "开始时间", show: false },
|
|
|
- { key: "endTime", title: "结束时间", show: false },
|
|
|
- { key: "issueTime", title: "授权书开具时间", show: false },
|
|
|
- ];
|
|
|
-
|
|
|
- const initTableColumns = () => tableColumns;
|
|
|
- const initSearchColumns = () => searchColumns;
|
|
|
- const initSearchParams = () => arr2Obj(initSearchColumns(), "key", "value");
|
|
|
+ const initTableColumns = () => TableColumns;
|
|
|
+ const initSearchColumns = () => SearchColumns;
|
|
|
return {
|
|
|
loading: false,
|
|
|
searchColumns: initSearchColumns(),
|
|
|
searchParams: {
|
|
|
- // isAsc: "desc",
|
|
|
- // reasonable: "",
|
|
|
- // orderByColumn: "",
|
|
|
- ...initSearchParams(),
|
|
|
+ ...initParams(initSearchColumns()),
|
|
|
},
|
|
|
tableColumns: initTableColumns(),
|
|
|
- tableData: [
|
|
|
- {
|
|
|
- authorizedProductsCode: "授权产品 编码",
|
|
|
- dealerName: "经销商名称",
|
|
|
- authorizedAreaCode: "授权区域/医院 编码",
|
|
|
- authorizedAreaName: "授权区域/医院 名称",
|
|
|
- authorizedProductsName: "授权产品 名称",
|
|
|
- status: "0",
|
|
|
- createPerson: "创建人",
|
|
|
- createTime: "创建时间",
|
|
|
- updatePerson: "最后修改人",
|
|
|
- updateTime: "最后修改时间",
|
|
|
- id: "主键id----该值不显示",
|
|
|
- startTime: "2023-01-02",
|
|
|
- endTime: "2025-01-01",
|
|
|
- issueTime: "2023-01-02",
|
|
|
- }
|
|
|
- ],
|
|
|
+ tableData: [],
|
|
|
checkedList: [],
|
|
|
- page: { pageNum: 1, pageSize: 25 },
|
|
|
- total: 0,
|
|
|
+ page: {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 25,
|
|
|
+ total: 0
|
|
|
+ },
|
|
|
pageSizes: [10, 20, 50, 100],
|
|
|
+ layout: 'total, prev, pager, next, sizes, jumper',
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
// 查询---列表查询
|
|
|
- handelSearch() {
|
|
|
+ async handelSearch() {
|
|
|
this.loading = true;
|
|
|
console.log(this.searchParams, '查询');
|
|
|
- let isTime = this.searchParams.time && this.searchParams.time != '' && this.searchParams.time.length;
|
|
|
+ // 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] : '',
|
|
|
+ // startTime: isTime ? this.searchParams.time[0] : '',
|
|
|
+ // endTime: isTime ? this.searchParams.time[1] : '',
|
|
|
+ pageNum: pageNum,
|
|
|
+ pageSize: pageSize,
|
|
|
}
|
|
|
delete params['time']
|
|
|
console.log(params, 'params--------');
|
|
|
|
|
|
- dealerApi.dealerList(params, this.page).then(res => {
|
|
|
+ await dealerApi.list(params).then(res => {
|
|
|
console.log(res, '获取列表');
|
|
|
+ let { code, rows, total } = res;
|
|
|
this.loading = false;
|
|
|
+ if (code == 200) {
|
|
|
+ this.tableData = rows;
|
|
|
+ this.page.total = total;
|
|
|
+ }
|
|
|
}).catch(error => {
|
|
|
this.loading = false;
|
|
|
})
|
|
|
},
|
|
|
// 重置
|
|
|
handelResetSearch() {
|
|
|
+
|
|
|
console.log('重置');
|
|
|
|
|
|
for (const key in this.searchParams) {
|
|
@@ -217,7 +176,7 @@ export default {
|
|
|
},
|
|
|
// 刷新
|
|
|
handleRefresh() {
|
|
|
-
|
|
|
+ this.handelSearch();
|
|
|
},
|
|
|
handleSizeChange(e) {
|
|
|
this.page.pageSize = e;
|
|
@@ -249,38 +208,60 @@ export default {
|
|
|
setVisible(true);
|
|
|
},
|
|
|
// 删除
|
|
|
- handleDelDialog(rows) {
|
|
|
+ async handleDelDialog(rows) {
|
|
|
console.log(rows, '删除');
|
|
|
-
|
|
|
- // dealerApi.dealerDelete().then(res => {
|
|
|
- // console.log(res, '删除');
|
|
|
- // }).catch(error => {
|
|
|
-
|
|
|
- // })
|
|
|
+ let { id } = rows;
|
|
|
+ try {
|
|
|
+ this.loading = true;
|
|
|
+ let { code, msg } = await dealerApi.remove({ id });
|
|
|
+ if (code == 200) {
|
|
|
+ this.handleRefresh();
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.log(error);
|
|
|
+ } finally {
|
|
|
+ this.loading = false;
|
|
|
+ }
|
|
|
},
|
|
|
// 提交
|
|
|
- handleSubmit() {
|
|
|
- console.log('批量提交');
|
|
|
+ handleSubmit(row) {
|
|
|
+
|
|
|
+ console.log(row, '提交');
|
|
|
let params = {
|
|
|
id: '',
|
|
|
status: ''
|
|
|
}
|
|
|
- // 编辑
|
|
|
- // dealerApi.dealerUpdate(params).then(res => {
|
|
|
- // console.log(res, '编辑');
|
|
|
+ // try {
|
|
|
+ // this.loading = true;
|
|
|
+ // let { code, msg } = await dealerApi.submitOA();
|
|
|
+ // if (code == 200) {
|
|
|
+ // this.handleRefresh();
|
|
|
+ // }
|
|
|
+ // } catch (error) {
|
|
|
+ // console.log(error);
|
|
|
+ // } finally {
|
|
|
+ // this.loading = false;
|
|
|
+
|
|
|
+ // }
|
|
|
+
|
|
|
|
|
|
- // }).catch(error => {
|
|
|
|
|
|
- // })
|
|
|
},
|
|
|
// 下载
|
|
|
handleDownload() {
|
|
|
console.log('下载');
|
|
|
+ // try {
|
|
|
+ // let { code, msg } = await dealerApi.download();
|
|
|
+ // if (code == 200) {
|
|
|
+ // }
|
|
|
+ // } catch (error) {
|
|
|
+ // console.log(error);
|
|
|
+ // } finally {}
|
|
|
},
|
|
|
|
|
|
},
|
|
|
created() {
|
|
|
-
|
|
|
+ this.handelSearch();
|
|
|
}
|
|
|
|
|
|
}
|