<!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/page.js?v=20220615"></script>
|
<script src="../../../js/myelement.js?v=20220615"></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 class="topbar">
|
<span>{{title}}</span>
|
|
<span class="versionNo">版本号: {{currentVersion.label}}</span>
|
<!-- <h-select :datalist="versionList" v-on:itemselect="onVersionSelect"></h-select> -->
|
<h-iconselect ref="ref_addRoleToUser" icon="el-icon-caret-bottom"
|
:datalist="versionList" v-on:itemselect="onVersionSelect">
|
</h-iconselect>
|
<div style="float: right; margin-right: 24px;">
|
<el-button-group style="margin-left: 3px;">
|
<el-button icon="el-icon-refresh" @click="onRefresh">刷新</el-button>
|
<el-button v-if="role.isshow_db" icon="el-icon-plus" @click="onNewRecord" :disabled="!authorize.insert">添加</el-button>
|
<el-button v-if="role.isshow_db" @click="setEditTableData" :disabled="!authorize.edit">{{isEditTableData ? '取消编辑' : '在线编辑'}}</el-button>
|
</el-button-group>
|
|
<el-button-group style="margin-left: 3px;">
|
<el-button v-if="role.isshow_db" @click="onChangeStatu('cancel')" :disabled="!authorize.upload">取消</el-button>
|
<el-button v-if="role.isshow_db" @click="onChangeStatu('submit')" :disabled="!authorize.commit">提交</el-button>
|
<el-button v-if="role.isshow_jl" @click="approval()" :disabled="!authorize.commit">审批</el-button>
|
</el-button-group>
|
|
<el-button-group style="margin-left: 3px;">
|
<el-button @click="onShowDetail()" :disabled="!authorize.commit">关联单据</el-button>
|
</el-button-group>
|
</div>
|
</div>
|
|
<div class="topbar-line">
|
<div class="query-icon">
|
<i class="iconfont icon-query"></i>
|
</div>
|
<div class="query-bar" style="width: 95%;" >
|
<el-form label-position='right' :inline="true" :model="formInline" class="demo-form-inline">
|
<el-row>
|
<el-col :span="5">
|
<el-form-item label="订单编号:" label-width="100px" style="line-height: 40px;">
|
<el-input size="mini" v-model="formInline.field1" style="width: 140px;"></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="11">
|
<el-form-item label="单据日期:" label-width="80px" style="line-height: 40px; text-align: center;">
|
<el-col :span="11">
|
<el-date-picker type="date" placeholder="开始日期" v-model="formInline.field4.begtime" style="width: 100%;"></el-date-picker>
|
</el-col>
|
<el-col :span="2">-</el-col>
|
<el-col :span="11">
|
<el-date-picker type="date" placeholder="结束日期" v-model="formInline.field4.endtime" style="width: 100%;"></el-date-picker>
|
</el-col>
|
</el-form-item>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item label="客户名称:" label-width="80px" style="line-height: 40px;">
|
<el-input size="mini" v-model="formInline.field2" style="width: 140px;"></el-input>
|
<el-button style="padding: 5px;" @click="showPopup_gh">*</el-button><!-- icon="el-icon-share" -->
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row >
|
<el-col :span="5">
|
<el-form-item label="订单类型:" label-width="100px" style="line-height: 40px;">
|
<el-select v-model="formInline.field6" placeholder="请选择"style="width: 140px;">
|
<el-option
|
v-for="item in orderType"
|
:key="item.value"
|
:label="item.label"
|
:value="item.value">
|
</el-option>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
<el-col :span="6">
|
<el-form-item label="状态:" label-width="80px" style="line-height: 40px;">
|
<el-select v-model="formInline.field7" placeholder="请选择">
|
<el-option
|
v-for="item in orderStatus"
|
:key="item.value"
|
:label="item.label"
|
:value="item.value">
|
</el-option>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
<el-col :span="13">
|
<el-form-item>
|
<el-button @click="onQuery">查 询</el-button>
|
<el-button @click="onInitQuery">重 置</el-button>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
</el-form>
|
</div>
|
</div>
|
|
<div 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="tableHeight2"
|
:is-highlight-row="true"
|
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>
|
|
<el-dialog :visible.sync="rowTableDialog" width="60%">
|
<div slot="title" class="dialog-title">
|
<i class="iconfont icon-customermanagement"></i>
|
<span> {{formAttr.title}} </span>
|
</div>
|
<h-form
|
ref="form1"
|
:form-attr="formAttr"
|
:table-fields="tableFields"
|
:form-data="formData"
|
v-on:show-popup="showPopup"
|
>
|
</h-form>
|
|
<div slot="footer" class="dialog-footer">
|
<el-button @click="rowTableDialog = false">取 消</el-button>
|
<el-button type="primary" @click="saveRowTable">保 存</el-button>
|
</div>
|
</el-dialog>
|
|
<el-dialog title="选择客户" :visible.sync="popupByFieldsDialog" width="80%" top="20px">
|
<div class="topbar-line">
|
<div class="query-icon">
|
<i class="iconfont icon-query"></i>
|
</div>
|
<div class="query-bar">
|
<el-form label-position='left' label-width="50px" :inline="true" :model="formInline_gh" class="demo-form-inline">
|
<el-form-item label="名称:" style="line-height: 40px;">
|
<el-input size="mini" v-model="formInline_gh.field2" placeholder="请输入" style="width: 140px;"></el-input>
|
</el-form-item>
|
<el-form-item>
|
<el-button @click="onQuery_gh">查 询</el-button>
|
<el-button @click="onInitQuery_gh">重 置</el-button>
|
</el-form-item>
|
</el-form>
|
</div>
|
</div>
|
<h-table
|
v-if="isRefresh"
|
ref="table2"
|
:table-fields="tableFields1"
|
:table-data="tableData_cus2"
|
:pagesize="pagesize_gh"
|
:pagenum="pagenum_gh"
|
:total="total_gh"
|
:table-height="tableHeight_cus"
|
:is-highlight-row="true"
|
|
v-on:row-click="rowClickCus"
|
v-on:get-data="getData_gh"
|
>
|
</h-table>
|
|
<div slot="footer" class="dialog-footer" >
|
<el-button type="default" @click="popupByFieldsDialog = false">取 消</el-button>
|
<el-button type="primary" @click="saveFormValByField">确 定</el-button>
|
</div>
|
</el-dialog>
|
</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>
|
|
<script type="text/javascript">
|
new Vue({
|
el: "#vbody",
|
data: {
|
role: RootRole,
|
title: "销售订单",
|
authorize: {
|
download: true,
|
upload: true,
|
insert: true,
|
edit: true,
|
commit: true
|
},
|
state: {
|
operatebuttons: true,
|
editbuttons: true,
|
commitbuttons: false
|
},
|
currentVersion: {
|
value: "1.0",
|
label: "1.0"
|
},
|
versionList: [
|
{
|
value: "1.0",
|
label: "1.0"
|
},
|
{
|
value: "2.0",
|
label: "2.0"
|
},
|
{
|
value: "3.0",
|
label: "3.0"
|
}
|
],
|
provinces: [],
|
orderType: [],
|
orderStatus: [],
|
formInline: {
|
field4: {}
|
},
|
begTime: "",
|
endTime: "",
|
|
isRefresh: true,
|
tableFields: [
|
{field: "field1", name: "订单编号", isshow: "T", type: "button", align: "center", width: "160", required: true, disabled:false, iscellclick: true},
|
{field: "field4", name: "单据日期", isshow: "T", align: "center", required: true},
|
{field: "field6", name: "订单类型", isshow: "T", align: "center", type: "select", options: dataRoot.database.orderType},
|
{field: "field7", name: "状态", isshow: "T", align: "center", type: "button", iscellclick: true},
|
{field: "field13", name: "客户编码", isshow: "T", align: "center", width: "120", required: true},
|
{field: "field2", name: "客户名称", isshow: "T", align: "center", width: "280", required: true},
|
{field: "field3", name: "制单人", isshow: "T", align: "center"},
|
{field: "field5", name: "金额", isshow: "T", align: "right", width: "120", formatter: "formatter_money"},
|
{field: "field16", name: "上传附件", isshow: "T", align: "center", type: "button", iscellclick: true},
|
{field: "field12", name: "资信检查", isshow: "T", align: "center", type: "button", iscellclick: true, formatter: "formatter_TF1"}
|
],
|
operationtype: "",
|
tableData_old: [],
|
tableData_new: [],
|
tableData2: [],
|
tableData: [],
|
tableHeight2: 450,
|
urlImg2: "./img/wushuju.png",
|
isEditTableData:false,
|
|
pagesize: 10,
|
pagenum: 1,
|
total: 0,
|
rowTableDialog: false,
|
selectrow: {},
|
|
formAttr: {
|
istitle: false,
|
title: "销售订单",
|
columnnumber: 3,
|
labelwidth: "100px",
|
labelposition: "right",
|
size: "medium",
|
border: "10px solid #c6c6c600"
|
},
|
tableFields2: [],
|
formData: {},
|
popupByFieldsDialog: false,
|
formInline_gh: {},
|
tableFields1: [
|
{field: "field1", name: "客户代码", isshow: "T", align: "center", required: true},
|
{field: "field2", name: "客户名称", isshow: "T", align: "center", required: true},
|
],
|
tableData_cus_new: [],
|
tableData_cus: [],
|
tableData_cus2: [],
|
pagesize_gh: 10,
|
pagenum_gh: 1,
|
total_gh: 0,
|
tableHeight_cus: 350,
|
selectcusrow: {},
|
|
selectFormField:{},
|
},
|
created() {
|
this.orderType = dataRoot.database.orderType;
|
this.orderStatus = dataRoot.database.orderStatus;
|
this.provinces = dataRoot.database.province;
|
this.tableData_new = dataRoot.database.order;
|
this.tableData_old = clone(dataRoot.database.order);
|
this.tableData2 = this.tableData_new;
|
},
|
|
mounted() {
|
this.initTableData();
|
this.$nextTick(() => { // 以服务的方式调用的 Loading 需要异步关闭
|
document.getElementById('page_root').style.display = "block";
|
document.getElementById('page_loading').style.display = "none";
|
});
|
},
|
|
methods:{
|
//表格
|
setEditTableData() {
|
this.isRefresh = false;
|
this.isEditTableData = !this.isEditTableData;
|
this.initTableData();
|
},
|
initTableData() {
|
let me = this;
|
this.total = this.tableData2.length;
|
this.tableData = this.tableData2.slice((this.pagenum-1)*this.pagesize, this.pagenum * this.pagesize);
|
|
if(this.tableData.length > 0){
|
this.$nextTick(function(){
|
this.isRefresh = true;
|
this.$nextTick(function(){
|
let header_height = me.$refs.table1.$el.getElementsByClassName('el-table__header-wrapper')[0].offsetHeight;
|
let row_height = me.$refs.table1.$el.getElementsByClassName('el-table__row')[0].offsetHeight || 40;
|
let body_width = me.$refs.table1.$el.getElementsByClassName('el-table__body')[0].offsetWidth;
|
let body_wrapper_width = me.$refs.table1.$el.getElementsByClassName('el-table__body-wrapper')[0].offsetWidth;
|
this.tableHeight2 = header_height + (row_height * this.pagesize) + this.pagesize/4.5;
|
if((body_width - body_wrapper_width)>5){
|
this.tableHeight2 += 20
|
}
|
})
|
})
|
}
|
},
|
|
getData(page) {
|
this.pagesize = page.pagesize;
|
this.pagenum = page.pagenum;
|
this.doQuery();
|
},
|
editData(scope) {
|
//this.operationtype = "edit";
|
//this.formData = clone(row);
|
//this.rowTableDialog = true;
|
this.selectrow = scope.row;
|
this.openMsg1("edit", scope.row);
|
},
|
delData(scope) {
|
let me = this;
|
let row = scope.row;
|
let index_ = scope.$index;
|
|
Root.confirm('确定删除-' + row.field1 + '-吗?', '删除提示', {
|
confirmButtonText: '删除',
|
cancelButtonText: '取消',
|
type: 'warning'
|
}).then(() => {
|
me.tableData_new.remove(row);
|
me.tableData2.remove(row);
|
me.doQuery();
|
Root.message({
|
type: 'success',
|
message: '删除成功!'
|
});
|
}).catch(() => {
|
Root.message({
|
type: 'info',
|
message: '已取消删除'
|
});
|
});
|
},
|
cellClick(obj) {
|
if(obj.column.property == "field1") {
|
this.selectrow = obj.row;
|
if(this.selectrow.field7 == "待审批") {
|
this.openMsg1("approval", obj.row);
|
}
|
else {
|
this.openMsg1("disabled", obj.row);
|
}
|
}
|
else if (obj.column.property == "field7") {
|
this.selectrow = obj.row;
|
this.showFlow("showFlow", obj.row);
|
}
|
else if (obj.column.property == "field16") {
|
this.selectrow = obj.row;
|
this.uploadEnclosure("uploadEnclosure", obj.row);
|
}
|
else if (obj.column.property == "field12") {
|
this.selectrow = obj.row;
|
this.showCredit("showCredit", obj.row);
|
}
|
},
|
rowClick(obj) {
|
this.selectrow = obj.row;
|
},
|
onChangeStatu(item) {
|
let row = this.selectrow;
|
if (!row.field1) {
|
Root.message({
|
type: 'warning',
|
message: '请先选择一条数据'
|
})
|
return;
|
}
|
if (item == "cancel") {
|
if (row.field7 == "已发货" || row.field7 == "审批通过") {
|
Root.message({
|
type: 'warning',
|
message: '审批通过后订单不可取消'
|
})
|
}
|
else {
|
row.field7 = "已取消";
|
this.selectrow = {};
|
}
|
|
}
|
else if (item == "submit") {
|
|
if (row.field7 == "草稿" || row.field7 == "已取消") {
|
this.uploadEnclosure("uploadEnclosure",row);
|
row.field7 = "待审批";
|
this.selectrow = {};
|
}
|
else {
|
Root.message({
|
type: 'warning',
|
message: '只有草稿和取消订单可提交'
|
})
|
}
|
}
|
this.isRefresh = false;
|
this.$nextTick(function(){
|
this.isRefresh = true;
|
})
|
},
|
onShowDetail(scope) {
|
let row = this.selectrow;
|
if (!row.field1) {
|
Root.message({
|
type: 'warning',
|
message: '请先选择一条数据'
|
})
|
return;
|
}
|
else {
|
this.openMsg2(row);
|
}
|
},
|
openMsg2(row) {
|
let me = this;
|
Root.popupParames = {
|
width: "900px",
|
url: "../flow/home/popup/popup_docNumber.html",
|
};
|
Root.popupParames.data = row;
|
Root.showPopup();
|
},
|
approval() {
|
let row = this.selectrow;
|
if (!row.field1) {
|
Root.message({
|
type: 'warning',
|
message: '请先选择一条数据'
|
})
|
return;
|
}
|
if (this.selectrow.field7 != "待审批") {
|
Root.message({
|
type: 'warning',
|
message: '不可审批状态'
|
})
|
}
|
else {
|
this.openMsg1("approval",row);
|
}
|
},
|
saveRowTable() {
|
if (this.operationtype == "edit") {//修改
|
for (var k in this.formData) {
|
this.selectrow[k] = this.formData[k];
|
}
|
}
|
else {//新增
|
this.tableData_new.push(this.formData);
|
this.doQuery();
|
}
|
|
this.rowTableDialog = false;
|
},
|
|
//表单
|
showPopup(obj) {
|
this.selectFormField = obj.obj;
|
this.popupByFieldsDialog = true;
|
},
|
saveFormValByField(val) {
|
this.popupByFieldsDialog = false;
|
this.$refs.form1.setFormValByField(this.selectFormField, val)
|
},
|
|
onVersionSelect(obj) {
|
this.currentVersion = obj;
|
},
|
onDownload() {
|
Root.message('这是一条消息提示');
|
},
|
onUpload() {
|
|
},
|
showPopup_gh() {
|
this.popupByFieldsDialog = true;
|
this.tableData_cus_new = dataRoot.database.customer;
|
this.tableData_cus = clone(this.tableData_cus_new);
|
this.tableData_cus2 = this.tableData_cus;
|
this.onQuery_gh();
|
},
|
onInitQuery_gh() {
|
this.formInline_gh = {};
|
this.tableData_cus = this.tableData_cus_new;
|
this.onQuery_gh();
|
},
|
onQuery_gh() {
|
this.pagenum_gh = 1;
|
this.doQuery_cus();
|
},
|
getData_gh(page) {
|
this.pagesize_gh = page.pagesize;
|
this.pagenum_gh = page.pagenum;
|
this.doQuery_cus();
|
},
|
doQuery_cus() {
|
let result = this.tableData_cus_new.filter(item => {
|
let bo = true;
|
for(var k in this.formInline_gh) {
|
let k_val = this.formInline_gh[k];
|
let bo_ = item[k].toLowerCase().indexOf(k_val.toLowerCase()) > -1;
|
if (!bo_) {
|
return false;
|
}
|
}
|
return bo;
|
});
|
this.tableData_cus = result;
|
this.getData_cus();
|
},
|
getData_cus() {
|
this.total_gh = this.tableData_cus.length;
|
this.tableData_cus2 = this.tableData_cus.slice((this.pagenum-1)*this.pagesize, this.pagenum * this.pagesize);
|
},
|
rowClickCus(obj) {
|
this.selectcusrow = obj.row;
|
},
|
|
saveFormValByField() {
|
if (this.selectcusrow != {}) {
|
this.formInline.field2 = this.selectcusrow.field2;
|
this.popupByFieldsDialog = false;
|
}
|
else {
|
Root.message({
|
type: 'warning',
|
message: '请先选择一条数据'
|
})
|
}
|
},
|
|
onQuery() {
|
this.pagenum = 1;
|
this.doQuery();
|
},
|
doQuery() {
|
let result = this.tableData_new.filter(item => {
|
let bo = true;
|
for(var k in this.formInline) {
|
let k_val = this.formInline[k];
|
if (k == "field4" && k_val != {}) {
|
let bo_ = true;
|
let itemTime = new Date(item[k]);
|
if (k_val.begtime) {
|
let begTime_val = new Date(k_val.begtime);
|
bo_ = itemTime >= begTime_val;
|
}
|
if (bo_ && k_val.endtime) {
|
let endTime_val = new Date(k_val.endtime);
|
bo_ = itemTime <= endTime_val;
|
}
|
|
if (!bo_) {
|
return false;
|
}
|
}
|
else if (k != "field4") {
|
let bo_ = item[k].toLowerCase().indexOf(k_val.toLowerCase()) > -1;
|
if (!bo_) {
|
return false;
|
}
|
}
|
}
|
return bo;
|
});
|
this.tableData2 = result;
|
this.initTableData();
|
},
|
|
onInitQuery() {
|
this.formInline = {field4: {}};
|
this.tableData2 = this.tableData_new;
|
this.initTableData();
|
},
|
onRefresh() {
|
this.formInline = {field4: {}};
|
this.tableData_new = this.tableData_old;
|
this.tableData2 = this.tableData_new;
|
this.initTableData();
|
},
|
onNewRecord() {
|
//this.operationtype = "add";
|
//this.rowTableDialog = true;
|
this.selectrow = {};
|
var aDate = new Date
|
var date_ = dateFormat(aDate,"yyyyMMddhhmmss");
|
var date1_ = dateFormat(aDate,"yyyy-MM-dd");
|
this.formData = {
|
field1: "DH" + date_,
|
field3: window.top.userinfo.user.name,
|
field4: date1_,
|
field7: "草稿",
|
field12: "未检"
|
};
|
this.openMsg1('add', this.formData);
|
},
|
onCommit() {
|
|
},
|
openMsg1(code, row) {
|
let me = this;
|
Root.popupParames = {
|
width: "900px",
|
//height: "580px",
|
url: "../order/sorder/sorder_edit.html",
|
callback: function(obj, callback) {
|
me.saveRowTable_popup(obj);
|
if (callback) {
|
callback();
|
}
|
}
|
};
|
if (code == "edit") {
|
this.operationtype = "edit";
|
Root.popupParames.data = row;
|
}
|
else if (code == "disabled") {
|
Root.popupParames.data = row;
|
Root.popupParames.disabled = true;
|
}
|
else if (code == "approval") {
|
this.operationtype = "approval";
|
Root.popupParames.data = row;
|
Root.popupParames.isjl = true;
|
}
|
else {
|
this.operationtype = "add";
|
Root.popupParames.data = row;
|
}
|
//Root.showSubItem(parames);
|
Root.popupParames.tableFields = this.tableFields1;
|
Root.showPopup();
|
},
|
showFlow(code, row) {
|
let me = this;
|
var imgUrl = "";
|
Root.popupParames = {
|
url: "../flow/home/popup/popup_flowChart.html",
|
};
|
if (row.field7 == "待审批") {
|
Root.popupParames.imgUrl = "../../../../img/inApproval.jpg"
|
}
|
else if (row.field7 == "待修改") {
|
Root.popupParames.imgUrl = "../../../../img/refused.jpg"
|
}
|
else if (row.field7 == "待发货" || row.field7 == "已发货") {
|
Root.popupParames.imgUrl = "../../../../img/passed.jpg"
|
}
|
else if (row.field7 == "草稿" || row.field7 == "已取消") {
|
Root.message({
|
type: 'warning',
|
message: '请先提交'
|
})
|
return;
|
}
|
Root.showPopup();
|
},
|
showCredit (code, row) {
|
let me = this;
|
Root.popupParames = {
|
url: "../flow/home/popup/popup_creditStatusAll.html",
|
};
|
Root.showPopup();
|
},
|
uploadEnclosure(code, row) {
|
let me = this;
|
Root.popupParames = {
|
url: "../flow/home/popup/popup_uploadEnclosure.html",
|
};
|
Root.showPopup();
|
},
|
|
saveRowTable_popup(obj) {
|
let formData_ = obj.row;
|
let operationtype_ = this.operationtype;
|
|
if (operationtype_ == "edit") {//修改
|
for (var k in formData_) {
|
this.selectrow[k] = clone(formData_[k]);
|
}
|
}
|
else if (operationtype_ == "approval") {//审批
|
for (var k in formData_) {
|
this.selectrow[k] = clone(formData_[k]);
|
}
|
}
|
else {//新增
|
this.tableData_new.push(formData_);
|
this.doQuery();
|
}
|
},
|
}
|
});
|
</script>
|
<style>
|
|
</style>
|
</body>
|
</html>
|