<!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/vue/axios/dist/axios.min.js"></script>
|
<script src="../../../js/myelement.js?v=20220615"></script>
|
<script src="../../../js/vue/page.js?v=20220615"></script>
|
<script src="../../../js/common.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_mkoo966o0uo.css" rel="stylesheet">
|
</head>
|
|
<body>
|
<div id="vbody">
|
<div id="page_root">
|
<div ref="popup_body" style="padding-right: 20px;">
|
<div class="el-dialog_header">
|
<div class="dialog-title">
|
<i class="iconfont icon-customermanagement"></i>
|
<span> {{formAttr.title}} </span>
|
</div>
|
</div>
|
<div style="height: 530px;overflow-y: auto">
|
<div class="el-dialog_body" style="height: 480px">
|
<h-form ref="form1"
|
:form-attr="formAttr"
|
:table-fields="formFields"
|
:form-data="formData"
|
v-on:show-popup="showPopup"
|
v-on:visible-change="cellVisibleChange">
|
</h-form>
|
<div v-if="notdisabled" style="text-align: right;">
|
<el-button-group>
|
<el-button @click="addTableData">新增数据</el-button>
|
<input type="file" id="btn_file" style="display: none;" @change="getFile($event)" />
|
<el-button @click="fileUpload()">导入</el-button>
|
<el-button @click="downloadTemplate()">下载模板</el-button>
|
<!-- <el-button @click="download()">导出</el-button> -->
|
</el-button-group>
|
</div>
|
<h-table v-if="isRefresh"
|
ref="table2"
|
:tableloading="tableloading"
|
v-loading.fullscreen.lock="fullscreenLoading"
|
element-loading-background="rgba(0, 0, 0, 0.4)"
|
:table-fields="tableFields"
|
:table-data="tableData2"
|
:is-edit-table-data="isEditTableData"
|
:is-within-edit-table-data="isWithinEditTableData"
|
:table-height="tableHeight2"
|
:is-pagination="false"
|
:is-show-index="true"
|
v-on:edit-data="editData"
|
v-on:del-data="delData"
|
v-on:cell-input-change="cellInputChange"
|
v-on:cell-select-change="cellSelectChange"
|
v-on:cell-click="cellClick"
|
v-on:visible-change="cellVisibleChange"
|
v-on:cell-show-popup="cellShowPopup">
|
</h-table>
|
<div v-if="acctObj.flow_id && popupParames.sceneCode == 'approval'" style="height: 350px; border-top: 1px solid #ccc;">
|
<iframe :src="'../../approval/ApprovalList_page.html?flow_id=' + acctObj.flow_id" style="width: 100%; height: 100%; border: 0px;"></iframe>
|
</div>
|
</div>
|
|
</div>
|
<el-dialog title="填写原因" :visible.sync="reasonvisible" v-loading="reasonLoading" height="50%">
|
|
<el-input type="textarea" :autosize="{ minRows: 2, maxRows: 10}" placeholder="请输入原因"
|
v-model="textarea2">
|
</el-input>
|
<h-form ref="form2"
|
:form-attr="formAttr1"
|
:table-fields="formFields_season"
|
:form-data="formData2"
|
v-if="selectTime"
|
v-on:visible-change="cellVisibleChange">
|
</h-form>
|
|
<div class="dialog-footer" style="float: right;margin-top: 30px;">
|
<el-button type="default" @click="reasonvisible = false">取 消</el-button>
|
<el-button type="primary" @click="saveReason">确 定</el-button>
|
</div>
|
</el-dialog>
|
<div class="el-dialog_footer">
|
<el-button v-if="Approval" type="success" @click="onpassApproval">通过</el-button>
|
<el-button v-if="Approval" type="danger" @click="onrefuseApproval">拒绝</el-button>
|
<el-button v-if="notdisabled" type="primary" @click="saveRowTable">保 存</el-button>
|
<el-button v-if="notdisabled" type="primary" @click="submitRowTable">提 交</el-button>
|
<el-button v-if="browse" @click="download()">导出</el-button>
|
<el-button v-if="!fromDing" type="default" @click="closeDialog">关闭</el-button>
|
</div>
|
</div>
|
</div>
|
<div id="page_loading" style="position: absolute; top:0px; width: 100vw; height: 100vh;z-index: 9999;">
|
<div class="spinner">
|
<div class="cube1"></div>
|
<div class="cube2"></div>
|
</div>
|
</div>
|
|
<el-dialog :visible.sync="dingResult" width="40vw" height="50vh" :show-close="false" :close-on-click-modal="false" :close-on-press-escape="false">
|
<span>{{dingResultTxt}}</span>
|
<div style="min-height: 150px;"></div>
|
</el-dialog>
|
</div>
|
|
<script type="text/javascript">
|
new ListVue({
|
el: "#vbody",
|
data: {
|
disabled: false,
|
notdisabled: true,
|
Approval: false,
|
isType: true,
|
browse: false,
|
|
form_dataname: "producePlan",
|
dataname: "producePlanDetail",
|
uploadDataname: "tempProduceDetail",
|
|
acctObj:{
|
flow_id:""
|
},
|
|
formAttr: {
|
title: "生产计划信息",
|
istitle: false,
|
columnnumber: 2,
|
labelwidth: "130px",
|
labelposition: "right",
|
size: "medium",
|
border: "0px solid #c6c6c600",
|
},
|
formAttr1: {
|
istitle: false,
|
columnnumber: 2,
|
labelwidth: "130px",
|
labelposition: "right",
|
size: "medium",
|
border: "0px solid #c6c6c600",
|
},
|
formFields: [],
|
formData: {},
|
formData2: {},
|
newRowDefault: {
|
id: uuid_short(),
|
status: "input",
|
create_time: createDatetime(),
|
create_operate_id: window.top.userinfo.employee.id,
|
create_operate_name: window.top.userinfo.employee.name,
|
create_operate_code: window.top.userinfo.employee.code,
|
year: createYearByQuarter() + "",
|
quarter: createQuarter()
|
},
|
|
tableFields: [],
|
tableData2: [],
|
tableDataChange: {},
|
tableHeight2: 300,
|
|
isEditTableData: true,
|
isWithinEditTableData: false,
|
isRefresh: true,
|
selectFormField: {},
|
selectedrow: {},
|
isUpload: false,
|
uploadType: "produce",
|
batch_id: "",
|
productDetail: [],
|
textarea2: "",
|
dataRequest: [
|
{
|
isClientMode: false,
|
code: "code",
|
label: "value",
|
name: "business_line_name", // 字段名
|
dataname: "dictitem",
|
filter: " parent_id='business_line'"
|
},
|
{
|
isClientMode: false,
|
code: "code",
|
label: "value",
|
name: "manager_part_name", // 字段名
|
dataname: "dictitem",
|
filter: " parent_id='manager-part'"
|
},
|
],
|
dataRequestObj: {},
|
formFields_season:[],
|
selectTimeRole: false,
|
selectTime: false,
|
tableloading: false,
|
reasonvisible: false,
|
reasonLoading: false,
|
fullscreenLoading: false,
|
fromDing: false,
|
dingResult: false,
|
dingResultTxt: "",
|
},
|
|
created() {
|
var me = this;
|
this.popupParames = clone(Root.popupParames);
|
let business_line_code = "";
|
let roleList = window.top.userinfo.user.roleList;
|
roleList.map(e=>{
|
if(e.code == "zsx") {
|
business_line_code = "zsx"
|
}else if(e.code == "zyx") {
|
business_line_code = "zyx"
|
}else if(e.code == "djk") {
|
business_line_code = "djk"
|
}else if(e.code == "xls") {
|
business_line_code = "xls"
|
}else if(e.code == "sdfx") {
|
business_line_code = "sdfx"
|
}
|
})
|
|
//if(this.popupParames.sceneCode == "add") {
|
// this.dataRequest = this.dataRequest.map(e=>{
|
// if(e.name == "business_line_name")
|
// e.filter += " and code = '" + business_line_code + "'"
|
// return e
|
// })
|
//}
|
if (this.popupParames.data) {
|
this.formData = clone(this.popupParames.data);
|
this.formData.year = this.formData.year + "";
|
this.acctObj.flow_id = this.formData.flow_id;
|
}
|
if (this.popupParames.sceneCode) {
|
if (this.popupParames.sceneCode == "browse") {
|
this.formAttr.disabled = true;
|
this.isWithinEditTableData = false;
|
this.notdisabled = false;
|
this.isEditTableData = false;
|
this.Approval = false;
|
this.browse = true;
|
} else if (this.popupParames.sceneCode == "approval") {
|
this.formAttr.disabled = true;
|
this.isWithinEditTableData = false;
|
this.notdisabled = false;
|
this.isEditTableData = false;
|
this.Approval = true;
|
} else if (this.popupParames.sceneCode == "add") {
|
if (this.newRowDefault) {
|
let formData_ = clone(this.formData);
|
|
for (var k in this.newRowDefault) {
|
formData_[k] = this.newRowDefault[k];
|
}
|
this.formData = formData_;
|
}
|
}
|
}
|
|
},
|
|
mounted() {
|
var me = this;
|
this.initFields();
|
|
if (this.popupParames.sceneCode != "add") {
|
this.initData();
|
}
|
|
var urlParam = getGetParams(this.popupParames.url);
|
|
for(let key in urlParam) {
|
if(key == "fromDing") {
|
this.fromDing = urlParam[key];
|
}
|
}
|
if (this.dataRequest.length) {
|
var result = {};
|
this.loadRequestData(this.dataRequest, result, function(data) {
|
me.dataRequestObj = data;
|
if (me.formFields.length) { //formFields 表格或表单的字段集
|
var formFields_part_ = clone(me.formFields);
|
formFields_part_.map(e=>{
|
if(e.field == "business_line_code") { //manager_part_name 字段名
|
e.options = me.dataRequestObj.business_line_name;
|
if(me.dataRequestObj.business_line_name)
|
me.dataRequestObj.business_line_name.map(e=>{
|
if (!me.dataRequestObj.map) {
|
me.dataRequestObj.map = {};
|
}
|
if (!me.dataRequestObj.map.business_line_name) {
|
me.dataRequestObj.map.business_line_name = {};
|
}
|
me.dataRequestObj.map.business_line_name[e.code] = e.value;
|
})
|
}else if(e.field == "manager_part_code") { //manager_part_name 字段名
|
e.options = me.dataRequestObj.manager_part_name;
|
me.dataRequestObj.manager_part_name.map(e=>{
|
if (!me.dataRequestObj.map) {
|
me.dataRequestObj.map = {};
|
}
|
if (!me.dataRequestObj.map.manager_part_name) {
|
me.dataRequestObj.map.manager_part_name = {};
|
}
|
me.dataRequestObj.map.manager_part_name[e.code] = e.value;
|
})
|
}
|
});
|
me.formFields = formFields_part_;
|
}
|
//me.initData();
|
});
|
}
|
|
this.$nextTick(() => { // 以服务的方式调用的 Loading 需要异步关闭
|
document.getElementById('page_root').style.display = "block";
|
document.getElementById('page_loading').style.display = "none";
|
|
//重新设置弹窗宽高
|
this.$nextTick(function() {
|
let w_ = this.$refs.popup_body.offsetWidth + "px";
|
let h_ = this.$refs.popup_body.offsetHeight + "px";
|
Root.setPopupWH(w_, h_);
|
})
|
});
|
},
|
|
methods: {
|
initFields() {
|
let me = this;
|
me.tableFields = dataRootFields.tableFields.producePlanDetail_;
|
me.formFields = dataRootFields.formFields.producePlan_;
|
me.formFields_season = dataRootFields.formFields.producePlan_season;
|
},
|
|
initData() {
|
let me = this;
|
|
let filter_table = "1=1";
|
|
if (this.formData.id) {
|
filter_table = "plan_produce_detail.parent_id = '" + this.formData.id + "'";
|
}
|
|
let param_table = {
|
isClientMode: false,
|
dataname: this.dataname,
|
filter: filter_table,
|
}
|
this.tableloading = true;
|
Server.call("root/data/getEntitySet", param_table, function(result) {
|
if (result && result.data) {
|
// me.tableData2 = result.data.entityset;
|
var i = 0;
|
var data_ = result.data.entityset;
|
if (data_ && data_.length > 0) {
|
me.getStockCount(data_,i);
|
}
|
else {
|
me.tableloading = false;
|
}
|
}
|
});
|
|
let param_role = {
|
isClientMode: false,
|
dataname: "roleEditAble",
|
filter: "type = 'productChange'",
|
}
|
|
Server.call("root/data/getEntitySet", param_role, function(result) {
|
if (result && result.data) {
|
for (var i = 0; i < result.data.entityset.length; i++) {
|
for (var j = 0; j < window.top.userinfo.user.roleList.length; j++) {
|
if(window.top.userinfo.user.roleList[j].id == result.data.entityset[i].r_id) {
|
me.selectTimeRole = true;
|
}
|
}
|
}
|
}
|
});
|
},
|
getStockCount(row,i) {
|
var me = this;
|
let param = {
|
"deliveryPartCode": row[i].delivery_part_code,
|
"productCodeList": [row[i].product_code]
|
}
|
axios.post(window.top.RootSetting.url_stock + "order/getInventoryByVo", param)
|
.then(data => {
|
console.info(data);
|
if(data.data.data) {
|
row[i].stock = data.data.data.count;
|
}
|
if(row.length-1 == i) {
|
this.tableloading = false;
|
me.tableData2 = row;
|
}else{
|
me.getStockCount(row,++i);
|
}
|
})
|
.catch( (error) => {
|
console.log(error);
|
});
|
},
|
onpassApproval() {
|
this.textarea2 = "";
|
this.reasonvisible = true;
|
this.passOrRefuse = true;
|
if(this.selectTimeRole) {
|
this.selectTime = true;
|
}
|
},
|
onrefuseApproval() {
|
this.textarea2 = "";
|
this.reasonvisible = true;
|
this.passOrRefuse = false;
|
this.selectTime = false;
|
},
|
saveReason() {
|
let me = this;
|
this.reasonLoading = true;
|
if(this.selectTime) {
|
if(this.formData2.supply_date) {
|
let param = {
|
id: this.formData.id,
|
predict_supply_date: this.formData2.supply_date
|
}
|
Server.call("root/data/updateEntity/" + me.form_dataname, param, function(result) {
|
console.info(result);
|
if(result.success) {
|
if (me.passOrRefuse) {
|
let param = {
|
flowId: me.formData.flow_id,
|
businessType: "product_plan",
|
pass: true,
|
variableMap: {
|
reason: me.textarea2
|
}
|
}
|
if(me.formData.business_line_code == "zsx") {
|
param.variableMap.zsx = true;
|
}else {
|
param.variableMap.zsx = false
|
}
|
Server.call("root/api/dealAct", param, function(result2) {
|
if (result2.success) {
|
Root.message({
|
type: 'success',
|
message: '审批成功'
|
});
|
if(me.fromDing) {
|
me.dingResult = true;
|
me.dingResultTxt = "审批成功"
|
return;
|
}
|
me.reasonLoading = false;
|
Root.tab.removeItem(Root.tab.selected);
|
Root.tab.open(me.popupParames.parentOption, true);
|
} else {
|
Root.message({
|
type: 'warning',
|
message: result2.message
|
});
|
}
|
})
|
} else {
|
if (me.textarea2 != "") {
|
let param = {
|
flowId: me.formData.flow_id,
|
businessType: "product_plan",
|
pass: false,
|
variableMap: {
|
reason: me.textarea2
|
}
|
}
|
if(me.formData.business_line_code == "zsx") {
|
param.variableMap.zsx = true;
|
}else {
|
param.variableMap.zsx = false
|
}
|
Server.call("root/api/dealAct", param, function(result2) {
|
if (result2.success) {
|
Root.message({
|
type: 'success',
|
message: '拒绝审批成功'
|
});
|
|
if(me.fromDing) {
|
me.dingResult = true;
|
me.dingResultTxt = "拒绝审批成功"
|
return;
|
}
|
me.reasonLoading = false;
|
Root.tab.removeItem(Root.tab.selected);
|
Root.tab.open(me.popupParames.parentOption, true);
|
} else {
|
Root.message({
|
type: 'warning',
|
message: result2.message
|
});
|
}
|
})
|
} else {
|
Root.message({
|
type: 'warning',
|
message: '请填写原因'
|
});
|
me.reasonLoading = false;
|
}
|
}
|
}
|
});
|
}else {
|
Root.message({
|
type: 'warning',
|
message: '请选择预计供货时间'
|
});
|
this.reasonLoading = false;
|
}
|
}else {
|
if (this.passOrRefuse) {
|
let param = {
|
flowId: this.formData.flow_id,
|
businessType: "product_plan",
|
pass: true,
|
variableMap: {
|
reason: this.textarea2
|
}
|
}
|
if(me.formData.business_line_code == "zsx") {
|
param.variableMap.zsx = true;
|
}else {
|
param.variableMap.zsx = false
|
}
|
Server.call("root/api/dealAct", param, function(result2) {
|
if (result2.success) {
|
Root.message({
|
type: 'success',
|
message: '审批成功'
|
});
|
if(me.fromDing) {
|
me.dingResult = true;
|
me.dingResultTxt = "审批成功"
|
return;
|
}
|
me.reasonLoading = false;
|
Root.tab.removeItem(Root.tab.selected);
|
Root.tab.open(me.popupParames.parentOption, true);
|
} else {
|
Root.message({
|
type: 'warning',
|
message: result2.message
|
});
|
}
|
})
|
} else {
|
if (this.textarea2 != "") {
|
let param = {
|
flowId: this.formData.flow_id,
|
businessType: "product_plan",
|
pass: false,
|
variableMap: {
|
reason: this.textarea2
|
}
|
}
|
if(me.formData.business_line_code == "zsx") {
|
param.variableMap.zsx = true;
|
}else {
|
param.variableMap.zsx = false
|
}
|
Server.call("root/api/dealAct", param, function(result2) {
|
if (result2.success) {
|
Root.message({
|
type: 'success',
|
message: '拒绝审批成功'
|
});
|
|
if(me.fromDing) {
|
me.dingResult = true;
|
me.dingResultTxt = "拒绝审批成功"
|
return;
|
}
|
me.reasonLoading = false;
|
Root.tab.removeItem(Root.tab.selected);
|
Root.tab.open(me.popupParames.parentOption, true);
|
} else {
|
Root.message({
|
type: 'warning',
|
message: result2.message
|
});
|
}
|
})
|
} else {
|
Root.message({
|
type: 'warning',
|
message: '请填写原因'
|
});
|
me.reasonLoading = false;
|
}
|
}
|
}
|
},
|
onServerInitData(data) {
|
|
},
|
closeDialog() {
|
if (this.popupParames.totab) {
|
Root.tab.removeItem(Root.tab.selected);
|
Root.tab.open(this.popupParames.parentOption, false);
|
} else {
|
Root.hidePopup();
|
}
|
},
|
|
createCode(array_) {
|
var me = this
|
Server.call("root/code/nextval", {
|
ruleCode: "Code-Produce"
|
}, function(result) {
|
if (result && result.data) {
|
me.formData.code = result.data.value;
|
me.doSave(array_);
|
}
|
})
|
},
|
|
dataExistValidation() {
|
var me = this;
|
var array_ = [];
|
|
if(this.tableData2.length == 0) {
|
Root.message({
|
type: 'warning',
|
message: '明细数据为空'
|
});
|
return;
|
}
|
|
var param = {
|
isClientMode: false,
|
dataname: "producePlanFilter",
|
filter: "manager_part_code =" + "\'" + this.formData.manager_part_code + "\'" +
|
"and business_line_code =" + "\'" + this.formData.business_line_code + "\'" +
|
"and plan_produce.delivery_part_code =" + "\'" + this.formData.delivery_part_code + "\'" +
|
"and year =" + "\'" + this.formData.year + "\'" +
|
"and quarter =" + "\'" + this.formData.quarter + "\'" +
|
"and type =" + "\'" + this.formData.type + "\'"
|
}
|
for (var id in me.tableDataChange) {
|
array_.push(id);
|
}
|
if(this.popupParames.sceneCode == "edit") {
|
me.doSave(array_);
|
}else {
|
me.createCode(array_);
|
}
|
|
|
/* let produc_str = ""
|
for (var i = 0; i < this.tableData2.length; i++) {
|
if(this.tableData2[i].product_code) {
|
produc_str += ",'" + this.tableData2[i].product_code + "'"
|
}
|
}
|
produc_str = produc_str.substring(1)
|
param.filter += " and product_code in (" + produc_str + ")"
|
if(this.popupParames.sceneCode == "edit") {
|
Server.call("root/data/getEntitySet/", param, function(result) {
|
if(result.success) {
|
if(result.data.entityset.length > 0 && me.formData.type == "1") {
|
if(result.data.entityset[0].id == me.formData.id) {
|
me.doSave(array_);
|
}else {
|
Root.message({
|
type: 'warning',
|
message: '正常类型的生产计划已经被创建'
|
});
|
}
|
}else {
|
me.doSave(array_);
|
}
|
}
|
});
|
}else {
|
Server.call("root/data/getEntitySet/", param, function(result) {
|
if(result.success) {
|
if(result.data.entityset.length > 0 && me.formData.type == "1") {
|
Root.message({
|
type: 'warning',
|
message: '正常类型的生产计划已经被创建'
|
});
|
}else {
|
me.createCode(array_);
|
}
|
}
|
});
|
} */
|
},
|
|
submitRowTable() {
|
this.formData.continueCommit = true;
|
this.saveRowTable();
|
},
|
|
saveRowTable() {
|
this.dataIntegrityValidation();
|
},
|
|
doSave(array) {
|
var me = this;
|
this.fullscreenLoading = true;
|
|
/* if (!this.isType && this.formData.type == "1") {
|
Root.message({
|
type: 'warning',
|
message: '请修改类型为增补'
|
});
|
this.fullscreenLoading = false;
|
return;
|
} */
|
for (var i = 0; i < this.tableData2.length; i++) {
|
let data;
|
data = this.tableData2[i];
|
if(data.product_code == "") {
|
Root.message({
|
type: 'warning',
|
message: '第' + (i+1) + "条明细: 请选择产品"
|
});
|
this.fullscreenLoading = false;
|
return;
|
}
|
if(data.cnt == null || data.cnt == 0) {
|
Root.message({
|
type: 'warning',
|
message: '第' + (i+1) + "条明细: 请填写件数,且件数不能为0"
|
});
|
this.fullscreenLoading = false;
|
return;
|
}
|
|
}
|
for (var i = 0; i < array.length; i++) {
|
let data;
|
data = me.tableDataChange[array[i]].data;
|
if(data.cnt == null || data.cnt == 0 || data.product_code == "") {
|
Root.message({
|
type: 'warning',
|
message: '数据不完整,请检查数据'
|
});
|
this.fullscreenLoading = false;
|
return;
|
}
|
}
|
|
|
if (this.isUpload) {
|
var param = {
|
dataname: this.uploadDataname,
|
parentId: this.formData.id,
|
type: this.uploadType,
|
batchId: this.batch_id
|
};
|
|
if (this.formData.type == "正常" || this.formData.type == "1") {
|
param.isSuppler = true;
|
} else if (this.formData.type == "增补" || this.formData.type == "2") {
|
param.isSuppler = false;
|
}
|
|
//新建
|
if(this.popupParames.sceneCode == "add") {
|
if (me.formData.newfile_id) {
|
me.formData.file_id = me.formData.newfile_id;
|
}
|
|
Server.call("root/data/insertEntity/" + me.form_dataname, me.formData, function(result) {
|
if(result.success) {
|
Server.call("root/plan/transDataByTemp/", param, function(result) {
|
me.fullscreenLoading = false;
|
if(result.success) {
|
if (me.formData.continueCommit) {
|
let param1 = {
|
businessId: me.formData.id,
|
businessType: "product_plan",
|
variableMap: {
|
business_line_code: me.formData.business_line_code,
|
brand_business_code: me.formData.delivery_part_code
|
}
|
}
|
if(me.formData.business_line_code == "zsx") {
|
param1.variableMap.zsx = true;
|
}else {
|
param1.variableMap.zsx = false
|
}
|
Server.call("root/api/startAct", param1, function(result) {
|
console.log(result);
|
if (result.success){
|
if(result.data.data && result.data.data.activitiId) {
|
Server.call("root/data/updateEntity/" + me.form_dataname, {id: me.formData.id,flow_id: result.data.data.activitiId}, function(result) {
|
if(result.success) {
|
Root.message({
|
type: 'success',
|
message: '提交成功'
|
});
|
me.fullscreenLoading = false;
|
//2关闭当前页面并刷新前页面
|
Root.tab.removeItem(Root.tab.selected);
|
Root.tab.open(me.popupParames.parentOption, true);
|
}else{
|
Root.message({
|
type: 'warning',
|
message: result.message
|
});
|
me.fullscreenLoading = false;
|
return;
|
}
|
});
|
}else {
|
Root.message({
|
type: 'warning',
|
message: "提交出现异常"
|
});
|
me.fullscreenLoading = false;
|
return;
|
}
|
}else{
|
Root.message({
|
type: 'warning',
|
message: result.message
|
});
|
me.fullscreenLoading = false;
|
return;
|
}
|
});
|
|
}else {
|
Root.message({
|
type: 'success',
|
message: '保存成功'
|
});
|
me.fullscreenLoading = false;
|
//2关闭当前页面并刷新前页面
|
Root.tab.removeItem(Root.tab.selected);
|
Root.tab.open(me.popupParames.parentOption, true);
|
}
|
// Root.hidePopup();
|
}else {
|
Root.message({
|
type: 'warning',
|
message: result.message
|
});
|
me.fullscreenLoading = false;
|
return;
|
}
|
// //2关闭当前页面并刷新前页面
|
// Root.tab.removeItem(Root.tab.selected);
|
// Root.tab.open(me.popupParames.parentOption, true);
|
}, function(err) {
|
let str = "";
|
if(err.data.data.length > 0) {
|
for (var i = 0; i < err.data.data.length - 1; i++) {
|
str += "line:" + err.data.data[i].line + ","
|
}
|
str += "line:" + err.data.data[err.data.data.length-1].line
|
}
|
Root.message({
|
type: 'warning',
|
message: err.message + str
|
});
|
me.fullscreenLoading = false;
|
return;
|
});
|
}
|
})
|
}else {
|
//编辑
|
if (me.formData.newfile_id) {
|
me.formData.file_id = me.formData.newfile_id;
|
}
|
Server.call("root/data/updateEntity/" + me.form_dataname, this.formData, function(result) {
|
|
});
|
|
Server.call("root/plan/transDataByTemp/", param, function(result) {
|
me.fullscreenLoading = false;
|
if(result.success) {
|
if (me.formData.continueCommit) {
|
if(me.formData.status == "refuse") {
|
let param1 = {
|
flowId: me.formData.flow_id,
|
businessType: "product_plan",
|
pass: true,
|
variableMap: {
|
reason: ""
|
}
|
}
|
if(me.formData.business_line_code == "zsx") {
|
param1.variableMap.zsx = true;
|
}else {
|
param1.variableMap.zsx = false
|
}
|
Server.call("root/api/dealAct", param1, function(result) {
|
if (result.success) {
|
Root.message({
|
type: 'success',
|
message: '提交成功'
|
});
|
me.fullscreenLoading = false;
|
Root.tab.removeItem(Root.tab.selected);
|
Root.tab.open(me.popupParames.parentOption, true);
|
/* if (me.popupParames.callback) {
|
let obj = {
|
|
}
|
Root.popupParames.callback(obj, function() {
|
Root.hidePopup();
|
});
|
} */
|
} else {
|
Root.message({
|
type: 'warning',
|
message: result.message
|
});
|
me.fullscreenLoading = false;
|
return;
|
}
|
})
|
}else {
|
let param1 = {
|
businessId: me.formData.id,
|
businessType: "product_plan",
|
variableMap: {
|
business_line_code: me.formData.business_line_code,
|
brand_business_code: me.formData.delivery_part_code
|
}
|
}
|
if(me.formData.business_line_code == "zsx") {
|
param1.variableMap.zsx = true;
|
}else {
|
param1.variableMap.zsx = false
|
}
|
Server.call("root/api/startAct", param1, function(result) {
|
console.log(result);
|
if (result.success){
|
if(result.data.data && result.data.data.activitiId) {
|
Server.call("root/data/updateEntity/" + me.form_dataname, {id: me.formData.id,flow_id: result.data.data.activitiId}, function(result) {
|
if(result.success) {
|
Root.message({
|
type: 'success',
|
message: '提交成功'
|
});
|
me.fullscreenLoading = false;
|
//2关闭当前页面并刷新前页面
|
Root.tab.removeItem(Root.tab.selected);
|
Root.tab.open(me.popupParames.parentOption, true);
|
// me.onQuery();
|
}else{
|
Root.message({
|
type: 'warning',
|
message: result.message
|
});
|
me.fullscreenLoading = false;
|
return;
|
}
|
});
|
}else {
|
Root.message({
|
type: 'warning',
|
message: "提交出现异常"
|
});
|
me.fullscreenLoading = false;
|
return;
|
}
|
}else{
|
Root.message({
|
type: 'warning',
|
message: result.message
|
});
|
me.fullscreenLoading = false;
|
return;
|
}
|
});
|
}
|
}else {
|
Root.message({
|
type: 'success',
|
message: '保存成功'
|
});
|
me.fullscreenLoading = false;
|
//2关闭当前页面并刷新前页面
|
Root.tab.removeItem(Root.tab.selected);
|
Root.tab.open(me.popupParames.parentOption, true);
|
}
|
// Root.hidePopup();
|
}else {
|
Root.message({
|
type: 'warning',
|
message: result.message
|
});
|
me.fullscreenLoading = false;
|
return;
|
}
|
// //2关闭当前页面并刷新前页面
|
// Root.tab.removeItem(Root.tab.selected);
|
// Root.tab.open(me.popupParames.parentOption, true);
|
}, function(err) {
|
// console.info(err);
|
let str = "";
|
if(err.data.data.length > 0) {
|
for (var i = 0; i < err.data.data.length - 1; i++) {
|
str += "line:" + err.data.data[i].line + ","
|
}
|
str += "line:" + err.data.data[err.data.data.length-1].line
|
}
|
Root.message({
|
type: 'warning',
|
message: err.message + str
|
});
|
me.fullscreenLoading = false;
|
return;
|
})
|
}
|
} else{
|
if (array.length) { //存在需处理的明细数据
|
var id = array[0];
|
var row_ = this.tableDataChange[id];
|
var type = row_.type;
|
var row = row_.data;
|
|
var param = {};
|
let event = "";
|
|
if (type == "add") {
|
param = row;
|
param.parent_id = this.formData.id;
|
param.isClientMode = false;
|
|
event = "insertEntity";
|
} else if (type == "up") {
|
param = row;
|
param.isClientMode = false;
|
|
event = "updateEntity";
|
} else if (type == "del") {
|
param = {
|
id: row.id,
|
isClientMode: false
|
}
|
event = "deleteEntity";
|
}
|
|
Server.call("root/data/" + event + "/" + this.dataname, param, function(result) {
|
array.remove(id);
|
me.doSave(array);
|
});
|
|
} else {
|
if(this.popupParames.sceneCode != "edit") {
|
if (Object.keys(me.tableDataChange).length == undefined || Object.keys(me
|
.tableDataChange).length == 0) {
|
Root.message({
|
type: 'warning',
|
message: '请添加数据'
|
});
|
this.fullscreenLoading = false;
|
return;
|
}
|
}
|
//1保存form数据
|
let param = this.formData;
|
param.isClientMode = false;
|
let event = "updateEntity";
|
|
if(param.type == "正常") {
|
param.type = "1";
|
}else if(param.type == "增补") {
|
param.type = "2";
|
}
|
|
if (this.popupParames.sceneCode == "add") {
|
event = "insertEntity"
|
}
|
|
Server.call("root/data/" + event + "/" + this.form_dataname, param, function(result) {
|
if (me.formData.continueCommit) {
|
if(param.status == "refuse") {
|
let param1 = {
|
flowId: result.data.entity.flow_id,
|
businessType: "product_plan",
|
pass: true,
|
variableMap: {
|
reason: ""
|
}
|
}
|
if(me.formData.business_line_code == "zsx") {
|
param1.variableMap.zsx = true;
|
}else {
|
param1.variableMap.zsx = false
|
}
|
Server.call("root/api/dealAct", param1, function(result) {
|
if (result.success) {
|
Root.message({
|
type: 'success',
|
message: '提交成功'
|
});
|
me.fullscreenLoading = false;
|
Root.tab.removeItem(Root.tab.selected);
|
Root.tab.open(me.popupParames.parentOption, true);
|
/* if (me.popupParames.callback) {
|
let obj = {
|
|
}
|
Root.popupParames.callback(obj, function() {
|
Root.hidePopup();
|
});
|
} */
|
} else {
|
Root.message({
|
type: 'warning',
|
message: result.message
|
});
|
me.fullscreenLoading = false;
|
return;
|
}
|
})
|
}else {
|
let param1 = {
|
businessId: me.formData.id,
|
businessType: "product_plan",
|
variableMap: {
|
business_line_code: me.formData.business_line_code,
|
brand_business_code: me.formData.delivery_part_code
|
}
|
}
|
if(me.formData.business_line_code == "zsx") {
|
param1.variableMap.zsx = true;
|
}else {
|
param1.variableMap.zsx = false
|
}
|
Server.call("root/api/startAct", param1, function(result) {
|
console.log(result);
|
if (result.success){
|
if(result.data.data && result.data.data.activitiId) {
|
Server.call("root/data/updateEntity/" + me.form_dataname, {id: me.formData.id,flow_id: result.data.data.activitiId}, function(result) {
|
if(result.success) {
|
Root.message({
|
type: 'success',
|
message: '提交成功'
|
});
|
me.fullscreenLoading = false;
|
Root.tab.removeItem(Root.tab.selected);
|
Root.tab.open(me.popupParames.parentOption, true);
|
// me.onQuery();
|
}else{
|
Root.message({
|
type: 'warning',
|
message: result.message
|
});
|
me.fullscreenLoading = false;
|
return;
|
}
|
});
|
}else {
|
Root.message({
|
type: 'warning',
|
message: "提交出现异常"
|
});
|
me.fullscreenLoading = false;
|
return;
|
}
|
}else{
|
Root.message({
|
type: 'warning',
|
message: result.message
|
});
|
me.fullscreenLoading = false;
|
return
|
}
|
});
|
}
|
}else {
|
Root.message({
|
type: 'success',
|
message: '保存成功'
|
});
|
me.fullscreenLoading = false;
|
Root.tab.removeItem(Root.tab.selected);
|
Root.tab.open(me.popupParames.parentOption, true);
|
}
|
// this.fullscreenLoading = false;
|
//2回调
|
// Root.tab.removeItem(Root.tab.selected);
|
// Root.tab.open(me.popupParames.parentOption, true);
|
});
|
};
|
}
|
},
|
|
rowChange(row, type) {
|
//tc
|
if(!this.isUpload) {
|
if(row.add_id) {
|
var id_ = row.add_id;
|
}else {
|
var id_ = row.id;
|
}
|
if(type != "del") {
|
if (this.tableDataChange[id_]) {
|
this.tableDataChange[id_].data = row;
|
} else {
|
var changeRow_ = {
|
type: type,
|
data: row
|
};
|
if (id_ == undefined || id_ == "") {
|
this.tableDataChange[row.add_id] = changeRow_;
|
} else{
|
this.tableDataChange[id_] = changeRow_;
|
}
|
}
|
}
|
}
|
//t2
|
if (type == "add") {
|
this.tableData2.unshift(row);
|
} else if (type == "del") {
|
this.tableData2.remove(row);
|
if(row.add_id) {
|
this.$delete(this.tableDataChange, row.add_id)
|
}
|
}
|
this.$refs.form1.refresh();
|
},
|
|
fileUpload() {
|
if(!this.formData.delivery_part_code) {
|
Root.message({
|
type:"warning",
|
message:"请先选择生产工厂"
|
})
|
return;
|
}
|
/* if (this.formData.manager_part_code == undefined || this.formData.manager_part_code == '') {
|
Root.message({
|
type: 'warning',
|
message: '请选择管理主体'
|
});
|
return;
|
} else if (this.formData.type == undefined || this.formData.type == '') {
|
Root.message({
|
type: 'warning',
|
message: '请选择类型'
|
});
|
return;
|
} else if (this.formData.business_line_code == undefined || this.formData.business_line_code ==
|
'') {
|
Root.message({
|
type: 'warning',
|
message: '请选择业务线'
|
});
|
return;
|
} */
|
document.getElementById("btn_file").click()
|
},
|
|
getFile(event) {
|
var me = this;
|
this.fullscreenLoading = true;
|
var file = event.target.files;
|
var forms = new FormData();
|
|
if(file.length <= 0) {
|
this.fullscreenLoading = false;
|
}
|
for (var i = 0; i < file.length; i++) {
|
// 上传类型判断
|
var FileName = file[i].name;
|
var idx = FileName.lastIndexOf(".");
|
if (idx != -1) {
|
var ext = FileName.substr(idx + 1).toUpperCase();
|
ext = ext.toLowerCase();
|
if (ext == 'xlsx') {
|
let formData = new FormData()
|
formData.append("file", file[i]);
|
|
uploadAxios.post(baseUrl + 'root/plan/uploadProduce?userId=' + window.top.userinfo.user.id, formData).then(data_ => {
|
// console.log(data_.data.data.entityset);
|
if(data_.data.success) {
|
me.isUpload = true;
|
let file_id_ = data_.data.data.file_id;
|
me.formData.newfile_id = file_id_;
|
|
let i = 0;
|
let tableData = data_.data.data.entityset;
|
me.tableloading = true;
|
me.getStockCount(tableData,i);
|
me.batch_id = tableData[0].batch_id;
|
}else {
|
Root.message({
|
type: 'warning',
|
message: data_.data.message ? data_.data.message : "导入失败,请稍后再试"
|
});
|
}
|
|
/* for (var i = 0; i < data_.data.data.entityset.length; i++) {
|
data_.data.data.entityset[i].upload_id = uuid_short();
|
}
|
if(this.upload) {
|
for (var i = 0; i < this.tableData2.length; i++) {
|
if(this.tableData2[i].upload_id) {
|
this.tableData2.splice(i,1);
|
i --
|
}
|
}
|
for(let key in this.tableDataChange) {
|
if(this.tableDataChange[key].data.upload_id) {
|
this.$delete(this.tableDataChange, this.tableDataChange[key].data.upload_id)
|
}
|
}
|
this.tableData2.unshift(...data_.data.data.entityset);
|
data_.data.data.entityset.map(e => {
|
this.tableDataChange[e.upload_id] = {
|
data: e,
|
type: "add"
|
};
|
})
|
}else {
|
this.upload = true;
|
this.tableData2.unshift(...data_.data.data.entityset);
|
data_.data.data.entityset.map(e => {
|
this.tableDataChange[e.upload_id] = {
|
data: e,
|
type: "add"
|
};
|
})
|
} */
|
|
/* this.tableData2.unshift(...data_.data.data.entityset);
|
this.tableDataChange = {};
|
data_.data.data.entityset.map(e => {
|
this.tableDataChange[e.product_id] = {
|
data: e,
|
type: "add"
|
};
|
|
var param = {
|
dataname: "produceplansummary",
|
filter: "product_id =" + "\'" + e.product_id + "\'" +
|
"and manager_part_code =" + "\'" + this.formData
|
.manager_part_code + "\'" +
|
"and business_line_code =" + "\'" + this.formData
|
.business_line_code + "\'" +
|
"and year =" + "\'" + this.formData.year + "\'" +
|
"and quarter =" + "\'" + this.formData.quarter +
|
"\'" +
|
"and type = '正常'"
|
}
|
Server.call("root/data/getEntitySet/", param, function(
|
result) {
|
console.log(result);
|
if (result.data.entityset.length != 0) {
|
me.isType = false;
|
}
|
})
|
}) */
|
|
// this.$refs.btn_file.value = null;
|
me.fullscreenLoading = false;
|
}).catch(error => {
|
me.$message({
|
showClose: true,
|
message: ':请求出现错误:' + error,
|
type: 'error'
|
});
|
me.fullscreenLoading = false;
|
});
|
} else {
|
Root.message({
|
type: 'info',
|
message: '格式不正确'
|
});
|
me.fullscreenLoading = false;
|
}
|
}
|
}
|
},
|
downloadTemplate() {
|
var name = "生产计划模板.xlsx"
|
var url = baseUrl + "file/downloadTemplate?type=produce_upload&&userId=" + window.top.userinfo.user.id + "&&name=" + name;
|
dealExportByPath(url, "生产计划模板.xlsx");
|
// dealExportByPath("../../../template/plan.xlsx", "计划模板");
|
},
|
download() {
|
var id = "'" + this.formData.id + "'";
|
var url = baseUrl + "plan/downloadByType?type=Produce&&userId=" + window.top.userinfo.user.id + "&&id=" + id;
|
dealExportByPath(url, "生产计划信息.xlsx");
|
// dealExportByPath("../../../template/plan.xlsx","文件");
|
},
|
|
addTableData() {
|
var me = this;
|
if(!this.formData.delivery_part_name) {
|
Root.message({
|
type:"warning",
|
message:"请选择生产工厂"
|
})
|
return;
|
}
|
if(!this.formData.manager_part_code) {
|
Root.message({
|
type:"warning",
|
message:"请选择管理主体"
|
})
|
return;
|
}
|
if(!this.formData.business_line_code) {
|
Root.message({
|
type:"warning",
|
message:"请选择业务线"
|
})
|
return;
|
}
|
if(!this.formData.type) {
|
Root.message({
|
type:"warning",
|
message:"请选择类型"
|
})
|
return;
|
}
|
if (this.selectedrow != {}) {
|
this.selectedrow.isWithinEdit = false;
|
}
|
|
var id_ = uuid_short();
|
var row_ = {
|
isWithinEdit: true,
|
add_id: id_
|
};
|
|
for (var i = 0; i < this.tableFields.length; i++) {
|
let field_ = this.tableFields[i].field;
|
|
if (field_ == "parent_id") {
|
row_[field_] = this.formData.id;
|
} else {
|
row_[field_] = "";
|
}
|
}
|
|
this.selectedrow = row_;
|
if(this.isUpload) {
|
row_.batch_id = this.batch_id,
|
row_.line = this.tableData2.length+1,
|
Server.call("root/data/insertEntity/" + this.uploadDataname, row_, function(result) {
|
console.info(result);
|
result.data.entity.isWithinEdit = true;
|
me.tableData2.unshift(result.data.entity);
|
});
|
}else {
|
this.rowChange(row_, "add");
|
}
|
},
|
|
editData(scope) {
|
if (scope.row.isWithinEdit) {
|
scope.row.isWithinEdit = false;
|
} else {
|
if (this.selectedrow != {}) {
|
this.selectedrow.isWithinEdit = false;
|
}
|
this.selectedrow = scope.row;
|
scope.row.isWithinEdit = scope.row.isWithinEdit ? false : true;
|
}
|
this.isRefresh = false;
|
this.$nextTick(function() {
|
this.isRefresh = true;
|
})
|
},
|
|
showPopup(obj) {
|
this.selectFormField = obj.obj;
|
if (this.selectFormField.field == "delivery_part_name" ) {
|
let me = this;
|
var filter_ = "1 = 1";
|
Root.showPopup({
|
url: "../org/company/popup/managesubject_list.html",
|
width: 800,
|
height: 550,
|
dataname:"approvalFactoryNode",
|
type :"approvalFactoryNode",
|
filter:filter_,
|
callback: function(obj, callback) {
|
let formData_ = clone(me.formData);
|
formData_.delivery_part_name = obj.row.name;
|
formData_.delivery_part_code = obj.row.code;
|
me.formData = formData_;
|
me.tableData2 = [];
|
me.tableDataChange = {}
|
/* if(me.tableData2.length > 0) {
|
me.tableData2 = [];
|
me.addTableData();
|
} */
|
|
if (callback) {
|
callback();
|
}
|
}
|
});
|
}
|
},
|
|
cellShowPopup(scope) {
|
let me = this;
|
let row = scope.row;
|
let field = scope.column.property;
|
if (field == "company_name") {
|
Root.showPopup({
|
url: "../org/company/popup/managesubject_list.html",
|
width: 800,
|
height: 550,
|
type: "company_name",
|
dataname: "demandproduct",
|
callback: function(obj, callback) {
|
row.factory = obj.row.legalpersonsubjectname
|
if(me.isUpload) {
|
let param = row;
|
Server.call("root/data/updateEntity/" + me.uploadDataname, param, function(result) {
|
console.info(result);
|
});
|
}else {
|
me.rowChange(row, "up");
|
}
|
if (callback) {
|
callback();
|
}
|
}
|
});
|
} else if (field == "product_name") {
|
if (this.formData.year == undefined || this.formData.year == '') {
|
Root.message({
|
type: 'warning',
|
message: '请选择年份'
|
});
|
return;
|
}else if (this.formData.manager_part_code == undefined || this.formData.manager_part_code == '') {
|
Root.message({
|
type: 'warning',
|
message: '请选择管理主体'
|
});
|
return;
|
} else if (this.formData.type == undefined || this.formData.type == '') {
|
Root.message({
|
type: 'warning',
|
message: '请选择类型'
|
});
|
return;
|
} else if (this.formData.business_line_code == undefined || this.formData.business_line_code == '') {
|
Root.message({
|
type: 'warning',
|
message: '请选择业务线'
|
});
|
return;
|
} else if (this.formData.delivery_part_code == undefined || this.formData.delivery_part_code == '') {
|
Root.message({
|
type: 'warning',
|
message: '请选择生产工厂'
|
});
|
return;
|
}
|
|
let filter = " and flows.status = 'open' and delivery_organization.code='" + this.formData.delivery_part_code + "' and md_product.active = 1";
|
if(this.tableData2.length > 0) {
|
// for (var i = 0; i < this.tableData2.length; i++) {
|
// if(this.tableData2[i].product_code) {
|
// filter += " and company_name = '" + this.tableData2[i].company_name + "'"
|
// break;
|
// }
|
// }
|
|
for (var i = 0; i < this.tableData2.length; i++) {
|
if(this.tableData2[i].product_code) {
|
filter += " and product_link.product_code <> '" + this.tableData2[i].product_code + "'"
|
}
|
}
|
}
|
|
Root.showPopup({
|
url: "../md/product/popup/product_list.html",
|
width: 800,
|
height: 550,
|
dataname: "productLink",
|
type: "onlySimple",
|
filter: filter,
|
callback: function(obj, callback) {
|
let row_ = row;
|
row_.product_name = obj.row.product_name
|
row_.product_id = obj.row.id
|
row_.product_code = obj.row.product_code
|
row_.product_spec = obj.row.product_spec
|
row_.company_name = obj.row.company_name
|
row_.min_cnt = obj.row.min_cnt
|
row_.due_total = obj.row.due_total
|
row_.unfinish_cnt = obj.row.unfinish_cnt
|
row_.conversion_rate = obj.row.conversion_rate
|
row_.average_puresale_cnt = obj.row.average_puresale_cnt
|
|
var param1 = {
|
dataname: "produceSumLastYear",
|
filter: "year =" + "\'" + (me.formData.year - 1) + "\'" +
|
"and product_code =" + "\'" + row_.product_code + "\'"
|
}
|
|
Server.call("root/data/getEntitySet/", param1, function(result) {
|
console.log(result);
|
if(result.data.entityset.length >0) {
|
row_.sum_produce_cnt = result.data.entityset[0].sum_produce_cnt ? result.data.entityset[0].sum_produce_cnt : 0;
|
}
|
if(me.isUpload) {
|
let param = row_;
|
Server.call("root/data/updateEntity/" + me.uploadDataname, param, function(result) {
|
console.info(result);
|
});
|
}else {
|
me.rowChange(row_, "up");
|
}
|
})
|
|
var param = {
|
dataname: "produceplansummary",
|
filter: "product_id =" + "\'" + row_.product_id + "\'" +
|
"and a1.manager_part_code =" + "\'" + me.formData
|
.manager_part_code + "\'" +
|
"and a1.business_line_code =" + "\'" + me.formData
|
.business_line_code + "\'" +
|
"and a1.year =" + "\'" + me.formData.year + "\'" +
|
"and a1.quarter =" + "\'" + me.formData.quarter + "\'" +
|
"and a1.type = '正常'"
|
}
|
Server.call("root/data/getEntitySet/", param, function(result) {
|
console.log(result);
|
if (result.data.entityset.length != 0) {
|
me.isType = false;
|
}
|
})
|
let arr = [];
|
arr.push(row_.product_code)
|
let param2 = {
|
"deliveryPartCode": me.formData.delivery_part_code,
|
"productCodeList": arr
|
}
|
|
axios.post(window.top.RootSetting.url_stock + "order/getInventoryByVo", param2)
|
.then(data => {
|
console.info(data);
|
row_.stock = data.data.data.count;
|
row = row_;
|
})
|
.catch( (error) => {
|
console.log(error);
|
});
|
|
// row.stock = obj.row.stock
|
if (callback) {
|
callback();
|
}
|
}
|
});
|
}
|
},
|
|
cellVisibleChange(obj) {
|
/* if (obj.field == "business_line_code") {
|
var param = {
|
dataname: "dictitem",
|
filter: " parent_id='business_line'"
|
}
|
|
Server.call("root/data/getEntitySet", param, function(result) {
|
if (result && result.data.entityset ) {
|
obj.options = result.data.entityset;
|
}
|
});
|
} else if (obj.field == "manager_part_code") {
|
var param = {
|
dataname: "dictitem",
|
filter: " parent_id='manager-part'"
|
}
|
|
Server.call("root/data/getEntitySet", param, function(result) {
|
if (result && result.data.entityset ) {
|
obj.options = result.data.entityset;
|
}
|
});
|
} */
|
},
|
|
cellSelectChange(scope) {
|
let me = this;
|
let row = scope.row;
|
let field = scope.column.property;
|
|
if (field == "productname") {
|
let val = row[field];
|
let param_ = {
|
isClientMode: false,
|
dataname: "factory_product",
|
filter: "concat(md_product.name,md_product.spec) = " + "'" + val + "'",
|
}
|
|
Server.call("root/data/getEntitySet", param_, function(result) {
|
var productDetail = result.data.entityset[0];
|
row.factory = productDetail.factoryname;
|
row.productcode = productDetail.productcode;
|
row.productname = productDetail.productname + productDetail.spec;
|
row.spec = productDetail.spec;
|
|
if(me.isUpload) {
|
let param = row;
|
Server.call("root/data/updateEntity/" + me.uploadDataname, param, function(result) {
|
console.info(result);
|
});
|
}else {
|
me.rowChange(row, "up");
|
}
|
});
|
}
|
|
this.$refs.form1.refresh();
|
},
|
|
dataIntegrityValidation() {
|
if (this.formData.year == undefined || this.formData.year == '') {
|
Root.message({
|
type: 'warning',
|
message: '请选择年份'
|
});
|
return;
|
}else if (this.formData.manager_part_code == undefined || this.formData.manager_part_code == '') {
|
Root.message({
|
type: 'warning',
|
message: '请选择管理主体'
|
});
|
return;
|
} else if (this.formData.type == undefined || this.formData.type == '') {
|
Root.message({
|
type: 'warning',
|
message: '请选择类型'
|
});
|
return;
|
} else if (this.formData.business_line_code == undefined || this.formData.business_line_code == '') {
|
Root.message({
|
type: 'warning',
|
message: '请选择业务线'
|
});
|
return;
|
} else if (this.formData.delivery_part_code == undefined || this.formData.delivery_part_code == '') {
|
Root.message({
|
type: 'warning',
|
message: '请选择生产工厂'
|
});
|
return;
|
}
|
|
this.dataExistValidation();
|
},
|
|
cellInputChange(scope) {
|
let row = scope.row;
|
let field = scope.column.property;
|
if (field == "standard_cnt") {
|
if(row.min_cnt > row.standard_cnt) {
|
Root.message({
|
type: 'warning',
|
message: '输入的件数小于最小批量'
|
});
|
}
|
row.cnt = (row.standard_cnt ? row.standard_cnt : 0) * (row.conversion_rate ? row.conversion_rate : 1);
|
}
|
if(this.isUpload) {
|
let param = row;
|
Server.call("root/data/updateEntity/" + this.uploadDataname, param, function(result) {
|
console.info(result);
|
});
|
}else {
|
this.rowChange(row, "up");
|
}
|
},
|
|
cellClick(obj) {
|
// if(obj.column.property == "productname") {
|
// this.selectedrow = obj.row;
|
// this.showPic("showPic", obj.row);
|
// }
|
},
|
|
delData(scope) {
|
let me = this;
|
let row = scope.row;
|
let index_ = scope.$index;
|
|
Root.confirm('确定删除-' + row.product_name + '-吗?', '删除提示', {
|
confirmButtonText: '删除',
|
cancelButtonText: '取消',
|
type: 'warning'
|
}).then(() => {
|
if (row.id == undefined || row.id == '') {
|
me.rowChange(row, "del");
|
} else {
|
let param = {
|
id: row.id
|
}
|
if(me.isUpload) {
|
Server.call("root/data/deleteEntity" + "/" + me.uploadDataname, param, function(result) {
|
me.rowChange(row, "del");
|
});
|
}else {
|
Server.call("root/data/deleteEntity" + "/" + me.dataname, param, function(result) {
|
me.rowChange(row, "del");
|
});
|
}
|
}
|
Root.message({
|
type: 'success',
|
message: '删除成功!'
|
});
|
}).catch(() => {
|
|
Root.message({
|
type: 'info',
|
message: '已取消删除'
|
});
|
});
|
},
|
|
showPic(code, row) {
|
Root.popupParames = {
|
url: "../md/product/sku/pic_list.html",
|
};
|
Root.showPopup(Root.popupParames);
|
},
|
}
|
});
|
</script>
|
|
<style>
|
.el-collapse {
|
border: 0;
|
}
|
|
.el-collapse-item__content {
|
padding-bottom: 5px;
|
}
|
|
.el-collapse-item__header {
|
height: 30px;
|
line-height: 30px;
|
}
|
|
.el-collapse-item__header.is-active {
|
border-bottom-color: #e9f5f2;
|
}
|
|
.el-collapse-item__wrap {
|
border: 0;
|
}
|
|
.el-input__inner {
|
padding: 0 2px;
|
}
|
.header {
|
height: 21px;
|
}
|
.el-dialog__header {
|
border-bottom: 0;
|
}
|
.el-dialog__body {
|
text-align: center;
|
/* height: 200px; */
|
}
|
</style>
|
</body>
|
</html>
|