emis-frontend/src/views/emis/emisElectronicPagApply/sendList.vue
2024-06-24 09:22:55 +08:00

495 lines
17 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>
<div class="app-container">
<search-form :model="queryParams" ref="queryForm" size="small" :maxShow="6" label-width="68px" v-show="showSearch" @search="handleQuery" @reset="resetQuery">
<el-form-item :label="$t('流水号')" prop="applySeq">
<el-input
v-model="queryParams.applySeq"
:placeholder="$t('多个流水号逗号或换行隔开')"
clearable
type="textarea"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item :label="$t('申购时间范围(31天)')" prop="applyDate" label-width="140px">
<elDateSimplePicker clearable v-model="dateTimeRange" :placeholder="$t('申购时间')" style="z-index:9999" ></elDateSimplePicker>
</el-form-item>
<el-form-item :label="$t('发放状态')" prop="blSend">
<el-select clearable v-model="queryParams.blSend" placeholder="请选择">
<el-option
v-for="dict in dict.type.emis_proc_send_status"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<!-- emis_proc_send_status -->
<el-form-item label="取消状态" prop="blCancel">
<el-select clearable v-model="queryParams.blCancel" placeholder="请选择">
<el-option
v-for="dict in dict.type.emis_cancel_status"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="物料品名" prop="materialCode">
<el-select clearable v-model="queryParams.materialCode" placeholder="请选择">
<el-option
v-for="dict in dict.type.emis_material_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
</search-form>
<XdTable v-loading="loading"
border
size="small"
:data="emisElectronicPagApplyList"
: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
size="mini"
@click="handleSend"
v-hasPermi="['emis:emisElectronicPagApply:send']"
>发放</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="primary"
plain
size="mini"
@click="handleCancel"
v-hasPermi="['emis:emisElectronicPagApply:cancel']"
>取消</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:emisElectronicPagApply: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="applySeq" min-width="180" />
<el-table-column :label="$t('申购网点')" align="center" prop="applySiteName" min-width="100" />
<el-table-column :label="$t('申购时间')" align="center" prop="applyDate" min-width="170" />
<el-table-column :label="$t('物料品名')" align="center" prop="materialCode" width="100" >
<template slot-scope="scope">
<dict-tag :options="dict.type.emis_material_type" :value="scope.row.materialCode"/>
</template>
</el-table-column>
<el-table-column :label="$t('物品单价')" align="center" prop="unitMoney" width="80" />
<el-table-column :label="$t('申请数量')" align="center" prop="applyCount" width="80" />
<el-table-column :label="$t('总金额')" align="center" prop="sumMoney" min-width="100" />
<el-table-column :label="$t('申购备注')" align="center" prop="remark" min-width="100" />
<el-table-column :label="$t('是否发放')" align="center" prop="blSend" width="100" >
<template slot-scope="scope">
<el-tag type="success" v-if="scope.row.blSend == '1'">是</el-tag>
<span v-else>否</span>
</template>
</el-table-column>
<el-table-column :label="$t('发放时间')" align="center" prop="sendDate" min-width="170" />
<el-table-column :label="$t('发放人')" align="center" prop="sendManName" min-width="100" />
<el-table-column :label="$t('发放网点')" align="center" prop="sendSiteName" min-width="100" />
<el-table-column :label="$t('是否取消')" align="center" prop="blCancel" width="100" >
<template slot-scope="scope">
<el-tag type="danger" v-if="scope.row.blCancel == '1'">是</el-tag>
<span v-else>否</span>
</template>
</el-table-column>
<el-table-column :label="$t('取消人')" align="center" prop="cancelManName" min-width="100" />
<el-table-column :label="$t('取消时间')" align="center" prop="cancelDate" min-width="170" />
<el-table-column :label="$t('取消网点')" align="center" prop="cancelSiteName" min-width="100" />
<el-table-column :label="$t('发放人')" align="center" prop="sendManName" min-width="100" />
<el-table-column :label="$t('发放中心')" align="center" prop="sendSiteName" min-width="100" />
<el-table-column :label="$t('申购人')" align="center" prop="applyManName" 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>
</div>
</template>
<script>
import { listEmisElectronicPagApply, getEmisElectronicPagApply, delEmisElectronicPagApply, addEmisElectronicPagApply, updateEmisElectronicPagApply } from "@/api/emis/emisElectronicPagApply";
import elDateSimplePicker from '@/components/DatePickerAdv/elDateSimplePicker';
import { getDateTimeToString } from '@/utils/payutils'
import {dateToStr} from '@/utils/custom'
import { sendByApply,cancelApply } from "@/api/emis/emisElectronicPagApply";
export default {
name: "emisElectronicPagApply",
components: { elDateSimplePicker},
dicts: ['emis_material_type','emis_cancel_status','emis_proc_send_status'],
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 创建时间搜索
dateTimeRange:[],
// 总条数
total: 0,
// 网点电子面单申请表格数据
emisElectronicPagApplyList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
openForm: false,
titleForm: "",
titleEmisElectronicPagApply: "",
openEmisElectronicPagApply: false,
// 显示编辑框更多
moreInputVisible: false,
// 弹出展示层
currentId:null,
id:null,
titleView:"",
openView: false,
// 备注时间范围
daterangeApplyDate: [],
// 备注时间范围
daterangeCreateTime: [],
// 备注时间范围
daterangeUpdateTime: [],
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 20,
prefix: null,
applySeq: null,
applyDate: null,
provideType: null,
materialCode: null,
materialName: null,
applyManCode: null,
applySiteCode: null,
applyCount: null,
unitMoney: null,
sumMoney: null,
blSend: '0',
sendDate: null,
sendManCode: null,
sendSiteCode: null,
sendCenterManCode: null,
sendCenterSiteCode: null,
blCancel: '0',
cancelManCode: null,
cancelDate: null,
cancelSiteCode: null,
userSiteCode: null,
provideFlag: '1',
delFlag: null,
remark: null,
},
// 表单参数
form: {},
// 表单校验
rules: {
id: [
{ required: true, message: "id不能为空", trigger: "blur" }
],
}
};
},
created() {
this.getList();
},
methods: {
/** 查询网点电子面单申请列表 */
getList() {
this.loading = true;
this.queryParams.params = {};
if(this.dateTimeRange&&this.dateTimeRange.length==2){
let startDate = new Date(this.dateTimeRange[0]);
let endDate= new Date(this.dateTimeRange[1]);
startDate=dateToStr(startDate);
endDate=dateToStr(endDate)
this.queryParams.params["beginApplyDate"] = startDate;
this.queryParams.params["endApplyDate"] = endDate;
}
listEmisElectronicPagApply(this.queryParams).then(response => {
this.emisElectronicPagApplyList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
applySeq: null,
applyDate: getDateTimeToString(new Date()),
provideType: null,
applyName: null,
applyMan: null,
applyManCode: null,
applySite: null,
applySiteCode: null,
unitMoney: null,
applyCount: null,
sumMoney: null,
blSend: null,
sendDate: null,
sendMan: null,
sendManCode: null,
sendSite: null,
sendSiteCode: null,
blCancel: null,
cancelMan: null,
cancelManCode: null,
cancelDate: null,
cancelSite: null,
cancelSiteCode: null,
userSite: null,
userSiteCode: null,
startNo: null,
endNo: null,
curStartNo: null,
hasBillCount: null,
blAllowAllocate: null,
createSiteCode: null,
modifySiteCode: null,
delFlag: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
remark: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
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
},
// 排序 查询字段是表格中字段名字 动态取值排序顺序
handleSortChange(column) {
this.queryParams.orderByColumn = column.prop;
this.queryParams.isAsc = column.order;
this.getList();
},
/** 新增按钮操作 */
handleAdd(row) {
this.reset();
this.openForm = true;
this.titleForm = "新增申购";
},
handleShowMoreInput(){
this.moreInputVisible = !this.moreInputVisible;
},
handleSend(){
if (this.ids && this.ids.length>0) {
this.$confirm("确认发放?", "提示", {
cancelButtonText: "返回",
confirmButtonText: "确认发放",
type: "warning",
distinguishCancelAndClose: true,
closeOnClickModal: false
}).then(async () => {
for(let i=0;i<this.ids.length;i++)
{
let id=this.ids[i];
let postData={id:id};
let res=await sendByApply(postData)
}
this.$modal.msgSuccess("发放成功");
this.getList();
});
}
},
handleCancel(){
// const id =this.ids[0];
if (this.ids && this.ids.length>0) {
this.$confirm("确认取消?", "提示", {
cancelButtonText: "返回",
confirmButtonText: "确认取消",
type: "warning",
distinguishCancelAndClose: true,
closeOnClickModal: false
}).then(async () => {
for(let i=0;i<this.ids.length;i++)
{
let id=this.ids[i];
let postData={id:id};
let res=await cancelApply(postData)
}
this.$modal.msgSuccess("取消成功");
this.getList();
});
}
},
handleFormChanged(){
this.openForm = false;
this.getList();
},
cancelForm(){
this.openForm = false;
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除').then(function() {
return delEmisElectronicPagApply(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
// this.download('emis/emisElectronicPagApply/export', {
// ...this.queryParams
// }, `emisElectronicPagApply_${new Date().getTime()}.xlsx`)
const loadingInstance = this.$loading({
text: '正在导出...'
})
var qParam = {...this.queryParams};
qParam.pageNum=1;
qParam.pageSize=5000;
listEmisElectronicPagApply(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 = ['id','申购序号','申购时间','申购类型:网点','物料名称:电子面单','申购人','申购人编号','申购站点','申购站点编号','单价','申请数量','总金额','是否已发放','发放时间','发放人','发放人编号','发放站点','发放站点代码','是否取消','取消人','取消人代码','取消时间','取消站点','取消站点代码','面单用户站点','面单用户站点代码','分配开始编号','分配结束编号','已使用当前编号','剩余数量','是否允许自动分配单号','创建站点代码','修改站点代码','删除标志(0代表存在','创建者','创建时间','更新者','更新时间','备注',];
const filterVal = ['id','applySeq','applyDate','provideType','applyName','applyMan','applyManCode','applySite','applySiteCode','unitMoney','applyCount','sumMoney','blSend','sendDate','sendMan','sendManCode','sendSite','sendSiteCode','blCancel','cancelMan','cancelManCode','cancelDate','cancelSite','cancelSiteCode','userSite','userSiteCode','startNo','endNo','curStartNo','hasBillCount','blAllowAllocate','createSiteCode','modifySiteCode','delFlag','createBy','createTime','updateBy','updateTime','remark',];
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>