emis-frontend/src/views/emis/emisCommissionQuote/index.vue
2025-03-06 15:55:17 +08:00

494 lines
18 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<XdPageContainer class="app-container">
<SearchForm slot="pageHeader" :model="queryParams" ref="queryForm" size="mini" :maxShow="21" label-width="68px" v-show="showSearch" @search="handleQuery" @reset="resetQuery">
<!-- <el-form-item label="" prop="quoteCode">
<el-input
v-model="queryParams.quoteCode"
:placeholder="$t('提成方案编码')"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item> -->
<el-form-item label="方案名称" prop="quoteName">
<el-input
v-model="queryParams.quoteName"
:placeholder="$t('方案名称')"
clearable
/>
</el-form-item>
<el-form-item label="计算类型" prop="calcType">
<el-select v-model="queryParams.calcType" clearable filterable placeholder="请选择" style="width:100%">
<el-option label="按票计算" :value="1"></el-option>
<el-option label="重量计算" :value="2"></el-option>
<el-option label="体积计算" :value="3"></el-option>
<el-option label="包裹数" :value="4"></el-option>
</el-select>
</el-form-item>
<el-form-item label="岗位类型" prop="postType">
<el-select v-model="queryParams.postType" placeholder="岗位类型" clearable filterable >
<el-option
v-for="item in dict.type.emis_commission_post"
v-bind:key="item.value"
v-bind:label="item.label"
v-bind:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="运输方式" prop="transType">
<el-select v-model="queryParams.transType" placeholder="运输方式" clearable filterable >
<el-option
v-for="item in dict.type.emis_biz_shipping_method"
v-bind:key="item.value"
v-bind:label="item.label"
v-bind:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="启用状态" prop="blOpen">
<el-select v-model="queryParams.blOpen" clearable placeholder="启用状态" >
<el-option key="1" label="启用" :value="1"/>
<el-option key="0" label="停用" :value="0"/>
</el-select>
</el-form-item>
<el-form-item label="员工编号" prop="empCode">
<el-input
v-model="queryParams.empCode"
:placeholder="$t('员工编号')"
clearable
/>
</el-form-item>
<el-form-item label="员工名称" prop="empName">
<el-input
v-model="queryParams.empName"
:placeholder="$t('员工名称')"
clearable
/>
</el-form-item>
<el-form-item label="开始日期" prop="startDate">
<el-date-picker clearable
v-model="queryParams.startDate"
type="date"
value-format="yyyy-MM-dd HH:mm:ss"
:placeholder="$t('开始日期')">
</el-date-picker>
</el-form-item>
<el-form-item label="结束日期" prop="endDate">
<el-date-picker clearable
v-model="queryParams.endDate"
type="date"
value-format="yyyy-MM-dd HH:mm:ss"
:placeholder="$t('结束日期')">
</el-date-picker>
</el-form-item>
</SearchForm>
<XdTable
slot="pageContent"
slot-scope="slotProps"
:height="(slotProps.contentHeight)+'px'"
v-loading="loading"
border stripe
size="mini"
:data="emisCommissionQuoteList"
storageName="emisCommissionQuoteList_main_241115"
:showSearch.sync="showSearch"
:queryParams="queryParams"
:total="total"
@queryTable="getList"
@selection-change="handleSelectionChange"
@sort-change="handleSortChange"
>
<div slot="toolbar">
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['emis:emisCommissionQuote:add']"
>新增提成方案</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
size="mini"
:disabled="single"
@click="handleCopy"
v-hasPermi="['emis:emisCommissionQuote:add']"
>复制方案</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['emis:emisCommissionQuote:edit']"
>修改方案</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['emis:emisCommissionQuote:remove']"
>删除</el-button>
</el-col>
</el-row>
</div>
<el-table-column type="selection" width="55" align="center" />
<!-- <el-table-column :label="$t('方案名称')" align="left" prop="quoteName" min-width="200" :show-overflow-tooltip="true"/> -->
<el-table-column :label="$t('方案名称')" align="left" prop="quoteName" width="300" :show-overflow-tooltip="true">
<template slot-scope="scope">
<div class="link-type" @click="handleUpdate(scope.row)">
<span v-if="scope.row.blOpen==1">{{scope.row.quoteName}}</span>
<span v-else ><span style="text-decoration:line-through;color:gray">{{scope.row.quoteName}}</span>-已停用</span>
</div>
</template>
</el-table-column>
<el-table-column :label="$t('提成类型')" align="center" prop="feeType" min-width="150" >
<template slot-scope="scope">
<dict-tag :options="dict.type.emis_commission_fee_type" :value="scope.row.feeType"/>
</template>
</el-table-column>
<el-table-column :label="$t('计算类型')" align="center" prop="calcType" min-width="100" >
<template slot-scope="scope">
<div v-if="scope.row.calcType == 1" >
<span>按票计算</span>
</div>
<div v-if="scope.row.calcType == 2" >
<span>重量计算</span>
</div>
<div v-if="scope.row.calcType == 3" >
<span>体积计算</span>
</div>
<div v-if="scope.row.calcType == 4" >
<span>包裹数</span>
</div>
</template>
</el-table-column>
<el-table-column :label="$t('起始国')" align="center" prop="fromCountryName" min-width="100" :show-overflow-tooltip="true">
<template slot-scope="scope">
<span v-if="scope.row.fromCountry=='-1'">全部</span>
<span v-if="scope.row.fromCountry=='-2'">非中国</span>
<span v-else>{{ scope.row.fromCountryName }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('目的国')" align="center" prop="countryName" min-width="100" :show-overflow-tooltip="true">
<template slot-scope="scope">
<span v-if="scope.row.country=='-1'">全部</span>
<span v-if="scope.row.country=='-2'">非中国</span>
<span v-else>{{ scope.row.countryName }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('线路')" align="center" prop="transLine" min-width="100" :show-overflow-tooltip="true">
<template slot-scope="scope">
<span>{{ scope.row.transLine }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('产品类型')" align="center" prop="prodName" min-width="100" :show-overflow-tooltip="true">
<template slot-scope="scope">
<span>{{ scope.row.prodName }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('寄件网点')" align="center" prop="sendSiteName" min-width="100" :show-overflow-tooltip="true">
<template slot-scope="scope">
<span>{{ scope.row.sendSiteName }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('下一网点')" align="center" prop="nextSiteName" min-width="100" :show-overflow-tooltip="true">
<template slot-scope="scope">
<span>{{ scope.row.nextSiteName }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('岗位类型')" align="center" prop="postType" min-width="100" >
<template slot-scope="scope">
<dict-tag :options="dict.type.emis_commission_post" :value="scope.row.postType"/>
</template>
</el-table-column>
<el-table-column :label="$t('快递类型')" align="center" prop="transType" min-width="100" :show-overflow-tooltip="true">
<template slot-scope="scope">
<dict-tag :options="dict.type.emis_biz_shipping_method" :value="scope.row.transType"/>
</template>
</el-table-column>
<el-table-column label="启用状态" align="center" prop="blOpen" min-width="100" >
<template slot-scope="scope">
<el-tag v-if="scope.row.blOpen==1" type="success">启用</el-tag>
<el-tag v-if="scope.row.blOpen==0" type="danger">停用</el-tag>
</template>
</el-table-column>
<!-- <el-table-column :label="$t('员工编号')" align="center" prop="empCode" min-width="100" /> -->
<el-table-column :label="$t('提成员工范围')" align="center" prop="empName" min-width="150" :show-overflow-tooltip="true" />
<el-table-column :label="$t('开始日期')" align="center" prop="startDate" min-width="170" />
<el-table-column :label="$t('结束日期')" align="center" prop="endDate" min-width="170" />
<!-- <el-table-column :label="$t('优先级')" align="center" prop="priorityLevel" min-width="100" /> -->
<el-table-column :label="$t('备注')" align="center" prop="remark" min-width="100" />
<el-table-column label="创建人" align="center" prop="createByName" width="80" :show-overflow-tooltip="true"/>
<el-table-column label="创建网点" align="center" prop="createSiteName" width="80" :show-overflow-tooltip="true"/>
<el-table-column label="创建时间" align="center" prop="createTime" width="170"/>
<el-table-column label="修改人" align="center" prop="updateByName" width="80" :show-overflow-tooltip="true"/>
<el-table-column label="修改网点" align="center" prop="updateSiteName" width="80" :show-overflow-tooltip="true"/>
<el-table-column label="修改时间" align="center" prop="updateTime" width="170"/>
</XdTable>
<el-dialog :title="titleForm" :visible.sync="openForm" width="90%" :destroy-on-close="true" v-dialogDrag append-to-body :close-on-click-modal="false">
<emisCommissionQuoteForm :quoteId="currentId" :isCopy="isCopy" @on-changed="handleFormChanged" @on-cancel="cancelForm"></EmisCommissionQuoteForm>
</el-dialog>
</XdPageContainer>
</template>
<script>
import { listEmisCommissionQuote, getEmisCommissionQuote, delEmisCommissionQuote, addEmisCommissionQuote, updateEmisCommissionQuote } from "@/api/emis/emisCommissionQuote";
import elDateSimplePicker from '@/components/DatePickerAdv/elDateSimplePicker';
import emisCommissionQuoteForm from '@/views/emis/emisCommissionQuote/emisCommissionQuoteForm';
export default {
name: "EmisCommissionQuote",
components: { elDateSimplePicker,emisCommissionQuoteForm },
dicts: ['emis_price_type','emis_fee_type','sys_currency_type',
'emis_commission_post','emis_biz_shipping_method','emis_commission_fee_type'],
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 创建时间搜索
dateTimeRange:[],
// 总条数
total: 0,
// 员工提成方案报价表格数据
emisCommissionQuoteList: [],
currentId:null,
currentQuote:null,
openForm: false,
titleForm: "",
// 弹出展示层
quoteId:null,
titleView:"",
openView: false,
// 更新网点时间范围
daterangeStartDate: [],
// 更新网点时间范围
daterangeEndDate: [],
// 更新网点时间范围
daterangeCreateTime: [],
// 更新网点时间范围
daterangeUpdateTime: [],
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 20,
quoteCode: null,
quoteName: null,
calcType: null,
postType: null,
transType: null,
blOpen: null,
empCode: null,
empName: null,
startDate: null,
endDate: null,
priorityLevel: null,
remark: null,
delFlag: null,
},
};
},
created() {
this.getList();
},
methods: {
/** 查询员工提成方案报价列表 */
getList() {
this.loading = true;
listEmisCommissionQuote(this.addDateRange(this.queryParams, this.dateTimeRange)).then(response => {
this.emisCommissionQuoteList = response.rows;
this.total = response.total;
this.loading = false;
});
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.quoteId)
let [lastObj]=selection.slice(-1);
this.currentQuote=lastObj;
this.single = selection.length!==1
this.multiple = !selection.length
},
// 排序 查询字段是表格中字段名字 动态取值排序顺序
handleSortChange(column) {
this.queryParams.orderByColumn = column.prop;
this.queryParams.isAsc = column.order;
this.getList();
},
/** 新增按钮操作 */
handleAdd(row) {
this.currentId=null;
this.openForm= true;
this.isCopy = false;
this.titleForm = "新增提成方案";
},
handleCopy() {
this.currentId = this.currentQuote.quoteId ;
this.openForm = true;
this.isCopy = true;
this.titleForm = "复制方案【"+this.currentQuote.quoteName+"】";
},
handleShowMoreInput(){
this.moreInputVisible = !this.moreInputVisible;
},
/** 修改按钮操作 */
handleUpdate(row) {
this.currentId= row.quoteId || this.ids;
this.openForm = true;
this.isCopy = false;
this.titleForm = "修改提成方案";
},
handleView(row) {
this.quoteId=row.quoteId;
this.titleView="查看";
this.openView=true;
// this.router.push({ path: '/emis/emisCommissionQuote/viewDetail', query: { quoteId: row.quoteId }})
},
handleFormChanged(){
this.openForm = false;
this.getList();
},
cancelForm(){
this.openForm = false;
},
/** 删除按钮操作 */
handleDelete(row) {
const quoteIds = row.quoteId || this.ids;
this.$modal.confirm('是否确认删除').then(function() {
return delEmisCommissionQuote(quoteIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
// this.download('emis/emisCommissionQuote/export', {
// ...this.queryParams
// }, `emisCommissionQuote_${new Date().getTime()}.xlsx`)
const loadingInstance = this.$loading({
text: '正在导出...'
})
var qParam = {...this.queryParams};
qParam.pageNum=1;
qParam.pageSize=5000;
listEmisCommissionQuote(this.addDateRange(qParam, this.dateTimeRange)).then(response => {
this.downloadLoading = false
if (response.code === 200) {
const curList = response.rows
import('@/vendor/Export2Excel').then(excel => {
const tHeader = ['序号','提成方案编码','提成方案名称','计算类型','岗位类型:emis_commission_post','快递类型:emis_biz_shipping_method','启用状态','员工编号','员工名称','开始日期','结束日期','优先级','备注','租户ID','删除标志(0代表存在','创建者','创建时间','更新者','更新时间','创建网点','更新网点',];
const filterVal = ['quoteId','quoteCode','quoteName','calcType','postType','transType','blOpen','empCode','empName','startDate','endDate','priorityLevel','remark','tenantId','delFlag','createBy','createTime','updateBy','updateTime','createSite','updateSite',];
const data = this.formatJson(filterVal, curList, response.rows)
excel.export_json_to_excel({
header: tHeader,
data,
filename: '员工提成方案报价',
autoWidth: true
})
loadingInstance.close()
})
}
});
},
formatJson(filterVal, jsonData, resData) {
let index = 0
return jsonData.map(v => filterVal.map(j => {
if (j === 'index') {
return ++index
}
if (j === 'status') {
var statusStr='xxx'
if(v[j] == 10){
statusStr='xxx'
}
return statusStr;
}
return v[j]
}))
},
/** 列索引函数 */
getIndex($index) {
return (this.queryParams.pageNum - 1) * this.queryParams.pageSize + $index + 1
},
/** 时间搜索响应函数 */
dateTimeChange(value){
this.dateTimeRange=value;
},
}
};
</script>
<style scoped>
.el-divider{
margin-top: 0px;
background: 0 0;
border-top: 1px solid #E6EBF5;
}
.el-divider__text {
color: #0955ee;
cursor: pointer;
}
</style>