This commit is contained in:
2021-12-10 17:07:29 +08:00
parent 9f3c13f893
commit f445045cc4
29 changed files with 539 additions and 868 deletions

View File

@@ -155,7 +155,7 @@ export default {
getDataList () {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('currTask/mainCurrentTaskNow'),
url: this.$http.adornUrl('/currTask/mainCurrentTaskNow'),
method: 'post',
data: this.$http.adornData({
current: this.pageIndex,

View File

@@ -30,8 +30,8 @@
data () {
return {
dataForm: {
mobile: '',
password: ''
mobile: '13588441519',
password: '123abc.'
},
dataRule: {
mobile: [
@@ -52,7 +52,7 @@
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$http({
url: this.$http.adornUrl('passport/login'),
url: this.$http.adornUrl('/passport/login'),
method: 'post',
data: this.$http.adornData({
'mobile': this.dataForm.mobile,

View File

@@ -1,20 +1,32 @@
<template>
<el-dialog
:title="!dataForm.id ? '新增' : '修改'"
:title="!row ? '新增' : '修改'"
:close-on-click-modal="false"
:visible.sync="visible">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
<el-form-item label="标识卡" prop="paramKey">
<el-input v-model="dataForm.paramKey" placeholder="标识卡"></el-input>
<el-form :model="dataForm" v-loading="formLoading" :rules="dataRule" ref="dataForm" label-width="80px">
<el-form-item label="标识卡" prop="idenCardNum">
<el-input v-model="dataForm.idenCardNum" @change="setIdenCardNum" ref="idenCardNum" placeholder="标识卡"></el-input>
</el-form-item>
<el-form-item label="产品名称" prop="paramValue">
<el-input v-model="dataForm.paramValue" placeholder="产品名称"></el-input>
<el-form-item label="客户名称" prop="customerName">
<el-input v-model="dataForm.customerName" disabled placeholder="客户名称"></el-input>
</el-form-item>
<el-form-item label="数量" prop="number">
<el-input v-model="dataForm.remark" placeholder="数量"></el-input>
<el-form-item label="材料牌号" prop="materialDes">
<el-input v-model="dataForm.materialDes" disabled placeholder="材料牌号"></el-input>
</el-form-item>
<el-form-item label="重量" prop="remark">
<el-input v-model="dataForm.remark" placeholder="重量"></el-input>
<el-form-item label="订单号" prop="orderNo">
<el-input v-model="dataForm.orderNo" disabled placeholder="订单号"></el-input>
</el-form-item>
<el-form-item label="产品名称" prop="productName">
<el-input v-model="dataForm.productName" disabled placeholder="产品名称"></el-input>
</el-form-item>
<el-form-item label="数量" prop="quantity">
<el-input v-model="dataForm.quantity" placeholder="数量"></el-input>
</el-form-item>
<el-form-item label="单位" prop="unit">
<el-input v-model="dataForm.unit" disabled placeholder="单位"></el-input>
</el-form-item>
<el-form-item label="重量" prop="weight">
<el-input v-model="dataForm.weight" placeholder="重量"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
@@ -30,68 +42,93 @@
return {
visible: false,
dataForm: {
id: 0,
paramKey: '',
paramValue: '',
remark: ''
idenCardNum: null,
customerName: null,
materialDes: null,
orderNo: null,
productName: null,
quantity: null,
unit: null,
weight: null
},
dataRule: {
paramKey: [
{ required: true, message: '参数名不能为空', trigger: 'blur' }
idenCardNum: [
{ required: true, message: '标识卡号不能为空', trigger: 'blur' }
],
paramValue: [
{ required: true, message: '参数值不能为空', trigger: 'blur' }
quantity: [
{ required: true, message: '数量不能为空', trigger: 'blur' }
],
weight: [
{ required: true, message: '重量不能为空', trigger: 'blur' }
]
}
},
formLoading: false,
row: null,
editIndex: null
}
},
methods: {
init (id) {
this.dataForm.id = id || 0
init (row, idx) {
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
this.$http({
url: this.$http.adornUrl(`/sys/config/info/${this.dataForm.id}`),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
if (data && data.code === 0) {
this.dataForm.paramKey = data.config.paramKey
this.dataForm.paramValue = data.config.paramValue
this.dataForm.remark = data.config.remark
}
})
if (row) {
this.row = row
this.dataForm = row
this.editIndex = idx
}
this.$refs['idenCardNum'].focus()
})
},
setIdenCardNum () {
this.formLoading = true
if (this.dataForm.idenCardNum) {
this.$http({
url: this.$http.adornUrl(`/orderInfo/getTaskInfoByIdenCardNum`),
method: 'get',
params: this.$http.adornParams({
'idenCardNum': this.dataForm.idenCardNum
})
}).then(({data}) => {
console.log(data)
if (data && data.code === 0) {
this.dataForm = data.data
this.dataForm.targetQuantity = data.data.quantity
this.dataForm.targetWeight = data.data.weight
this.dataForm.weight = null
this.dataForm.quantity = null
} else {
this.$message.warning(data.msg)
}
this.formLoading = false
})
} else {
this.$message.warning('请输入标识卡号')
}
},
// 表单提交
dataFormSubmit () {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$http({
url: this.$http.adornUrl(`/sys/config/${!this.dataForm.id ? 'save' : 'update'}`),
method: 'post',
data: this.$http.adornData({
'id': this.dataForm.id || undefined,
'paramKey': this.dataForm.paramKey,
'paramValue': this.dataForm.paramValue,
'remark': this.dataForm.remark
})
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
} else {
this.$message.error(data.msg)
if (this.editIndex) {
const taskList = JSON.parse(sessionStorage.getItem('taskList'))
taskList.splice(this.editIndex, 1, this.dataForm)
sessionStorage.setItem('taskList', JSON.stringify(taskList))
} else if (sessionStorage.getItem('taskList')) {
const taskList = JSON.parse(sessionStorage.getItem('taskList'))
taskList.push(this.dataForm)
sessionStorage.setItem('taskList', JSON.stringify(taskList))
} else {
const arr = [this.dataForm]
sessionStorage.setItem('taskList', JSON.stringify(arr))
}
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
}

View File

@@ -1,19 +1,24 @@
<template>
<div class="mod-config">
<div style="color:#67c23a;background:#f0f9eb;padding:5px;margin-bottom:5px;text-align:center">录入托盘标识卡信息</div>
<el-form :inline="true">
<el-form-item>
<el-button type="primary" @click="addOrUpdateHandle()">新增</el-button>
</el-form-item>
<el-form-item style="margin-left:8%">
<el-form-item label="加工类型">
<el-select v-model="processType" clearable>
<el-option :value="0" label="初始加工" />
<el-option :value="1" label="复加工" />
</el-select>
</el-form-item>
<el-form-item style="margin-left:2%">
任务起点位置 :
<el-button style="margin-left:10px" type="primary" @click="getPoint(0)">{{startBtnName}}</el-button>
<el-button style="margin-left:10px" type="primary" @click="getPoint(0)">{{startPosition}}</el-button>
</el-form-item>
<el-form-item style="margin-left:2%">
窑炉 :
<el-button style="margin-left:10px" type="primary" @click="getPoint(1)">{{kilnBtnName}}</el-button>
<el-button style="margin-left:10px" type="primary" @click="getPoint(1)">{{kilnId}}</el-button>
</el-form-item>
<el-form-item style="margin-left:10%">
<el-form-item style="margin-left:2%">
<el-button type="primary" @click="submitTask()">提交任务</el-button>
</el-form-item>
</el-form>
@@ -30,43 +35,46 @@
width="50">
</el-table-column>
<el-table-column
prop="id"
prop="idenCardNum"
header-align="center"
align="center"
label="标识卡">
</el-table-column>
<el-table-column
prop="paramKey"
prop="customerName"
header-align="center"
align="center"
label="客户信息">
label="客户名称">
</el-table-column>
<el-table-column
prop="paramValue"
prop="orderNo"
header-align="center"
align="center"
label="订单号">
</el-table-column>
<el-table-column
prop="remark"
prop="productName"
header-align="center"
align="center"
label="产品名称">
</el-table-column>
<el-table-column
prop="card"
prop="materialDes"
header-align="center"
align="center"
label="材料号牌">
</el-table-column>
<el-table-column
prop="num"
prop="finishQuantity"
header-align="center"
align="center"
label="已完成数">
<template slot-scope="scope">
{{ `${scope.row.finishQuantity}/${scope.row.targetQuantity}` }}
</template>
</el-table-column>
<el-table-column
prop="number"
prop="quantity"
header-align="center"
align="center"
label="数量">
@@ -89,20 +97,11 @@
align="center"
label="操作">
<template slot-scope="scope">
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">修改</el-button>
<el-button type="text" size="small" @click="deleteHandle(scope.row.id)">删除</el-button>
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row, scope.$index)">修改</el-button>
<el-button type="text" size="small" @click="deleteHandle(scope.$index)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
<process-point v-if="processPointVisible" ref="processPoint" @refreshPoint="setPoint"></process-point>
@@ -115,12 +114,11 @@
export default {
data () {
return {
startBtnName: '选择起点',
kilnBtnName: '选择窑炉',
startPosition: '选择起点',
kilnId: '选择窑炉',
targetPosition: '',
dataList: [],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
processType: null,
dataListLoading: false,
addOrUpdateVisible: false,
processPointVisible: false
@@ -136,41 +134,18 @@
methods: {
// 获取数据列表
getDataList () {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/sys/config/list'),
method: 'get',
params: this.$http.adornParams({
'page': this.pageIndex,
'limit': this.pageSize
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
} else {
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
})
},
// 每页数
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
// 当前页
currentChangeHandle (val) {
this.pageIndex = val
this.getDataList()
this.dataList = sessionStorage.getItem('taskList') ? JSON.parse(sessionStorage.getItem('taskList')) : []
// if (data && data.code === 0) {
// this.dataList = data.data.records
// } else {
// this.dataList = []
// }
},
// 新增 / 修改
addOrUpdateHandle (id) {
addOrUpdateHandle (row, idx) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
this.$refs.addOrUpdate.init(row, idx)
})
},
// 获取点位
@@ -182,9 +157,10 @@
},
setPoint (count, pointType) {
if (!pointType) {
this.startBtnName = count
this.startPosition = count
} else {
this.kilnBtnName = count
this.kilnId = count
this.targetPosition = count
}
},
submitTask () {
@@ -193,43 +169,61 @@
message: '任务为空,请新增一条托盘信息',
type: 'warning'
})
} else if (this.startBtnName === '选择起点') {
} else if (this.startPosition === '选择起点') {
this.$message({
message: '请选择任务起点',
type: 'warning'
})
} else if (this.kilnBtnName === '选择窑炉') {
} else if (this.kilnId === '选择窑炉') {
this.$message({
message: '请选择窑炉',
type: 'warning'
})
} else if (!this.processType) {
this.$message.warning('请选择加工类型')
} else {
this.$confirm(`确定提交任务?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl(`currTask/createProcessTask`),
method: 'post',
data: this.$http.adornData({
craftCode: '',
detParams: this.dataList,
kilnId: this.kilnId,
processType: this.processType,
startPosition: this.startPosition,
targetPosition: this.targetPosition
})
}).then(({data}) => {
console.log(data)
if (data && data.code === 0) {
this.$message.success('任务提交成功')
this.dataList = []
sessionStorage.setItem('taskList', '')
this.startPosition = '选择起点'
this.kilnId = '选择窑炉'
this.targetPosition = null
} else {
this.$message.warning(data.msg)
}
})
}).catch(() => {})
}
},
// 删除
deleteHandle (id) {
this.$confirm(`确定对[id=${id}]进行删除]操作?`, '提示', {
deleteHandle (idx) {
console.log(idx)
this.$confirm(`确定对第${idx + 1}项进行删除操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/sys/config/delete'),
method: 'post',
data: this.$http.adornData(id, false)
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList()
}
})
} else {
this.$message.error(data.msg)
}
})
this.dataList.splice(idx, 1)
sessionStorage.setItem('taskList', JSON.stringify(this.dataList))
}).catch(() => {})
}
}