350 lines
11 KiB
Vue
350 lines
11 KiB
Vue
<template>
|
||
<XdPageContainer class="app-container">
|
||
<SearchForm :model="queryParams" ref="queryForm" size="small" :maxShow="20" label-width="100px" v-show="showSearch" @search="handleQuery" @reset="resetQuery">
|
||
|
||
<el-form-item :label="$t('额度编号')" prop="accCode">
|
||
<el-input v-model="queryParams.accCode" placeholder="额度编号" />
|
||
</el-form-item>
|
||
|
||
<el-form-item :label="$t('员工姓名')" prop="salesmen">
|
||
<EmpNamePicker1 :placeholder="$t('员工姓名')" v-model="queryParams.salesmen" ></EmpNamePicker1>
|
||
</el-form-item>
|
||
|
||
|
||
</SearchForm>
|
||
|
||
<XdTable v-loading="loading"
|
||
|
||
ref="refTable"
|
||
storageName="emisTempCreditSalesmenList_main_250310"
|
||
border stripe
|
||
size="small"
|
||
:data="emisTempCreditSalesmenList"
|
||
: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:emisTempCreditSalesmen: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:emisTempCreditSalesmen: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:emisTempCreditSalesmen:remove']"
|
||
>删除</el-button>
|
||
</el-col>
|
||
<el-col :span="1.5">
|
||
<el-button
|
||
type="warning"
|
||
plain
|
||
icon="el-icon-download"
|
||
size="mini"
|
||
@click="handleExport"
|
||
v-hasPermi="['emis:emisTempCreditSalesmen:export']"
|
||
>导出</el-button>
|
||
</el-col>
|
||
</el-row>
|
||
</div>
|
||
|
||
<el-table-column type="selection" width="55" align="center" />
|
||
<el-table-column :label="$t('额度编号')" align="center" prop="accCode" min-width="150" />
|
||
<el-table-column :label="$t('员工姓名')" align="center" prop="salesmen" min-width="120" :sortable="true"/>
|
||
<el-table-column :label="$t('临时额度')" align="center" prop="tempCreditMoneyAdjust" min-width="120" :sortable="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="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="50%" :destroy-on-close="true" v-dialogDrag append-to-body>
|
||
<emisTempCreditSalesmenForm :id="currentId" @on-changed="handleFormChanged" @on-cancel="cancelForm"></EmisTempCreditSalesmenForm>
|
||
</el-dialog>
|
||
|
||
|
||
<!--
|
||
<el-dialog :title="titleView" :visible.sync="openView" width="60%" :close-on-click-modal="false" v-dialogDrag append-to-body>
|
||
<emisTempCreditSalesmenView :id="id" ></EmisTempCreditSalesmenView>
|
||
</el-dialog>
|
||
-->
|
||
|
||
</XdPageContainer>
|
||
</template>
|
||
|
||
<script>
|
||
import { listEmisTempCreditSalesmen, getEmisTempCreditSalesmen, delEmisTempCreditSalesmen, addEmisTempCreditSalesmen, updateEmisTempCreditSalesmen } from "@/api/emis/emisTempCreditSalesmen";
|
||
import elDateSimplePicker from '@/components/DatePickerAdv/elDateSimplePicker';
|
||
// import emisTempCreditSalesmenView from '@/views/emis/emisTempCreditSalesmen/emisTempCreditSalesmenView';
|
||
import emisTempCreditSalesmenForm from '@/views/emis/emisTempCreditSalesmen/emisTempCreditSalesmenForm';
|
||
import EmpNamePicker1 from '@/views/emis/EmisBaseTools/EmpNamePicker.vue';
|
||
|
||
import NumberRangePicker from '@/components/NumberRange/NumberRangePicker';
|
||
import { formatSearchStr,deepClone } from '@/utils/index'
|
||
|
||
export default {
|
||
name: "EmisTempCreditSalesmen",
|
||
components: { elDateSimplePicker,emisTempCreditSalesmenForm,EmpNamePicker1,NumberRangePicker },
|
||
dicts: ['emis_biz_shipping_method'],
|
||
data() {
|
||
return {
|
||
// 遮罩层
|
||
loading: true,
|
||
// 选中数组
|
||
ids: [],
|
||
// 非单个禁用
|
||
single: true,
|
||
// 非多个禁用
|
||
multiple: true,
|
||
// 显示搜索条件
|
||
showSearch: true,
|
||
// 创建时间搜索
|
||
dateTimeRange:[],
|
||
// 总条数
|
||
total: 0,
|
||
// 销售信用额度表格数据
|
||
emisTempCreditSalesmenList: [],
|
||
|
||
currentId:null,
|
||
openForm: false,
|
||
titleForm: "",
|
||
|
||
// 弹出展示层
|
||
id:null,
|
||
titleView:"",
|
||
openView: false,
|
||
|
||
selectionList:null,
|
||
|
||
// 查询参数
|
||
queryParams: {
|
||
pageNum: 1,
|
||
pageSize: 20,
|
||
accCode: null,
|
||
tempCreditMoneyAdjust: null,
|
||
startDate: null,
|
||
endDate: null,
|
||
remark: null,
|
||
delFlag: null,
|
||
},
|
||
};
|
||
},
|
||
created() {
|
||
this.getList();
|
||
},
|
||
methods: {
|
||
getProperty(obj, str) {
|
||
str = str.replace(/\[(\w+)\]/g, ".$1"); // 处理数组下标
|
||
let arr = str.split(".");
|
||
for (let i in arr) {
|
||
obj = obj[arr[i]] || "";
|
||
}
|
||
return obj;
|
||
},
|
||
sortFun: function (attr, rev) {
|
||
//第一个参数传入info里的prop表示排的是哪一列,第二个参数是升还是降排序
|
||
if (rev == undefined||rev==null) {
|
||
rev = 1;
|
||
} else {
|
||
rev = (rev) ? 1 : -1;
|
||
}
|
||
let that=this;
|
||
return function (a, b) {
|
||
a = that.getProperty(a,attr);
|
||
b = that.getProperty(b,attr);
|
||
if (a < b) {
|
||
return rev * -1;
|
||
}
|
||
if (a > b) {
|
||
return rev * 1;
|
||
}
|
||
return 0;
|
||
}
|
||
},
|
||
// 排序 查询字段是表格中字段名字 动态取值排序顺序
|
||
handleSortChange(column) {
|
||
this.emisTempCreditSalesmenList = this.emisTempCreditSalesmenList.sort(
|
||
this.sortFun(column.prop, column.order === 'ascending')
|
||
);
|
||
},
|
||
/** 查询销售信用额度列表 */
|
||
getList() {
|
||
this.loading = true;
|
||
|
||
let qParam = {...this.queryParams}
|
||
|
||
listEmisTempCreditSalesmen(qParam).then(response => {
|
||
this.emisTempCreditSalesmenList = 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.id)
|
||
this.single = selection.length!==1
|
||
this.multiple = !selection.length
|
||
},
|
||
/** 新增按钮操作 */
|
||
handleAdd(row) {
|
||
this.currentId=null;
|
||
this.openForm= true;
|
||
this.titleForm = "新增";
|
||
},
|
||
/** 修改按钮操作 */
|
||
handleUpdate(row) {
|
||
this.currentId= row.id||this.ids[0];
|
||
this.openForm = true;
|
||
this.titleForm = "修改";
|
||
},
|
||
handleView(row) {
|
||
this.id=row.id;
|
||
this.titleView="查看";
|
||
this.openView=true;
|
||
// this.router.push({ path: '/emis/emisTempCreditSalesmen/viewDetail', query: { id: row.id }})
|
||
},
|
||
handleFormChanged(){
|
||
this.openForm = false;
|
||
this.getList();
|
||
},
|
||
cancelForm(){
|
||
this.openForm = false;
|
||
},
|
||
/** 删除按钮操作 */
|
||
handleDelete(row) {
|
||
const ids = row.id || this.ids;
|
||
this.$modal.confirm('是否确认删除').then(function() {
|
||
return delEmisTempCreditSalesmen(ids);
|
||
}).then(() => {
|
||
this.getList();
|
||
this.$modal.msgSuccess("删除成功");
|
||
}).catch(() => {});
|
||
},
|
||
/** 导出按钮操作 */
|
||
/** 导出按钮操作 */
|
||
handleExport() {
|
||
const loadingInstance = this.$loading({
|
||
text: '正在导出...'
|
||
})
|
||
if(this.selectionList&&this.selectionList.length>0){
|
||
this.exportData(this.selectionList,loadingInstance);
|
||
}
|
||
else{
|
||
let qParam = {...this.queryParams}
|
||
|
||
qParam.pageNum=1;
|
||
qParam.pageSize=20000;
|
||
|
||
listEmisTempCreditSalesmen(qParam).then(response => {
|
||
if (response.code === 200) {
|
||
this.exportData(response.rows,loadingInstance);
|
||
}
|
||
});
|
||
}
|
||
},
|
||
exportData(selData,loadingInstance){
|
||
const curList =selData
|
||
import('@/vendor/Export2Excel').then(excel => {
|
||
const exportParam=this.$refs.refTable.getExportParam();
|
||
const tHeader = exportParam.header;
|
||
const filterVal = exportParam.filter;
|
||
const data = this.formatJson(filterVal, curList, selData)
|
||
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 === 'curMoney') {
|
||
return (v['creditMoney'] - v['useMoney']).toFixed(2);
|
||
}
|
||
if (j === 'curMoneyRate') {
|
||
return (((v['creditMoney'] - v['useMoney'])/v['creditMoney'])*100 ).toFixed(2);
|
||
}
|
||
if (j === 'transType') {
|
||
return this.selectDictLabels(this.dict.type.emis_biz_shipping_method,v[j]);
|
||
}
|
||
|
||
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>
|