<!doctype html>
|
<html>
|
<head>
|
<meta charset="utf-8"><meta http-equiv="Expires" content="0"><meta http-equiv="Pragma" content="no-cache"><meta http-equiv="Cache-control" content="no-cache"><meta http-equiv="Cache" content="no-cache">
|
<title>返还申请</title>
|
<script src="../../../jsnew/elementDefault.js?v=20220425"></script>
|
<script src="../../../jsnew/vue/vue.js"></script>
|
<script src="../../../jsnew/vue/element-ui/element-ui_15/index.js"></script>
|
<script src="../../../jsnew/myelement.js?v=20220425"></script>
|
<script src="../../../jsnew/page.js?v=20220425"></script>
|
<!-- <script src="../../../setting.js"></script> -->
|
|
<link href="../../../jsnew/vue/element-ui/element-ui_15/theme-chalk/index.css" rel="stylesheet">
|
<link href="../../../jsnew/myelement.css?v=20220426" rel="stylesheet">
|
<link href="../../../jsnew/theme.css?v=20220426" rel="stylesheet">
|
<link href="../../../css/iconfont.css" rel="stylesheet">
|
<link href="../../../jsnew/page.css?v=20220425" rel="stylesheet">
|
<link href="//at.alicdn.com/t/font_2374495_13ltsxm2eor.css" rel="stylesheet">
|
</head>
|
|
<body style="margin: 0px;">
|
<div v-cloak id="vbody">
|
<div id="page_root">
|
<div ref="popup_body" style="padding: 0 20px;">
|
<div class="el-dialog__header">
|
<div class="dialog-title">
|
<i class="iconfont icon-customermanagement"></i>
|
<span> {{title}}</span>
|
</div>
|
</div>
|
|
<div class="el-dialog__footer" v-if="isapproval || isbrowse">
|
<el-button size="small" v-if="isapproval" type="success" @click="approvalOp(true)">批 准</el-button>
|
<el-button size="small" v-if="isapproval" type="danger" @click="approvalOp(false)">拒 绝</el-button>
|
<el-button size="small" type="default" @click="closeDialog">取 消</el-button>
|
</div>
|
|
<div :style="{height: t_height +'px', 'overflow-y': 'auto'}">
|
<div class="el-dialog__body">
|
<h-form
|
ref="form1"
|
:form-attr="formAttr"
|
:table-fields="formFields"
|
:form-data="formData"
|
:table-field-click="formfieldClick"
|
>
|
</h-form>
|
|
<div class="h_dialog__body">
|
<div v-if="isedit || isrefuseedit" style="display: flex; margin-top: 10px;">
|
<div style="margin-left: auto;">
|
<el-button-group style="display: flex;">
|
<!-- <el-button @click="addTableData">新增明细</el-button>
|
<el-button @click="">模板下载</el-button>
|
<el-button @click="">导 入</el-button> -->
|
<el-button size="small" type="primary" @click="selectDetails" style="margin-right: 30px;">选择返还明细</el-button>
|
<el-button size="small" type="primary" id="btn-change-1" v-if="btnRefresh" @click="returnDefault">一键返还</el-button>
|
<el-button size="small" type="default" id="btn-change-2" v-if="btnRefresh" @click="returnBySelf">手动返还</el-button>
|
</el-button-group>
|
</div>
|
</div>
|
|
<h-table
|
v-if="isRefresh && tableFields.length"
|
ref="table1"
|
:table-fields="tableFields"
|
:table-data="tableData"
|
:is-edit-table-data="false"
|
:is-within-edit-table-data="true"
|
:is-pagination="false"
|
:table-field-click="tablefieldClick"
|
:is-show-index="true"
|
:edit-table-button="editTableButton"
|
:isdraggableorder="false"
|
|
v-on:get-data="getData"
|
v-on:del-data="delData"
|
>
|
</h-table>
|
</div>
|
</div>
|
</div>
|
|
<div v-if="showApprovalInfo" style="border-top: 15px">
|
<!-- <iframe :src="'../../approval/ApprovalList_page.html?flow_id=' + flow_id" style="width: 100%; height: 100%; border: 0px;"></iframe> -->
|
<div style="width: 100%; height: 100%; border: 0px;">
|
<div class="topbar">
|
<span>审批记录</span>
|
|
<div style="float: right; margin-right: 20px;">
|
<el-button-group>
|
<!-- <el-button :disabled="isexport_pdf" @click="" :loading="export_loading">导出</el-button> -->
|
<el-button @click="onShowApproval">查看流程图</el-button>
|
<!-- <el-button type="default" @click="closeDialog">关 闭</el-button> -->
|
</el-button-group>
|
</div>
|
</div>
|
<div class="versionNo">
|
<h-table
|
v-if="isRefresh"
|
ref="table3"
|
:table-fields="tableFields3"
|
:table-data="tableData3"
|
:table-height="tableHeight"
|
:isdraggableorder="false"
|
:is-pagination="false"
|
:table-field-click="tablefieldClick"
|
>
|
</h-table>
|
</div>
|
</div>
|
</div>
|
<el-dialog :title="approvalTitle" :close-on-click-modal="false" :visible.sync="reasonvisible" height="50%">
|
<el-input
|
type="textarea"
|
:autosize="{ minRows: 2, maxRows: 10}"
|
placeholder="请输入原因"
|
v-model="approveremark">
|
</el-input>
|
|
<h-form
|
ref="form3"
|
:form-attr="formAttr3"
|
:table-fields="formFields3"
|
:form-data="formData3"
|
:table-field-click="formfieldClick"
|
>
|
</h-form>
|
|
<div slot="footer" class="dialog-footer" >
|
<el-button type="default" @click="reasonvisible = false">取 消</el-button>
|
<el-button type="primary" :loading="false" @click="saveReason">确 定</el-button>
|
</div>
|
</el-dialog>
|
<el-dialog title="附件列表" :close-on-click-modal="false" :visible.sync="showFileList" width="30%" height="10%">
|
<div class="versionNo">
|
<h-table
|
v-if="isRefresh"
|
ref="table1"
|
:table-fields="tableFields4"
|
:table-data="tableData4"
|
:table-height="250"
|
:is-pagination="false"
|
:table-field-click="tablefieldClick"
|
>
|
</h-table>
|
</div>
|
</el-dialog>
|
|
<div class="el-dialog__footer" v-if="!isapproval && !isbrowse">
|
<el-button size="small" type="default" @click="closeDialog">取 消</el-button>
|
<el-button size="small" v-if="isedit || isrefuseedit" type="primary" @click="saveRowTable">保 存</el-button>
|
<el-button size="small" v-if="isedit || isrefuseedit" type="success" @click="submitRowTable">提 交</el-button>
|
</div>
|
</div>
|
</div>
|
</div>
|
|
<div id="page_loading" style="position: absolute; top:0px; width: 100vw; height: 50vh;">
|
<div class="spinner">
|
<div class="cube1"></div>
|
<div class="cube2"></div>
|
</div>
|
</div>
|
|
<script type="text/javascript">
|
function initVue() {
|
new FormVue({
|
el: "#vbody",
|
data: {
|
dataname: "pkg_fb_approval",
|
table_dataname: "fb_approval_detail",
|
title: "返还申请",
|
dataurl: "rootjemin/data/getEntitySet",
|
options: [],
|
|
formAttr: {
|
columnnumber: 2,
|
labelwidth: "120px",
|
labelposition: "left",//"left",// right//top
|
size: "mini",
|
border: "0px solid #c6c6c600"
|
},
|
default_formFields: [
|
{isshow: "T", required: true, field: "customer_name", name: "商业名称", inputtype: "popup"},
|
{
|
isshow: "T", required: true, field: "plan_id", name: "折让类型", inputtype: "select",
|
options:[],
|
},
|
{
|
isshow: "T", required: true, field: "rule_id", name: "返还规则", type: "checkboxobjgroup",colspan: 2,
|
options: [],buttonname: "规则配置",
|
},
|
{isshow: "T", required: false, field: "amount", name: "返还总金额", inputtype: "span", pattern: '^[0-9]+(/.[0-9]{0,4})?$'},
|
],
|
formFields: [],
|
formfieldClick: {},
|
formData: {
|
// type_code: "1",
|
rule_id: [
|
|
],
|
// customer_name: "云南博泰药业有限公司",
|
// province:"云南省",
|
amount: "",
|
},
|
|
default_tableFields: [
|
{isshow: "T", field: "customer_code", name: "商业编码", width: "150", type: "span", isminwidth: true,},
|
{isshow: "T", field: "customer_name", name: "商业名称", width: "200", align: "left", type:"span", isminwidth: true,},
|
{isshow: "T", field: "task_code", name: "折让明细编码", type: "span", width: "150",},
|
{isshow: "T", field: "create_time", name: "创建时间", type: "span", formatter: "formatter_date", width: "150",},
|
{isshow: "T", field: "diff_amt", name: "应返还金额", width: "150", type:"span", formatter: "formatter_money", align: "right"},
|
{isshow: "F", field: "approve_amt", name: "实际返还金额", width: "150", type:"span", formatter: "formatter_money", align: "right"},
|
],
|
tableFields: [],
|
newTableData: {
|
// create_time: createDatetime(),
|
// creator_name: window.top.vue.userinfo.name,
|
},
|
tableData: [],
|
|
//审批相关
|
formAttr3: {
|
istitle: false,
|
title: "表单名称",
|
columnnumber: 2,
|
labelwidth: "140px",
|
labelposition: "left",//"left",// right//top
|
size: "mini",
|
border: "3px solid #c6c6c600"
|
},
|
default_tableFields3: [
|
{isshow: "T", field: "node_name", name: "当前节点", width: "150", type:"span", required: true},
|
{isshow: "T", field: "end_time", name: "申请/审批时间", width: "100", type:"span", formatter: "formatter_date", required: true, isminwidth: true,},
|
{isshow: "T", field: "pass", name: "审批情况", width: "150", type:"span", required: true, isminwidth: true,},
|
{isshow: "T", field: "reason", name: "原因", width: "150", type: "span", required: true, isminwidth: true,},
|
{isshow: "T", field: "user_name", name: "申请/审批人", width: "150", type:"span", required: true, isminwidth: true,},
|
{isshow: "T", field: "viewFile", name: "附件", width: "200", type:"span", required: true, isminwidth: true,},
|
],
|
tableFields3: [],
|
tableFields4: [
|
{isshow: "T", field: "attachment_name", name: "附件", width: "200", type:"span", required: true, isminwidth: true,},
|
],
|
tableData3: [],
|
tableData4: [],
|
|
formFields3: [],
|
formData3: {},
|
default_formFields3: [
|
{isshow: "T", field: "files2", name: "附件", type: "uploadfilelist"},
|
],
|
approvalTitle: '通过原因',
|
approveremark: "",
|
|
dataRequest: [
|
{
|
name: "fee_model_plan",
|
url: "rootjemin/data/getEntitySet",
|
paramsobj: {dataname: "fee_model_plan", filter: "type='common'"},//id in ('P001', 'P003', 'P004', 'P007')
|
isnotoption: false, //true:不是选项
|
},
|
{
|
name: "fb_rule",
|
url: "rootjemin/data/getEntitySet",
|
paramsobj: {dataname: "fb_rule", filter: ""},
|
}
|
],
|
planMap: {},
|
|
//字段设置
|
tablefieldClick: {},
|
formfieldClick: {},
|
|
//按键权限设置
|
isedit: false,//提交前编辑,保存/提交
|
isrefuseedit: false,//拒绝后编辑,保存/再次提交
|
isapproval: false,//审批,同意/拒绝/转办/退回
|
isbrowse: false,
|
isend: false,
|
|
iscommit: false,//提交标记
|
|
//弹窗参数
|
popupParames: {},
|
|
flow_id: "c1355b3fd4b049f28135548d17f2071f",
|
t_height:null,
|
isRefresh: true,
|
btnRefresh: true,
|
|
reasonvisible: false,
|
showFileList: false,
|
showApprovalInfo: false,
|
|
selectedrows: [],
|
state: "",
|
type_name: "",
|
returnSum: "4000",
|
rule_id: [],
|
rule_rate: [],
|
currentBtn: "auto",
|
|
notSave: false
|
},
|
computed: {
|
formDataRuleId() {
|
return this.formData.rule_id;
|
}
|
},
|
watch: {
|
formDataRuleId: function (newVal, oldVal) {
|
this.rule_id = newVal
|
this.changeTableField()
|
},
|
deep:true
|
},
|
created() {
|
this.popupParames = clone(Root.popupParames);
|
this.title = this.popupParames.title || this.popupParames.text;
|
if (this.popupParames.data) {
|
this.formData = clone(this.popupParames.data);
|
if (this.formData.state_name) {
|
this.state = clone(this.formData.state_name);
|
}
|
if (this.formData.type_name) {
|
this.type_name = clone(this.formData.type_name);
|
}
|
}
|
|
if (this.popupParames.delta && this.popupParames.delta.type_name) {
|
this.type_name = clone(this.popupParames.delta.type_name);
|
}
|
|
if (this.popupParames.sceneCode) {
|
if (this.popupParames.sceneCode == "add") {//新增
|
// if (this.newformData) {
|
// let formData_ = clone(this.formData);
|
|
// for (var k in this.newformData) {
|
// formData_[k] = this.newformData[k];
|
// }
|
// this.formData = formData_;
|
// }
|
|
// if (this.newTableData) {
|
// this.tableData.push(clone(this.newTableData));
|
// }
|
// this.tableData = [];
|
this.isedit = true;
|
|
var newEntity_ = {
|
name: "newEntity",
|
url: "rootjemin/data/newEntity",
|
paramsobj: {dataname: "pkg_fb_approval"},
|
isnotoption: true, //true:不是选项
|
}
|
this.dataRequest.push(newEntity_);
|
}
|
else if (this.popupParames.sceneCode == "browse") {//只读
|
this.formAttr.disabled = true;
|
this.isbrowse = true;
|
// this.formAttr2.disabled = true;
|
}
|
else if (this.popupParames.sceneCode == "edit") {//编辑
|
this.isedit = true;
|
}
|
else if (this.popupParames.sceneCode == "approval") {//审批
|
this.formAttr.disabled = true;
|
// this.formAttr2.disabled = true;
|
this.isapproval = true;
|
}
|
else if (this.popupParames.sceneCode == "refuseedit") {//拒绝后的编辑
|
this.isrefuseedit = true;
|
}
|
}
|
},
|
|
mounted() {
|
var me = this;
|
me.t_height = document.documentElement.clientHeight*1 - 100;
|
//预加载数据
|
if (this.dataRequest && this.dataRequest.length) {
|
var result = {};
|
this.loadRequestData(this.dataRequest, result, function(data) {
|
me.dataRequestObj = data;
|
//预加载数据后给哪些字段设置options或formatterjson
|
if (me.dataRequestObj.newEntity) {
|
var formData = clone(me.dataRequestObj.newEntity.data["fb_approval"]);
|
formData.rule_id = []
|
me.formData = formData;
|
}
|
if (data && data.fb_rule.data.entityset) {
|
data.fb_rule.data.entityset.map(s => {
|
s.code = s.id
|
s.value = s.name
|
s.groupname = s.group_name
|
})
|
|
me.options = data.fb_rule.data.entityset
|
}
|
me.initData();
|
});
|
}
|
else {
|
this.initData();
|
}
|
|
// 以服务的方式调用的 Loading 需要异步关闭
|
this.$nextTick(() => {
|
hideLoading();
|
|
//重新设置弹窗宽高
|
this.$nextTick(function(){
|
let w_ = this.$refs.popup_body.offsetWidth + "px";
|
// let w_ = "900px";
|
let h_ = this.$refs.popup_body.offsetHeight + "px";
|
Root.setPopupWH(w_, h_);
|
})
|
});
|
},
|
|
methods:{
|
//关闭弹窗
|
closeDialog() {
|
var me = this;
|
if (me.popupParames.totab){
|
Root.tab.removeItem(Root.tab.selected);
|
Root.tab.open(me.popupParames.parentOption, false);
|
}
|
else {
|
Root.hidePopup();
|
}
|
},
|
//关闭前调回调
|
saveAfter() {
|
var me = this;
|
if(this.popupParames.callback) {
|
let obj = {
|
//row: this.formData
|
}
|
this.popupParames.callback(obj, function() {
|
me.closeDialog();
|
});
|
}
|
else {
|
me.closeDialog();
|
}
|
},
|
|
initData() {
|
let me = this
|
var id_ = null;
|
|
if (this.formData.id) {
|
id_ = this.formData.id;
|
}
|
this.dataurl = "rootjemin/data/getEntity"
|
this.getRowDataById(id_, function(result) {//查询后的回调,用于获取字段的
|
me.dataurl = "rootjemin/data/getEntitySet"
|
if (result.meta && result.meta['fb_approval'] && result.meta['fb_approval'].fields) {
|
var metas = clone(result.meta['fb_approval'].fields);
|
|
table_metas = clone(result.meta[me.table_dataname].fields);
|
|
var formFields_ = [];
|
var tableFields_ = [];
|
metas.map(f=>{
|
f.isshow = "T";
|
formFields_.push(clone(f));
|
})
|
table_metas.map(f=>{
|
f.isshow = "T";
|
tableFields_.push(clone(f));
|
})
|
|
if (!me.formFields || (me.formFields && me.formFields.length == 0)) {
|
let options = listTOListGroup(me.options, "groupname", "name");
|
me.default_formFields.map(f => {
|
if(f.field == "rule_id") {
|
f.options = options;
|
}
|
if (f.field == 'plan_id') {
|
me.dataRequestObj.fee_model_plan.data.entityset.map(e => {
|
e.value = e.name
|
e.code = e.id
|
|
me.planMap[e.id] = e.name
|
})
|
f.options = me.dataRequestObj.fee_model_plan.data.entityset
|
}
|
})
|
|
if (!me.formData.rule_id) {
|
me.default_tableFields.map(f => {
|
if(f.field == "approve_amt") {
|
f.isshow = "T";
|
}
|
})
|
}
|
|
me.formFields = clone(me.default_formFields);
|
me.tableFields = clone(me.default_tableFields);
|
|
me.tableFields3 = clone(me.default_tableFields3);
|
me.formFields3 = clone(me.default_formFields3);
|
|
|
//字段数组转字段obj
|
me.fieldsToFieldsObj();
|
//设置字段事件
|
me.tableFieldClick();
|
}
|
}
|
|
if (me.rowData['fb_approval']) {
|
if (me.rowData['fb_approval']['rule_id']) {
|
me.rowData['fb_approval']['rule_id'] = [me.rowData['fb_approval']['rule_id']]
|
}
|
me.formData = me.rowData['fb_approval'];
|
|
if (me.formData.flow_id) {
|
me.showApprovalInfo = true
|
me.getApprovalHisInfo(me.formData.flow_id || "")
|
}
|
if (me.popupParames.sceneCode == "approval" && me.formData.readed != "T") {
|
me.setPolicyReaded()
|
}
|
}
|
if (me.rowData['fb_approval_detail']) {
|
me.rowData['fb_approval_detail'].map(e => {
|
e.diff_amt = e.cope_amt
|
e.customer_code = me.formData.customer_code
|
e.customer_name = me.formData.customer_name
|
})
|
me.tableData = me.rowData['fb_approval_detail'];
|
}
|
|
if (me.formData.id && !me.formData.rule_id && me.formData.status && (me.formData.status == "input" || me.formData.status == "refuse")) {
|
me.returnBySelf('notClear')
|
}
|
})
|
},
|
|
changeTableField() {
|
let tableFields = clone(this.default_tableFields)
|
|
if (this.dataRequestObj && this.dataRequestObj.fb_rule && this.dataRequestObj.fb_rule.data.entityset) {
|
this.rule_rate = []
|
this.rule_id.map(e => {
|
let obj = this.dataRequestObj.fb_rule.data.entityset.filter(s => s.id == e)[0]
|
let list = {id: obj.id, rate: obj.rate, isshow: "T", field: obj.rule_name, name: obj.rule_name, width: "150", type:"span", formatter: "formatter_money", align: "right"}
|
tableFields.push(list)
|
this.rule_rate.push(obj.rate)
|
})
|
}
|
|
if (this.currentBtn == "self") {
|
tableFields.map(s => {
|
if (s.field == "approve_amt") {
|
s.isshow = "T"
|
s.type = "input"
|
}
|
})
|
}
|
|
this.tableFields = tableFields
|
|
if (this.tableData.length > 0) {
|
let tableData = clone(this.tableData)
|
let amount = 0
|
tableData.map(e => {
|
tableFields.map(s => {
|
if (s.id) {
|
e[s.field] = (parseFloat(e.diff_amt) * s.rate).toFixed(2)
|
//amount += e[s.field]
|
}
|
})
|
})
|
|
//this.$set(this.formData, 'amount', amount)
|
|
this.tableData = tableData
|
}
|
},
|
|
selectDetails() {
|
var me = this;
|
|
if (!me.formData.customer_code) {
|
Root.message({
|
type: 'warning',
|
message: '请先选择商业'
|
});
|
return
|
}
|
if (!me.formData.plan_id) {
|
Root.message({
|
type: 'warning',
|
message: '请先选择折让类型'
|
});
|
return
|
}
|
|
var config = {
|
totab: false, //true: 以Tab导航的方式打开
|
width: "900px",
|
height: "450px",
|
icon: "icon-product",
|
text: "选择返还明细",
|
id: "popup_back_info",//totab: true时需设置,用于判断是否已打开此页面
|
url: "../tradeDiscount/discount/popup_back_list.html",
|
data: {},
|
delta: {},
|
dataname: "fee_book_detail",
|
filter: " customer_code = '" + me.formData.customer_code + "' and plan_id = '" + me.formData.plan_id + "' and diff_amt > 0",
|
sceneCode: "add", //"add"//"browse",
|
callback: function(data, callback) {
|
me.tableFields.map(e => {
|
if (e.rate) {
|
data.map(s => {
|
s[e.field] = s.diff_amt * e.rate
|
})
|
}
|
})
|
|
me.tableData = data
|
|
if (callback) {
|
callback();
|
}
|
}
|
};
|
me.doPopupByPublic(config);
|
},
|
|
//手动返还
|
returnBySelf(remark) {
|
var me = this;
|
|
this.currentBtn = "self"
|
|
document.getElementById('btn-change-1').type = "default"
|
document.getElementById('btn-change-2').type = "primary"
|
document.getElementById('btn-change-1').className = "el-button el-button--default el-button--mini"
|
document.getElementById('btn-change-2').className = "el-button el-button--primary el-button--mini"
|
// this.$nextTick(() => {
|
// this.btnRefresh = false
|
// this.btnRefresh = true
|
// })
|
|
this.rule_id = []
|
let formData = clone(this.formData)
|
formData.rule_id = []
|
this.formData = formData
|
|
let formFields = clone(this.formFields)
|
formFields.map(e => {
|
if (e.field == 'rule_id') {
|
e.disabled = true
|
}
|
})
|
this.formFields = formFields
|
|
if (remark && remark == "notClear") {
|
|
}
|
else {
|
for (var td in me.tableData) {
|
if (me.tableData[td].approve_amt) {
|
me.tableData[td].approve_amt = "";
|
}
|
}
|
}
|
|
var tableFields_ = clone(me.tableFields);
|
tableFields_.map( t=> {
|
if (t.field == "approve_amt") {
|
t.isshow = "T";
|
t.type = "input";
|
// t.inputkeys = "number";
|
}
|
})
|
me.tableFields = clone(tableFields_);
|
},
|
|
//一键返还
|
returnDefault() {
|
var me = this;
|
|
this.currentBtn = "auto"
|
|
document.getElementById('btn-change-1').type = "primary"
|
document.getElementById('btn-change-2').type = "default"
|
document.getElementById('btn-change-1').className = "el-button el-button--primary el-button--mini"
|
document.getElementById('btn-change-2').className = "el-button el-button--default el-button--mini"
|
// this.$nextTick(() => {
|
// this.btnRefresh = false
|
// this.btnRefresh = true
|
// })
|
|
let formFields = clone(me.formFields)
|
formFields.map(e => {
|
if (e.field == 'rule_id') {
|
e.disabled = false
|
}
|
})
|
me.formFields = formFields
|
|
var sum = clone(me.returnSum);
|
|
var tableFields_ = clone(me.tableFields);
|
tableFields_.map( t=> {
|
if (t.field == "approve_amt") {
|
t.isshow = "F";
|
// t.inputkeys = "number";
|
}
|
})
|
me.tableFields = clone(tableFields_);
|
},
|
|
returnData() {
|
var me = this;
|
var sum_ = 0;
|
me.stepspageobj[1].tableData.map( td => {
|
sum_ += td.approve_amt*1;
|
})
|
if (sum_ != me.returnSum) {
|
Root.message({
|
type: 'error',
|
message: '输入的总返还金额为:' + me.returnSum + ', 与实际的返还总金额:' + sum_ + '不相等。请重新调整'
|
});
|
return;
|
} else {
|
Root.message({
|
type: 'success',
|
message: '已成功返还'
|
});
|
me.saveAfter();
|
}
|
},
|
|
tableFieldClick() {
|
var me = this;
|
//筛选字段事件设置
|
this.filterfieldClick = {};
|
|
//表单字段事件设置
|
this.formfieldClick = {
|
rule_id: {
|
button: {
|
onclick: function(obj) {
|
var config = {
|
totab: true,
|
id: "1213",
|
text: "返还规则配置",
|
url: "../tradeDiscount/discount/return_rule_config.html",
|
};
|
|
window.top.tab.open(config);
|
}
|
}
|
},
|
attachment_name: {
|
buttonarray: {
|
onclick: function(obj) {
|
var filenamefield = obj.obj.field;
|
var fileidfield = "attachment_name";
|
if(obj.buttonobj && obj.buttonobj.code == "showfilebyfile"){
|
me.showFileImgByFileId(obj.buttonobj.fileobj);
|
}else if (obj.buttonobj && obj.buttonobj.code == "uploadlist"){
|
me.onPopupByUploadFile(filenamefield, fileidfield, me.dataname);
|
}else if (obj.buttonobj && obj.buttonobj.code == "delfilebyfile"){
|
me.deleteByFileId(filenamefield, obj.buttonobj.fileobj);
|
}
|
}
|
}
|
},
|
files2: {
|
buttonarray: {
|
onclick: function(obj) {
|
var filenamefield = obj.obj.field;
|
var fileidfield = "files2";
|
if(obj.buttonobj && obj.buttonobj.code == "showfilebyfile"){
|
me.showFileImgByFileId(obj.buttonobj.fileobj, true);
|
}else if (obj.buttonobj && obj.buttonobj.code == "uploadlist"){
|
me.onPopupByUploadFile(filenamefield, fileidfield, me.dataname, true);
|
}else if (obj.buttonobj && obj.buttonobj.code == "delfilebyfile"){
|
me.deleteByFileId(filenamefield, obj.buttonobj.fileobj, true);
|
}
|
}
|
}
|
},
|
customer_name: {
|
popup: {
|
onclick: function(obj) {//弹窗点击事件
|
//打开
|
me.open_customerlist(obj);
|
}
|
},
|
},
|
plan_id: {
|
select: {
|
onchange: function(obj) {//弹窗点击事件
|
obj.data.plan_id = obj.selectoption.code
|
obj.data.plan_name = obj.selectoption.name
|
|
obj.data.rule_id = []
|
|
let options = listTOListGroup(me.options.filter(item => item.plan_id == obj.data.plan_id), "groupname", "name");
|
me.default_formFields.map(f => {
|
if(f.field == "rule_id") {
|
f.options = options;
|
}
|
})
|
|
me.formFields = clone(me.default_formFields);
|
me.formFields3 = clone(me.default_formFields3);
|
|
|
//字段数组转字段obj
|
me.fieldsToFieldsObj();
|
//设置字段事件
|
me.tableFieldClick();
|
|
if (me.formData.customer_code) {
|
//me.getCanBackList()
|
}
|
}
|
},
|
},
|
};
|
|
//表格字段事件设置
|
this.tablefieldClick = {
|
viewFile: {
|
val: {
|
onclick: function(obj) {
|
me.showFileList = true
|
me.getFileList(obj.row.attachment)
|
},
|
}
|
},
|
attachment_name: {
|
val: {
|
onclick: function(obj) {
|
me.showFileImgByFileId({file_id: obj.row.attachment, file_name: obj.row.attachment_name}, true);
|
},
|
}
|
},
|
approve_amt: {
|
input: {
|
onchange: function(obj) {
|
if (obj.row.diff_amt) {
|
me.notSave = false
|
if (parseFloat(obj.row.approve_amt) > parseFloat(obj.row.diff_amt)) {
|
Root.message({
|
type: 'warning',
|
message: '不能超过应返还金额,请重新填写'
|
});
|
obj.row.approve_amt = 0
|
me.notSave = true
|
return
|
}
|
|
let amount = 0
|
me.tableData.map(e => {
|
if (e.approve_amt) {
|
amount += parseFloat(e.approve_amt)
|
}
|
})
|
|
me.$set(me.formData, "amount", amount)
|
}
|
}
|
}
|
}
|
};
|
},
|
|
//客户选择
|
open_customerlist(obj) {
|
var me = this;
|
|
var config = {
|
totab: false, //true: 以Tab导航的方式打开
|
width: "900px",
|
height: "450px",
|
icon: "icon-product",
|
text: "选择客户",
|
id: "popup_return_customer_info",//totab: true时需设置,用于判断是否已打开此页面
|
url: "../agreement/popup/popup_customer_list.html",
|
data: {},
|
delta: {},
|
dataname: "customer",
|
filter: "1 = 1",
|
sceneCode: "add", //"add"//"browse",
|
callback: function(obj, callback) {
|
let formData_ = clone(me.formData);
|
|
formData_.customer_id = obj.row.id;
|
formData_.customer_code = obj.row.md_code;
|
formData_.customer_name = obj.row.md_description;
|
|
me.formData = formData_;
|
|
if (me.formData.plan_id) {
|
//me.getCanBackList()
|
}
|
|
if (callback) {
|
callback();
|
}
|
}
|
};
|
me.doPopupByPublic(config);
|
},
|
|
getCanBackList() {
|
let me = this
|
|
let param = {
|
dataName: "fee_book_detail",
|
filter: "customer_code = '" + me.formData.customer_code + "' and plan_id = '" + me.formData.plan_id + "'"
|
}
|
Server.call("rootjemin/data/getEntitySet", param, function(result) {
|
if (result.success) {
|
let dataList = result.data.entityset || []
|
|
me.tableData = dataList
|
}
|
});
|
},
|
|
//提交
|
submitRowTable() {
|
this.iscommit = true;
|
this.saveRowTable();
|
},
|
|
//保存
|
saveRowTable() {
|
var me = this;
|
|
if (me.notSave) {
|
me.notSave = false
|
return
|
}
|
|
var bo = me.$refs.form1.checkForm();
|
|
if(!bo) {
|
Root.message({
|
type: 'warning',
|
message: '请填写必填项'
|
});
|
return;
|
}
|
|
if (this.currentBtn == 'auto') {
|
if (this.rule_id.length != 1) {
|
Root.message({
|
type: 'warning',
|
message: '请只勾选一条规则进行保存'
|
});
|
return
|
}
|
}
|
|
if (this.tableData.length == 0) {
|
Root.message({
|
type: 'warning',
|
message: '请选择返还明细'
|
});
|
return
|
}
|
|
var operator_ = "save";//保存
|
if(me.iscommit) {
|
operator_ = "commit";//提交
|
}
|
|
var entity_ = clone(this.formData);
|
var entity = {};
|
for (var r in entity_) {
|
if (entity_[r]) {
|
entity[r] = entity_[r];
|
}
|
}
|
if (this.rule_id.length > 0) {
|
entity['rule_id'] = this.rule_id[0]
|
entity['rule_rate'] = this.rule_rate[0]
|
}
|
else {
|
entity['rule_id'] = ""
|
entity['rule_rate'] = ""
|
}
|
|
var tableData_ = [];
|
let amount = 0
|
this.tableData.map(r=>{
|
r.detail_id = r.id
|
r.cope_amt = r.diff_amt
|
if (this.currentBtn == "auto") {
|
this.tableFields.map(e => {
|
if (e.id) {
|
r.approve_amt = r[e.field]
|
}
|
})
|
}
|
|
amount += parseFloat(r.approve_amt)
|
|
var row_ = {};
|
for (var k in r) {
|
if (r[k]) {
|
row_[k] = r[k];
|
}
|
}
|
tableData_.push(row_);
|
})
|
if (this.currentBtn == "auto") {
|
entity['amount'] = amount
|
}
|
|
let param = {
|
dataname: "pkg_fb_approval",
|
data: {
|
fb_approval: entity,
|
fb_approval_detail: tableData_
|
},
|
}
|
|
Server.call("rootjemin/data/saveEntity", param, function(result) {
|
if (result.success) {
|
if(me.iscommit){
|
me.iscommit = false;
|
me.doSubmit(param.data.fb_approval.id);
|
}
|
else {
|
Root.message({
|
type: 'success',
|
message: '保存成功'
|
});
|
me.saveAfter();
|
}
|
}
|
});
|
},
|
|
doSubmit(id) {
|
let me = this;
|
let pa = {
|
dataName: "fb_approval",
|
id: id,
|
flow_id: this.formData.flow_id || "",
|
business_type: "returnApply"
|
}
|
Server.call("rootjemin/data/Commit", pa, function(result) {
|
if (result.success) {
|
Root.message({
|
type: 'success',
|
message: '提交成功'
|
});
|
window.top.vue.setMenuBadgeByMenuid('09111', 'returnApply');
|
me.saveAfter();
|
}
|
}, function(result) {
|
if (result.messages && result.messages.list && result.messages.list.length > 0){
|
let str = ''
|
result.messages.list.map(e => {
|
if (!str) str += "<div style='max-height:200px; width: 340px; overflow: auto;'>" + e.message
|
else {
|
str += "</br></br> " + e.message
|
}
|
})
|
|
Root.message({
|
dangerouslyUseHTMLString: true,
|
type: 'error',
|
message: str
|
});
|
}
|
});
|
},
|
|
setPolicyReaded() {
|
let me = this
|
let param = {
|
dataName: 'pkg_fb_approval',
|
data: {
|
fb_approval: {
|
id: me.formData.id,
|
readed: "T"
|
}
|
},
|
}
|
|
Server.call("rootjemin/data/saveEntity", param, function(result) {});
|
},
|
getFileList(parentFileId) {
|
let me = this
|
|
let param = {
|
dataName: "sys_file_mapping",
|
filter: "parent_id = '" + parentFileId + "'"
|
}
|
Server.call("rootjemin/data/getEntitySet", param, function(result) {
|
if (result.success) {
|
let fileList = result.data.entityset || []
|
fileList.map(e => {
|
e.attachment_name = e.file_name
|
e.attachment = e.file_id
|
})
|
|
me.tableData4 = fileList
|
}
|
});
|
},
|
getApprovalHisInfo(flowId) {
|
let me = this
|
|
if (!flowId) {
|
return
|
}
|
|
let param = {
|
flowId: flowId
|
}
|
|
Server.call("jeminact/root/order/getHistoryTask", param, function(result) {
|
if (result.success) {
|
let tableData = []
|
tableData = result.data.entityset
|
tableData.map(s => {
|
s.pass = !s.pass && s.pass !== 0? '' : s.pass == '1'? '同意' : '拒绝'
|
s.user_name = s.user_name? s.user_name : '已完成'
|
|
s.viewFile = s.attachment? "查看附件" : ''
|
})
|
me.tableData3 = tableData
|
}
|
});
|
},
|
onShowApproval() {
|
var me = this;
|
let param = {
|
isClientMode: false,
|
flowId: this.formData.flow_id
|
}
|
|
var config = {
|
hide_close: true,
|
width: "85vw",
|
height: "95vh",
|
url: "../approval_new/Approval_flowid_new.html",
|
data: {},
|
delta: {
|
flow_id: this.formData.flow_id,
|
title: ''
|
},
|
};
|
|
this.doPopupByPublic(config);
|
},
|
approvalOp(op) {
|
this.reasonvisible = true
|
this.approveremark = ""
|
this.formData3.files2 = null
|
if (op) {
|
this.approvalTitle = '通过原因'
|
this.pass = true
|
}
|
else {
|
this.approvalTitle = '拒绝原因'
|
this.pass = false
|
}
|
},
|
|
saveReason() {
|
let me = this
|
|
if (!this.pass && !this.approveremark) {
|
Root.message({
|
type: 'warning',
|
message: '请填写拒绝原因'
|
})
|
|
return
|
}
|
|
if (this.formData3.files2 && this.formData3.files2.length > 0) {
|
let sys_file_mapping = []
|
let parent_id = uuid_short()
|
this.formData3.files2.map(e => {
|
let list = {
|
parent_id: parent_id,
|
type: "fb_approval",
|
file_id: e.id,
|
file_name: e.file_name
|
}
|
sys_file_mapping.push(list)
|
})
|
let param = {
|
dataName: 'sys_file_mapping',
|
data: {
|
sys_file_mapping: sys_file_mapping
|
},
|
}
|
|
Server.call("rootjemin/data/saveEntity", param, function(result) {
|
if (result.success) {
|
me.doSaveReason(parent_id)
|
}
|
});
|
}
|
else {
|
me.doSaveReason()
|
}
|
},
|
|
doSaveReason(parent_id) {
|
let me = this
|
|
let param = {
|
businessId: this.formData.id,
|
flowId: this.formData.flow_id,
|
variableMap: {
|
dataName: "fb_approval",
|
reason: this.approveremark,
|
flowId: this.formData.flow_id,
|
attachment: parent_id?parent_id : ""
|
},
|
pass: this.pass
|
}
|
Server.call("jeminact/rootact/act/deal/" + this.formData.flow_id, param, function(result) {
|
if (result.success) {
|
Root.message({
|
type: 'success',
|
message: '审批成功'
|
})
|
window.top.vue.setMenuBadgeByMenuid('09111', 'returnApply');
|
me.saveAfter()
|
}
|
else {
|
Root.message({
|
type: 'error',
|
message: result.error
|
})
|
}
|
});
|
},
|
|
onPopupByUploadFile(filenamefield, fileidfield,dataname, isApprovalReason) {
|
var me = this;
|
let url = isApprovalReason? "../tool_new/popup_uploadFile_new.html" : "../tool/popup_uploadFile.html"
|
var analysistype_ = "";
|
var formData_ = isApprovalReason? clone(me.formData3) : clone(me.formData2);
|
var delta_ = {filetypelist: []}//".png", ".jpg", ".pdf"
|
var config = {
|
totab: false,
|
width: "500px",
|
icon: "icon-product",
|
text: "附件上传",
|
id: "popupByUploadFile",
|
url: url,
|
data: {
|
dataName: dataname,
|
fileidfieldName: fileidfield,
|
id: me.formData.id,
|
fileNamefieldName: filenamefield,
|
// max_size: "100MB",
|
},
|
delta: delta_,
|
callback: function(obj, callback) {
|
me.$message({
|
showClose: true,
|
message: '上传成功!',
|
type: 'success'
|
});
|
|
var file_ = {
|
id: obj.row[0].id,
|
file_name: decodeURI(obj.row[0].name)
|
}
|
if (!formData_[filenamefield]) {
|
formData_[filenamefield] = []
|
}
|
formData_[filenamefield].push(file_);
|
|
if (isApprovalReason) {
|
me.formData3 = formData_;
|
}
|
else {
|
me.formData2 = formData_;
|
}
|
if (callback) {
|
callback();
|
}
|
}
|
};
|
this.doPopupByPublic(config);
|
},
|
|
deleteByFileId(filenamefield, fileobj, isApprovalReason){
|
var me = this;
|
Root.confirm('确定删除附件【' + fileobj.file_name + '】吗?', '删除提示', {
|
confirmButtonText: '删除',
|
cancelButtonText: '取消',
|
type: 'warning'
|
}).then(() => {
|
if (isApprovalReason) {
|
me.formData3[filenamefield].remove(fileobj);
|
}
|
else {
|
me.formData2[filenamefield].remove(fileobj);
|
}
|
Root.message({
|
type: 'success',
|
message: '删除成功!'
|
});
|
}).catch(() => {
|
|
});
|
},
|
|
showFileImgByFileId(fileobj, isApprovalReason) {
|
let me = this;
|
var file_id = fileobj.file_id || fileobj.id;
|
var file_name = fileobj.file_name;
|
|
this.zzimg = {};
|
this.zzimgList = [];
|
this.file_txt = false;
|
if(file_id) {
|
var fileid = file_id;
|
let fileName = clone(file_name);
|
let index1 = fileName.lastIndexOf(".");
|
let index2 = fileName.length;
|
let suffix = fileName.substring(index1, index2).toLowerCase(); //后缀名
|
if (suffix == ".png" || suffix == ".jpg" || suffix == ".pdf") {
|
var row = {
|
fileid: fileid,
|
filename: fileName
|
}
|
|
var config = {
|
totab: false,
|
width: "1200px",
|
height: 800,
|
icon: "icon-product",
|
text: "附件预览",
|
id: "pdf_" + fileid,
|
url: "../tool/popup_file_pdf.html",
|
data: row,
|
delta: {},
|
callback: function(obj, callback) {
|
if (callback) {
|
callback();
|
}
|
}
|
};
|
this.doPopupByPublic(config);
|
|
}
|
else {//只可下载,不可预览
|
if (isApprovalReason) {
|
handleDownloadNew(fileid);
|
}
|
else {
|
handleDownload(fileid);
|
}
|
}
|
}
|
},
|
}
|
});
|
};
|
|
initVue();
|
</script>
|
|
<style>
|
/* 在vue.js中 v-cloak 这个指令是防止页面加载时出现 vuejs 的变量名而设计的 */
|
[v-cloak] {
|
display: none !important;
|
}
|
.h_table {
|
margin-top: 10px;
|
position: relative;
|
margin-bottom: 25px;
|
}
|
</style>
|
</body>
|
</html>
|