<!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="../../../js/vue/vue.js"></script>
|
<script src="../../../js/vue/element-ui/lib/index.js"></script>
|
<script src="../../../js/myelement.js?v=20220615"></script>
|
<script src="../../../js/vue/page.js?v=20220615"></script>
|
<script src="./setting.js"></script>
|
|
<link href="../../../js/vue/element-ui/lib/theme-chalk/index.css" rel="stylesheet">
|
<link href="../../../css/myelement.css?v=20220425" rel="stylesheet">
|
<link href="../../../css/iconfont.css" rel="stylesheet">
|
<link href="../../../css/page.css?v=20220425" rel="stylesheet">
|
<link href="//at.alicdn.com/t/font_2374495_13ltsxm2eor.css" rel="stylesheet">
|
</head>
|
|
<body>
|
<div id="vbody">
|
<div id="page_root">
|
<div class="topbar">
|
<span>{{title}}</span>
|
<div style="float: right; margin-right: 24px;">
|
<!-- <el-button-group style="margin-left: 3px;">
|
<el-button icon="el-icon-refresh" @click="refreshData">刷新</el-button>
|
<el-button v-if="buttons.edit" :disabled="buttons.edit.disabled" @click="setEditTableData">
|
{{isEditTableData ? '取消编辑' : '在线编辑'}}
|
</el-button>
|
</el-button-group> -->
|
|
<el-button-group style="margin-left: 3px;">
|
<el-button v-if="buttons.approve && activeName == '0'" :disabled="!selectedrow.id" @click="approvalData('status')">审批</el-button>
|
<!-- <el-button :disabled="!selectedrow.id" @click="onShowApproval()">审批记录</el-button> -->
|
</el-button-group>
|
</div>
|
</div>
|
<!-- 查询条件 -->
|
<div class="topbar-line">
|
<div style="float: left; width: 100%;">
|
<el-tabs v-model="activeName" @tab-click="handleClick">
|
<el-tab-pane label="待审批" name="0"></el-tab-pane>
|
<el-tab-pane label="审批历史" name="1"></el-tab-pane>
|
</el-tabs>
|
</div>
|
<div class="query-icon">
|
<i class="iconfont icon-query"></i>
|
</div>
|
<div v-if="activeName == '0'" class="query-bar">
|
<h-form-filter
|
ref="form1"
|
:form-attr="filterAttr"
|
:table-fields="filterFields"
|
:form-data="filterObj"
|
:isbuttonquery="true"
|
|
v-on:on-formchange="onQuery"
|
v-on:show-popup="showFilterPopup"
|
v-on:on-query="onQuery"
|
v-on:on-init-query="onInitFilter"
|
v-on:on-edit-query="onEditFilter">
|
</h-form-filter>
|
</div>
|
<div v-if="activeName == '1'" class="query-bar">
|
<h-form-filter
|
ref="form_records"
|
:form-attr="filterAttr"
|
:table-fields="filterFields_record"
|
:form-data="filterObj"
|
:isbuttonquery="true"
|
|
v-on:show-popup="showFilterPopup"
|
v-on:on-formchange="onQueryApprovalRecords"
|
v-on:on-query="onQueryApprovalRecords"
|
v-on:on-init-query="onInitFilterApprovalRecords"
|
>
|
</h-form-filter>
|
</div>
|
</div>
|
<div v-if="activeName == '0'" class="versionNo">
|
<h-table
|
v-if="isRefresh"
|
ref="table1"
|
:table-fields="tableFields"
|
:table-data="tableData"
|
:is-edit-table-data="isEditTableData"
|
:pagesize="pagesize"
|
:pagenum="pagenum"
|
:total="total"
|
:table-height="tableHeight"
|
:is-highlight-row="true"
|
:edit-table-button="editTableButton"
|
v-on:get-data="getData"
|
v-on:edit-data="editData"
|
v-on:del-data="delData"
|
v-on:row-click="rowClick"
|
v-on:cell-click="cellClick"
|
>
|
</h-table>
|
</div>
|
<div v-if="activeName == '1'" class="versionNo">
|
<h-table
|
v-if="isRefresh"
|
ref="table_records"
|
:table-fields="tableFields"
|
:table-data="tableData"
|
:is-edit-table-data="isEditTableData"
|
:pagesize="pagesize"
|
:pagenum="pagenum"
|
:total="total"
|
:table-height="tableHeight"
|
:is-highlight-row="true"
|
:edit-table-button="editTableButton"
|
v-on:edit-data="editData"
|
v-on:del-data="delData"
|
v-on:row-click="rowClick"
|
|
v-on:get-data="getApprovalRecordsData"
|
v-on:cell-click="cellClick"
|
>
|
</h-table>
|
</div>
|
<div id="page_loading" style="position: absolute; top:0px; width: 100vw; height: 100vh;">
|
<div class="spinner">
|
<div class="cube1"></div>
|
<div class="cube2"></div>
|
</div>
|
</div>
|
</div>
|
</div>
|
|
<script type="text/javascript">
|
var setting = getSetting("demandproduct_list");
|
var initlized = false;
|
var data = [];
|
|
new ListVue({
|
el: "#vbody",
|
data: {
|
pageAttr: {
|
heightType: "page"
|
},
|
dataname: "productSummaryApproval",
|
dataname_records: "demandProduct",
|
tabaleFieldsName: "demandProduct_",
|
filterFieldsName: "demandProduct_",
|
|
title: "全产品目录审批",
|
textarea2: "",
|
param1: {},
|
param2: {},
|
filterList: [],
|
orderby: "update_time desc",
|
pagenum: 1,
|
pagesize: 10,
|
total: 0,
|
tableData: [],
|
activeName: '0',
|
total_tab0: 0,
|
total_tab1: 0,
|
editTableButton: {
|
edit: {
|
isshow: true,
|
txt: "编辑"
|
},
|
del: {
|
isshow: false,
|
txt: "删除"
|
},
|
save: {
|
isshow: true,
|
txt: "保存"
|
}
|
},
|
// filter_: " and status = 'working' and fne.emp_code = '" + window.top.userinfo.employee.code + "'"
|
filterObjBydefault: {
|
"status": "working",
|
"emp_code": window.top.userinfo.employee.code
|
}
|
},
|
created() {
|
this.pageCode = "A2-5-1";
|
this.getResoures();
|
this.getdlempcode("product_summary");//根据流程获取代理人员,设置this.dl_emp_codestrs
|
},
|
|
mounted() {
|
this.initData();
|
this.$nextTick(() => { // 以服务的方式调用的 Loading 需要异步关闭
|
hideLoading();
|
});
|
},
|
|
methods: {
|
|
initData() {
|
if (initlized) {
|
return;
|
}
|
initlized = true;
|
|
var total_tab = "total_tab" + this.activeName;
|
this.totaltab = total_tab;
|
this.onQuery(total_tab);
|
},
|
|
onServerInitData(data) {
|
var me = this.data;
|
|
me.tableFields = data.tableFields;
|
me.filterFields = data.filterFields;
|
me.filterFields_record = data.filterFields;
|
|
if (me.filterFields.length > 0) {
|
for (var i = 0; i < me.filterFields.length; i++) {
|
let fieldObj_ = me.filterFields[i];
|
|
me.filterFieldsObj[fieldObj_.field] = fieldObj_;
|
}
|
}
|
if (me.tableFields.length > 0) {
|
for (var i = 0; i < me.tableFields.length; i++) {
|
let fieldObj_ = me.tableFields[i];
|
|
me.tableFieldsObj[fieldObj_.field] = fieldObj_;
|
}
|
}
|
},
|
doQuery() {
|
var me = this;
|
let filter_ = "1=1"
|
this.filterList = [];
|
filter_ += this.filter_;
|
this.selectedrow = {};
|
|
for (var k in this.filterObj) {
|
let k_val = this.filterObj[k];
|
let fieldObj_ = this.filterFieldsObj[k];
|
|
let type_ = fieldObj_.type;
|
let field_ = fieldObj_.field;
|
let fieldtype_ = "equal";
|
if (fieldObj_.fieldname) {
|
field_ = fieldObj_.fieldname
|
}
|
if (fieldObj_.fieldtype) {
|
fieldtype_ = fieldObj_.fieldtype
|
}
|
|
if (type_ != "daterange") {
|
//注释:type: equal(等于)/in(在多个数据中)/like(模糊)/minval(最小值)/maxval(最大值)/mininclude(最小且包含该值)/maxinclude(最大且包含该值)
|
if (fieldtype_ == "like") {
|
filter_ += " and " + field_ + " like '%" + k_val + "%'";
|
} else {
|
filter_ += " and " + field_ + " = '" + k_val + "'";
|
}
|
}
|
}
|
|
if (this.filterObjBydefault != {}) {
|
for(var k in this.filterObjBydefault) {
|
let k_val = this.filterObjBydefault[k];
|
filter_ += " and " + k + " = '" + k_val +"'";
|
}
|
}
|
|
if (this.filterTxt) {
|
filter_ += " and " + this.filterTxt;
|
}
|
|
let param_ = {
|
isClientMode: false,
|
dataname: this.dataname,
|
filterList: this.filterList,
|
filter: filter_,
|
orderby: this.orderby,
|
page: {
|
no: this.pagenum,
|
pagesize: this.pagesize
|
},
|
//attachmeta: true
|
}
|
Server.call("root/data/getEntitySet", param_, function(result) {
|
console.log(result);
|
me.total = 0;
|
me.tableData = [];
|
if (result && result.data) {
|
var data_ = result.data.entityset;
|
me.total = result.data.page.recordcount;
|
me.tableData = data_;
|
for (var i = 0; i < me.tableData.length; i++) {
|
if (me.tableData[i].type == 0) {
|
me.tableData[i].type = "按需生产";
|
} else if (me.tableData[i].type == 1) {
|
me.tableData[i].type = "安全库存";
|
}
|
}
|
}
|
me.tableDataAfter();
|
});
|
},
|
|
handleClick(tab) {
|
var me = this;
|
var total_tab = "total_tab" + tab.name;
|
this.totaltab = total_tab;
|
|
if (tab.name == "0") {
|
this.filterTxt = "";
|
this.filterFields = dataRootFields.filterFields.demandProduct_;
|
if (this.filterFields.length > 0) {
|
for (var i = 0; i < this.filterFields.length; i++) {
|
let fieldObj_ = this.filterFields[i];
|
|
this.filterFieldsObj[fieldObj_.field] = fieldObj_;
|
}
|
}
|
this.onQuery(total_tab);
|
}
|
else if (tab.name == "1") {
|
this.orderby="create_time desc";
|
this.approvaltype = "product_summary";
|
|
this.filterFields_record = dataRootFields.filterFields.demandProduct_approve;
|
|
if (this.filterFields_record.length > 0) {
|
for (var i = 0; i < this.filterFields_record.length; i++) {
|
let fieldObj_ = this.filterFields_record[i];
|
|
this.filterFieldsObj[fieldObj_.field] = fieldObj_;
|
}
|
}
|
this.approvalfields = ["*"];
|
this.filterTxt = "act_assignee in ('" +localStorage.getItem("emp_code")+"','"+localStorage.getItem("emp_id")+"','"+localStorage.getItem("id")+"'" + me.dl_emp_codestrs + ")";//"act_assignee='" + localStorage.getItem("emp_code") + "'" //c.create_operate_id = '" + localStorage.getItem("emp_id") + "'
|
this.onQueryApprovalRecords(total_tab)
|
}
|
|
},
|
|
editData(scope) {
|
this.selectedrow = scope.row;
|
|
if(this.selectedrow.status == "working") {
|
Root.message({
|
type: 'warning',
|
message: '当前状态不可修改'
|
});
|
return
|
}
|
|
if (scope.row.isWithinEdit) {
|
scope.row.isWithinEdit = false;
|
this.saveRowData(scope.row);
|
} else {
|
scope.row.isWithinEdit = true;
|
data = clone(this.selectedrow);
|
}
|
this.isRefresh = false;
|
this.$nextTick(function() {
|
this.isRefresh = true;
|
})
|
},
|
|
saveRowData(row) {
|
var me = this;
|
var type_;
|
var event;
|
if (row.type == "按需生产" || row.type == "0") {
|
type_ = 0;
|
} else if (row.type == "安全库存" || row.type == "1") {
|
type_ = 1;
|
}
|
let param = {
|
dataname: this.dataname,
|
filter: "md_product.id=" + '\'' + row.id + '\''
|
}
|
Server.call("root/data/getEntity/", param, function(result) {
|
console.log(result);
|
if (result.data.entity){
|
if (result.data.entity.link_id) {
|
event = 'updateEntity/'
|
} else {
|
event = 'insertEntity/';
|
}
|
|
if (type_ != result.data.entity.type){
|
Root.confirm('确定提交-' + row.md_description + '-吗?', '提示', {
|
confirmButtonText: "提交",
|
cancelButtonText: '取消',
|
type: 'warning'
|
}).then(() => {
|
let param2 = {
|
businessId: row.id,
|
businessType: "product_summary",
|
variableMap: ""
|
}
|
Server.call("root/api/startAct", param2, function(result) {
|
console.log(result);
|
if (result.success) {
|
let param3 = {
|
id: row.id,
|
flow_id: result.data.data.activitiId,
|
product_code: row.product_code,
|
type: type_,
|
}
|
Server.call("root/data/" + event + me.dataname,param3 , function(result) {
|
if (result.success) {
|
Root.message({
|
type: 'success',
|
message: '提交成功'
|
});
|
me.onQuery();
|
} else {
|
Root.message({
|
type: 'warning',
|
message: result.message
|
});
|
}
|
});
|
}
|
});
|
}).catch(() => {
|
Root.message({
|
type: 'info',
|
message: '已取消'
|
});
|
});
|
}
|
}
|
});
|
},
|
setEditTableData: function() {
|
if (this.onSetEditTableData) {
|
this.onSetEditTableData.call(this, arguments);
|
return
|
}
|
|
this.isRefresh = false;
|
this.isEditTableData = !this.isEditTableData;
|
if (!this.isEditTableData) {
|
this.doQuery();
|
}
|
for (var i = 0; i < this.tableData.length; i++) {
|
this.tableData[i].isWithinEdit = false;
|
}
|
this.tableDataAfter();
|
},
|
|
onShowApproval() {
|
var me = this;
|
var row = this.selectedrow;
|
|
if (!row || !row.id) {
|
Root.message({
|
type: 'warning',
|
message: '请先选择一条数据'
|
});
|
return false;
|
} else {
|
let param = {
|
isClientMode: false,
|
flowId: row.flow_id
|
}
|
|
Server.call("root/order/getHistoryTask/", param, function(result) {
|
console.log(result);
|
if (result && result.data) {
|
|
Root.popupParames = {
|
width: "900px",
|
height: "700px",
|
url: "../approval/ApprovalList.html",
|
data: result.data,
|
};
|
// GET /act/historyNode/{flowId}
|
// "../approval/ApprovalList.html",
|
Root.popupParames.disabled = true;
|
Root.showPopup(Root.popupParames);
|
}
|
|
});
|
|
}
|
},
|
onApproveData(config, code) {
|
var me = this;
|
var row = this.selectedrow;
|
|
//1. empty row
|
if (!row || !row.id) {
|
Root.message({
|
type: 'warning',
|
message: '请选择要审批的数据'
|
});
|
return false;
|
}
|
if ("working" != row.status) {
|
Root.message({
|
type: 'warning',
|
message: '当前状态不可审批'
|
});
|
return false;
|
}
|
|
config.combine({
|
totab: false,
|
icon: "icon-product",
|
text: "审批全产品目录",
|
id: "demandproduct_edit_approval",
|
url: "../order/plan/demandproduct_edit.html",
|
sceneCode: "approval",
|
data: row,
|
delta: me.dataname,
|
callback: function(obj,callback) {
|
me.onQuery();
|
if (callback) {
|
callback();
|
}
|
}
|
});
|
return true;
|
},
|
rowDblClick(event) {
|
this.selectedrow = event.row;
|
|
if(this.selectedrow.status == "working") {
|
Root.message({
|
type: 'warning',
|
message: '当前状态不可修改'
|
});
|
return
|
}
|
if (event.row.isWithinEdit) {
|
event.row.isWithinEdit = false;
|
//this.saveRowData(event.row);
|
} else {
|
event.row.isWithinEdit = true;
|
data = clone(this.selectedrow);
|
}
|
this.isRefresh = false;
|
this.$nextTick(function() {
|
this.isRefresh = true;
|
})
|
},
|
rowClick(obj) {
|
if(this.selectedrow == obj.row){
|
return;
|
}
|
if (this.selectedrow != {}) {
|
this.selectedrow.isWithinEdit = false;
|
this.saveRowData(this.selectedrow);
|
}
|
this.selectedrow = obj.row;
|
//obj.row.isWithinEdit = obj.row.isWithinEdit ? false : true;
|
|
},
|
showFilterPopup(filter) {
|
let me = this;
|
let row = filter.obj;
|
let field = filter.obj.field;
|
var filterValue = clone(me.filterObj);
|
if (field == "company_name") {
|
Root.showPopup({
|
url: "../order/plan/popup/brand_business_list.html",
|
width: 800,
|
height: 550,
|
type: "company_name",
|
dataname: "demandproduct",
|
callback: function(obj, callback) {
|
filterValue[field] = obj.row.company_name;
|
me.filterObj = filterValue;
|
if(me.activeName == "0") {
|
me.onQuery();
|
}else if(me.activeName == "1") {
|
var total_tab = "total_tab" + me.activeName;
|
me.totaltab = total_tab;
|
me.onQueryApprovalRecords(total_tab);
|
}
|
if (callback) {
|
callback();
|
}
|
}
|
});
|
} else if ("product_name" == field) {
|
Root.showPopup({
|
url: "../md/product/popup/product_list.html",
|
width: 800,
|
height: 550,
|
type: "onlySimple",
|
callback: function(result, callback) {
|
filterValue[field] = result.row.product_name;
|
me.filterObj = filterValue;
|
if(me.activeName == "0") {
|
me.onQuery();
|
}else if(me.activeName == "1") {
|
var total_tab = "total_tab" + me.activeName;
|
me.totaltab = total_tab;
|
me.onQueryApprovalRecords(total_tab);
|
}
|
if (callback) {
|
callback();
|
}
|
}
|
});
|
}
|
},
|
onCellClick(config, obj) {
|
let me = this;
|
var clickContext = this.selectCellField.clickContext;
|
if (this.selectCellField.field == "status") {
|
// clickContext.url = "";
|
if (obj.row.status != 'input' && obj.row.status != 'close' && obj.row.status) {
|
clickContext.url = "../approval/ApprovalList.html";
|
clickContext.delta = {
|
flow_id: obj.row.flow_id,
|
}
|
clickContext.width = "75vw";
|
clickContext.height = "65vh";
|
clickContext.hide_close = true;
|
}
|
}
|
if (clickContext && clickContext.type == "popup" && clickContext.url != "") {
|
config.combine({
|
url: clickContext.url,
|
hide_close: clickContext.hide_close,
|
sceneCode: clickContext.sceneCode,
|
data: obj.row,
|
delta: clickContext.delta ? clickContext.delta : {},
|
width: clickContext.width,
|
height: clickContext.height
|
})
|
} else {
|
return false;
|
}
|
|
return true;
|
},
|
},
|
});
|
</script>
|
<style>
|
.el-select__tags {
|
max-height: 28px;
|
overflow: hidden;
|
}
|
</style>
|
</body>
|
</html>
|