Commit 55147a8f authored by 张海景's avatar 张海景

update:修改上机扫描和下机扫描

parent ac7aec34
...@@ -345,10 +345,13 @@ const install = (Vue, vm) => { ...@@ -345,10 +345,13 @@ const install = (Vue, vm) => {
params params
), ),
// 新增 // 新增
// http://192.168.3.91:8080/tm/tmToolMachines/scancode
tmToolMachines: (params = {}) => tmToolMachines: (params = {}) =>
vm.$u.postJson(config.adminPath + '/tm/tmToolMachines', params), vm.$u.postJson(config.adminPath + '/tm/tmToolMachines', params),
tmToolMachinesRecord: (params = {}) => tmToolMachinesRecord: (params = {}) =>
vm.$u.putJson(config.adminPath + '/tm/tmToolMachines', params), vm.$u.putJson(config.adminPath + '/tm/tmToolMachines', params),
tmToolMachinesScancode: (params = {}) =>
vm.$u.postJson(config.adminPath + '/tm/tmToolMachines/scancode', params),
}, },
}; };
......
<template> <template>
<view class="dmodel-table"> <view class="dmodel-table">
<u-button type="primary" size="mini" @click="commonClick('1')">上机</u-button> <u-button type="primary" size="mini" @click="commonClick('1')">上机</u-button>
<u-button style="margin-left: 20rpx;" type="success" size="mini" @click="commonClick('2')">下机</u-button> <u-button style="margin-left: 20rpx" type="success" size="mini" @click="commonClick('2')">下机</u-button>
<zb-table :columns="tableColumn" :data="tableData" :stripe="true" @toggleAllSelection="toggleAllSelection" <u-button style="margin-left: 20rpx" type="success" size="mini" @click="handleScancode('1')">上机扫描</u-button>
@toggleRowSelection="toggleRowSelection"> <u-button style="margin-left: 20rpx" type="success" size="mini" @click="handleScancode('2')">下机扫描</u-button>
</zb-table> <zb-table :columns="tableColumn" :data="tableData" :stripe="true" @toggleAllSelection="toggleAllSelection" @toggleRowSelection="toggleRowSelection"></zb-table>
</view> </view>
</template> </template>
<script> <script>
export default { export default {
props: { props: {
data: { data: {
type: Array, type: Array,
...@@ -19,96 +19,108 @@ ...@@ -19,96 +19,108 @@
data() { data() {
return { return {
tableSelectData: [], tableSelectData: [],
tableColumn: [{ tableColumn: [
{
type: 'selection', type: 'selection',
width: 35 width: 35
}, },
{ {
name: 'typeName', name: 'typeName',
label: '状态', label: '状态',
width: 80, width: 80
}, },
{ {
name: 'toolCode', name: 'toolCode',
label: '刀模版sn码', label: '刀模版sn码',
width: 140, width: 140
}, },
{ {
name: 'toolName', name: 'toolName',
label: '刀模版名称', label: '刀模版名称',
width: 140, width: 140
}, },
{ {
name: 'itemName', name: 'itemName',
label: '物料名称', label: '物料名称',
width: 140, width: 140
}, },
{ {
name: 'upDate', name: 'upDate',
label: '上机时间', label: '上机时间',
width: 140, width: 140
}, },
{ {
name: 'downDate', name: 'downDate',
label: '下机时间', label: '下机时间',
width: 140, width: 140
},
],
} }
]
};
}, },
computed: { computed: {
tableData() { tableData() {
return this.data || [] return this.data || [];
} }
}, },
methods: { methods: {
async commonClick(type) { async commonClick(type) {
if (this.tableSelectData.length == 0) { if (this.tableSelectData.length == 0) {
return this.$u.toast('请选择一条数据!') return this.$u.toast('请选择一条数据!');
} }
// 判断选中的类型是否一致 // 判断选中的类型是否一致
if (this.tableSelectData.length > 1) { if (this.tableSelectData.length > 1) {
let flag = false let flag = false;
for (let i = 1; i < this.tableSelectData.length; i++) { for (let i = 1; i < this.tableSelectData.length; i++) {
const pre = this.tableSelectData[i - 1] const pre = this.tableSelectData[i - 1];
const cur = this.tableSelectData[i] const cur = this.tableSelectData[i];
flag = cur.type == pre.type flag = cur.type == pre.type;
if (!flag) { if (!flag) {
break; break;
} }
} }
if (!flag) { if (!flag) {
return this.$u.toast('请选择状态相同的数据') return this.$u.toast('请选择状态相同的数据');
} }
} }
const params = this.tableSelectData.map((v) => {
const params = this.tableSelectData.map(v => {
return { return {
toolMachinesId: v.toolMachinesId, toolMachinesId: v.toolMachinesId,
type type
} };
}) });
const {code} = await this.$u.api.dModel.tmToolMachinesRecord(params) const { code } = await this.$u.api.dModel.tmToolMachinesRecord(params);
if (code == 200) { if (code == 200) {
this.$emit('action') this.$emit('action');
} }
},
handleScancode(type) {
uni.scanCode({
success: (res) => {
console.log(res, 'res7778888');
this.$u.api.dModel.tmToolMachinesScancode({ type, sn: res.result }).then((res) => {
// console.log(res, 'res333')
if (res.code === 200) {
this.$emit('action');
}
});
}
});
}, },
toggleAllSelection(checked, arr) { toggleAllSelection(checked, arr) {
this.tableSelectData = arr this.tableSelectData = arr;
}, },
toggleRowSelection(checked, arr) { toggleRowSelection(checked, arr) {
this.tableSelectData = arr this.tableSelectData = arr;
},
} }
} }
};
</script> </script>
<style scoped> <style scoped>
.dmodel-table { .dmodel-table {
height: 500rpx; height: 500rpx;
margin-top: 20rpx; margin-top: 20rpx;
padding: 0 20rpx; padding: 0 20rpx;
} }
</style> </style>
...@@ -171,7 +171,7 @@ ...@@ -171,7 +171,7 @@
show-cancel-button show-cancel-button
:title-style="{ 'background-color': '#1E3770', color: '#FFFFFF', 'line-height': '37px', 'padding-top': '0px' }" :title-style="{ 'background-color': '#1E3770', color: '#FFFFFF', 'line-height': '37px', 'padding-top': '0px' }"
v-model="knifeTempVisible" v-model="knifeTempVisible"
width="1300rpx" width="1600rpx"
> >
<u-form label-width="130px" :model="knifeTempSearch" :rules="rules"> <u-form label-width="130px" :model="knifeTempSearch" :rules="rules">
<u-row> <u-row>
...@@ -187,7 +187,7 @@ ...@@ -187,7 +187,7 @@
</u-col> </u-col>
</u-row> </u-row>
</u-form> </u-form>
<dModelList :data="dModelData" @action="upDownGetList" /> <dModelList :data="dModelData" @action="upDownGetList"/>
</u-modal> </u-modal>
<u-modal <u-modal
...@@ -701,7 +701,7 @@ export default { ...@@ -701,7 +701,7 @@ export default {
{ {
name: 'arrangeCode', name: 'arrangeCode',
label: '编排单号', label: '编排单号',
width: 200, width: 120,
cellFun: (row, index) => { cellFun: (row, index) => {
console.log(row, index) console.log(row, index)
this.tableDataDetail = row.proWorkorderList; this.tableDataDetail = row.proWorkorderList;
...@@ -750,7 +750,7 @@ export default { ...@@ -750,7 +750,7 @@ export default {
{ {
name: 'taskCode', name: 'taskCode',
label: '任务单号', label: '任务单号',
width: 180 width: 120
}, },
// { // {
// name: 'workorderCode', // name: 'workorderCode',
...@@ -1034,9 +1034,10 @@ export default { ...@@ -1034,9 +1034,10 @@ export default {
return; return;
} }
const params = { const params = {
arrangeCode: this.tableSelectData[0].arrangeCode || '', taskWorkunitId: this.tableSelectData[0].taskWorkunitId
processId: this.tableSelectData[0].processId, // arrangeCode: this.tableSelectData[0].arrangeCode || '',
workunitId: this.vuex_workunit.workunitId // processId: this.tableSelectData[0].processId,
// workunitId: this.vuex_workunit.workunitId
}; };
const records = await this.$u.api.dModel.getRecordsByProcessIdAndArrangeCode(params); const records = await this.$u.api.dModel.getRecordsByProcessIdAndArrangeCode(params);
// 如果有数据 // 如果有数据
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment