Merge branch 'master' of ssh://192.168.1.149:29418/高精2.0

This commit is contained in:
liushuai
2018-11-27 14:39:13 +08:00
10 changed files with 249 additions and 130 deletions

View File

@@ -148,7 +148,7 @@ export function deleteFileData(num) {
data: {
type: '2',
name: 'PDM_装箱单_随机技术文件_删除数据',
param: `号=${num}`
param: `文件编号=${num}`
}
})
}
@@ -160,7 +160,7 @@ export function editFileData(name, number, remark, num) {
data: {
type: '2',
name: 'PDM_装箱单_随机技术文件_修改数据',
param: `名称=${name}&数量=${number}&备注=${remark}&号=${num}`
param: `名称=${name}&数量=${number}&备注=${remark}&文件编号=${num}`
}
})
}
@@ -196,24 +196,24 @@ export function deleteSpareData(num) {
data: {
type: '2',
name: 'PDM_装箱单_备件_删除数据',
param: `号=${num}`
param: `备件编号=${num}`
}
})
}
export function editSpareData(name, specification, number, unit, remark, num) {
export function editSpareData(name, specification, unit, number, remark, num) {
return request({
url: '',
method: 'post',
data: {
type: '2',
name: 'PDM_装箱单_备件_修改数据',
param: `名称=${name}&规格=${specification}&数量=${number}&单位=${unit}&备注=${remark}&号=${num}`
param: `名称=${name}&规格=${specification}&数量=${number}&单位=${unit}&备注=${remark}&备件编号=${num}`
}
})
}
export function addSpareData(name, specification, number, unit, remark, num) {
export function addSpareData(name, specification, unit, number, remark, num) {
return request({
url: '',
method: 'post',

View File

@@ -167,6 +167,7 @@ export default {
// 4) 回调函数,必须
Vue.prototype.addTable = function(requestData, param, form, callback) {
if (type(callback) === 'function' && type(requestData) === 'function' && type(form) === 'string') {
console.log(this.$refs[form])
this.$refs[form].validate((valid) => {
if (valid) {
requestData(...param).then(response => {

View File

@@ -15,7 +15,8 @@
<el-button slot="append" icon="el-icon-search" @click="fetchPeopleForName"/>
</el-input>
<el-button type="primary" icon="el-icon-circle-plus-outline" size="small" @click="addPeople()">新增</el-button>
<!--<el-button v-popover:popover4 type="success" icon="el-icon-sort" size="small" @click="moveGroup">移动</el-button>-->
<!--<el-button v-popover:popover4 type="success" icon="el-icon-sort" size="small" @click="moveGroup">移动-->
<!--</el-button>-->
<!--<el-button size="small" @click="postMaintain()">岗位维护</el-button>-->
<!--<el-popover-->
<!--ref="popover4"-->
@@ -29,7 +30,9 @@
<!--:disabled="true"-->
<!--size="small"-->
<!--placeholder="请选择部门"/>-->
<!--<el-button type="text" size="small" style="margin-left: 60px; margin-top: 15px" @click="moveGroupConfim">确认</el-button>-->
<!--<el-button type="text" size="small" style="margin-left: 60px; margin-top: 15px" @click="moveGroupConfim">-->
<!--确认-->
<!--</el-button>-->
<!--<el-dropdown-menu slot="dropdown">-->
<!--<el-tree-->
<!--ref="treeForm"-->
@@ -176,18 +179,18 @@
</el-row>
<!--新增和编辑部门-->
<!--<el-dialog :title="department_Title" :visible.sync="department_DFV" center style="min-height: 200px" width="400px">-->
<!--<el-form ref="form" :model="form" :rules="rules" label-position="left" label-width="110px" class="demo-ruleForm">-->
<!--<el-form-item label="部门名称" prop="DepartmentName">-->
<!--<el-input v-model="department_Form.DepartmentName" size="small" style="width:200px"/>-->
<!--</el-form-item>-->
<!--</el-form>-->
<!--<div slot="footer" class="dialog-footer">-->
<!--<el-button @click="cancel">取消</el-button>-->
<!--<el-button v-if="department_Title==='新增部门'" type="primary" @click="submitAdd">确定</el-button>-->
<!--<el-button v-else-if="department_Title==='编辑部门'" type="primary" @click="submitEdit">确定</el-button>-->
<!--</div>-->
<!--</el-dialog>-->
<el-dialog :title="department_Title" :visible.sync="department_DFV" center style="min-height: 200px" width="400px">
<el-form ref="department_Form" :model="department_Form" :rules="rules" label-position="left" label-width="110px" class="demo-ruleForm">
<el-form-item label="部门名称" prop="DepartmentName">
<el-input v-model="department_Form.DepartmentName" size="small" style="width:200px"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="cancel">取消</el-button>
<el-button v-if="department_Title==='新增部门'" type="primary" @click="submitAdd">确定</el-button>
<el-button v-else-if="department_Title==='编辑部门'" type="primary" @click="submitEdit">确定</el-button>
</div>
</el-dialog>
<el-dialog :title="people_title" :visible.sync="people_DFV" center style="min-height: 200px" width="800px">
<el-form ref="people_form" :rules="rules" :model="people_form" label-position="left" label-width="110px" class="demo-ruleForm">
@@ -467,6 +470,7 @@ export default {
deleteTable() {
if (this.id) {
this.deleteRow(delList, this.id, function() { this.getTreeData() })
this.i = 1
} else {
this.$message.warning(`请选择部门`)
}

View File

@@ -40,11 +40,11 @@
<el-input v-model="number" placeholder="零件号" clearable size="small" style="width: 200px;"/>
<el-button type="success" class="el-icon-search" size="small" style="margin: 10px 0 0 10px" @click="getTableData();pageCurrent=1;pageSize=10;total = 0">查询</el-button>
<span>进度颜色</span>
<!--<span style="background-color: white">全部</span>-->
<span style="background-color: red">拖期</span>
<span style="background-color: yellow">即将拖期</span>
<span style="background-color: lawngreen">如期</span>
<span style="background-color: deepskyblue">工序外协</span>
<span style="background-color: grey">报废</span>
</el-row>
</el-card>
@@ -396,7 +396,6 @@ export default {
this.Groups = []
if (this.project !== '') {
getMachines(this.project).then(response => {
console.log(response.data)
for (let i = 0; i < response.data.length; i++) {
this.Machines.push({
label: response.data[i].机床图号,

View File

@@ -173,7 +173,7 @@
v-loading="listLoading1"
:data="tableData1"
class="table"
border
borde
style="max-height: 500px"
height="500">
<el-table-column label="零件图号" align="center" width="240">
@@ -1224,6 +1224,7 @@ export default {
}
}).then(() => {
this.tableData1.push(this.result[i])
console.log(this.tableData1)
selection2(this.工艺计划流水号[this.indexAdjust]).then(response => { // 刷新对话框显示和颜色
for (let i = 0; i < response.data.length; i++) {
this.partType = response.data[i].零件类型

View File

@@ -475,6 +475,7 @@
<script>
import elInput from 'element-ui/packages/input'
import { searchProjectNumber2, SelectContractFunds, AccountsReceivable, editDay, TransPlanning, selectBatch, editList, delMoney, editTime, selectMax, editFukuan, fukuan, selectProvince, SelectMarketingManager, searchTable1, searchTable2, editBatchCapitalChar, deletechar, searchProjectNumber, searchProjectName, addList, PaymentPhase, dellist, selectMachine, selectBatchFundingDetails } from '@/api//MarketingCenter/ContractCapitalManagement'
export default {
components: {
elInput

View File

@@ -19,7 +19,7 @@
</el-card>
<el-card>
<el-row>
<el-col :span="16"><div class="grid-content bg-purple">
<el-col :span="17"><div class="grid-content bg-purple">
<el-table
v-loading="tableData2Loading"
id="tb"
@@ -27,7 +27,7 @@
:data="tableData5"
highlight-current-row
style="width: 100%"
height="235"
height="315"
@row-click="searchCargoBox"
>
<el-table-column align="center" label="发货单号" width="150">
@@ -65,6 +65,11 @@
{{ scope.row.运输状态 }}
</template>
</el-table-column>
<el-table-column align="center" label="签收人" width="80">
<template slot-scope="scope">
{{ scope.row.签收人 }}
</template>
</el-table-column>
<el-table-column align="center" label="追溯码" width="150">
<template slot-scope="scope">
<canvas :id="canvas[scope.$index]"/>
@@ -91,19 +96,22 @@
</el-table-column>
</el-table>
</div></el-col>
<el-col :span="8"><div class="grid-content bg-purple-light">
<div style="width: 550px;height:236px; border: 2px solid rgb(228, 231, 237);margin-left: 5px">
<!--<el-upload-->
<!--style="margin-left: 10px"-->
<!--action="https://jsonplaceholder.typicode.com/posts/"-->
<!--list-type="picture-card"-->
<!--:on-preview="handlePictureCardPreview"-->
<!--:on-remove="handleRemove">-->
<!--<i class="el-icon-plus"></i>-->
<!--</el-upload>-->
<!--<el-dialog :visible.sync="dialogVisible">-->
<!--<img width="100%" :src="dialogImageUrl" alt="">-->
<!--</el-dialog>-->
<el-col :span="7"><div class="grid-content bg-purple-light">
<div style="width: 473px;height:315px; border: 2px solid rgb(228, 231, 237);margin-left: 5px">
<el-upload
:on-preview="handlePictureCardPreview"
:on-remove="handleRemove"
:file-list="fileList"
:before-upload="beforeUpload"
:on-success="onSuccess"
:action="'http://192.168.1.122:8410/submit/upload2.ashx?InvoiceNum='+ invoiceNum"
list-type="picture-card">
<i class="el-icon-plus"/>
</el-upload>
<el-dialog :visible.sync="dialogVisible">
<img :src="dialogImageUrl" width="100%" alt="">
</el-dialog>
</div>
</div></el-col>
</el-row>
@@ -510,6 +518,8 @@
</template>
<script>
import request from '@/utils/request'
// import { sleep } from '@/utils/tool'
import elInput from 'element-ui/packages/input'
import { submitRremove, searchCargoBoxDetailed, submitMoveInto, delCargoBox, addCargoBox, searchCargoBox, editInvoice, delInvoice, addInvoice, editAdress, addAdress, deleteAdress, citySearch, provinceSearch, addressSearch, searchParts, searchHost, searchSparePart, searchProjectName, searchPackingList, searchFile, searchInvoice } from '@/api//MarketingCenter/DeliveryManagement'
import QRCode from 'qrcode'
@@ -522,6 +532,7 @@ export default {
canvas: [],
show: false,
num: '',
fileList: [],
a: 1, // 嵌套表格交换变量
b: 1, // 嵌套表格交换变量
flag1: '', // 发货单旗帜变量
@@ -584,6 +595,8 @@ export default {
dialogFormVisible3: false, // 填充货箱内货物对话框显示隐藏
dialogFormVisible4: false, // 移除货箱内货物对话框显示隐藏
QueryDetail: '',
dialogImageUrl: '',
dialogVisible: false,
Transport: [
{
value: 0,
@@ -885,6 +898,7 @@ export default {
},
searchCargoBox(row) {
this.invoiceNum = row.发货单编号
this.getFileList()
this.getSelect(searchCargoBox, ['货箱号', '货箱号编号'], 'cargoBox', this.invoiceNum)
},
addCargoBox() {
@@ -1054,7 +1068,7 @@ export default {
// 生成的二维码内容,可以添加变量
this.QueryDetail = this.cargoBoxValue.toString()
var canvas = document.getElementById('canvas')
QRCode.toCanvas(canvas, this.QueryDetail, function(error) {
QRCode.toCanvas(canvas, 'http://192.168.1.132:8080/#/searchBoxDetails/index?id=' + this.QueryDetail, function(error) {
if (error) console.error(error)
console.log('success!')
})
@@ -1064,11 +1078,67 @@ export default {
},
clear() {
this.show = false
},
async getFileList() {
const { data } = await request({
url: '',
method: 'post',
data: {
type: '3',
name: `select * from 发货管理_附件 where 是否启用 = 1 and 发货单编号 = ${this.invoiceNum}`
}
})
this.fileList = data.map(item => {
return {
_id: item.附件号,
name: item.文件标识,
url: 'http://192.168.1.122:8410/webpage/img/' + item.文件标识
}
})
},
async handleRemove(file, fileList) {
const { data } = await request({
url: '',
method: 'post',
data: {
type: '4',
name: `update 发货管理_附件 set 是否启用 = 0 where 附件号 = ${file._id}`
}
})
if (data[0].result === '0') {
this.$message.error('删除失败了。')
}
},
handlePictureCardPreview(file) {
this.dialogImageUrl = file.url
this.dialogVisible = true
},
beforeUpload(file) {
const isJPG = /^image\/.*/.test(file.type)
const isLt4M = file.size / 1024 / 1024 < 4
const isInvoiceNum = !!this.invoiceNum
if (!isInvoiceNum) {
this.$message.error('请先选择装箱单。。')
}
if (!isJPG) {
this.$message.error('只能上传图片。。')
}
if (!isLt4M) {
this.$message.error('上传头像图片大小不能超过 4MB!')
}
return isJPG && isLt4M && isInvoiceNum
},
onSuccess(res, file, fileList) {
fileList = []
if (res[0].result === '1') {
this.getFileList()
} else {
this.$message.error('上传失败')
}
}
// clear() {
// this.cargoBox = []
// this.cargoBoxValue = ''
// }
}
}
</script>

View File

@@ -260,7 +260,7 @@
<template slot-scope="scope">
<el-button
size="mini"
type="danger"
type="primary"
icon="el-icon-edit"
@click="editFile(scope.row)">编辑</el-button>
<el-button
@@ -274,7 +274,7 @@
</el-card>
<el-dialog :title="receiptTitle" :visible.sync="receiptVisible" center style="min-height: 200px" width="800px">
<el-form ref="receiptForm" :rules="rules" :model="receiptForm" label-position="left" label-width="110px" class="demo-ruleForm">
<el-form ref="receiptForm" :rules="receiptRules" :model="receiptForm" label-position="left" label-width="110px" class="demo-ruleForm">
<el-row>
<el-col :span="12">
<el-form-item label="装箱单号" prop="装箱单号">
@@ -321,10 +321,10 @@
</el-dialog>
<el-dialog :visible.sync="machineVisible" :title="machineTitle" center style="min-height: 200px" width="400px">
<el-form ref="machineForm" :rules="rules" :model="machineForm" label-position="left" label-width="110px" class="demo-ruleForm">
<el-form ref="machineForm" :rules="machineRules" :model="machineForm" label-position="left" label-width="110px" class="demo-ruleForm">
<el-row>
<el-col v-if="machineTitle==='添加主机'" :span="24">
<el-form-item label="机床号" prop="装箱单号">
<el-form-item label="机床号" prop="机床号">
<el-select v-model="machineValue" placeholder="请选择机床图号" filterable size="small">
<el-option
v-for="item in machine"
@@ -354,7 +354,7 @@
</el-dialog>
<el-dialog :visible.sync="fileVisible" :title="fileTitle" center style="min-height: 200px" width="400px">
<el-form ref="machineForm" :rules="rules" :model="fileForm" label-position="left" label-width="110px" class="demo-ruleForm">
<el-form ref="fileForm" :rules="filerules" :model="fileForm" label-position="left" label-width="110px" class="demo-ruleForm">
<el-row>
<el-col :span="24">
<el-form-item label="名称" prop="名称">
@@ -381,7 +381,7 @@
</el-dialog>
<el-dialog :visible.sync="spareVisible" :title="spareTitle" center style="min-height: 200px" width="400px">
<el-form ref="machineForm" :rules="rules" :model="spareForm" label-position="left" label-width="110px" class="demo-ruleForm">
<el-form ref="spareForm" :rules="spareRule" :model="spareForm" label-position="left" label-width="110px" class="demo-ruleForm">
<el-row>
<el-col :span="24">
<el-form-item label="名称" prop="名称">
@@ -439,13 +439,17 @@ export default {
spareVisible: false,
spareTitle: '',
spareForm: {
: '',
备件编: '',
名称: '',
规格: '',
单位: '',
备注: '',
数量: ''
},
spareRule: {
名称: [{ required: true, message: '请输入名称', trigger: 'blur' }],
数量: [{ required: true, message: '请输入数量', trigger: 'blur' }]
},
spareData: [],
receiptForm: {
装箱单号: '',
@@ -455,12 +459,21 @@ export default {
联系人: '',
联系方式: ''
},
receiptRules: {
装箱单号: [{ required: true, message: '请输入装箱单号', trigger: 'blur' }],
名称: [{ required: true, message: '请输入名称', trigger: 'blur' }],
发货节点: [{ required: true, message: '请输入发货节点', trigger: 'blur' }]
},
machineForm: {
序号: '',
机床号: '',
备注: '',
数量: ''
},
machineRules: {
机床号: [{ required: true, message: '请选择机床号', trigger: 'change' }],
数量: [{ required: true, message: '请输入数量', trigger: 'blur' }]
},
rules: {
},
machineTableData: [],
@@ -469,10 +482,14 @@ export default {
fileVisible: false,
fileTitle: '',
fileForm: {
: '',
文件编: '',
名称: '',
数量: '',
备注: ''
},
filerules: {
名称: [{ required: true, message: '请输入名称', trigger: 'blur' }],
数量: [{ required: true, message: '请输入数量', trigger: 'blur' }]
}
}
},
@@ -495,6 +512,10 @@ export default {
}
},
projectValue(val) {
this.machineTableData = []
this.receiptData = []
this.spareData = []
this.fileData = []
if (val) {
this.getMachineSelect(val)
}
@@ -570,8 +591,11 @@ export default {
cancel() {
this.receiptVisible = false
this.machineVisible = false
this.fileVisible = false
this.spareVisible = false
},
async getMachineData() {
this.machineTableData = []
const response = await getMachineData(this.receiptNum)
const data = response.data
for (let i = 0; i < data.length; i++) {
@@ -598,11 +622,15 @@ export default {
})
},
async submitAddMachine() {
const response = await addMachineData(this.projectName, this.machineValue, this.machineForm.备注, this.machineForm.数量, this.receiptNum)
if (response.data[0].result === '1') {
this.addTable(addMachineData, [this.projectName, this.machineValue, this.machineForm.备注, this.machineForm.数量, this.receiptNum], 'machineForm', function() {
this.machineVisible = false
this.getMachineData()
}
})
// const response = await addMachineData(this.projectName, this.machineValue, this.machineForm.备注, this.machineForm.数量, this.receiptNum)
// if (response.data[0].result === '1') {
// this.machineVisible = false
// this.getMachineData()
// }
},
editMachine(row) {
this.editForm(row, 'machineForm', function() {
@@ -611,11 +639,15 @@ export default {
})
},
async submitEditMachine() {
const response = await updateMachineData(this.machineForm.序号, this.machineForm.数量, this.machineForm.备注)
if (response.data[0].result === '1') {
this.editTable(updateMachineData, [this.machineForm.序号, this.machineForm.数量, this.machineForm.备注], 'machineForm', function() {
this.machineVisible = false
this.getMachineData()
}
})
// const response = await updateMachineData(this.machineForm.序号, this.machineForm.数量, this.machineForm.备注)
// if (response.data[0].result === '1') {
// this.machineVisible = false
// this.getMachineData()
// }
},
deleteMachine(row) {
this.deleteRow(deleteMachineData, row.序号, function() {
@@ -625,20 +657,18 @@ export default {
async getFileData() {
const response = await getFileData(this.receiptNum)
this.fileData = response.data
console.log(this.fileData)
},
addFile() {
this.addForm('machineForm', function() {
this.addForm('fileForm', function() {
this.fileTitle = `添加文件`
this.fileVisible = true
})
},
async submitAddFile() {
const response = await addFileData(this.fileForm.名称, this.fileForm.数量, this.fileForm.备注, this.receiptNum)
if (response.data[0].result === '1') {
this.addTable(addFileData, [this.fileForm.名称, this.fileForm.数量, this.fileForm.备注, this.receiptNum], 'fileForm', function() {
this.fileVisible = false
this.getFileData()
}
})
},
editFile(row) {
this.editForm(row, 'fileForm', function() {
@@ -647,14 +677,13 @@ export default {
})
},
async submitEditFile() {
const response = await editFileData(this.fileForm.名称, this.fileForm.数量, this.fileForm.备注, this.fileForm.序号)
if (response.data[0].result === '1') {
this.editTable(editFileData, [this.fileForm.名称, this.fileForm.数量, this.fileForm.备注, this.fileForm.文件编号], 'fileForm', function() {
this.fileVisible = false
this.getFileData()
}
})
},
deleteFile(row) {
this.deleteRow(deleteFileData, row., function() {
this.deleteRow(deleteFileData, row.文件编, function() {
this.getFileData()
})
},
@@ -669,11 +698,15 @@ export default {
})
},
async submitAddSpare() {
const response = await addSpareData(this.spareForm.名称, this.spareForm.规格, this.spareForm.单位, this.spareForm.数量, this.spareForm.备注, this.receiptNum)
if (response.data[0].result === '1') {
this.addTable(addSpareData, [this.spareForm.名称, this.spareForm.规格, this.spareForm.单位, this.spareForm.数量, this.spareForm.备注, this.receiptNum], 'spareForm', function() {
this.spareVisible = false
this.getSpareData()
}
})
// const response = await addSpareData(this.spareForm.名称, this.spareForm.规格, this.spareForm.单位, this.spareForm.数量, this.spareForm.备注, this.receiptNum)
// if (response.data[0].result === '1') {
// this.spareVisible = false
// this.getSpareData()
// }
},
editSpare(row) {
this.editForm(row, 'spareForm', function() {
@@ -682,14 +715,18 @@ export default {
})
},
async submitEditSpare() {
const response = await editSpareData(this.spareForm.名称, this.spareForm.规格, this.spareForm.单位, this.spareForm.数量, this.spareForm.备注, this.fileForm.序号)
if (response.data[0].result === '1') {
this.editTable(editSpareData, [this.spareForm.名称, this.spareForm.规格, this.spareForm.单位, this.spareForm.数量, this.spareForm.备注, this.spareForm.备件编号], 'spareForm', function() {
this.spareVisible = false
this.getSpareData()
}
})
// const response = await editSpareData(this.spareForm.名称, this.spareForm.规格, this.spareForm.单位, this.spareForm.数量, this.spareForm.备注, this.spareForm.备件编号)
// if (response.data[0].result === '1') {
// this.spareVisible = false
// this.getSpareData()
// }
},
deleteSpare(row) {
this.deleteRow(deleteSpareData, row., function() {
this.deleteRow(deleteSpareData, row.备件编, function() {
this.getSpareData()
})
}

View File

@@ -22,25 +22,24 @@
<el-upload :on-remove="handleRemove" :file-list="itemFile" action=""/>
</div>
<div v-if="worksheet.length !== 0" style="float: right;margin: 20px 0">
<el-button icon="el-icon-upload2" type="primary" size="small" @click="basicPartsToSQL">导入到数据库</el-button>
<el-button :disabled="disabled" icon="el-icon-upload2" type="primary" size="small" @click="basicPartsToSQL">导入到数据库</el-button>
</div>
</div>
</el-card>
<specification-data ref="specificationData" :groups-names="groupsNames" :machine-names="machineNames" :project-name="projectName" @machineChange="machineChange"/>
<el-upload
class="upload-demo"
drag
action="http://localhost:8410/submit/uploadImg.ashx?InvoiceNum=1"
multiple>
<i class="el-icon-upload"/>
<div class="el-upload__text">将文件拖到此处<em>点击上传</em></div>
<div slot="tip" class="el-upload__tip">只能上传jpg/png文件且不超过500kb</div>
</el-upload>
<!--<el-upload-->
<!--class="upload-demo"-->
<!--drag-->
<!--action="http://localhost:8410/submit/uploadImg.ashx?InvoiceNum=1"-->
<!--multiple>-->
<!--<i class="el-icon-upload"/>-->
<!--<div class="el-upload__text">将文件拖到此处<em>点击上传</em></div>-->
<!--<div slot="tip" class="el-upload__tip">只能上传jpg/png文件且不超过500kb</div>-->
<!--</el-upload>-->
</div>
</template>
<script>
/* eslint-disable */
import UploadExcelComponent from './UploadExcel/index.vue'
import specificationData from './specificationData'
import { sleep } from '../../../utils/tool'
@@ -58,7 +57,8 @@ export default {
loading: false,
groupsNames: [],
machineNames: [],
err: 0
err: 0,
disabled: false
}
},
computed: {
@@ -88,6 +88,10 @@ export default {
this.fetchData()
},
methods: {
async test() {
await sleep(10000)
console.log(1)
},
fetchData() {
this.getSelect(initProject, ['项目名称', '项目流水号'], 'project')
},
@@ -112,7 +116,7 @@ export default {
})
}
},
selected(data) { // 选择需要导入的文件
async selected(data) { // 选择需要导入的文件
this.worksheet = data.worksheet // 获取每个多选文件的表格坐标及值
this.itemFile = data.itemFile
},
@@ -131,6 +135,7 @@ export default {
async basicPartsToSQL() {
try {
this.loading = true
this.dispatch = true
this.err = 0
for (let j = this.worksheet.length - 1; j >= 0; j--) {
let establishment,
@@ -154,48 +159,51 @@ export default {
manufacturer,
remarks,
classificationCode
const response = await isExit(this.projectValue, this.worksheet[j].F2.v)
const res = response.data
if (res[0].Column1 === 0) {
this.$notify.error(`${this.worksheet[j].F2.v}机床不存在,请确认文件是否正确`)
this.loading = false
return
const response = await isExit(this.projectValue, this.worksheet[j].F2.v)
const res = response.data
if (res[0].Column1 === 0) {
this.$notify.error(`${this.worksheet[j].F2.v}机床不存在,请确认文件是否正确`)
this.loading = false
this.disabled = false
return
} else {
this.worksheet[j].G1 ? establishment = this.worksheet[j].G1.v : establishment = ''
this.worksheet[j].I1 ? proofread = this.worksheet[j].I1.v : proofread = ''
this.worksheet[j].L1 ? review = this.worksheet[j].L1.v : review = ''
this.worksheet[j].P1 ? date = this.worksheet[j].P1.v : date = ''
this.worksheet[j].Q1 ? pageNum = parseInt(this.worksheet[j].Q1.v.replace(/[^0-9]/ig, '')) : pageNum = ''
this.worksheet[j].C2 ? machineName = this.worksheet[j].C2.v : machineName = ''
this.worksheet[j].F2 ? machineNum = this.worksheet[j].F2.v : machineNum = ''
this.worksheet[j].J2 ? componentName = this.worksheet[j].J2.v : componentName = ''
this.worksheet[j].P2 ? componentNum = this.worksheet[j].P2.v : componentNum = ''
this.worksheet[j].Q2 ? totalNum = parseInt(this.worksheet[j].Q2.v.replace(/[^0-9]/ig, '')) : totalNum = ''
this.worksheet[j].R2 ? contractNum = this.worksheet[j].R2.v : contractNum = ''
this.worksheet[j].M2 ? groupNum = this.worksheet[j].M2.v : groupNum = ''
const len = parseInt(this.worksheet[j]['!ref'].split(':')[1].substring(1)) - 3
for (let i = 0; i < len; i++) {
const attr = i + 4
drawingNum = this.worksheet[j][`B${attr}`] ? this.worksheet[j][`B${attr}`].v : ''
name = this.worksheet[j][`D${attr}`] ? this.worksheet[j][`D${attr}`].v : ''
type = this.worksheet[j][`F${attr}`] ? this.worksheet[j][`F${attr}`].v : ''
material = this.worksheet[j][`J${attr}`] ? this.worksheet[j][`J${attr}`].v : ''
spareNum = this.worksheet[j][`L${attr}`] ? this.worksheet[j][`L${attr}`].v : ''
useNum = this.worksheet[j][`M${attr}`] ? this.worksheet[j][`M${attr}`].v : ''
manufacturer = this.worksheet[j][`O${attr}`] ? this.worksheet[j][`O${attr}`].v : ''
remarks = this.worksheet[j][`Q${attr}`] ? this.worksheet[j][`Q${attr}`].v : ''
classificationCode = this.worksheet[j][`R${attr}`] ? this.worksheet[j][`R${attr}`].v : ''
if (!drawingNum && !name && !type && !material && !spareNum && !useNum && !manufacturer && !remarks && !classificationCode) { // 当图号、名称、规格、材料、备件数量、装机数量、制造商、备注、分类码都为空时,循环终止,防止向数据库中插入多余且无用的数据
break
} else {
this.worksheet[j].G1 ? establishment = this.worksheet[j].G1.v : establishment = ''
this.worksheet[j].I1 ? proofread = this.worksheet[j].I1.v : proofread = ''
this.worksheet[j].L1 ? review = this.worksheet[j].L1.v : review = ''
this.worksheet[j].P1 ? date = this.worksheet[j].P1.v : date = ''
this.worksheet[j].Q1 ? pageNum = parseInt(this.worksheet[j].Q1.v.replace(/[^0-9]/ig, '')) : pageNum = ''
this.worksheet[j].C2 ? machineName = this.worksheet[j].C2.v : machineName = ''
this.worksheet[j].F2 ? machineNum = this.worksheet[j].F2.v : machineNum = ''
this.worksheet[j].J2 ? componentName = this.worksheet[j].J2.v : componentName = ''
this.worksheet[j].P2 ? componentNum = this.worksheet[j].P2.v : componentNum = ''
this.worksheet[j].Q2 ? totalNum = parseInt(this.worksheet[j].Q2.v.replace(/[^0-9]/ig, '')) : totalNum = ''
this.worksheet[j].R2 ? contractNum = this.worksheet[j].R2.v : contractNum = ''
this.worksheet[j].M2 ? groupNum = this.worksheet[j].M2.v : groupNum = ''
const len = parseInt(this.worksheet[j]['!ref'].split(':')[1].substring(1)) - 3
for (let i = 0; i < len; i++) {
const attr = i + 4
drawingNum = this.worksheet[j][`B${attr}`] ? this.worksheet[j][`B${attr}`].v : ''
name = this.worksheet[j][`D${attr}`] ? this.worksheet[j][`D${attr}`].v : ''
type = this.worksheet[j][`F${attr}`] ? this.worksheet[j][`F${attr}`].v : ''
material = this.worksheet[j][`J${attr}`] ? this.worksheet[j][`J${attr}`].v : ''
spareNum = this.worksheet[j][`L${attr}`] ? this.worksheet[j][`L${attr}`].v : ''
useNum = this.worksheet[j][`M${attr}`] ? this.worksheet[j][`M${attr}`].v : ''
manufacturer = this.worksheet[j][`O${attr}`] ? this.worksheet[j][`O${attr}`].v : ''
remarks = this.worksheet[j][`Q${attr}`] ? this.worksheet[j][`Q${attr}`].v : ''
classificationCode = this.worksheet[j][`R${attr}`] ? this.worksheet[j][`R${attr}`].v : ''
if (!drawingNum && !name && !type && !material && !spareNum && !useNum && !manufacturer && !remarks && !classificationCode) { // 当图号、名称、规格、材料、备件数量、装机数量、制造商、备注、分类码都为空时,循环终止,防止向数据库中插入多余且无用的数据
break
if (machineNum && groupNum) {
await sleep(50)
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 {
if (machineNum && groupNum) {
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 {
this.loading = false
this.$notify.error(`请确认导入文件是否正确`)
return
}
this.loading = false
this.disabled = false
this.$notify.error(`请确认导入文件是否正确`)
return
}
}
}
}
this.itemFile.splice(j, 1)
@@ -213,14 +221,12 @@ export default {
async insertToSQL(establishment, proofread, review, date, machineName, machineNum, componentName, componentNum, groupNum, contractNum, pageNum, totalNum, drawingNum, name, type, material, spareNum, useNum, manufacturer, remarks, classificationCode) {
try {
if (groupNum.indexOf('MX') > -1) {
await sleep(10)
const response = await importBasics(establishment, proofread, review, date, this.projectName, machineNum, machineName, componentName, componentNum, groupNum, contractNum, totalNum, pageNum, drawingNum, name, type, material, spareNum, useNum, manufacturer, remarks, classificationCode)
const res = response.data
if (res[0].result === '0') {
this.$notify.error(`${drawingNum}导入失败`)
}
} else {
await sleep(10)
const response = await importPurcharse(establishment, proofread, review, date, this.projectName, machineNum, machineName, componentName, componentNum, groupNum, contractNum, totalNum, pageNum, drawingNum, name, type, material, spareNum, useNum, manufacturer, remarks, classificationCode)
const res = response.data
if (res[0].result === '0') {

View File

@@ -133,7 +133,7 @@
</el-table-column>
<el-table-column align="center" label="零件类型">
<template slot-scope="scope">
{{ scope.row.标准件类型 }}
{{ scope.row.件类型 }}
</template>
</el-table-column>
<el-table-column align="center" label="供货商">
@@ -273,14 +273,14 @@ export default {
})
} else {
const type = this.groupName.indexOf('WG') > -1 ? 2 : 1
console.log(type)
this.loadingWB = true
purchasePartsData(this.groupValue, type, this.pageCurrentWB, this.pageSizeWB).then(response => {
this.loadingWB = false
const data = response.data
this.totalWB = data.total
this.tableDataWB = data.rows.map(item => {
item.标准件类型 = item.标准件类型 === '1' ? '外购件' : '标准件'
console.log(item)
item.零件类型 = item.零件类型 === '2' ? '外购件' : '标准件'
return item
})
})