<!DOCTYPE html>
|
<html lang="en">
|
|
<head>
|
<meta charset="utf-8">
|
<title></title>
|
<meta name="renderer" content="webkit">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
<link rel="stylesheet" href="../../static/evn/index.css">
|
<style>
|
.text-center {
|
text-align: center;
|
}
|
.text-gray-500 {
|
width: 100%;
|
color: #6b7280;
|
}
|
</style>
|
</head>
|
|
<body>
|
<div id="app">
|
<el-card>
|
<el-form :inline="true" label-width="auto">
|
<el-form-item label="开工日期">
|
|
<div>
|
<el-date-picker
|
v-model="tableSearchParam.dateStart"
|
type="date"
|
placeholder="开始日期"
|
style="width: 150px;"
|
:default-time="defaultTime"
|
/>
|
</div>
|
<div style="margin-left: 5px;margin-right: 5px">
|
<span >-</span>
|
</div>
|
<div>
|
<el-date-picker
|
v-model="tableSearchParam.dateEnd"
|
type="date"
|
placeholder="结束日期"
|
style="width: 150px;"
|
:default-time="defaultTime"
|
/>
|
</div>
|
</el-form-item>
|
|
|
<el-form-item label="供应商">
|
<el-select v-model="tableSearchParam.venId" placeholder="选择供应商" style="width: 150px" >
|
<el-option
|
v-for="item in options"
|
:key="item.value"
|
:label="item.label"
|
:value="item.value"
|
/>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="">
|
<el-button type="primary" @click="page" circle >
|
<el-icon><Search /></el-icon>
|
</el-button>
|
</el-form-item>
|
</el-form>
|
<el-form :inline="true">
|
<el-form-item label="">
|
<el-button type="primary" @click="fnPrintView('否')">打印预览</el-button>
|
</el-form-item>
|
<el-form-item label="">
|
<el-button type="primary" @click="fnPrint('是')">打印</el-button>
|
</el-form-item>
|
<el-form-item label="">
|
<el-button type="primary" @click="fnTongBu()">生成委外出库单</el-button>
|
</el-form-item>
|
<el-form-item label="">
|
<el-button type="primary">撤销生成</el-button>
|
</el-form-item>
|
<el-form-item label="">
|
<el-button type="primary">数据查询</el-button>
|
</el-form-item>
|
|
</el-form>
|
<el-table :data="tableData" border style="width: 100%" row-key="id" @selection-change="handleSelectionChange" max-height="650">
|
<el-table-column type="selection" >
|
</el-table-column>
|
<el-table-column type="index" width="50" >
|
</el-table-column>
|
<el-table-column prop="venName" label="供应商" >
|
</el-table-column>
|
<el-table-column prop="invCode" label="物料编码">
|
</el-table-column>
|
<el-table-column prop="invName" label="物料名称" width="250" :show-overflow-tooltip="true">
|
</el-table-column>
|
<el-table-column prop="invStd" label="规格" width="150" :show-overflow-tooltip="true">
|
</el-table-column>
|
<el-table-column prop="unit" label="单位" width="70">
|
</el-table-column>
|
<el-table-column prop="whName" label="仓库" width="90">
|
</el-table-column>
|
<el-table-column prop="qqty" label="期初数量">
|
</el-table-column>
|
<el-table-column prop="fqty" label="应发数量">
|
</el-table-column>
|
<el-table-column prop="yqty" label="已发数量">
|
</el-table-column>
|
<el-table-column prop="wqty" label="未发数量">
|
</el-table-column>
|
<el-table-column prop="qty" label="实发数量">
|
</el-table-column>
|
<el-table-column prop="izSync" label="是否生成">
|
</el-table-column>
|
</el-table>
|
<!-- <div style="margin-top: 10px">-->
|
<!-- <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"-->
|
<!-- :current-page="currentPage" :page-sizes="pageSizes" :page-size="pageSize"-->
|
<!-- layout="total, sizes, prev, pager, next, jumper" :total="pageTotal">-->
|
<!-- </el-pagination>-->
|
<!-- </div>-->
|
|
|
</el-card>
|
</div>
|
|
<script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script>
|
<script type="text/javascript" src="../../static/js/common.js" charset="utf-8"></script>
|
<script src="../../static/evn/vue.global.js"></script>
|
<script src="../../static/evn/element-plus.js"></script>
|
<script src="../../static/evn/icons-vue.js"></script>
|
<script src='../../static/js/erp/LodopFuncs.js'></script>
|
<script type="module">
|
// 导入中文语言包
|
import zhCn from '../../static/js/erp/zh-cn.js';
|
|
const { createApp, ref, onMounted, onBeforeMount ,watchEffect} = Vue;
|
|
|
const app = createApp({
|
setup() {
|
const currentPage = ref(1)
|
const pageSizes = ref([15,20, 30, 50, 100, 200])
|
const pageSize = ref(15)
|
const pageTotal = ref(0)
|
const tableSearchParam = ref({
|
izJb:"否",
|
dateStart:new Date(),
|
dateEnd: new Date(),
|
venId:null,
|
izJs:"否"
|
})
|
const tableData = ref([])
|
const defaultTime = ref(new Date())
|
const fullscreenLoading = ref(false)
|
|
const selectData = ref([
|
])
|
|
const depName = ref('')
|
|
const options = ref([])
|
|
watchEffect(() =>{
|
options.value.map(item =>{
|
if (item.value === tableSearchParam.value.venId){
|
depName.value = item.label
|
}
|
})
|
|
})
|
|
const printOptions = [
|
{
|
value: '否',
|
label: '否'
|
},
|
{
|
value: '是',
|
label: '是'
|
},
|
|
]
|
|
const selectList = ref([])
|
|
function page(){
|
let data = JSON.parse(JSON.stringify(tableSearchParam.value))
|
data.curr = currentPage.value
|
data.limit = pageSize.value
|
if (tableSearchParam.value.datetime != null) {
|
data.datetime = null
|
data.create_time = tableSearchParam.value.datetime[0] + " - " + tableSearchParam.value.datetime[1]
|
}
|
const loading = ElementPlus.ElLoading.service({
|
lock: true,
|
text: 'Loading',
|
background: 'rgba(0, 0, 0, 0.7)',
|
})
|
$.ajax({
|
url: "http://127.0.0.1:9090/mo/materialwwout/getList",
|
headers: {
|
'token': localStorage.getItem('token')
|
},
|
data: data,
|
dataType: 'json',
|
contentType: 'application/json;charset=UTF-8',
|
method: 'GET',
|
success: function(res) {
|
loading.close()
|
if (res.code == 200) {
|
tableData.value = res.data
|
ElementPlus.ElMessage({
|
message: "拉取数据完成",
|
type: 'success'
|
});
|
} else if (res.code === 403) {
|
top.location.href = baseUrl + "/";
|
} else {
|
ElementPlus.ElMessage({
|
message: res.msg,
|
type: 'error'
|
});
|
}
|
}
|
});
|
}
|
|
function fnTongBu(){
|
if (selectList.value.length === 0){
|
ElementPlus.ElMessage({
|
message: "请先选择",
|
type: 'error'
|
});
|
return ;
|
}
|
for(let i=0; i<selectList.value.length; i++) {
|
var rowData = selectList.value[i];
|
if(rowData.qty === "" || rowData.qty === null || rowData.qty.replace(" ","") === "")
|
{
|
ElementPlus.ElMessage({
|
message: "请确认数量存在!",
|
type: 'error'
|
});
|
return ;
|
}
|
}
|
const loading = ElementPlus.ElLoading.service({
|
lock: true,
|
text: 'Loading',
|
background: 'rgba(0, 0, 0, 0.7)',
|
})
|
$.ajax({
|
url:"http://127.0.0.1:9090/mo/materialwwout/tongbu",
|
headers: {
|
'token': localStorage.getItem('token')
|
},
|
data: JSON.stringify(selectList.value),
|
dataType: 'json',
|
contentType: 'application/json;charset=UTF-8',
|
method: 'POST',
|
success: function(res) {
|
loading.close();
|
if (res.code == 200) {
|
ElementPlus.ElMessage({
|
message: "生成成功",
|
type: 'success'
|
});
|
page()
|
} else if (res.code === 403) {
|
top.location.href = baseUrl + "/";
|
} else {
|
ElementPlus.ElMessage({
|
message: res.msg,
|
type: 'error'
|
});
|
}
|
}
|
});
|
}
|
|
function fnCanelPrint(){
|
if (selectList.value.length === 0){
|
ElementPlus.ElMessage({
|
message: "请先选择",
|
type: 'error'
|
});
|
return ;
|
}
|
const loading = ElementPlus.ElLoading.service({
|
lock: true,
|
text: 'Loading',
|
background: 'rgba(0, 0, 0, 0.7)',
|
})
|
$.ajax({
|
url:"http://127.0.0.1:9090/mo/materialuse/canelprint",
|
headers: {
|
'token': localStorage.getItem('token')
|
},
|
data: JSON.stringify(selectList.value),
|
dataType: 'json',
|
contentType: 'application/json;charset=UTF-8',
|
method: 'POST',
|
success: function(res) {
|
loading.close();
|
if (res.code == 200) {
|
ElementPlus.ElMessage({
|
message: "撤销成功",
|
type: 'success'
|
});
|
page()
|
} else if (res.code === 403) {
|
top.location.href = baseUrl + "/";
|
} else {
|
ElementPlus.ElMessage({
|
message: res.msg,
|
type: 'error'
|
});
|
}
|
}
|
});
|
}
|
|
|
|
function getVendor(){
|
$.ajax({
|
url: "http://127.0.0.1:9090/basicinfo/vendor/getlistfordropdown",
|
contentType: 'application/json;charset=UTF-8',
|
method: 'GET',
|
success: function(res) {
|
if (res.code == 200) {
|
res.data.map(item => {
|
options.value.push({
|
value: item.venId, label: item.venName
|
})
|
})
|
} else {
|
ElementPlus.ElMessage({
|
message: res.msg,
|
type: 'error'
|
});
|
}
|
}
|
});
|
}
|
function fnPrint(izPrint) {
|
if (selectList.value.length === 0){
|
ElementPlus.ElMessage({
|
message: "请先选择",
|
type: 'error'
|
});
|
return ;
|
}
|
ElementPlus.ElMessageBox.confirm('确定打印吗?')
|
.then(() => {
|
print(izPrint,0)
|
})
|
.catch(() => {
|
// catch error
|
})
|
|
}
|
|
function fnPrintView(izPrint){
|
if (selectList.value.length === 0){
|
ElementPlus.ElMessage({
|
message: "请先选择",
|
type: 'error'
|
});
|
return ;
|
}
|
|
|
|
print(izPrint,0)
|
}
|
|
|
|
function print(izPrint,izRed){
|
const LODOP = getLodop()
|
|
const loading = ElementPlus.ElLoading.service({
|
lock: true,
|
text: 'Loading',
|
background: 'rgba(0, 0, 0, 0.7)',
|
})
|
let data = JSON.parse(JSON.stringify(tableSearchParam.value))
|
data.curr = currentPage.value
|
data.limit = pageSize.value
|
if (tableSearchParam.value.datetime != null) {
|
data.datetime = null
|
data.create_time = tableSearchParam.value.datetime[0] + " - " + tableSearchParam.value.datetime[1]
|
}
|
$.ajax({
|
url: "http://127.0.0.1:9090/mo/materialwwout/updateprint",
|
headers: {
|
'token': localStorage.getItem('token')
|
},
|
data: data,
|
dataType: 'json',
|
contentType: 'application/json;charset=UTF-8',
|
method: 'GET',
|
success: function(res) {
|
loading.close()
|
if (res.code == 200) {
|
ElementPlus.ElMessage({
|
message: "打印状态更新成功!",
|
type: 'success'
|
});
|
|
} else if (res.code === 403) {
|
top.location.href = baseUrl + "/";
|
} else {
|
ElementPlus.ElMessage({
|
message: res.msg,
|
type: 'error'
|
});
|
}
|
}
|
});
|
|
var gridData = [];
|
var listVen=[];
|
for(var i=0; i<selectList.value.length; i++) {
|
var curRowData = selectList.value[i]
|
|
var izExist=false;
|
for (var j = 0; j < listVen.length; j++) {
|
if(curRowData.venId === listVen[j].venId)
|
{
|
izExist=true;
|
break;
|
}
|
}
|
if(izExist === false)
|
{
|
var o={};
|
o.venId=curRowData.venId;
|
o.venName=curRowData.venName;
|
listVen.push(o);
|
}
|
gridData.push(curRowData);
|
}
|
|
|
LODOP.PRINT_INITA(0,0,800,1100,"委外加工出库单");
|
// LODOP.SET_PRINT_PAGESIZE(1,0,0,"A5");
|
// LODOP.SET_PRINT_PAGESIZE(1,870,520,"");
|
|
// LODOP.PRINT_INITA(0,0,800,500,"委外加工出库单");
|
// LODOP.SET_PRINT_PAGESIZE(1,800,500,"");
|
LODOP.SET_PRINT_MODE("PRINT_NOCOLLATE",1);
|
|
|
LODOP.ADD_PRINT_TEXT(28,375,331,36,"委外加工出库单");
|
LODOP.SET_PRINT_STYLEA(0,"FontSize",20);
|
LODOP.SET_PRINT_STYLEA(0,"ItemType",1);
|
LODOP.ADD_PRINT_TEXT(69,128,413,25,"开工日期:"+dateFormat("YYYY-mm-dd", tableSearchParam.value.dateStart)+" 到 "+dateFormat("YYYY-mm-dd", tableSearchParam.value.dateEnd));
|
LODOP.SET_PRINT_STYLEA(0,"FontSize",12);
|
LODOP.SET_PRINT_STYLEA(0,"ItemType",1);
|
|
|
LODOP.ADD_PRINT_TEXT(69,451,196,25,"单据日期:"+dateFormat("YYYY-mm-dd", new Date()));
|
LODOP.SET_PRINT_STYLEA(0,"FontSize",12);
|
LODOP.SET_PRINT_STYLEA(0,"ItemType",1);
|
LODOP.ADD_PRINT_TEXT(69,645,176,25,"发料人:");
|
LODOP.SET_PRINT_STYLEA(0,"FontSize",12);
|
LODOP.SET_PRINT_STYLEA(0,"ItemType",1);
|
|
LODOP.ADD_PRINT_TABLE(96,123,2000,960,CreateTable(gridData));
|
LODOP.SET_PRINT_STYLEA(0,"TableHeightScope",1);
|
|
LODOP.SET_PRINT_MODE("FULL_WIDTH_FOR_OVERFLOW",true);
|
|
|
LODOP.PRINT_DESIGN();
|
// if(izPrint=="是")
|
// {
|
// LODOP.PRINT();
|
// }
|
// else{
|
// LODOP.PREVIEW();
|
// }
|
|
}
|
|
function dateFormat(fmt, date) {
|
let ret;
|
const opt = {
|
"Y+": date.getFullYear().toString(), // 年
|
"m+": (date.getMonth() + 1).toString(), // 月
|
"d+": date.getDate().toString(), // 日
|
"H+": date.getHours().toString(), // 时
|
"M+": date.getMinutes().toString(), // 分
|
"S+": date.getSeconds().toString() // 秒
|
// 有其他格式化字符需求可以继续添加,必须转化成字符串
|
};
|
for (let k in opt) {
|
ret = new RegExp("(" + k + ")").exec(fmt);
|
if (ret) {
|
fmt = fmt.replace(ret[1], (ret[1].length == 1) ? (opt[k]) : (opt[k].padStart(ret[1].length, "0")))
|
};
|
};
|
return fmt;
|
}
|
|
function CreateTable(result) {
|
// var css =" <style> table,td,th {border: 1px solid black;border-style: solid;border-collapse: collapse;font-size: 15px;}</style><table border=1>";
|
var css = "<style> table,td,th {table-layout: fixed;border: 1px black solid;border-collapse: collapse;font-size: 15px;}</style><table>";
|
//第一行
|
var th = "<thead><tr style='height:30px'>" +
|
"<th >序号</th>" +
|
"<th >供应商</th>" +
|
"<th >物料编码</th>" +
|
"<th >物料名称</th>" +
|
"<th >物料规格</th>" +
|
"<th >单位</th>" +
|
"<th >仓库</th>" +
|
"<th >应发数量</th>" +
|
"<th >未发数量</th>" +
|
"<th >实发数量</th>" +
|
"</tr></thead>";
|
|
var td="";
|
var row=1;
|
for (var i = 0; i <result.length; i++) {
|
|
td = td+"<tr style='height:30px'><td style='width:30px;' align='center' >"+(row)+"</td><td style='width:170px;word-wrap:break-word;word-break:break-all;' align='left' >" + result[i].venName + "</td><td style='width:90px;' align='left' >" + result[i].invCode + "</td><td style='width:110px;word-wrap:break-word;word-break:break-all;' align='left' >" + result[i].invName + "</td> <td style='width:60px;' align='left' >" + result[i].invStd + "</td> <td style='width:40px;' align='left' >" + result[i].unit + "</td><td style='width:80px;' align='left' >" + result[i].whName + "</td> <td style='width:60px;' align='left' >" + result[i].fqty + "</td> <td style='width:60px;' align='left' >" + result[i].wqty + "</td> <td style='width:60px;' align='left' ></td> </tr>"
|
row++;
|
}
|
|
var txt = css +th+ td +"</table>";
|
return txt;
|
|
}
|
|
|
|
function handleSizeChange(val) {
|
pageSize.value = val
|
currentPage.value = 1 // 重置到第一页
|
page()
|
}
|
|
function handleCurrentChange(val) {
|
currentPage.value = val
|
page()
|
}
|
function handleSelectionChange(val) {
|
|
selectList.value = val
|
}
|
|
onMounted(() => {
|
page()
|
})
|
|
onBeforeMount(() => {
|
getVendor()
|
|
})
|
|
return {
|
tableData,
|
currentPage,
|
pageSizes,
|
pageSize,
|
pageTotal,
|
tableSearchParam,
|
defaultTime,
|
selectData,
|
options,
|
printOptions,
|
page,
|
fnPrint,
|
fnPrintView,
|
fnCanelPrint,
|
fnTongBu,
|
handleSizeChange,
|
handleCurrentChange,
|
handleSelectionChange
|
|
}
|
}
|
});
|
|
app.use(ElementPlus, {
|
locale: zhCn.default || zhCn
|
});
|
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
|
app.component(key, component)
|
}
|
app.mount('#app');
|
</script>
|
|
</body>
|
|
</html>
|