This commit is contained in:
caoxinyu
2019-09-29 17:36:11 +08:00
parent b4e82fa4f7
commit 392d7f7d79
8 changed files with 831 additions and 36 deletions

View File

@@ -156,9 +156,9 @@ export function createInquirySheet(num1, id, num2, remark) {
url: '', url: '',
method: 'post', method: 'post',
data: { data: {
type: '2', type: '1',
name: '采购管理_询价单_增加数据', name: '采购管理_询价单_增加数据',
param: `询价单编号=${num1}&采购员=${id}&供应商流水号=${num2}&备注=${remark}&identity=1=output` param: `询价单编号=${num1}&采购员=${id}&供应商流水号=${num2}&备注=${remark}`
} }
}) })
} }

View File

@@ -76,8 +76,8 @@ export function searchTable1(...params) {
method: 'post', method: 'post',
data: { data: {
type: '1', type: '1',
name: '采购管理_采购部采购_查询物料_分配后', name: 'xqs_采购管理_采购部采购_查询物料_分配后',
param: `物料类别流水号_check=${params[2]}&物料类别流水号=${params[3]}&物料品种流水号_check=${params[4]}&物料品种流水号=${params[5]}&项目流水号_check=${params[6]}&项目流水号=${params[7]}&机床流水号_check=${params[8]}&机床流水号=${params[9]}&组件流水号_check=${params[10]}&组件流水号=${params[11]}&物料名称_check=${params[12]}&物料名称=${params[13]}&物料状态编号=${params[14]}&物料规格_check=${params[15]}&物料规格=${params[16]}&物料型号_check=${params[17]}&物料型号=${params[18]}&零件类型=${params[19]}`, param: `物料类别流水号_check=${params[2]}&物料类别流水号=${params[3]}&物料品种流水号_check=${params[4]}&物料品种流水号=${params[5]}&项目流水号_check=${params[6]}&项目流水号=${params[7]}&机床流水号_check=${params[8]}&机床流水号=${params[9]}&组件流水号_check=${params[10]}&组件流水号=${params[11]}&物料名称_check=${params[12]}&物料名称=${params[13]}&物料状态编号=${params[14]}&物料规格_check=${params[15]}&物料规格=${params[16]}&物料型号_check=${params[17]}&物料型号=${params[18]}&零件类型=${params[19]}&时间段_check=${params[20]}&开始时间=${params[21]}&结束时间=${params[22]}`,
Pagination: params[0] + '&' + params[1] Pagination: params[0] + '&' + params[1]
} }
}) })

View File

@@ -23,7 +23,7 @@ export const downloadFileMachine = `http://192.168.1.231:8411/submit/downloadFil
export const MESUploadFile = `http://192.168.1.231:8411/submit/MESUploadFile.ashx` export const MESUploadFile = `http://192.168.1.231:8411/submit/MESUploadFile.ashx`
export const MESDownloadFile = `http://192.168.1.231:8411/submit/MESDownloadFile.ashx` export const MESDownloadFile = `http://192.168.1.231:8411/submit/MESDownloadFile.ashx`
const service = axios.create({ const service = axios.create({
baseURL: `http://192.168.0.103:8005/submit/MESCommonBase.ashx`, baseURL: `http://192.168.0.110:8005/submit/MESCommonBase.ashx`,
timeout: 1500000 // 请求超时时间 timeout: 1500000 // 请求超时时间
}) })
export default service export default service

View File

@@ -603,7 +603,7 @@
</table> </table>
</div> </div>
<el-dialog :visible.sync="dialogVisible1" title="供应商选择" center style="min-height: 300px" width="700px"> <el-dialog v-el-drag-dialog :visible.sync="dialogVisible1" title="供应商选择" center style="min-height: 300px" width="700px">
<el-form ref="form1" :model="form1" label-position="left" label-width="90px" class="searchForm"> <el-form ref="form1" :model="form1" label-position="left" label-width="90px" class="searchForm">
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
@@ -709,10 +709,10 @@
</el-form> </el-form>
</el-dialog> </el-dialog>
<el-dialog :visible.sync="dialogVisible2" :title="title2" center style="min-height: 300px" width="400px"> <el-dialog v-el-drag-dialog :visible.sync="dialogVisible2" :title="title2" center style="min-height: 300px" width="400px">
<el-form ref="form2" :model="form2" :rules="rules2" label-position="left" label-width="90px"> <el-form ref="form2" :model="form2" :rules="rules2" label-position="left" label-width="90px">
<el-form-item label="询价单号" prop="inquirySheetNum"> <el-form-item label="询价单号" prop="inquirySheetNum">
<el-input v-model="form2.inquirySheetNum" readonly size="small"/> <el-input v-model="form2.inquirySheetNum" size="small"/>
</el-form-item> </el-form-item>
<el-form-item label="供应商" prop="supplierNameValue"> <el-form-item label="供应商" prop="supplierNameValue">
<el-select v-model="form2.supplierNameValue" style="width:200px" placeholder="供应商" size="small" filterable> <el-select v-model="form2.supplierNameValue" style="width:200px" placeholder="供应商" size="small" filterable>
@@ -742,7 +742,7 @@
</div> </div>
</el-dialog> </el-dialog>
<el-dialog :visible.sync="dialogVisible3" title="物料变更选择" center style="min-height: 300px;" width="780px"> <el-dialog v-el-drag-dialog :visible.sync="dialogVisible3" title="物料变更选择" center style="min-height: 300px;" width="780px">
<el-row style="margin-bottom: 10px"> <el-row style="margin-bottom: 10px">
<span>物料名称:</span> <span>物料名称:</span>
<el-input v-model="materialName0" placeholder="物料名称" size="small" clearable/> <el-input v-model="materialName0" placeholder="物料名称" size="small" clearable/>
@@ -790,7 +790,7 @@
</div> </div>
</el-dialog> </el-dialog>
<el-dialog :visible.sync="dialogVisible4" title="使用滞货" center style="min-height: 300px;" width="400px"> <el-dialog v-el-drag-dialog :visible.sync="dialogVisible4" title="使用滞货" center style="min-height: 300px;" width="400px">
<span>使用滞货数量:</span> <span>使用滞货数量:</span>
<el-input-number :min="0" :max="maxUseNumber" v-model="useNumber" controls-position="right"/> <el-input-number :min="0" :max="maxUseNumber" v-model="useNumber" controls-position="right"/>
<div style="margin: 10px 0 0 10px;color: red">注意:确定后将不可取消使用滞货</div> <div style="margin: 10px 0 0 10px;color: red">注意:确定后将不可取消使用滞货</div>
@@ -1538,8 +1538,7 @@ export default {
this.$refs['form2'].validate((valid) => { this.$refs['form2'].validate((valid) => {
if (valid) { if (valid) {
createInquirySheet(this.form2.inquirySheetNum, this.id, this.form2.supplierNameValue, '').then(response => { createInquirySheet(this.form2.inquirySheetNum, this.id, this.form2.supplierNameValue, '').then(response => {
console.log(response.data) if (!(response.data)) {
if (response.data[0].result === '1') {
this.$message.success('创建成功') this.$message.success('创建成功')
this.form2.supplierNameValue = '' this.form2.supplierNameValue = ''
this.inquirySheetNum = '' this.inquirySheetNum = ''
@@ -1547,7 +1546,7 @@ export default {
this.supplierValue = '' this.supplierValue = ''
this.dialogVisible2 = false this.dialogVisible2 = false
this.searchTable2() this.searchTable2()
} else { this.$message.error('操作失败') } } else { this.$message.error('操作失败!该询价单已存在,请重新输入') }
}) })
} }
}) })

View File

@@ -276,14 +276,17 @@
size="small" size="small"
style="margin-left: 10px" style="margin-left: 10px"
@click="addOfflineContract">创建离线合同</el-button> @click="addOfflineContract">创建离线合同</el-button>
<el-button
type="warning" <el-tooltip :open-delay="1000" effect="dark" content="将勾选的物料库中物料选入到选中的离线合同" placement="top">
size="small" <el-button
style="margin-left: 10px" type="warning"
@click="addMateriel">选入物料</el-button> size="small"
style="margin-left: 10px"
@click="addMateriel">选入物料</el-button>
</el-tooltip>
</div> </div>
<el-table v-loading="" :data="tableData2" border style="max-height: 460px;" height="300px" size="mini" highlight-current-row @row-click="searchTable3"> <el-table v-loading="" :data="tableData2" border style="max-height: 460px;" height="300px" size="mini" highlight-current-row @row-click="searchTable3">
<el-table-column type="expand" fixed="left"> <el-table-column label="详情" type="expand" fixed="left">
<template slot-scope="scope"> <template slot-scope="scope">
<el-form label-position="left" inline class="demo-table-expand"> <el-form label-position="left" inline class="demo-table-expand">
<el-form-item label="离线合同备注"> <el-form-item label="离线合同备注">
@@ -368,8 +371,9 @@
<el-button v-if="quickChangePrice" size="mini" style="float:right;" @click="quickChangePrice=!quickChangePrice">快速修改价格</el-button> <el-button v-if="quickChangePrice" size="mini" style="float:right;" @click="quickChangePrice=!quickChangePrice">快速修改价格</el-button>
<el-button v-else size="mini" style="float:right;" @click="quickChangePrice=!quickChangePrice">还原</el-button> <el-button v-else size="mini" style="float:right;" @click="quickChangePrice=!quickChangePrice">还原</el-button>
</div> </div>
<el-table v-loading="" :data="tableData3" :summary-method="getSummaries" border style="max-height: 500px;" height="500px" size="mini" show-summary> <!--<h3>合同详细信息</h3>-->
<el-table-column label="离线合同编号" align="center" min-width="150"> <el-table v-loading="" :data="tableData3" :summary-method="getSummaries" border style="max-height: 500px;" height="450px" size="mini" show-summary>
<el-table-column label="离线合同编号" align="center" width="110">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.离线合同编号 }} {{ scope.row.离线合同编号 }}
</template> </template>
@@ -395,7 +399,7 @@
<b v-else>{{ scope.row.数量 }}</b> <b v-else>{{ scope.row.数量 }}</b>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="单位" align="center" min-width="100"> <el-table-column label="单位" align="center" min-width="60">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.计量单位 }} {{ scope.row.计量单位 }}
</template> </template>

View File

@@ -41,6 +41,19 @@
<b style="float: right; color: #8492a6; font-size: 13px">{{ item.name }}</b> <b style="float: right; color: #8492a6; font-size: 13px">{{ item.name }}</b>
</el-option> </el-option>
</el-select> </el-select>
<span>时间段:</span>
<el-date-picker
v-model="dateRange"
:picker-options="pickerOptions"
size="small"
type="daterange"
align="center"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
range-separator=""
style="width:300px"
start-placeholder="开始日期"
end-placeholder="结束日期"/>
<el-button <el-button
type="success" type="success"
size="small" size="small"
@@ -70,18 +83,22 @@
<span style="margin-right: -10px">物料状态:</span> <span style="margin-right: -10px">物料状态:</span>
<el-cascader :options="materialStatus" :props="{ checkStrictly: true }" v-model="materialStatusValue" size="small" style="margin-left: 10px"/> <el-cascader :options="materialStatus" :props="{ checkStrictly: true }" v-model="materialStatusValue" size="small" style="margin-left: 10px"/>
<div style="float:right;padding-top:10px;"> <div style="float:right;padding-top:10px;">
<el-button <el-tooltip :open-delay="1000" effect="dark" content="选择采购员后,将物料分配给所选的采购员" placement="top">
type="primary" <el-button
size="small" type="primary"
icon="el-icon-menu" size="small"
style="margin-left: 10px" icon="el-icon-menu"
@click="allocateTask1">分配</el-button> style="margin-left: 10px"
<el-button @click="allocateTask1">分配</el-button>
type="danger" </el-tooltip>
size="small" <el-tooltip :open-delay="1000" effect="dark" content="退回勾选的未分配的物料至车间" placement="top">
icon="el-icon-back" <el-button
style="margin-left: 10px" type="danger"
@click="executeReturn1">退回</el-button> size="small"
icon="el-icon-back"
style="margin-left: 10px"
@click="executeReturn1">退回</el-button>
</el-tooltip>
</div> </div>
</el-row> </el-row>
<el-row style="margin-bottom: 15px"> <el-row style="margin-bottom: 15px">
@@ -646,6 +663,34 @@ export default {
name: '', // 采购任务分配 name: '', // 采购任务分配
data() { data() {
return { return {
pickerOptions: {
shortcuts: [{
text: '最近一周',
onClick(picker) {
const end = new Date()
const start = new Date()
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
picker.$emit('pick', [start, end])
}
}, {
text: '最近一个月',
onClick(picker) {
const end = new Date()
const start = new Date()
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
picker.$emit('pick', [start, end])
}
}, {
text: '最近三个月',
onClick(picker) {
const end = new Date()
const start = new Date()
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
picker.$emit('pick', [start, end])
}
}]
},
dateRange: '',
timer2: '', timer2: '',
machines: [], machines: [],
source: [ source: [
@@ -861,13 +906,14 @@ export default {
this.MaterialCategoryValue ? this.check1 = 1 : this.check1 = 0 this.MaterialCategoryValue ? this.check1 = 1 : this.check1 = 0
this.MaterialVarietyValue ? this.check2 = 1 : this.check2 = 0 this.MaterialVarietyValue ? this.check2 = 1 : this.check2 = 0
this.projectValue ? this.check3 = 1 : this.check3 = 0 this.projectValue ? this.check3 = 1 : this.check3 = 0
let check0, check1, check2, check3 let check0, check1, check2, check3, check4
this.machineValue ? check0 = 1 : check0 = 0 this.machineValue ? check0 = 1 : check0 = 0
this.groupValue ? check1 = 1 : check1 = 0 this.groupValue ? check1 = 1 : check1 = 0
this.materialName ? this.check4 = 1 : this.check4 = 0 this.materialName ? this.check4 = 1 : this.check4 = 0
this.materialSpec ? check2 = 1 : check2 = 0 this.materialSpec ? check2 = 1 : check2 = 0
this.materialModel ? check3 = 1 : check3 = 0 this.materialModel ? check3 = 1 : check3 = 0
searchTable1(this.pageCurrent0, this.pageSize0, this.check1, this.MaterialCategoryValue, this.check2, this.MaterialVarietyValue, this.check3, this.projectValue, check0, this.machineValue, check1, this.groupValue, this.check4, this.materialName, this.materialStatusValue[this.materialStatusValue.length - 1], check2, this.materialSpec, check3, this.materialModel, 1).then(response => { this.dateRange ? check4 = 1 : (check4 = 0, this.dateRange = '')
searchTable1(this.pageCurrent0, this.pageSize0, this.check1, this.MaterialCategoryValue, this.check2, this.MaterialVarietyValue, this.check3, this.projectValue, check0, this.machineValue, check1, this.groupValue, this.check4, this.materialName, this.materialStatusValue[this.materialStatusValue.length - 1], check2, this.materialSpec, check3, this.materialModel, 1, check4, this.dateRange[0], this.dateRange[1]).then(response => {
this.tableData0 = response.data.rows this.tableData0 = response.data.rows
this.total0 = response.data.total this.total0 = response.data.total
}) })

View File

@@ -0,0 +1,224 @@
/* eslint-disable */
require('script-loader!file-saver');
// import XLSX from 'xlsx'
import XLSX from 'xlsx-style'
function generateArray(table) {
var out = [];
var rows = table.querySelectorAll('tr');
var ranges = [];
for (var R = 0; R < rows.length; ++R) {
var outRow = [];
var row = rows[R];
var columns = row.querySelectorAll('td');
for (var C = 0; C < columns.length; ++C) {
var cell = columns[C];
var colspan = cell.getAttribute('colspan');
var rowspan = cell.getAttribute('rowspan');
var cellValue = cell.innerText;
if (cellValue !== "" && cellValue == +cellValue) cellValue = +cellValue;
//Skip ranges
ranges.forEach(function (range) {
if (R >= range.s.r && R <= range.e.r && outRow.length >= range.s.c && outRow.length <= range.e.c) {
for (var i = 0; i <= range.e.c - range.s.c; ++i) outRow.push(null);
}
});
//Handle Row Span
if (rowspan || colspan) {
rowspan = rowspan || 1;
colspan = colspan || 1;
ranges.push({
s: {
r: R,
c: outRow.length
},
e: {
r: R + rowspan - 1,
c: outRow.length + colspan - 1
}
});
};
//Handle Value
outRow.push(cellValue !== "" ? cellValue : null);
//Handle Colspan
if (colspan)
for (var k = 0; k < colspan - 1; ++k) outRow.push(null);
}
out.push(outRow);
}
return [out, ranges];
};
function datenum(v, date1904) {
if (date1904) v += 1462;
var epoch = Date.parse(v);
return (epoch - new Date(Date.UTC(1899, 11, 30))) / (24 * 60 * 60 * 1000);
}
function sheet_from_array_of_arrays(data, opts) {
var ws = {};
var range = {
s: {
c: 10000000,
r: 10000000
},
e: {
c: 0,
r: 0
}
};
for (var R = 0; R != data.length; ++R) {
for (var C = 0; C != data[R].length; ++C) {
if (range.s.r > R) range.s.r = R;
if (range.s.c > C) range.s.c = C;
if (range.e.r < R) range.e.r = R;
if (range.e.c < C) range.e.c = C;
var cell = {
v: data[R][C]
};
if (cell.v == null) continue;
var cell_ref = XLSX.utils.encode_cell({
c: C,
r: R
});
if (typeof cell.v === 'number') cell.t = 'n';
else if (typeof cell.v === 'boolean') cell.t = 'b';
else if (cell.v instanceof Date) {
cell.t = 'n';
cell.z = XLSX.SSF._table[14];
cell.v = datenum(cell.v);
} else cell.t = 's';
ws[cell_ref] = cell;
}
}
if (range.s.c < 10000000) ws['!ref'] = XLSX.utils.encode_range(range);
return ws;
}
function Workbook() {
if (!(this instanceof Workbook)) return new Workbook();
this.SheetNames = [];
this.Sheets = {};
}
function s2ab(s) {
var buf = new ArrayBuffer(s.length);
var view = new Uint8Array(buf);
for (var i = 0; i != s.length; ++i) view[i] = s.charCodeAt(i) & 0xFF;
return buf;
}
export function export_table_to_excel(id) {
var theTable = document.getElementById(id);
var oo = generateArray(theTable);
var ranges = oo[1];
/* original data */
var data = oo[0];
var ws_name = "SheetJS";
var wb = new Workbook(),
ws = sheet_from_array_of_arrays(data);
/* add ranges to worksheet */
// ws['!cols'] = ['apple', 'banan'];
ws['!merges'] = ranges;
/* add worksheet to workbook */
wb.SheetNames.push(ws_name);
wb.Sheets[ws_name] = ws;
var wbout = XLSX.write(wb, {
bookType: 'xlsx',
bookSST: false,
type: 'binary'
});
saveAs(new Blob([s2ab(wbout)], {
type: "application/octet-stream"
}), "test.xlsx")
}
export function export_json_to_excel({
headerGroup,
dataGroup,
sheetGroup,
filename,
autoWidth = true,
bookType= 'xlsx'
} = {}) {
var wb = new Workbook()
for (let i = 0; i < dataGroup.length; i++) {
/* original data */
let data = dataGroup[i]
filename = filename || 'excel-list'
data = [...data]
data.unshift(headerGroup[i]);
var ws_name = sheetGroup[i];
var ws = sheet_from_array_of_arrays(data);
if (autoWidth) {
/*设置worksheet每列的最大宽度*/
const colWidth = data.map(row => row.map(val => {
/*先判断是否为null/undefined*/
if (val == null) {
return {
'wch': 10
};
}
/*再判断是否为中文*/
else if (val.toString().charCodeAt(0) > 255) {
return {
'wch': val.toString().length * 2
};
} else {
return {
'wch': val.toString().length
};
}
}))
/*以第一行为初始值*/
let result = colWidth[0];
for (let i = 1; i < colWidth.length; i++) {
for (let j = 0; j < colWidth[i].length; j++) {
if (result[j]['wch'] < colWidth[i][j]['wch']) {
result[j]['wch'] = colWidth[i][j]['wch'];
}
}
}
ws['!cols'] = result;
}
let R = 0;
data.map(item => {
let C = 0;
item.map(itm => {
var cell_ref = XLSX.utils.encode_cell({c:C,r:R});
var cell = {v: itm }
cell.s= {
alignment: {
horizontal: "center"
}
}
ws[cell_ref] = cell;
C++;
})
R++;
})
/* add worksheet to workbook */
wb.SheetNames.push(ws_name);
wb.Sheets[ws_name] = ws;
}
var wbout = XLSX.write(wb, {
bookType: bookType,
bookSST: false,
type: 'binary'
});
saveAs(new Blob([s2ab(wbout)], {
type: "application/octet-stream"
}), `${filename}.${bookType}`);
}

View File

@@ -0,0 +1,522 @@
<template>
<div class="app-container">
<el-card>
<el-row>
<span>名称:</span>
<el-input v-model="Name" placeholder="名称" size="small" clearable style="width:200px"/>
<span>规格:</span>
<el-input v-model="spec" placeholder="规格" size="small" clearable style="width:200px"/>
<span>型号:</span>
<el-input v-model="model" placeholder="型号" size="small" clearable style="width:200px"/>
<el-button type="success" size="small" icon="el-icon-search" style="margin-left: 15px" @click="searchTable()">查询</el-button>
</el-row>
<el-row v-show="false">
<span>机床编号:</span>
<el-select v-model="machineNumberValue" filterable placeholder="机床编号" size="small" clearable @change="machineChange">
<el-option
v-for="item in machineNumber"
:key="item.value"
:label="item.label"
:value="item.value">
<div style="float: left">{{ item.label }}</div>
<div style="float: right; color: #8492a6; font-size: 13px">{{ item.name }}</div>
</el-option>
</el-select>
<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</span>
<el-select v-model="groupNumberValue" placeholder="组号" size="small" clearable>
<el-option
v-for="item in groupNumber"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-row>
</el-card>
<el-tabs v-model="PartType" type="border-card" @tab-click="searchTable()">
<el-tab-pane label="标准件" name="标准件">
<el-table :data="tableData0" size="mini" style="max-height: 600px" height="600px" border stripe>
<el-table-column align="center" label="采购情况" width="80px">
<template slot-scope="scope">
<el-tag v-if="!scope.row.人员编号" type="primary" size="small">未分配</el-tag>
<el-tag v-if="parseInt(scope.row.询价状态编号)===1&&scope.row.人员编号!==''" type="warning" size="small">未询价</el-tag>
<el-tag v-if="parseInt(scope.row.询价状态编号)===3&&parseInt(scope.row.采购状态编号)!==3" type="success" size="small">已询价</el-tag>
<el-tag v-if="parseInt(scope.row.询价状态编号)===3&&parseInt(scope.row.采购状态编号)===3" type="info" size="small">已采购</el-tag>
</template>
</el-table-column>
<el-table-column align="center" label="名称" width="100px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.物料名称 }}
</template>
</el-table-column>
<el-table-column align="center" label="型号" min-width="100px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.物料型号 }}
</template>
</el-table-column>
<el-table-column align="center" label="规格" min-width="200px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.物料规格 }}
</template>
</el-table-column>
<el-table-column align="center" label="备注" min-width="100px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.备注 || '—' }}
</template>
</el-table-column>
<el-table-column align="center" label="技术下达数量" width="100px">
<template slot-scope="scope">
{{ scope.row.零件数量 || '—' }}
</template>
</el-table-column>
<el-table-column align="center" label="合同采购数量" width="100px">
<template slot-scope="scope">
{{ parseInt(scope.row.询价状态编号)===1&&scope.row.人员编号!=='' ? '—' : scope.row.数量 || scope.row.离线采购数量 || '—' }}
</template>
</el-table-column>
<el-table-column align="center" label="到货数量" width="100px">
<template slot-scope="scope">
{{ parseInt(scope.row.询价状态编号)===1&&scope.row.人员编号!=='' ? '—' : scope.row.已到货数量 || scope.row.离线到货数量 || '—' }}
</template>
</el-table-column>
</el-table>
<div class="block">
<el-pagination
:current-page="pageCurrent0"
:page-sizes="[10, 20, 30, 40]"
:page-size="pageSize0"
:total="total0"
style="margin-top:10px;display:inline-block;width:50%"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange0"
@current-change="handleCurrentChange0"/>
</div>
</el-tab-pane>
<el-tab-pane label="外购件" name="外购件">
<el-table :data="tableData1" size="mini" style="max-height: 600px" height="600px" border stripe>
<el-table-column align="center" label="采购情况" width="80px">
<template slot-scope="scope">
<el-tag v-if="!scope.row.人员编号" type="primary" size="small">未分配</el-tag>
<el-tag v-if="parseInt(scope.row.询价状态编号)===1&&scope.row.人员编号!==''" type="warning" size="small">未询价</el-tag>
<el-tag v-if="parseInt(scope.row.询价状态编号)===3&&parseInt(scope.row.采购状态编号)!==3" type="success" size="small">已询价</el-tag>
<el-tag v-if="parseInt(scope.row.询价状态编号)===3&&parseInt(scope.row.采购状态编号)===3" type="info" size="small">已采购</el-tag>
</template>
</el-table-column>
<!--<el-table-column align="center" label="机床图号" width="100px" show-overflow-tooltip>-->
<!--<template slot-scope="scope">-->
<!--{{ scope.row.机床图号 }}-->
<!--</template>-->
<!--</el-table-column>-->
<!--<el-table-column align="center" label="组号" width="80px">-->
<!--<template slot-scope="scope">-->
<!--{{ scope.row.组号 }}-->
<!--</template>-->
<!--</el-table-column>-->
<el-table-column align="center" label="名称" width="100px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.物料名称 }}
</template>
</el-table-column>
<el-table-column align="center" label="型号" min-width="100px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.物料型号 }}
</template>
</el-table-column>
<el-table-column align="center" label="规格" min-width="200px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.物料规格 }}
</template>
</el-table-column>
<!--<el-table-column align="center" label="供货商" min-width="100px" show-overflow-tooltip>-->
<!--<template slot-scope="scope">-->
<!--{{ scope.row.供货商 || '—' }}-->
<!--</template>-->
<!--</el-table-column>-->
<!--<el-table-column align="center" label="备注" min-width="100px" show-overflow-tooltip>-->
<!--<template slot-scope="scope">-->
<!--{{ scope.row.备注 || '—' }}-->
<!--</template>-->
<!--</el-table-column>-->
<el-table-column align="center" label="技术下达数量" width="100px">
<template slot-scope="scope">
{{ scope.row.零件数量 || '—' }}
</template>
</el-table-column>
<el-table-column align="center" label="合同采购数量" width="100px">
<template slot-scope="scope">
{{ parseInt(scope.row.询价状态编号)===1&&scope.row.人员编号!=='' ? '—' : scope.row.数量 || scope.row.离线采购数量 || '—' }}
</template>
</el-table-column>
<el-table-column align="center" label="到货数量" width="100px">
<template slot-scope="scope">
{{ parseInt(scope.row.询价状态编号)===1&&scope.row.人员编号!=='' ? '—' : scope.row.已到货数量 || scope.row.离线到货数量 || '—' }}
</template>
</el-table-column>
<!--<el-table-column align="center" label="供应商" min-width="150px" show-overflow-tooltip>-->
<!--<template slot-scope="scope">-->
<!--{{ parseInt(scope.row.询价状态编号)===1&&scope.row.人员编号!=='' ? '—' : scope.row.供应商名称 || scope.row.离线合同供应商名称 || '—' }}-->
<!--</template>-->
<!--</el-table-column>-->
<!--<el-table-column align="center" label="合同编号" min-width="100px" show-overflow-tooltip>-->
<!--<template slot-scope="scope">-->
<!--{{ parseInt(scope.row.询价状态编号)===1&&scope.row.人员编号!=='' ? '—' : scope.row.采购合同编号 || scope.row.离线合同编号 || '—' }}-->
<!--</template>-->
<!--</el-table-column>-->
<!--<el-table-column align="center" label="采购员" width="100px">-->
<!--<template slot-scope="scope">-->
<!--{{ scope.row.姓名 || '—' }}-->
<!--</template>-->
<!--</el-table-column>-->
</el-table>
<div class="block">
<el-pagination
:current-page="pageCurrent1"
:page-sizes="[10, 20, 30, 40]"
:page-size="pageSize1"
:total="total1"
style="margin-top:10px;display:inline-block;width:50%"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange1"
@current-change="handleCurrentChange1"/>
</div>
</el-tab-pane>
<el-tab-pane label="基本件" name="基本件">
<el-table :data="tableData2" size="mini" style="max-height: 600px" height="600px" border stripe>
<el-table-column align="center" label="采购情况" width="80px">
<template slot-scope="scope">
<el-tag v-if="!scope.row.人员编号" type="primary" size="small">未分配</el-tag>
<el-tag v-if="parseInt(scope.row.询价状态编号)===1&&scope.row.人员编号!==''" type="warning" size="small">未询价</el-tag>
<el-tag v-if="parseInt(scope.row.询价状态编号)===3&&parseInt(scope.row.采购状态编号)!==3" type="success" size="small">已询价</el-tag>
<el-tag v-if="parseInt(scope.row.询价状态编号)===3&&parseInt(scope.row.采购状态编号)===3" type="info" size="small">已采购</el-tag>
</template>
</el-table-column>
<!--<el-table-column align="center" label="机床图号" width="100px" show-overflow-tooltip>-->
<!--<template slot-scope="scope">-->
<!--{{ scope.row.机床图号 }}-->
<!--</template>-->
<!--</el-table-column>-->
<el-table-column align="center" label="名称" min-width="100px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.零件名称 }}
</template>
</el-table-column>
<!--<el-table-column align="center" label="图号" min-width="100px" show-overflow-tooltip>-->
<!--<template slot-scope="scope">-->
<!--{{ scope.row.零件图号 }}-->
<!--</template>-->
<!--</el-table-column>-->
<el-table-column align="center" label="规格" min-width="100px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.规格 }}
</template>
</el-table-column>
<!--<el-table-column align="center" label="材料" min-width="100px" show-overflow-tooltip>-->
<!--<template slot-scope="scope">-->
<!--{{ scope.row.材料 }}-->
<!--</template>-->
<!--</el-table-column>-->
<!--<el-table-column align="center" label="供货商" min-width="100px" show-overflow-tooltip>-->
<!--<template slot-scope="scope">-->
<!--{{ scope.row.供货商 || '—' }}-->
<!--</template>-->
<!--</el-table-column>-->
<el-table-column align="center" label="备注" min-width="100px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.备注 || '—' }}
</template>
</el-table-column>
<el-table-column align="center" label="技术下达数量" width="100px">
<template slot-scope="scope">
{{ scope.row.零件数量 || '—' }}
</template>
</el-table-column>
<el-table-column align="center" label="采购数量" width="100px">
<template slot-scope="scope">
{{ parseInt(scope.row.询价状态编号)===1&&scope.row.人员编号!=='' ? '—' : scope.row.数量 || '—' }}
</template>
</el-table-column>
<el-table-column align="center" label="到货数量" width="100px">
<template slot-scope="scope">
{{ parseInt(scope.row.询价状态编号)===1&&scope.row.人员编号!=='' ? '—' : scope.row.已到货数量 || '—' }}
</template>
</el-table-column>
<!--<el-table-column align="center" label="供应商" min-width="100px" show-overflow-tooltip>-->
<!--<template slot-scope="scope">-->
<!--{{ parseInt(scope.row.询价状态编号)===1&&scope.row.人员编号!=='' ? '—' : scope.row.供应商名称 || '—' }}-->
<!--</template>-->
<!--</el-table-column>-->
<!--<el-table-column align="center" label="采购合同编号" min-width="100px">-->
<!--<template slot-scope="scope">-->
<!--{{ parseInt(scope.row.询价状态编号)===1&&scope.row.人员编号!=='' ? '—' : scope.row.采购合同编号 || '—' }}-->
<!--</template>-->
<!--</el-table-column>-->
<!--<el-table-column align="center" label="采购员" width="100px">-->
<!--<template slot-scope="scope">-->
<!--{{ scope.row.姓名 || '—' }}-->
<!--</template>-->
<!--</el-table-column>-->
</el-table>
<div class="block">
<el-pagination
:current-page="pageCurrent2"
:page-sizes="[10, 20, 30, 40]"
:page-size="pageSize2"
:total="total2"
style="margin-top:10px;display:inline-block;width:50%"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange2"
@current-change="handleCurrentChange2"/>
</div>
</el-tab-pane>
</el-tabs>
</div>
</template>
<script>
import { initMachineProject, searchgroup, searchTable1, searchTable2, searchTable1Export, searchTable2Export } from '@/api/PurchasingCenter/PurchaseSituationSearch'
import { mapGetters } from 'vuex'
export default {
name: '', // 采购件采购查询
data() {
return {
Name: '',
spec: '',
model: '',
machineNumberValue: '',
machineNumber: [],
groupNumberValue: '',
groupNumber: [],
PartType: '标准件',
tableData0: [],
tableData1: [],
tableData2: [],
tableData3: [],
pageCurrent0: 1,
pageSize0: 20,
total0: 0,
pageCurrent1: 1,
pageSize1: 20,
total1: 0,
pageCurrent2: 1,
pageSize2: 20,
total2: 0
}
},
computed: {
...mapGetters([
'name',
'id' // 人员编号
])
},
created() {
this.fetchData()
this.searchTable()
},
methods: {
// 导出采购物料执行情况
exportDetail() {
let check1, check2
this.machineNumberValue ? check1 = 1 : check1 = 0
this.groupNumberValue ? check2 = 1 : check2 = 0
searchTable1Export(check1, this.machineNumberValue, check2, this.groupNumberValue, 1).then(res1 => { // 标准件
searchTable1Export(check1, this.machineNumberValue, check2, this.groupNumberValue, 2).then(res2 => { // 外购件
searchTable2Export(check1, this.machineNumberValue, check2, this.groupNumberValue).then(res3 => { // 基本件
import('./Export2Excel').then(excel => {
const dataGroup = []
const filterVal1 = ['机床图号', '组号', '物料名称', '物料型号', '物料规格', '零件数量', ['数量', '离线采购数量'], ['已到货数量', '离线到货数量'], ['供应商名称', '离线合同供应商名称'], ['采购合同编号', '离线合同编号'], '姓名', '供货商', '备注'] // tableData0里的属性名
const filterVal2 = ['机床图号', '组号', '物料名称', '物料型号', '物料规格', '零件数量', ['数量', '离线采购数量'], ['已到货数量', '离线到货数量'], ['供应商名称', '离线合同供应商名称'], ['采购合同编号', '离线合同编号'], '姓名', '供货商', '备注'] // tableData1里的属性名
const filterVal3 = ['机床图号', '组号', '零件名称', '零件图号', '规格', '材料', '零件数量', '数量', '已到货数量', '供应商名称', '采购合同编号', '姓名', '供货商', '备注'] // tableData2里的属性名
const data1 = res1.data.map(v => filterVal1.map(j => {
if (typeof (j) === 'string') {
return v[j] || '—'
} else {
return v[j[0]] || v[j[1]] || '—'
}
}))
data1.map(v => {
v.push('') // 物料状态
if (v[10] === '—') {
v[13] = '未分配'
} else if (v[6] === '—') {
v[13] = '未采购'
} else if (v[6] !== '—' && v[6] !== v[7]) {
v[13] = '未全部到货'
} else if (v[6] !== '—' && v[6] === v[7]) {
v[13] = '全部到货'
}
})
dataGroup.push(data1)
const data2 = res2.data.map(v => filterVal2.map(j => {
if (typeof (j) === 'string') {
return v[j] || '—'
} else {
return v[j[0]] || v[j[1]] || '—'
}
}))
data2.map(v => {
v.push('') // 物料状态
if (v[10] === '—') {
v[13] = '未分配'
} else if (v[6] === '—') {
v[13] = '未采购'
} else if (v[6] !== '—' && v[6] !== v[7]) {
v[13] = '未全部到货'
} else if (v[6] !== '—' && v[6] === v[7]) {
v[13] = '全部到货'
}
})
dataGroup.push(data2)
const data3 = res3.data.map(v => filterVal3.map(j => {
if (typeof (j) === 'string') {
return v[j] || '—'
} else {
return v[j[0]] || v[j[1]] || '—'
}
}))
data3.map(v => {
v.push('') // 物料状态
if (v[11] === '—') {
v[14] = '未分配'
} else if (v[7] === '—') {
v[14] = '未采购'
} else if (v[7] !== '—' && v[7] !== v[8]) {
v[14] = '未全部到货'
} else if (v[7] !== '—' && v[7] === v[8]) {
v[14] = '全部到货'
}
})
dataGroup.push(data3)
const headerGroup = [['机床号', '组号', '名称', '图号或型号', '规格', '技术下达数量', '合同采购数量', '到货数量', '供应商', '合同编号', '采购员', '供货商', '备注', '物料状态'],
['机床号', '组号', '名称', '图号或型号', '规格', '技术下达数量', '合同采购数量', '到货数量', '供应商', '合同编号', '采购员', '供货商', '备注', '物料状态'],
['机床号', '组号', '名称', '图号或型号', '规格', '材料', '技术下达数量', '合同采购数量', '到货数量', '供应商', '合同编号', '采购员', '供货商', '备注', '物料状态']]
const sheetGroup = ['标准件', '外购件', '基本件']
excel.export_json_to_excel({
headerGroup: headerGroup,
dataGroup: dataGroup,
sheetGroup: sheetGroup,
filename: '采购物料执行情况',
autoWidth: true,
bookType: 'xlsx'
})
})
})
})
})
},
fetchData() {
initMachineProject().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.machineNumber.push({
label: response.data[i].机床图号,
name: response.data[i].项目名称,
value: response.data[i].机床流水号
})
}
})
},
machineChange() {
this.groupNumberValue = ''
this.groupNumber = []
searchgroup(this.machineNumberValue).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.groupNumber.push({
label: response.data[i].组号,
value: response.data[i].组件流水号
})
}
})
},
searchTable() {
if (this.PartType === '标准件') {
this.searchTable0()
} else if (this.PartType === '外购件') {
this.searchTable1()
} else if (this.PartType === '基本件') {
this.searchTable2()
}
},
handleSizeChange0(val) {
this.pageSize0 = val
this.pageCurrent0 = 1
this.searchTable0()
},
handleCurrentChange0(val) {
this.pageCurrent0 = val
this.searchTable0()
},
handleSizeChange1(val) {
this.pageSize1 = val
this.pageCurrent1 = 1
this.searchTable1()
},
handleCurrentChange1(val) {
this.pageCurrent1 = val
this.searchTable1()
},
handleSizeChange2(val) {
this.pageSize2 = val
this.pageCurrent2 = 1
this.searchTable2()
},
handleCurrentChange2(val) {
this.pageCurrent2 = val
this.searchTable2()
},
searchTable0() { // 查询标准件
let check1, check2, check3, check4, check5
this.machineNumberValue ? check1 = 1 : check1 = 0
this.groupNumberValue ? check2 = 1 : check2 = 0
this.Name ? check3 = 1 : check3 = 0
this.spec ? check4 = 1 : check4 = 0
this.model ? check5 = 1 : check5 = 0
searchTable1(check1, this.machineNumberValue, check2, this.groupNumberValue, this.pageCurrent0, this.pageSize0, 1, check3, this.Name, check4, this.spec, check5, this.model).then(response => {
console.log(this.tableData0)
this.tableData0 = response.data.rows
this.total0 = response.data.total
})
},
searchTable1() { // 查询外购件
let check1, check2, check3, check4, check5
this.machineNumberValue ? check1 = 1 : check1 = 0
this.groupNumberValue ? check2 = 1 : check2 = 0
this.Name ? check3 = 1 : check3 = 0
this.spec ? check4 = 1 : check4 = 0
this.model ? check5 = 1 : check5 = 0
searchTable1(check1, this.machineNumberValue, check2, this.groupNumberValue, this.pageCurrent1, this.pageSize1, 2, check3, this.Name, check4, this.spec, check5, this.model).then(response => {
this.tableData1 = response.data.rows
this.total1 = response.data.total
})
},
searchTable2() { // 查询基本件
let check1, check2, check3, check4, check5
this.machineNumberValue ? check1 = 1 : check1 = 0
this.groupNumberValue ? check2 = 1 : check2 = 0
this.Name ? check3 = 1 : check3 = 0
this.spec ? check4 = 1 : check4 = 0
this.model ? check5 = 1 : check5 = 0
searchTable2(check1, this.machineNumberValue, check2, this.groupNumberValue, this.pageCurrent2, this.pageSize2, check3, this.Name, check4, this.spec, check5, this.model).then(response => {
this.tableData2 = response.data.rows
this.total2 = response.data.total
})
}
}
}
</script>
<style scoped>
.el-card{
margin-bottom: 0px;
}
.el-select{
width:200px
}
.el-input{
width:200px
}
span{
margin: 10px 0 10px 10px;
}
.el-tag{
margin: 0
}
</style>