This commit is contained in:
lixin
2018-11-30 11:23:51 +08:00
12 changed files with 526 additions and 87 deletions

View File

@@ -12,7 +12,7 @@ export function getEntryNameValue() {
} }
}) })
} }
// 项目名称 // 机床名称
export function getToolNum(num) { export function getToolNum(num) {
return request({ return request({
url: '', url: '',

View File

@@ -1,27 +1,47 @@
import request from '@/utils/request' import request from '@/utils/request'
// 查询(未编制) export function machine() {
export function searchPartNum1(num1, start, end, pageCurrent, pageSize) {
return request({ return request({
url: '', url: '',
method: 'post', method: 'post',
data: { data: {
type: '1', type: '1',
name: '车间生产管理工艺_零件工艺计划_查询序间外协零件_价格预算', name: '车间生产管理工艺_序间外协_项目查询'
param: '定额人员编号=0&零件图号=' + num1 + '&开始时间=' + start + '&结束时间=' + end + '&预算状态=0',
Pagination: pageCurrent + '&' + pageSize
} }
}) })
} }
// 查询零件号(已编制) export function getToolNum(num) {
export function searchPartNum2(num, start, end, pageCurrent, pageSize) {
return request({ return request({
url: '', url: '',
method: 'post', method: 'post',
data: { data: {
type: '1', type: '1',
name: '车间生产管理工艺_零件工艺计划_查询序间外协零件_价格预算', name: '车间生产管理工艺_传递后_机床名称_查询数据_查询所有机床',
param: '定额人员编号=0&零件图号=' + num + '&开始时间=' + start + '&结束时间=' + end + '&预算状态=1', param: '项目流水号=' + num
}
})
}
// 组号
export function getNum(num) {
return request({
url: '',
method: 'post',
data: {
type: '1',
name: '车间生产管理工艺_传递后_组件名称_查询数据_查询所有组',
param: '机床流水号=' + num
}
})
}
// 查询(未编制)
export function searchPartNum1(num1, num2, num3, num4, num5, num6, num7, num8, num9, pageCurrent, pageSize) {
return request({
url: '',
method: 'post',
data: {
type: '1',
name: '车间生产管理工艺_零件工艺计划_查询序间外协零件_价格预算_new',
param: '项目流水号_check=' + num1 + '&项目流水号=' + num2 + '&机床流水号_check=' + num3 + '&机床流水号=' + num4 + '&组件流水号_check=' + num5 + '&组件流水号=' + num6 + '&零件图号_check=' + num7 + '&零件图号=' + num8 + '&预算状态=' + num9,
Pagination: pageCurrent + '&' + pageSize Pagination: pageCurrent + '&' + pageSize
} }
}) })

View File

@@ -1,14 +1,47 @@
import request from '@/utils/request' import request from '@/utils/request'
export function machine() {
return request({
url: '',
method: 'post',
data: {
type: '1',
name: '车间生产管理工艺_序间外协_项目查询'
}
})
}
export function getToolNum(num) {
return request({
url: '',
method: 'post',
data: {
type: '1',
name: '车间生产管理工艺_传递后_机床名称_查询数据_查询所有机床',
param: '项目流水号=' + num
}
})
}
// 组号
export function getNum(num) {
return request({
url: '',
method: 'post',
data: {
type: '1',
name: '车间生产管理工艺_传递后_组件名称_查询数据_查询所有组',
param: '机床流水号=' + num
}
})
}
// 查询表1 // 查询表1
export function searchTable(check, num1, pageCurrent, pageSize) { export function searchTable(num1, num2, num3, num4, num5, num6, check, num7, pageCurrent, pageSize) {
return request({ return request({
url: '', url: '',
method: 'post', method: 'post',
data: { data: {
type: '1', type: '1',
name: '车间生产管理工艺_零件工艺计划_查询数据_状态_新', name: '车间生产管理工艺_零件工艺计划_查询数据_状态_新',
param: '项目流水号_check=0&项目流水号=0&机床流水号_check=0&机床流水号=0&组件流水号_check=0&组件流水号=0&零件图号_check=' + check + '&零件图号=' + num1 + '&考核状态_check=0&考核状态=0&单件是否外协_check=1&单件是否外协=1&时间=0&机加工开始时间=0&机加工结束时间=0&零件类型=0', param: '项目流水号_check=' + num1 + '&项目流水号=' + num2 + '&机床流水号_check=' + num3 + '&机床流水号=' + num4 + '&组件流水号_check=' + num5 + '&组件流水号=' + num6 + '&零件图号_check=' + check + '&零件图号=' + num7 + '&考核状态_check=0&考核状态=0&单件是否外协_check=1&单件是否外协=1&时间=0&机加工开始时间=0&机加工结束时间=0&零件类型=0',
Pagination: pageCurrent + '&' + pageSize Pagination: pageCurrent + '&' + pageSize
} }
}) })

206
src/vendor/Export2Excelcjn.js vendored Normal file
View File

@@ -0,0 +1,206 @@
/* eslint-disable */
require('script-loader!file-saver');
import XLSX from 'xlsx'
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({
header,
data,
filename,
autoWidth = true,
bookType= 'xlsx'
} = {}) {
/* original data */
filename = filename || 'excel-list'
data = [...data]
data.unshift(header);
var ws_name = filename || 'excel-list';
var wb = new Workbook(),
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;
}
/* 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

@@ -409,7 +409,7 @@ export default {
toolNumValue: '', toolNumValue: '',
toolNum: [], // 机床号 toolNum: [], // 机床号
NumValue: '', NumValue: '',
Num: [], // 机床后什么号 Num: [], // 分组
liushuihao: '', liushuihao: '',
gongyijihua: '', gongyijihua: '',
radio: 0, // 第一组 radio: 0, // 第一组

View File

@@ -1206,6 +1206,7 @@ export default {
if (this.零件图号.length !== 0) { if (this.零件图号.length !== 0) {
for (let i = 0; i < this.零件图号.length; i++) { for (let i = 0; i < this.零件图号.length; i++) {
selection2(this.工艺计划流水号[i]).then(response => { selection2(this.工艺计划流水号[i]).then(response => {
console.log(response.data, 2)
for (let k = 0; k < response.data.length; k++) { for (let k = 0; k < response.data.length; k++) {
this.process[i][k] = response.data[k].工艺名称简称 this.process[i][k] = response.data[k].工艺名称简称
this.planDate[i][k] = response.data[k].计划日期_短 this.planDate[i][k] = response.data[k].计划日期_短

View File

@@ -7,28 +7,33 @@
<el-radio :label="1">未编制</el-radio> <el-radio :label="1">未编制</el-radio>
<el-radio :label="2">已编制</el-radio> <el-radio :label="2">已编制</el-radio>
</el-radio-group> </el-radio-group>
<span>项目名称:</span>
<el-select v-model="entryNameValue" clearable filterable size="small" style="margin-bottom:10px" placeholder="项目名称" @change="typeChange()">
<el-option
v-for="item in entryName"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span>机床名称:</span>
<el-select v-model="toolNumValue" clearable filterable size="small" placeholder="机床号" style="margin-bottom:10px" @change="typeChange1()">
<el-option
v-for="item in toolNum"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span>分组:</span>
<el-select v-model="NumValue" clearable filterable size="small" style="margin-bottom:10px" placeholder="机床组号">
<el-option
v-for="item in Num"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span>零件图号:</span> <span>零件图号:</span>
<el-input v-model="partName" placeholder="零件图号" size="small" clearable style="width:200px"/> <el-input v-model="partName" placeholder="零件图号" size="small" clearable style="width:200px"/>
<span>开始时间:</span>
<el-date-picker
v-model="date01"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
type="date"
size="small"
placeholder="选择开始日期"/>
<span>结束时间:</span>
<el-date-picker
v-model="date02"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
type="date"
size="small"
placeholder="选择结束日期"/>
<el-button size="small" icon="el-icon-search" type="success" style="margin-left: 10px" @click="pageSize2=10; pageCurrent2=1;searchPartNum()">查询</el-button> <el-button size="small" icon="el-icon-search" type="success" style="margin-left: 10px" @click="pageSize2=10; pageCurrent2=1;searchPartNum()">查询</el-button>
</el-row> </el-row>
@@ -71,30 +76,30 @@
{{ scope.row.原材料规格 }} {{ scope.row.原材料规格 }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="面积" width="110" align="center"> <!--<el-table-column label="面积" width="110" align="center">-->
<template slot-scope="scope"> <!--<template slot-scope="scope">-->
{{ scope.row.面积 }} <!--{{ scope.row.面积 }}-->
</template> <!--</template>-->
</el-table-column> <!--</el-table-column>-->
<el-table-column label="重量" width="110" align="center"> <!--<el-table-column label="重量" width="110" align="center">-->
<template slot-scope="scope"> <!--<template slot-scope="scope">-->
{{ scope.row.重量 }} <!--{{ scope.row.重量 }}-->
</template> <!--</template>-->
</el-table-column> <!--</el-table-column>-->
<el-table-column label="材料费" width="110" align="center"> <!--<el-table-column label="材料费" width="110" align="center">-->
<template slot-scope="scope"> <!--<template slot-scope="scope">-->
{{ scope.row.材料费 }} <!--{{ scope.row.材料费 }}-->
</template> <!--</template>-->
</el-table-column> <!--</el-table-column>-->
<el-table-column label="操作" align="center" width="150px" fixed="right"> <!--<el-table-column label="操作" align="center" width="150px" fixed="right">-->
<template slot-scope="scope"> <!--<template slot-scope="scope">-->
<el-button <!--<el-button-->
size="mini" <!--size="mini"-->
type="primary" <!--type="primary"-->
class="el-icon-edit" <!--class="el-icon-edit"-->
@click="edit(scope.$index, scope.row, 'form')">编辑</el-button> <!--@click="edit(scope.$index, scope.row, 'form')">编辑</el-button>-->
</template> <!--</template>-->
</el-table-column> <!--</el-table-column>-->
</el-table> </el-table>
<div class="block"> <div class="block">
<el-pagination <el-pagination
@@ -134,7 +139,7 @@
</el-table-column> </el-table-column>
<el-table-column label="外协预算价格" width="110" align="center"> <el-table-column label="外协预算价格" width="110" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="tableData[scope.$index].外协预算价格_系数" size="mini" /> <el-input v-model="tableData[scope.$index].外协预算价格_计算" size="mini" />
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@@ -165,10 +170,16 @@
</template> </template>
<script> <script>
import { searchPartNum1, searchPartNum2, searchTable, saveWeightArea, saveMaterialPrice, saveRowPrice } from '@/api/Outsourcing/InterBudgetaryBudgets' import { machine, getToolNum, getNum, searchPartNum1, searchTable, saveWeightArea, saveMaterialPrice, saveRowPrice } from '@/api/Outsourcing/InterBudgetaryBudgets'
export default { export default {
data() { data() {
return { return {
entryNameValue: '',
entryName: [], // 项目名称
toolNumValue: '',
toolNum: [], // 机床号
NumValue: '',
Num: [], // 分组
lingjianhao: '', lingjianhao: '',
dialogFormVisible: false, dialogFormVisible: false,
form: { form: {
@@ -183,8 +194,6 @@ export default {
result2: [], result2: [],
radio: 1, radio: 1,
partName: '', // 零件名称 partName: '', // 零件名称
date01: '', // 开始时间
date02: '', // 结束时间
loading0: false, loading0: false,
tableData: [], tableData: [],
loading2: false, loading2: false,
@@ -194,33 +203,91 @@ export default {
pageCurrent2: 1 // 后台获取页 pageCurrent2: 1 // 后台获取页
} }
}, },
created() {
this.fetchData()
},
methods: { methods: {
radioChange() { radioChange() {
this.tableData2 = [] this.tableData2 = []
this.entryNameValue = ''
this.toolNumValue = ''
this.NumValue = ''
},
fetchData() {
this.entryNameValue = ''
this.entryName = []
machine().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.entryName.push({
label: response.data[i].项目名称,
value: response.data[i].项目流水号
})
}
})
},
typeChange() {
this.toolNumValue = ''
this.toolNum = []
this.NumValue = ''
this.Num = []
getToolNum(this.entryNameValue).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.toolNum.push({
label: response.data[i].机床图号,
value: response.data[i].机床流水号
})
}
})
},
typeChange1() {
this.NumValue = ''
this.Num = []
getNum(this.toolNumValue).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.Num.push({
label: response.data[i].组号,
value: response.data[i].组件流水号
})
}
})
}, },
// 查零件号 // 查零件号
searchPartNum() { searchPartNum() {
if (this.partName === null) { if (this.partName === null) {
this.partName = '' this.partName = ''
} }
if (this.date01 === '') { if (this.entryNameValue !== null && this.entryNameValue !== '') {
this.date01 = null this.check_entryNameValue = 1
} else {
this.check_entryNameValue = 0
} }
if (this.date02 === '') { if (this.toolNumValue !== null && this.toolNumValue !== '') {
this.date02 = null this.check_toolNumValue = 1
} else {
this.check_toolNumValue = 0
}
if (this.NumValue !== null && this.NumValue !== '') {
this.check_NumValue = 1
} else {
this.check_NumValue = 0
}
if (this.partName !== null && this.partName !== '') {
this.check_partName = 1
} else {
this.check_partName = 0
} }
this.loading2 = true this.loading2 = true
this.tableData2 = [] this.tableData2 = []
this.tableData = [] this.tableData = []
if (this.radio === 1) { if (this.radio === 1) {
searchPartNum1(this.partName, this.date01, this.date02, this.pageCurrent2, this.pageSize2).then(response => { searchPartNum1(this.check_entryNameValue, this.entryNameValue, this.check_toolNumValue, this.toolNumValue, this.check_NumValue, this.NumValue, this.check_partName, this.partName, 0, this.pageCurrent2, this.pageSize2).then(response => {
this.tableData2 = response.data.rows this.tableData2 = response.data.rows
this.total2 = response.data.total this.total2 = response.data.total
}).then(() => { }).then(() => {
this.loading2 = false this.loading2 = false
}) })
} else { } else {
searchPartNum2(this.partName, this.date01, this.date02, this.pageCurrent2, this.pageSize2).then(response => { searchPartNum1(this.check_entryNameValue, this.entryNameValue, this.check_toolNumValue, this.toolNumValue, this.check_NumValue, this.NumValue, this.check_partName, this.partName, 1, this.pageCurrent2, this.pageSize2).then(response => {
this.tableData2 = response.data.rows this.tableData2 = response.data.rows
this.total2 = response.data.total this.total2 = response.data.total
}).then(() => { }).then(() => {
@@ -238,7 +305,7 @@ export default {
return return
} else if (index === 5) { } else if (index === 5) {
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
sums[5] += parseFloat(data[i].外协预算价格_系数) sums[5] += parseFloat(data[i].外协预算价格_计算)
} }
sums[5] = parseInt(sums[5] * 100) / 100 sums[5] = parseInt(sums[5] * 100) / 100
} }
@@ -250,8 +317,8 @@ export default {
this.tableData = [] this.tableData = []
searchTable(row.工艺计划流水号, 1).then(response => { searchTable(row.工艺计划流水号, 1).then(response => {
for (let i = 0; i < response.data.length; i++) { for (let i = 0; i < response.data.length; i++) {
if (response.data[i].外协预算价格_系数 !== 0) { if (response.data[i].外协预算价格_计算 !== 0) {
response.data[i].外协预算价格_系数 = response.data[i].外协预算价格_系数.toFixed(2) response.data[i].外协预算价格_计算 = response.data[i].外协预算价格_计算.toFixed(2)
} }
} }
this.cailiaofei = row.材料费 this.cailiaofei = row.材料费
@@ -305,7 +372,7 @@ export default {
this.$message.error('请选择零件') this.$message.error('请选择零件')
} else { } else {
for (let i = 0; i < this.tableData.length; i++) { for (let i = 0; i < this.tableData.length; i++) {
saveRowPrice(this.tableData[i].工序流水号, parseFloat(this.tableData[i].外协预算价格_系数), this.tableData[i].工艺计划流水号, this.cailiaofei).then(response => { saveRowPrice(this.tableData[i].工序流水号, parseFloat(this.tableData[i].外协预算价格_计算), this.tableData[i].工艺计划流水号, this.cailiaofei).then(response => {
}) })
} }
this.$message.success('保存成功') this.$message.success('保存成功')

View File

@@ -433,12 +433,14 @@
placeholder="下达任务日期" placeholder="下达任务日期"
value-format="yyyy-MM-dd"/> value-format="yyyy-MM-dd"/>
</el-form-item> </el-form-item>
<el-form-item label="外协厂家" prop="外协厂家" style="margin-left: 200px">
<el-input v-model="form.外协厂家" readonly placeholder="外协厂家" size="small" style="width:200px" clearable>
<el-button slot="append" icon="el-icon-search" @click="onFocus1();param=1"/>
</el-input>
</el-form-item>
<el-form-item label="运费" prop="运费" style="margin-left: 200px"> <el-form-item label="运费" prop="运费" style="margin-left: 200px">
<el-input v-model="form.运费" placeholder="运费" size="small" style="width:200px" clearable/> <el-input v-model="form.运费" placeholder="运费" size="small" style="width:200px" clearable/>
</el-form-item> </el-form-item>
<el-form-item label="外协厂家" prop="外协厂家" style="margin-left: 200px">
<el-input v-model="form.外协厂家" readonly placeholder="外协厂家" size="small" style="width:200px" clearable @dblclick.native="onFocus1();param=1"/>
</el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button @click="callOff('form')">取消</el-button> <el-button @click="callOff('form')">取消</el-button>

View File

@@ -2,6 +2,30 @@
<div> <div>
<el-card> <el-card>
<el-row> <el-row>
<span>项目名称:</span>
<el-select v-model="entryNameValue" clearable filterable size="small" style="margin-bottom:10px" placeholder="项目名称" @change="typeChange()">
<el-option
v-for="item in entryName"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span>机床名称:</span>
<el-select v-model="toolNumValue" clearable filterable size="small" placeholder="机床号" style="margin-bottom:10px" @change="typeChange1()">
<el-option
v-for="item in toolNum"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span>分组:</span>
<el-select v-model="NumValue" clearable filterable size="small" style="margin-bottom:10px" placeholder="机床组号">
<el-option
v-for="item in Num"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span>零件图号:</span> <span>零件图号:</span>
<el-input v-model="partName" placeholder="零件图号" size="small" clearable style="width:200px"/> <el-input v-model="partName" placeholder="零件图号" size="small" clearable style="width:200px"/>
<el-button size="small" icon="el-icon-search" type="success" style="margin-left: 10px" @click="pageSize1=10; pageCurrent1=1;searchTable()">查询</el-button> <el-button size="small" icon="el-icon-search" type="success" style="margin-left: 10px" @click="pageSize1=10; pageCurrent1=1;searchTable()">查询</el-button>
@@ -108,10 +132,16 @@
</template> </template>
<script> <script>
import { searchTable, searchTable2, edit, edit2 } from '@/api/Outsourcing/PreorderAssociation' import { machine, getToolNum, getNum, searchTable, searchTable2, edit, edit2 } from '@/api/Outsourcing/PreorderAssociation'
export default { export default {
data() { data() {
return { return {
entryNameValue: '',
entryName: [], // 项目名称
toolNumValue: '',
toolNum: [], // 机床号
NumValue: '',
Num: [], // 分组
count: 0, // 计数器 (表二是否有外协工序) count: 0, // 计数器 (表二是否有外协工序)
InOut: 1, // 工序间是否外协变量 1自家 2外协 InOut: 1, // 工序间是否外协变量 1自家 2外协
num1: '', num1: '',
@@ -127,17 +157,73 @@ export default {
pageCurrent1: 1 pageCurrent1: 1
} }
}, },
created() {
this.fetchData()
},
methods: { methods: {
fetchData() {
this.entryNameValue = ''
this.entryName = []
machine().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.entryName.push({
label: response.data[i].项目名称,
value: response.data[i].项目流水号
})
}
})
},
typeChange() {
this.toolNumValue = ''
this.toolNum = []
this.NumValue = ''
this.Num = []
getToolNum(this.entryNameValue).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.toolNum.push({
label: response.data[i].机床图号,
value: response.data[i].机床流水号
})
}
})
},
typeChange1() {
this.NumValue = ''
this.Num = []
getNum(this.toolNumValue).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.Num.push({
label: response.data[i].组号,
value: response.data[i].组件流水号
})
}
})
},
searchTable() { searchTable() {
this.loading1 = true this.loading1 = true
this.tableData1 = [] this.tableData1 = []
this.tableData2 = [] this.tableData2 = []
if (this.partName !== null && this.partName !== '') { if (this.entryNameValue !== null && this.entryNameValue !== '') {
this.check_partName = true this.check_entryNameValue = 1
} else { } else {
this.check_partName = false this.check_entryNameValue = 0
} }
searchTable(this.check_partName, this.partName, this.pageCurrent1, this.pageSize1).then(response => { if (this.toolNumValue !== null && this.toolNumValue !== '') {
this.check_toolNumValue = 1
} else {
this.check_toolNumValue = 0
}
if (this.NumValue !== null && this.NumValue !== '') {
this.check_NumValue = 1
} else {
this.check_NumValue = 0
}
if (this.partName !== null && this.partName !== '') {
this.check_partName = 1
} else {
this.check_partName = 0
}
searchTable(this.check_entryNameValue, this.entryNameValue, this.check_toolNumValue, this.toolNumValue, this.check_NumValue, this.NumValue, this.check_partName, this.partName, this.pageCurrent1, this.pageSize1).then(response => {
this.tableData1 = response.data.rows this.tableData1 = response.data.rows
this.total1 = response.data.total this.total1 = response.data.total
}).then(() => { }).then(() => {

View File

@@ -39,7 +39,7 @@
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag v-if="parseInt(scope.row.询价状态编号)===1" type="warning" size="small">未询价</el-tag> <el-tag v-if="parseInt(scope.row.询价状态编号)===1" 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="success" size="small">已询价</el-tag>
<el-tag v-if="parseInt(scope.row.采购状态编号)===3" type="info" size="small">已采购</el-tag> <el-tag v-if="parseInt(scope.row.询价状态编号)!==1&&parseInt(scope.row.采购状态编号)===3" type="info" size="small">已采购</el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="项目名称" align="center" min-width="150"> <el-table-column label="项目名称" align="center" min-width="150">
@@ -628,7 +628,30 @@ export default {
}) })
}, },
exportInquirySheet(row) { // 导出询价单 exportInquirySheet(row) { // 导出询价单
alert('do not done') this.$confirm('确认导出询价单' + row.询价单编号 + '?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
import('@/vendor/Export2Excelcjn').then(excel => {
const tHeader = ['询价单编号', '供应商名称', '物料名称', '物料规格', '物料型号', '数量', '单价', '备注'] // 表头内容
const filterVal = ['询价单编号', '供应商名称', '物料名称', '物料规格', '物料型号', '零件数量'] // tableData3里的属性名
const list = this.tableData3
const data = list.map(v => filterVal.map(j => v[j]))
excel.export_json_to_excel({
header: tHeader,
data,
filename: row.询价单编号 + '_' + row.供应商名称,
autoWidth: true,
bookType: 'xlsx'
})
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消操作'
})
})
}, },
handleSelectionChange(val) { // 表1多选 handleSelectionChange(val) { // 表1多选
console.log(val) console.log(val)

View File

@@ -155,10 +155,9 @@
<table id="2" cellspacing="0px" align="center" border width="100%" style=""> <table id="2" cellspacing="0px" align="center" border width="100%" style="">
<tbody id="4"> <tbody id="4">
<tr id="tableHead" style="height: 40px"> <tr id="tableHead" style="height: 40px">
<td colspan="1" align="center">物料名称</td> <td colspan="2" align="center">物料名称</td>
<td colspan="1" align="center">物料规格</td> <td colspan="1" align="center">物料规格</td>
<td colspan="1" align="center">物料型号</td> <td colspan="1" align="center">物料型号</td>
<td colspan="1" align="center">发货天数</td>
<td colspan="1" align="center">数量</td> <td colspan="1" align="center">数量</td>
<td colspan="1" align="center">单价</td> <td colspan="1" align="center">单价</td>
<td colspan="1" align="center">总价</td> <td colspan="1" align="center">总价</td>
@@ -371,7 +370,7 @@ export default {
for (let i = 0; i < this.returns.length; i++) { for (let i = 0; i < this.returns.length; i++) {
tr[i] = document.createElement('tr') tr[i] = document.createElement('tr')
tr[i].setAttribute('class', 'tableData') tr[i].setAttribute('class', 'tableData')
tr[i].innerHTML = '<td colspan="1" align="center"></td>' + '<td colspan="1" align="center"></td>' + '<td colspan="1" align="center"></td>' + '<td colspan="1" align="center"></td>' + tr[i].innerHTML = '<td colspan="2" align="center"></td>' + '<td colspan="1" align="center"></td>' + '<td colspan="1" align="center"></td>' +
'<td colspan="1" align="center"></td>' + '<td colspan="1" align="center"></td>' + '<td colspan="1" align="center"></td>' '<td colspan="1" align="center"></td>' + '<td colspan="1" align="center"></td>' + '<td colspan="1" align="center"></td>'
document.getElementById('tableHead').after(tr[i]) document.getElementById('tableHead').after(tr[i])
} }
@@ -379,10 +378,9 @@ export default {
document.getElementsByClassName('tableData')[j].children[0].innerHTML = response.data[j].物料名称 document.getElementsByClassName('tableData')[j].children[0].innerHTML = response.data[j].物料名称
document.getElementsByClassName('tableData')[j].children[1].innerHTML = response.data[j].物料规格 document.getElementsByClassName('tableData')[j].children[1].innerHTML = response.data[j].物料规格
document.getElementsByClassName('tableData')[j].children[2].innerHTML = response.data[j].物料型号 document.getElementsByClassName('tableData')[j].children[2].innerHTML = response.data[j].物料型号
document.getElementsByClassName('tableData')[j].children[3].innerHTML = response.data[j].发货天 document.getElementsByClassName('tableData')[j].children[3].innerHTML = response.data[j].
document.getElementsByClassName('tableData')[j].children[4].innerHTML = response.data[j].数量 document.getElementsByClassName('tableData')[j].children[4].innerHTML = response.data[j].单价
document.getElementsByClassName('tableData')[j].children[5].innerHTML = response.data[j].单价 document.getElementsByClassName('tableData')[j].children[5].innerHTML = response.data[j].金额
document.getElementsByClassName('tableData')[j].children[6].innerHTML = response.data[j].金额
} }
}) })
} }

View File

@@ -196,6 +196,9 @@ export default {
} else { } else {
if (machineNum && groupNum) { if (machineNum && groupNum) {
await sleep(50) await sleep(50)
if (classificationCode) {
drawingNum += '-' + classificationCode
}
await this.insertToSQL(establishment, proofread, review, date, machineName, machineNum, componentName, componentNum, groupNum, contractNum, pageNum, totalNum, drawingNum, name, type, material, spareNum, useNum, manufacturer, remarks, classificationCode) await this.insertToSQL(establishment, proofread, review, date, machineName, machineNum, componentName, componentNum, groupNum, contractNum, pageNum, totalNum, drawingNum, name, type, material, spareNum, useNum, manufacturer, remarks, classificationCode)
} else { } else {
this.loading = false this.loading = false