<!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 type="text/javascript">
|
var pageVue = null;
|
function loadJsCss(callback) {
|
var jscss_urls = [];
|
window.top.initJsCss(document, jscss_urls, callback);
|
};
|
|
function initVue() {
|
new FormVue({
|
el: "#vbody",
|
data: {
|
dataname: "so_order",
|
table_dataname: "",
|
title: "寄售订单信息",
|
|
formAttr: {
|
istitle: false,
|
title: "表单名称",
|
columnnumber: 2,
|
labelwidth: "140px",
|
labelposition: "left",//"left",// right//top
|
size: "mini",
|
border: "5px solid #c6c6c600"
|
},
|
formFields: [
|
{isshow: "T", field: "order_type", name: "订单类型", type: "select", disabled:true, Option:[
|
{label:"寄售订单",value:"寄售订单"},
|
]},
|
{isshow: "T", field: "code", name: "订单编号", type: "span", disabled: true, required: true, notvalunit: true},
|
{isshow: "T", field: "sales_group", name: "销售组织", type: "select", disabled: true, required: true, notvalunit: true},
|
{isshow: "T", field: "product_group", name: "产品组", type: "select", disabled: true, defaultval: "", notvalunit: true},
|
{isshow: "T", field: "customer_consignee_user_name", name: "期望收货方式", type: "select",options: [{code: "普通快递",value: "普通快递"}, {code: "自提",value: "自提"}],},
|
{isshow: "T", field: "customer_consignee_phone", name: "收货地址", type: "select", required: true},
|
{isshow: "T", field: "operate_emp_name", name: "办事处分仓", type: "select"},
|
{isshow: "T", field: "business_depart_name", name: "期望交货日期", type: "date",},
|
{isshow: "T", field: "file_name_certificate_original111",name: "附件", type:"button", buttonarrayname: [{type: "isnotdatashow", buttonname:"附件上传",code:"upload", icon: "el-icon-upload", classname: "form_uploadfile"},{type:"isdata", buttonname: "查看文件", icon: "el-icon-search",code:"showfile", classname: "form_showfile"},{type: "isdatashow", buttonname: "删除附件", icon: "el-icon-delete",code:"delfile", classname: "form_delfile"}],},
|
{isshow: "T", field: "remark", name: "备注", type: "textarea", colspan:2, notvalunit: true},
|
],
|
newformData: {
|
//id: uuid_short(),
|
code: createCode("CS"),
|
create_time: createDatetime(),
|
state_code: "Input",
|
state_name: "草稿",
|
// order_type: "寄售订单",
|
// product_group: "结构性心脏病品类",
|
// sales_group: "北京华医",
|
creator_name: window.top.vue.userinfo.name,
|
customer_id: window.top.vue.userinfo.org.id,
|
customer_code: window.top.vue.userinfo.org.code,
|
customer_name: window.top.vue.userinfo.org.name,
|
ncc_customer_code: window.top.vue.userinfo.org.ncccode,
|
},
|
formData: {},
|
|
tableFields: [
|
{isshow: "T", field: "material_code", name: "物料编码", width: "100"},
|
{isshow: "T", field: "material_name", name: "物料名称", width: "350", type: "popup", align: "left"},
|
{isshow: "T", field: "spec", name: "规格", width:"150", type: "span",},
|
{isshow: "T", field: "qty", name: "数量", type: "input", istablesum: true},
|
{isshow: "T", field: "unit", name: "单位", type: "span"},
|
{isshow: "T", field: "product_price", name: "保证金", formatter: "formatter_money", align: "right"},
|
|
],
|
newTableData: {
|
create_time: createDatetime(),
|
// creator_name: window.top.vue.userinfo.name,
|
},
|
tableData: [],
|
|
isRefresh: true,
|
|
dataRequest: [
|
{
|
name: "md_salesgroup",//销售组织
|
//url: "root/front/getOneDictionary",
|
//paramsobj: { code: "OrgType", },
|
filter: "",
|
isnotoption: false, //true:不是选项
|
code:"code",//是下拉选项时设置
|
label:"name",//是下拉选项时设置
|
},
|
|
{
|
name: "md_prodgroup",//产品组
|
//url: "root/front/getOneDictionary",
|
//paramsobj: { code: "OrgType", },
|
isnotoption: false, //true:不是选项
|
code:"code",//是下拉选项时设置
|
label:"name",//是下拉选项时设置
|
},
|
|
{
|
name: "md_org_shipto",//收货地址
|
//url: "root/front/getOneDictionary",
|
//paramsobj: { code: "OrgType", },
|
filter: "parent_id='" + window.top.vue.userinfo.org.id + "'",
|
isnotoption: false, //true:不是选项
|
code:"address",//是下拉选项时设置
|
label:"address",//是下拉选项时设置
|
},
|
],
|
|
//按键权限设置
|
isedit: false,//提交前编辑,保存/提交
|
isrefuseedit: false,//拒绝后编辑,保存/再次提交
|
isapproval: false,//审批,同意/拒绝/转办/退回
|
|
iscommit: false,//提交标记
|
|
//审批相关变量
|
loading_save: false,
|
loading_pass: false,
|
reasonvisible:false,//审批通过或拒绝填写原因
|
textarea2: '',//填写理由
|
passOrRefuse:false,
|
|
//弹窗参数
|
popupParames: {},
|
//字段设置
|
tablefieldClick: {},
|
formfieldClick: {},
|
loading_page: false,
|
// tableCheckNopass: [],
|
|
iscustomer: false,
|
// isoverduelicence: false,
|
t_height:null,
|
},
|
created() {
|
this.popupParames = clone(Root.popupParames);
|
if (window.top.vue.userinfo && window.top.vue.userinfo.org && window.top.vue.userinfo.org.is_account) {
|
this.iscustomer = true;
|
//动态获取默认数据
|
// if (this.popupParames.sceneCode != "browse") {
|
// var OrgRegisterValidation_ = {
|
// name: "OrgRegisterValidation",
|
// url: "root/saleschecker/validCheck",
|
// paramsobj: {
|
// id: window.top.vue.userinfo.org.id,
|
// checkType: "OrgRegisterValidation"
|
// },
|
// isnotoption: true, //true:不是选项
|
// }
|
// this.dataRequest.push(OrgRegisterValidation_);
|
// }
|
}
|
|
this.title = this.popupParames.title || this.popupParames.text
|
if (this.popupParames.data) {
|
this.formData = clone(this.popupParames.data);
|
}
|
|
if (this.popupParames.sceneCode) {
|
if (this.popupParames.sceneCode == "add") {//新增
|
//动态获取默认数据
|
// var newEntity_ = {
|
// name: "newEntity",
|
// url: "root/data/newEntity",
|
// paramsobj: {dataname: ""},
|
// isnotoption: true, //true:不是选项
|
// }
|
// this.dataRequest.push(newEntity_);
|
|
// if (this.newTableData) {
|
// this.tableData.push(clone(this.newTableData));
|
// }
|
|
this.isedit = true;
|
}
|
else if (this.popupParames.sceneCode == "browse") {//只读
|
this.formAttr.disabled = true;
|
}
|
else if (this.popupParames.sceneCode == "edit") {//编辑
|
this.isedit = true;
|
}
|
else if (this.popupParames.sceneCode == "approval") {//审批
|
this.formAttr.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 - 91;
|
//预加载数据
|
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[""]);
|
// // formData.product_category_name = [];
|
// if (me.newformData) {
|
// let formData_ = clone(formData);
|
|
// for (var k in me.newformData) {
|
// if (!formData_[k]) {
|
// formData_[k] = me.newformData[k];
|
// }
|
// }
|
|
// me.formData = formData_;
|
// }
|
// }
|
|
// if (me.dataRequestObj.OrgRegisterValidation) {
|
// if (me.dataRequestObj.OrgRegisterValidation.validation && me.dataRequestObj.OrgRegisterValidation.validation.count && me.dataRequestObj.OrgRegisterValidation.validation.count.reject) {
|
// me.isoverduelicence = true;
|
// }
|
// }
|
|
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;
|
|
//字段数组转字段obj,目的为了筛选时获取字段属性
|
me.fieldsToFieldsObj();
|
|
//设置字段事件
|
me.tableFieldClick();
|
|
if (this.formData.id) {
|
id_ = this.formData.id;
|
}
|
|
this.getRowDataById(id_, function(result) {//查询后的回调,用于获取字段的
|
if (result.meta && result.meta[me.dataname] && result.meta[me.dataname].fields) {
|
var metas = clone(result.meta[me.dataname].fields);
|
var table_dataname_ = "";
|
for (var dataname_ in result.meta) {
|
if (dataname_ != me.dataname && !table_dataname_) {
|
table_dataname_ = dataname_;
|
}
|
}
|
var table_metas = [];
|
if (table_dataname_) {
|
me.table_dataname = table_dataname_;
|
table_metas = clone(result.meta[table_dataname_].fields);
|
|
}
|
|
var formFields_ = [];
|
var tableFields_ = [];
|
metas.map(f=>{
|
f.isshow = "T";
|
|
if(f.field == "salesgroup_code") {//销售组织
|
f.options = me.dataRequestObj.md_salesgroup;
|
}
|
else if(f.field == "prodgroup_code") {//产品组
|
f.options = me.dataRequestObj.md_prodgroup;
|
}
|
else if(f.field == "shipto_address_fullname") {//收货地址
|
f.options = me.dataRequestObj.md_org_shipto;
|
}
|
|
formFields_.push(clone(f));
|
})
|
table_metas.map(f=>{
|
f.isshow = "T";
|
tableFields_.push(clone(f));
|
})
|
|
if (!me.formFields || (me.formFields && me.formFields.length == 0)) {
|
me.formFields = clone(formFields_);
|
me.tableFields = clone(tableFields_);
|
}
|
}
|
|
if (me.rowData[me.dataname]) {
|
me.formData = me.rowData[me.dataname];
|
}
|
if (me.rowData[me.table_dataname]) {
|
me.tableData = me.rowData[me.table_dataname];
|
}
|
})
|
},
|
|
tableFieldClick() {
|
var me = this;
|
//表单字段事件设置
|
this.formfieldClick = {
|
hope_shipto_type_code:{
|
select: {
|
onchange: function(obj) {//单选更改事件
|
var formData_ = clone(me.formData);
|
formData_.hope_shipto_type = obj.selectoption.value || "";
|
me.formData = clone(formData_);
|
}
|
},
|
},
|
|
shipto_address_fullname:{
|
select: {
|
onchange: function(obj) {//单选更改事件
|
// console.log(obj);
|
// obj.data.type_name = clone(obj.product_type);
|
me.inputShipto(obj);
|
}
|
},
|
},
|
};
|
|
//表格字段事件设置
|
this.tablefieldClick = {
|
material_name: {
|
popup: {
|
onclick: function(obj) {//弹窗点击事件
|
//打开
|
me.tablepopup_productlist(obj);
|
}
|
},
|
},
|
qty: {
|
input: {
|
onkeydown: function(e, b) {
|
let key = e.key;
|
var box = /^[0-9]*$/;//数值的正则表达式
|
if (key == "Backspace") {//删除按键Backspace
|
return true
|
}
|
if (!box.test(key)) {
|
e.returnValue = false
|
return false
|
}
|
else return true
|
},
|
},
|
},
|
};
|
},
|
|
inputShipto(obj){
|
var me = this;
|
var formData_ = clone(me.formData);
|
|
formData_.shipto_contact = obj.selectoption.contact_name;
|
formData_.shipto_phone = obj.selectoption.contact_phone;
|
formData_.shipto_address_id = obj.selectoption.id;
|
formData_.ncc_shipto_address_id = obj.selectoption.ncc_id;
|
|
me.formData = clone(formData_);
|
},
|
|
tablepopup_productlist(obj) {
|
var me = this;
|
|
let index = obj.$index;
|
Root.showPopup({
|
url: "module/order/page/popup-new_consale_order-product.html",
|
width: 800,
|
height: 550,
|
sceneCode: "add",
|
|
callback: function(obj, callback) {
|
me.$set(me.tableData[index], "material_code", obj.row.material_code);
|
me.$set(me.tableData[index], "material_name", obj.row.material_name);
|
me.$set(me.tableData[index], "unit", obj.row.unit);
|
me.$set(me.tableData[index], "spec", obj.row.spec);
|
|
if (callback) {
|
callback();
|
}
|
}
|
});
|
},
|
|
addTableData() {
|
var table_row = clone(this.newTableData);
|
this.rowChange(table_row, "add", this.table_dataname);
|
},
|
|
delData(scope) {
|
let me = this;
|
let row = scope.row;
|
let index_ = scope.$index;
|
|
Root.confirm('确定删除数据【' + JSON.stringify(row) + '】吗?', '删除提示', {
|
confirmButtonText: '删除',
|
cancelButtonText: '取消',
|
type: 'warning'
|
}).then(() => {
|
me.rowChange(row, "del", me.table_dataname);
|
}).catch(() => {
|
Root.message({
|
type: 'info',
|
message: '已取消删除'
|
});
|
});
|
},
|
|
rowChange(row, type, tablename) {
|
var me = this;
|
if (type == "add") {
|
this.tableData.unshift(row);
|
}
|
else if (type == "del") {
|
if (row.id) {
|
let param = {
|
dataname: tablename,
|
id: row.id
|
}
|
|
Server.call("root/data/deleteEntity", param, function(result) {
|
console.log(result);
|
if (result && result.data) {
|
me.tableData.remove(row);
|
|
Root.message({
|
type: 'success',
|
message: '删除成功!'
|
});
|
}
|
});
|
}
|
else {
|
this.tableData.remove(row);
|
}
|
}
|
else {
|
|
}
|
},
|
|
//提交
|
submitRowTable() {
|
this.iscommit = true;
|
this.saveRowTable();
|
},
|
|
//保存
|
saveRowTable() {
|
var me = this;
|
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] == false || entity_[r] == 0) {
|
entity[r] = entity_[r];
|
}
|
}
|
|
var tableData_ = [];
|
this.tableData.map(r=>{
|
var row_ = {};
|
for (var k in r) {
|
if (r[k]) {
|
row_[k] = r[k];
|
}
|
}
|
tableData_.push(row_);
|
})
|
|
if (tableData_.length == 0) {
|
Root.message({
|
type: 'warning',
|
message: '请先添加明细数据'
|
});
|
return
|
}
|
|
let param = {
|
dataname: this.dataname,
|
// operator: operator_,
|
data: {},
|
}
|
param.data[this.dataname] = entity;
|
param.data[this.table_dataname] = tableData_;
|
|
Server.call("root/data/saveEntity", param, function(result) {
|
console.log(result);
|
if (result.success) {
|
if(me.iscommit){
|
me.iscommit = false;
|
Root.message({
|
type: 'success',
|
message: '提交成功'
|
});
|
me.saveAfter();
|
}
|
else {
|
Root.message({
|
type: 'success',
|
message: '保存成功'
|
});
|
me.saveAfter();
|
}
|
}
|
});
|
},
|
|
//审批通过相关数据赋值
|
onPassApproval(){
|
this.textarea2 = "";
|
this.reasonvisible = true;
|
this.passOrRefuse = true;
|
},
|
|
//审批拒绝相关数据赋值
|
onRefuseApproval(){
|
this.textarea2 = "";
|
this.reasonvisible = true;
|
this.passOrRefuse = false;
|
},
|
|
//保存通过/拒绝原因
|
saveReason(){
|
if(this.passOrRefuse){
|
//审批通过后拆分成生产订单;
|
//this.batchOrder();
|
//this.passApproval('sales',this.textarea2);
|
this.doApproval();
|
}else{
|
if(this.textarea2 != ""){
|
//this.refuseApproval('sales',this.textarea2)
|
this.doReject();
|
}
|
else{
|
Root.message({
|
type: 'warning',
|
message: '请填写原因'
|
});
|
}
|
}
|
},
|
|
//审批通过
|
doApproval() {
|
var me = this;
|
|
let param = {
|
"business_type":"sales",
|
"flow_id": this.formData.flow_id,
|
"user_id": Root.userInfo.id,
|
"pass": true,
|
"reason": this.textarea2,
|
"variableMap": {
|
"province": this.formData.province
|
}
|
}
|
Server.call("root/workFlow/dealAct", param, function(result) {
|
// console.log(result);
|
if (result.success) {
|
Root.message({
|
type: 'success',
|
message: '审批成功'
|
});
|
//拆单时要不要重新调用接口
|
me.saveAfter();
|
}
|
else {
|
Root.message({
|
type: 'success',
|
message: '已拒绝'
|
});
|
me.saveAfter();
|
}
|
});
|
},
|
|
//审批拒绝
|
doReject() {
|
var me = this;
|
|
let param = {
|
"business_type":"sales",
|
"flow_id": this.formData.flow_id,
|
"user_id": Root.userInfo.id,
|
"pass": false,
|
"reason": this.textarea2,
|
"variableMap": {
|
"province": this.formData.province
|
}
|
}
|
Server.call("root/workFlow/dealAct", param, function(result) {
|
// console.log(result);
|
if (result.success) {
|
Root.message({
|
type: 'success',
|
message: '已拒绝'
|
});
|
me.saveAfter();
|
}
|
});
|
},
|
}
|
});
|
};
|
|
loadJsCss(function () {
|
initVue();
|
});
|
</script>
|
<style>
|
/* 在vue.js中 v-cloak 这个指令是防止页面加载时出现 vuejs 的变量名而设计的 */
|
[v-cloak] {
|
display: none !important;
|
}
|
</style>
|
|
</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 :style="{height: t_height +'px', 'overflow-y': 'auto'}">
|
<!-- <div style="height: 550px; 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=" text-align: right; margin-top: 20px;">
|
<!-- 工具栏 -->
|
<div style=" display: inline-block; width: 90px;">
|
<el-button-group>
|
<el-button @click="addTableData">新增明细</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="isedit || isrefuseedit"
|
:is-within-edit-table-data="isedit || isrefuseedit"
|
:is-pagination="false"
|
:table-field-click="tablefieldClick"
|
:is-show-index="tableData.length ? true : false"
|
:edit-table-button="editTableButton"
|
|
|
v-on:get-data="getData"
|
v-on:del-data="delData"
|
>
|
</h-table>
|
</div>
|
|
<el-dialog title="填写原因" :visible.sync="reasonvisible" height="50%">
|
<el-input
|
type="textarea"
|
:autosize="{ minRows: 2, maxRows: 10}"
|
placeholder="请输入原因"
|
v-model="textarea2">
|
</el-input>
|
|
<div slot="footer" class="dialog-footer" >
|
<el-button type="primary" @click="saveReason">确 定</el-button>
|
<el-button type="default" @click="reasonvisible = false">取 消</el-button>
|
</div>
|
</el-dialog>
|
</div>
|
</div>
|
<div class="el-dialog__footer">
|
<el-button size="small" type="default" @click="closeDialog">取 消</el-button>
|
<el-button size="small" v-if="isedit || isrefuseedit" type="primary" @click="saveRowTable":icon="buttonsconfig.save.icon">{{buttonsconfig.save.name}}</el-button>
|
<el-button size="small" v-if="isedit" type="success" @click="submitRowTable":icon="buttonsconfig.submit.icon">{{buttonsconfig.submit.name}}</el-button>
|
<el-button size="small" v-if="isrefuseedit" type="success" @click="">再次提交</el-button>
|
|
<el-button size="small" v-if="isapproval" type="success" @click="onPassApproval">通 过</el-button>
|
<el-button size="small" v-if="isapproval" type="danger" @click="onRefuseApproval">拒 绝</el-button>
|
<!-- <el-button size="small" v-if="isapproval" type="primary" @click="">转 办</el-button>
|
<el-button size="small" v-if="isapproval" type="success" @click="">退 回</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>
|
</body>
|
</html>
|