first commit
This commit is contained in:
@@ -0,0 +1,723 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-card>
|
||||
<!-- <span style="margin-left: 15px">班次类型:</span>-->
|
||||
<el-select v-model="dataTypeValue" placeholder="工位号" clearable size="small" style="width:100px">
|
||||
<el-option
|
||||
v-for="item in dataType"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"/>
|
||||
</el-select>
|
||||
<el-button type="primary" icon="el-icon-search" size="small" style="margin-left: 15px" plain @click="searchTable()">查询</el-button>
|
||||
<el-button type="distribution" icon="el-icon-circle-plus-outline" size="small" @click="addShiftTable('form')">新增</el-button>
|
||||
<el-button type="info" plain size="small" icon="el-icon-upload2" @click="importOrder('form')">导入</el-button>
|
||||
<el-table
|
||||
:data="tableData"
|
||||
border
|
||||
stripe
|
||||
size="mini"
|
||||
height="800"
|
||||
center
|
||||
style="width: 100%">
|
||||
<el-table-column label="工位代码" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.工位代码 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="工位号" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.工位号 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="指南工位号" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.指南工位号 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column disabled label="机床类型" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.机床类型 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="线体类型" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.线体类型 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="二维码扫描枪" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.二维码扫描枪 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="固定条形码扫描枪" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.固定条形码扫描枪 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="手持条形码扫描枪" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.手持条形码扫描枪 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="PC" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.PC }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="工控机名称" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.工控机名称 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="工控机IP" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.工控机IP }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="通讯端口" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.通讯端口 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="文件名称" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.文件名称 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="PLC" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.PLC }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="PLC代码" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.PLC代码 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="PLC加工状态" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.PLC加工状态 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="PLC代码加工状态" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.PLC代码加工状态 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="发动机型号代码合成" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.发动机型号代码合成 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="日计划产量" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.日计划产量 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="准备时间" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.准备时间 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="机器时间" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.机器时间 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="人工时间" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.人工时间 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="技术难度系数" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.技术难度系数 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="是否线首" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.是否线首 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="分线物料追踪工位" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.分线物料追踪工位 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="总线上线工位" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.总线上线工位 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="总线被监测工位" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.总线被监测工位 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="扫描枪类型" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.扫描枪类型 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="工位类型" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.工位类型 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="分线物料追踪工位数据文件连接" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.分线物料追踪工位数据文件连接 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="总线上线工位数据文件连接" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.总线上线工位数据文件连接 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="OpcServer" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.OpcServer }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="OpcServer_MIS" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.OpcServer_MIS }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="OpcServer_OPNAME" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.OpcServer_OPNAME }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="目标循环时间" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.目标循环时间 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="工件类型" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.工件类型 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="工位基本操作指导" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.工位基本操作指导 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="工位基本指导图片" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.工位基本指导图片 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="工位上下线类型" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.工位上下线类型 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="大屏幕代码" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.大屏幕代码 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="大屏幕显示产量端口" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.大屏幕显示产量端口 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="大屏幕显示Andon大屏幕代码" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.大屏幕显示Andon大屏幕代码 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="大屏幕显示Andon端口" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.大屏幕显示Andon端口 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="是否有打印机" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.是否有打印机 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="打印机通讯端口" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.打印机通讯端口 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="工序号" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.工序号 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="工序名称" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.工序名称 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="是否有工位计算机" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.是否有工位计算机 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="是否有测量数据" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.是否有测量数据 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="是否启用MES" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.是否启用MES }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="在线状态" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.在线状态 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="是否通过监控系统保存数据" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.是否通过监控系统保存数据 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="是否监控" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.是否监控 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="返修工位号" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.返修工位号 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="工步属性" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.工步属性 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="MesServerCode" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.MesServerCode }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="MesDll" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.MesDll }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="MesWebCode" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.MesWebCode }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="订单选择权限" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.订单选择权限 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="服务器IP" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.服务器IP }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="Bar版本号" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.Bar版本号 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="监控属性代码" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.监控属性代码 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" fixed="right" width="150" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
@click="editShiftTable(scope.row)">编辑</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
<el-dialog :visible.sync="dialogFormVisible" :title="title" center style="min-height: 200px;" width="400px">
|
||||
<el-form ref="form" :model="form" :rules="rules" label-position="right" label-width="110px">
|
||||
<el-form-item label="电气元器件" prop="dataTypeValue" style="display: inline-block">
|
||||
<el-select v-model="form.dataTypeValue" placeholder="电气元器件" clearable size="small" style="width:200px" @change="changeName(form.dataTypeValue)">
|
||||
<el-option
|
||||
v-for="item in dataType"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="编号" prop="value" style="display: inline-block">
|
||||
<el-input v-model="form.value" clearable size="small" placeholder="序号"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="描述" prop="descript" style="display: inline-block">
|
||||
<el-input
|
||||
v-model="form.descript"
|
||||
clearable
|
||||
size="small"
|
||||
placeholder="描述"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否禁用" prop="active" style="display: inline-block">
|
||||
<el-select v-model="form.active" placeholder="是否禁用" clearable size="small" style="width:200px">
|
||||
<el-option
|
||||
v-for="item in active"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="comments" style="display: inline-block">
|
||||
<el-input
|
||||
v-model="form.comments"
|
||||
clearable
|
||||
size="small"
|
||||
placeholder="备注"/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button size="small" @click="callOff('form')">取消</el-button>
|
||||
<el-button v-if="title === '增加'" type="primary" size="small" @click="submitAdd('form')">确定</el-button>
|
||||
<el-button v-if="title === '编辑'" type="primary" size="small" @click="submitAdd1('form')">确定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<el-dialog :visible.sync="dialogFormVisible3" title="导入" center style="min-height: 200px" width="900px">
|
||||
<div class="app-container">
|
||||
<upload-excel-component style="margin-left: 15%" @on-selected-file="selected"/>
|
||||
<div style="margin-left: 395px">
|
||||
<span v-show="worksheet.length > 1" style="cursor: pointer;width: 50px;" @click="removeAll"><i class="el-icon-close"/></span>
|
||||
<el-upload :on-remove="handleRemove" :file-list="itemFile" style="width: 220px" action=""/>
|
||||
</div>
|
||||
<div v-if="worksheet.length !== 0" style="margin: 3px 0 0 395px">
|
||||
<el-button icon="el-icon-upload2" type="primary" size="small" @click="basicPartsToSQL">导入到数据库</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { sleep } from '../../../utils/tool'
|
||||
import UploadExcelComponent from './UploadExcel.vue'
|
||||
import request from '@/utils/request'
|
||||
export default {
|
||||
name: 'UploadExcel',
|
||||
components: { UploadExcelComponent },
|
||||
data() {
|
||||
return {
|
||||
loading: true,
|
||||
worksheet: [],
|
||||
itemFile: [],
|
||||
unSpecification: [],
|
||||
dataTypeValue: '',
|
||||
dataType: [],
|
||||
tableData: [],
|
||||
activeValue: '',
|
||||
active: [{
|
||||
label: '启用',
|
||||
value: 1
|
||||
}, {
|
||||
label: '禁用',
|
||||
value: 0
|
||||
}],
|
||||
dialogFormVisible: false,
|
||||
dialogFormVisible3: false,
|
||||
form: {
|
||||
name: '',
|
||||
value: '',
|
||||
descript: '',
|
||||
comments: '',
|
||||
ID: '',
|
||||
active: '',
|
||||
dataTypeValue: ''
|
||||
},
|
||||
rules: { // 表单验证规则
|
||||
dataTypeValue: [{ required: true, message: '请选择', trigger: 'change' }],
|
||||
name: [{ required: true, message: '请输入', trigger: 'blur' }]
|
||||
},
|
||||
title: '',
|
||||
pageCurrent: 1,
|
||||
pageSize: 20,
|
||||
total: 0
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getNumber()
|
||||
this.searchTable()
|
||||
},
|
||||
methods: {
|
||||
getNumber() {
|
||||
this.dataType = []
|
||||
request({
|
||||
url: '',
|
||||
method: 'post',
|
||||
data: {
|
||||
type: '3',
|
||||
name: `SELECT [工位号] FROM [dbo].[MES_计划BOM_工位与名称]`
|
||||
}
|
||||
}).then(response => {
|
||||
if (response.data.length) {
|
||||
for (let i = 0; i < response.data.length; i++) {
|
||||
this.dataType.push({
|
||||
label: response.data[i].工位号,
|
||||
value: response.data[i].工位号
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
changeName(val) {
|
||||
for (let i = 0; i < this.dataType.length; i++) {
|
||||
if (this.dataType[i].value === val) {
|
||||
console.log(this.dataType[i].label, 'this.stationNumber[i].label')
|
||||
this.form.name = this.dataType[i].label
|
||||
}
|
||||
}
|
||||
},
|
||||
searchTable() {
|
||||
this.tableData = []
|
||||
let dataTypeValue_check
|
||||
this.dataTypeValue ? dataTypeValue_check = 1 : dataTypeValue_check = 0
|
||||
var param = []
|
||||
param[0] = ['type_ischeck', dataTypeValue_check]
|
||||
param[1] = ['type', this.dataTypeValue]
|
||||
var Data = this.CreateData('11', '基础数据_工位信息维护_查询', param)
|
||||
this.ExecDatabase(Data).then(response => {
|
||||
console.log(response, 66)
|
||||
if (response.data.length !== 0) {
|
||||
this.tableData = response.data
|
||||
}
|
||||
this.loading = false
|
||||
console.log(this.tableData, 'this.tableData')
|
||||
})
|
||||
},
|
||||
addShiftTable(formName) {
|
||||
if (this.$refs[formName] !== undefined) {
|
||||
this.$refs[formName].resetFields()
|
||||
}
|
||||
this.title = '增加'
|
||||
this.form.name = ''
|
||||
this.form.value = ''
|
||||
this.form.descript = ''
|
||||
this.form.comments = ''
|
||||
this.form.dataTypeValue = ''
|
||||
this.form.active = ''
|
||||
this.dialogFormVisible = true
|
||||
},
|
||||
submitAdd(formName) {
|
||||
this.$refs[formName].validate((valid) => {
|
||||
if (valid) {
|
||||
var param = []
|
||||
param[0] = ['active', this.form.active]
|
||||
param[1] = ['type', this.form.dataTypeValue]
|
||||
param[2] = ['num', this.form.value]
|
||||
param[3] = ['descript', this.form.descript]
|
||||
param[4] = ['comments', this.form.comments]
|
||||
var Data = this.CreateData('12', 'Recipe_Machine_Add', param)
|
||||
this.ExecDatabase(Data).then(response => {
|
||||
console.log(response)
|
||||
if (response.data[0].result === '1') {
|
||||
this.$message({
|
||||
message: '增加成功',
|
||||
type: 'success'
|
||||
})
|
||||
this.dialogFormVisible = false
|
||||
this.searchTable()
|
||||
} else {
|
||||
this.$message.error('增加失败!')
|
||||
}
|
||||
})
|
||||
this.dialogFormVisible = false
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
},
|
||||
editShiftTable(row) {
|
||||
if (this.$refs['form'] !== undefined) {
|
||||
this.$refs['form'].resetFields()
|
||||
}
|
||||
if (row.Active === '启用') {
|
||||
this.form.active = 1
|
||||
} else if (row.Active === '禁用') {
|
||||
this.form.active = 0
|
||||
} else {
|
||||
this.form.active = ''
|
||||
}
|
||||
this.form.value = row.MachineNum
|
||||
this.form.descript = row.Described
|
||||
this.form.comments = row.Comments
|
||||
this.form.ID = row.id
|
||||
this.form.dataTypeValue = row.MachineNo
|
||||
this.title = '编辑'
|
||||
this.dialogFormVisible = true
|
||||
},
|
||||
submitAdd1() {
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (valid) {
|
||||
var param = []
|
||||
param[0] = ['name', this.form.name]
|
||||
param[1] = ['type', this.form.dataTypeValue]
|
||||
param[2] = ['num', this.form.value]
|
||||
param[3] = ['descript', this.form.descript]
|
||||
param[4] = ['comments', this.form.comments]
|
||||
param[5] = ['id', this.form.ID]
|
||||
param[6] = ['active', this.form.active]
|
||||
var Data = this.CreateData('12', 'Recipe_Machine_Update_NEW', param)
|
||||
this.ExecDatabase(Data).then(response => {
|
||||
if (response.data[0].result === '1') {
|
||||
this.$message({
|
||||
message: '修改成功',
|
||||
type: 'success'
|
||||
})
|
||||
this.searchTable()
|
||||
} else {
|
||||
this.$message.error('修改失败!')
|
||||
}
|
||||
})
|
||||
this.dialogFormVisible = false
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
},
|
||||
handleDelete(row) {
|
||||
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
request({
|
||||
url: '',
|
||||
method: 'post',
|
||||
data: {
|
||||
type: '4',
|
||||
name: `delete from Recipe_Machine where id = ${row.id}`
|
||||
}
|
||||
}).then(response => {
|
||||
if (response.data[0].result === '1') {
|
||||
this.$message.success('删除成功')
|
||||
this.searchTable()
|
||||
} else {
|
||||
this.$message.error('删除失败')
|
||||
}
|
||||
})
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '取消删除'
|
||||
})
|
||||
})
|
||||
},
|
||||
callOff() {
|
||||
this.dialogFormVisible = false
|
||||
},
|
||||
importOrder() {
|
||||
this.dialogFormVisible3 = true
|
||||
},
|
||||
removeAll() {
|
||||
this.worksheet = []
|
||||
this.itemFile = []
|
||||
},
|
||||
async selected(data) { // 选择需要导入的文件
|
||||
console.log(data, 1111)
|
||||
this.worksheet = data.worksheet // 获取每个多选文件的表格坐标及值
|
||||
this.itemFile = data.itemFile
|
||||
},
|
||||
handleRemove(file) { // 移除文件
|
||||
for (let i = 0; i < this.itemFile.length; i++) {
|
||||
if (this.itemFile[i].name === file.name) {
|
||||
this.worksheet.splice(i, 1)
|
||||
this.itemFile.splice(i, 1)
|
||||
}
|
||||
}
|
||||
},
|
||||
async basicPartsToSQL() {
|
||||
try {
|
||||
this.loading = true
|
||||
this.err = 0
|
||||
for (let j = this.worksheet.length - 1; j >= 0; j--) {
|
||||
let name,
|
||||
value,
|
||||
descript,
|
||||
comments
|
||||
for (let i = 0; i < 999; i++) {
|
||||
const attr = i + 2
|
||||
name = this.worksheet[j][`A${attr}`] ? this.worksheet[j][`A${attr}`].v : ''
|
||||
value = this.worksheet[j][`B${attr}`] ? this.worksheet[j][`B${attr}`].v : ''
|
||||
descript = this.worksheet[j][`C${attr}`] ? this.worksheet[j][`C${attr}`].v : ''
|
||||
comments = this.worksheet[j][`D${attr}`] ? this.worksheet[j][`D${attr}`].v : ''
|
||||
console.log(name, value, descript, comments)
|
||||
if (!name) {
|
||||
break
|
||||
} else {
|
||||
if (name) {
|
||||
await sleep(50)
|
||||
await this.insertToSQL(name, value, descript, comments)
|
||||
} else {
|
||||
this.loading = false
|
||||
this.$notify.error(`请确认导入文件是否正确`)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
this.itemFile.splice(j, 1)
|
||||
this.worksheet.splice(j, 1)
|
||||
this.err === 0 ? this.$message.success(`导入完成`) : this.$message.error(`导入失败个数为${this.err},请检查文件是否正确`)
|
||||
}
|
||||
this.loading = false
|
||||
this.searchTable()
|
||||
} catch (e) {
|
||||
this.err++
|
||||
this.loading = false
|
||||
this.$notify.error(`导入数据错误,请检查导入文件是否正确`)
|
||||
console.log(`导入数据错误${e}`)
|
||||
}
|
||||
},
|
||||
async insertToSQL(name, value, descript, comments) {
|
||||
try {
|
||||
var param = []
|
||||
param[0] = ['name', name]
|
||||
param[1] = ['num', value]
|
||||
param[2] = ['descript', descript]
|
||||
param[3] = ['comments', comments]
|
||||
var Data = this.CreateData('12', 'Recipe_Machine_Excel', param)
|
||||
const response = await this.ExecDatabase(Data)
|
||||
if (response.data[0].result === '1') {
|
||||
this.$notify.success(`${name}导入成功`)
|
||||
} else {
|
||||
this.$notify.error(`${name}导入失败`)
|
||||
}
|
||||
} catch (e) {
|
||||
this.err++
|
||||
this.$message.error(`导入数据错误`)
|
||||
console.log(`导入数据错误${e}`)
|
||||
}
|
||||
},
|
||||
handleSizeChange(val) {
|
||||
this.pageSize = val
|
||||
this.pageCurrent = 1
|
||||
this.searchTable()
|
||||
},
|
||||
handleCurrentChange(val) {
|
||||
this.pageCurrent = val
|
||||
this.searchTable()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user