From 8dcaa3c57c702ff1162121190539e4bd00f00f17 Mon Sep 17 00:00:00 2001 From: zhangdingyu <974548713@qq.com> Date: Sat, 28 Sep 2019 14:53:40 +0800 Subject: [PATCH 01/11] =?UTF-8?q?=E7=89=A9=E6=96=99=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PurchasingCenter/MaterialManagement.js | 11 +++ .../MaterialManagement/index.vue | 87 ++++++++++++++----- .../CreatingProcurementContracts/index.vue | 3 +- src/views/login/index.vue | 2 +- 4 files changed, 79 insertions(+), 24 deletions(-) diff --git a/src/api/PurchasingCenter/MaterialManagement.js b/src/api/PurchasingCenter/MaterialManagement.js index 6919ba92..491b0464 100644 --- a/src/api/PurchasingCenter/MaterialManagement.js +++ b/src/api/PurchasingCenter/MaterialManagement.js @@ -1,5 +1,16 @@ import request from '@/utils/request' +export function getSupplier1(check, num) { + return request({ + url: '', + method: 'post', + data: { + type: '1', + name: '库存管理_供货商_查询数据_根据条件', + param: '供货商_check=' + check + '=int&供货商=' + num + } + }) +} export function AddGonghuoshang(num) { return request({ url: '', diff --git a/src/views/PurchasingCenter/MaterialManagement/index.vue b/src/views/PurchasingCenter/MaterialManagement/index.vue index 11e7ae36..0e754056 100644 --- a/src/views/PurchasingCenter/MaterialManagement/index.vue +++ b/src/views/PurchasingCenter/MaterialManagement/index.vue @@ -36,7 +36,7 @@ 物料名称: - + 物料全称: - + 物料规格: - + 物料型号: 供货商: - + size="small" + clearable> + + + + + + + + + - - + + clearable> + + + + + + + + + @@ -459,6 +485,7 @@ + + From 392d7f7d79892c024797e4565fe12e48dac1838e Mon Sep 17 00:00:00 2001 From: caoxinyu Date: Sun, 29 Sep 2019 17:36:11 +0800 Subject: [PATCH 07/11] xqs --- .../PurchasingCenter/CreateInquirySheet.js | 4 +- .../PurchasingCenter/PurchaseTaskAllocate.js | 4 +- src/utils/request.js | 2 +- .../CreateInquirySheet/index.vue | 15 +- .../OfflineContract/index.vue | 22 +- .../PurchaseTaskAllocate/index.vue | 74 ++- .../ProcurementInquiry/Export2Excel.js | 224 ++++++++ .../ProcurementInquiry/index.vue | 522 ++++++++++++++++++ 8 files changed, 831 insertions(+), 36 deletions(-) create mode 100644 src/views/TechnologyCenter/ProcurementInquiry/Export2Excel.js create mode 100644 src/views/TechnologyCenter/ProcurementInquiry/index.vue diff --git a/src/api/PurchasingCenter/CreateInquirySheet.js b/src/api/PurchasingCenter/CreateInquirySheet.js index f0f8d699..8505ae2b 100644 --- a/src/api/PurchasingCenter/CreateInquirySheet.js +++ b/src/api/PurchasingCenter/CreateInquirySheet.js @@ -156,9 +156,9 @@ export function createInquirySheet(num1, id, num2, remark) { url: '', method: 'post', data: { - type: '2', + type: '1', name: '采购管理_询价单_增加数据', - param: `询价单编号=${num1}&采购员=${id}&供应商流水号=${num2}&备注=${remark}&identity=1=output` + param: `询价单编号=${num1}&采购员=${id}&供应商流水号=${num2}&备注=${remark}` } }) } diff --git a/src/api/PurchasingCenter/PurchaseTaskAllocate.js b/src/api/PurchasingCenter/PurchaseTaskAllocate.js index 2b1e345a..f326320b 100644 --- a/src/api/PurchasingCenter/PurchaseTaskAllocate.js +++ b/src/api/PurchasingCenter/PurchaseTaskAllocate.js @@ -76,8 +76,8 @@ export function searchTable1(...params) { method: 'post', data: { type: '1', - name: '采购管理_采购部采购_查询物料_分配后', - 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]}`, + 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]}&时间段_check=${params[20]}&开始时间=${params[21]}&结束时间=${params[22]}`, Pagination: params[0] + '&' + params[1] } }) diff --git a/src/utils/request.js b/src/utils/request.js index 867f7256..0e0b6870 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -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 MESDownloadFile = `http://192.168.1.231:8411/submit/MESDownloadFile.ashx` 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 // 请求超时时间 }) export default service diff --git a/src/views/PurchasingCenter/CreateInquirySheet/index.vue b/src/views/PurchasingCenter/CreateInquirySheet/index.vue index 3646c6c6..34f4f5ca 100644 --- a/src/views/PurchasingCenter/CreateInquirySheet/index.vue +++ b/src/views/PurchasingCenter/CreateInquirySheet/index.vue @@ -603,7 +603,7 @@ - + @@ -709,10 +709,10 @@ - + - + @@ -742,7 +742,7 @@ - + 物料名称: @@ -790,7 +790,7 @@ - + 使用滞货数量:
注意:确定后将不可取消使用滞货
@@ -1538,8 +1538,7 @@ export default { this.$refs['form2'].validate((valid) => { if (valid) { createInquirySheet(this.form2.inquirySheetNum, this.id, this.form2.supplierNameValue, '').then(response => { - console.log(response.data) - if (response.data[0].result === '1') { + if (!(response.data)) { this.$message.success('创建成功') this.form2.supplierNameValue = '' this.inquirySheetNum = '' @@ -1547,7 +1546,7 @@ export default { this.supplierValue = '' this.dialogVisible2 = false this.searchTable2() - } else { this.$message.error('操作失败') } + } else { this.$message.error('操作失败!该询价单已存在,请重新输入') } }) } }) diff --git a/src/views/PurchasingCenter/OfflineContract/index.vue b/src/views/PurchasingCenter/OfflineContract/index.vue index e450c44b..3039db15 100644 --- a/src/views/PurchasingCenter/OfflineContract/index.vue +++ b/src/views/PurchasingCenter/OfflineContract/index.vue @@ -276,14 +276,17 @@ size="small" style="margin-left: 10px" @click="addOfflineContract">创建离线合同
- 选入物料 + + + 选入物料 + - + - + diff --git a/src/views/PurchasingCenter/PurchaseTaskAllocate/index.vue b/src/views/PurchasingCenter/PurchaseTaskAllocate/index.vue index b2432f95..86876b4a 100644 --- a/src/views/PurchasingCenter/PurchaseTaskAllocate/index.vue +++ b/src/views/PurchasingCenter/PurchaseTaskAllocate/index.vue @@ -41,6 +41,19 @@ {{ item.name }} + 时间段: + 物料状态:
- 分配 - 退回 + + 分配 + + + 退回 +
@@ -646,6 +663,34 @@ export default { name: '', // 采购任务分配 data() { 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: '', machines: [], source: [ @@ -861,13 +906,14 @@ export default { this.MaterialCategoryValue ? this.check1 = 1 : this.check1 = 0 this.MaterialVarietyValue ? this.check2 = 1 : this.check2 = 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.groupValue ? check1 = 1 : check1 = 0 this.materialName ? this.check4 = 1 : this.check4 = 0 this.materialSpec ? check2 = 1 : check2 = 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.total0 = response.data.total }) diff --git a/src/views/TechnologyCenter/ProcurementInquiry/Export2Excel.js b/src/views/TechnologyCenter/ProcurementInquiry/Export2Excel.js new file mode 100644 index 00000000..a4a80fd7 --- /dev/null +++ b/src/views/TechnologyCenter/ProcurementInquiry/Export2Excel.js @@ -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}`); +} diff --git a/src/views/TechnologyCenter/ProcurementInquiry/index.vue b/src/views/TechnologyCenter/ProcurementInquiry/index.vue new file mode 100644 index 00000000..ab080500 --- /dev/null +++ b/src/views/TechnologyCenter/ProcurementInquiry/index.vue @@ -0,0 +1,522 @@ + + + + + From 643e3379b59eb24d37d1709b8b260f902375f8f4 Mon Sep 17 00:00:00 2001 From: zhangdingyu <974548713@qq.com> Date: Mon, 30 Sep 2019 09:25:46 +0800 Subject: [PATCH 08/11] a --- src/icons/svg/ProcurementInquiry.svg | 1 + src/utils/request.js | 2 +- src/views/ManufacturingCenter/InventoryQuery/index.vue | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 src/icons/svg/ProcurementInquiry.svg diff --git a/src/icons/svg/ProcurementInquiry.svg b/src/icons/svg/ProcurementInquiry.svg new file mode 100644 index 00000000..60fcb677 --- /dev/null +++ b/src/icons/svg/ProcurementInquiry.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/utils/request.js b/src/utils/request.js index 400de537..92890169 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -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 MESDownloadFile = `http://192.168.1.231:8411/submit/MESDownloadFile.ashx` const service = axios.create({ - baseURL: `http://localhost:8005/submit/MESCommonBase.ashx`, + baseURL: `http://192.168.0.102:8005/submit/MESCommonBase.ashx`, timeout: 1500000 // 请求超时时间 }) export default service diff --git a/src/views/ManufacturingCenter/InventoryQuery/index.vue b/src/views/ManufacturingCenter/InventoryQuery/index.vue index c325af8e..4d24e170 100644 --- a/src/views/ManufacturingCenter/InventoryQuery/index.vue +++ b/src/views/ManufacturingCenter/InventoryQuery/index.vue @@ -12,7 +12,7 @@ 查询 - + + + +