init project

This commit is contained in:
tao
2025-11-17 10:01:33 +08:00
commit 77c123408d
1018 changed files with 136951 additions and 0 deletions

137
pages/basic/cutterBind.vue Normal file
View File

@@ -0,0 +1,137 @@
<template>
<view>
<uni-forms ref="form" :modelValue="formData" :rules="rules">
<uni-row>
<uni-forms-item label="刀柄编码" :labelWidth='90' name="shankCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" v-model="formData.shankCode" type="text" />
</uni-forms-item>
<uni-forms-item label="刀刃编码" :labelWidth='90' name="bladeCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBarbladeCode" v-model="formData.bladeCode"
type="text" />
</uni-forms-item>
<uni-forms-item label="安装员" :labelWidth='90' name="installCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBarinstallBy" @change="selectinstallBy"
v-model="installCode" type="text" />
</uni-forms-item>
</uni-row>
</uni-forms>
<u-button type="primary" @click="submit">提交</u-button>
</view>
</template>
<script>
import {
listUseRecord,
getUseRecord,
delUseRecord,
addStartUse,
updateEndUse,
listEntity,
listMaterial,
listEquipment,
getEntity,
bindRecord
} from "@/api/basic/cutter.js";
import {
listEmployee
} from "@/api/mes/jobIn.js";
export default {
data() {
return {
formData: {
shankCode: null,
bladeCode: null,
installBy: null,
},
installCode: null,
rules: {
bladeCode: {
rules: [{
required: true,
errorMessage: '请输入刀刃编码!'
}]
},
shankCode: {
rules: [{
required: true,
errorMessage: '请输入刀柄编码!'
}]
},
installCode: {
rules: [{
required: true,
errorMessage: '请输入安装员!'
}]
},
}
}
},
mounted() {},
methods: {
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['qrCode', 'barCode'],
success: function(res) {
_this.formData.shankCode = res.result;
}
});
},
scanBarbladeCode() {
const _this = this;
uni.scanCode({
scanType: ['qrCode', 'barCode'],
success: function(res) {
_this.formData.bladeCode = res.result;
}
});
},
selectinstallBy(code) {
listEmployee({
empCode: code
}).then(async res => {
if (res.rows.length > 0) {
this.formData.installBy = res.rows[0].name;
} else {
this.$modal.msg("未查询到该人员,请重新输入!")
}
})
},
scanBarinstallBy() {
const _this = this;
uni.scanCode({
scanType: ['qrCode', 'barCode'],
success: function(res) {
_this.formData.installCode = res.result;
_this.selectinstallBy(res.result);
}
});
},
submit() {
this.$refs.form.validate().then(async res => {
if (this.formData.bladeCode && this.formData.shankCode) {
//判断安装员是否填入
setTimeout(() => {
if (this.formData.installBy) {
this.$modal.loading('提交中')
bindRecord(this.formData).then(res => {
this.$modal.closeLoading();
this.$modal.msgSuccess("刀具安装成功!")
setTimeout(() => {
this.$tab.switchTab("/pages/work/index");
}, 500);
})
} else {
this.$modal.msg("请输入安装员!")
}
}, 500);
}
})
}
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,227 @@
<template>
<view>
<uni-forms ref="form" :modelValue="formData" :rules="rules">
<uni-row>
<uni-forms-item label="刀刃编码" :labelWidth='90' name="cutterBladeCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" v-model="formData.cutterBladeCode"
type="text" />
</uni-forms-item>
<uni-forms-item label="设备编码" :labelWidth='90' name="equipmentCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBarequipmentCode" v-model="formData.equipmentCode"
type="text" />
</uni-forms-item>
<uni-forms-item label="拆卸员" :labelWidth='90' name="removeCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBarremoveBy" @change="selectremoveBy"
v-model="removeCode" type="text" />
</uni-forms-item>
<uni-forms-item label="操作员" :labelWidth='90' name="operatorCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBaroperator" @change="selectoperator"
v-model="operatorCode" type="text" />
</uni-forms-item>
</uni-row>
</uni-forms>
<u-button type="primary" @click="submit">提交</u-button>
</view>
</template>
<script>
import {
listUseRecord,
getUseRecord,
delUseRecord,
addStartUse,
updateEndUse,
listEntity,
listMaterial,
listEquipment,
getEntity,
removeBlade
} from "@/api/basic/cutter.js";
import {
listEmployee
} from "@/api/mes/jobIn.js";
export default {
data() {
return {
code: null,
formData: {
cutterBladeCode: null,
equipmentCode: null,
removeBy: null,
operator: null
},
removeCode: null,
operatorCode: null,
value: 0,
range: [],
entityOptions: [],
materialOptions: [],
rules: {
equipmentCode: {
rules: [{
required: true,
errorMessage: '请输入设备编码!'
},
{
pattern: '^[A-Z0-9]+$',
errorMessage: '请输入正确格式的设备编码!',
trigger: 'blur',
},
]
},
cutterBladeCode: {
rules: [{
required: true,
errorMessage: '请输入刀柄编码!'
}]
},
}
}
},
mounted() {},
methods: {
//扫描物料编码带出绑定的刀具信息
scanBarCode() {
if (this.formData.materialCode) {
console.log(this.formData.materialCode)
this.range = [];
//判断是否扫描二维码
if (typeof(this.formData.materialCode) === 'string') {
this.formData.materialName = this.materialOptions.find(item => item.materialCode == this.formData
.materialCode).materialName;
if (this.formData.materialCode != "") {
listEntity({
cutterMaterialCode: this.formData.materialCode,
cutterMaterialName: this.formData.materialName,
}).then((resp) => {
this.range = resp.rows;
for (var i = 0; i < resp.rows.length; i++) {
this.range[i].value = resp.rows[i].id;
this.range[i].text = resp.rows[i].entityCode + ':' + (!resp.rows[i].pieceNo ?
'' : resp.rows[i].pieceNo) + ':' + (!resp.rows[i].batchNo ? '' : resp
.rows[i].batchNo)
}
this.entityOptions = resp.rows;
});
} else {
this.entityOptions = [];
}
} else if (typeof(this.formData.materialCode) === 'object') {
if (this.formData.materialCode.id) {
this.formData.cutterEntityId = this.formData.materialCode.id;
getEntity(this.formData.materialCode.id).then(async res => {
this.range.push(res.data);
this.entityOptions = this.range;
this.formData.cutterEntityCode = this.range[0].entityCode;
this.range[0].value = this.range[0].id;
this.range[0].text = this.range[0].entityCode + ':' + (!this.range[0].pieceNo ?
'' : this.range[0].pieceNo) + ':' + (!this.range[0].batchNo ? '' : this
.range[0].batchNo)
})
}
this.formData.materialName = this.formData.materialCode.cutterMaterialName;
this.formData.materialCode = this.formData.materialCode.cutterMaterialCode;
}
}
},
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['qrCode', 'barCode'],
success: function(res) {
_this.formData.cutterBladeCode = res.result;
}
});
},
//根据设备编码获取设备id
getEquipmentId() {
if (this.formData.equipmentCode) {
listEquipment({
equipmentCode: this.formData.equipmentCode
}).then((resp) => {
if (resp.rows.length > 0) {
this.formData.equipmentId = resp.rows[0].id;
}
});
}
},
scanBarequipmentCode() {
const _this = this;
uni.scanCode({
scanType: ['qrCode', 'barCode'],
success: function(res) {
_this.formData.equipmentCode = res.result;
}
});
},
selectoperator(code) {
listEmployee({
empCode: code
}).then(async res => {
if (res.rows.length > 0) {
this.formData.operator = res.rows[0].name;
} else {
this.$modal.msg("未查询到该人员,请重新输入!")
}
})
},
selectremoveBy(code) {
listEmployee({
empCode: code
}).then(async res => {
if (res.rows.length > 0) {
this.formData.removeBy = res.rows[0].name;
} else {
this.$modal.msg("未查询到该人员,请重新输入!")
}
})
},
scanBarremoveBy() {
const _this = this;
uni.scanCode({
scanType: ['qrCode', 'barCode'],
success: function(res) {
_this.formData.removeCode = res.result;
_this.selectremoveBy(res.result);
}
});
},
scanBaroperator() {
const _this = this;
uni.scanCode({
scanType: ['qrCode', 'barCode'],
success: function(res) {
_this.formData.operatorCode = res.result;
_this.selectoperator(res.result);
}
});
},
submit() {
this.$refs.form.validate().then(async res => {
if (this.formData.equipmentCode && this.formData.cutterBladeCode) {
//判断安装员是否填入
setTimeout(() => {
if (this.formData.removeBy) {
this.$modal.loading('提交中')
removeBlade(this.formData).then(res => {
this.$modal.closeLoading();
this.$modal.msgSuccess("刀刃下机成功!")
setTimeout(() => {
this.$tab.switchTab("/pages/work/index");
}, 500);
})
} else {
this.$modal.msg("请输入拆卸员!")
}
}, 500);
}
})
}
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,234 @@
<template>
<view>
<uni-forms ref="form" :model="formData" :rules="rules">
<uni-row>
<uni-forms-item label="刀刃编码" :labelWidth='90' name="cutterBladeCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" v-model="formData.cutterBladeCode"
type="text" />
</uni-forms-item>
<uni-forms-item label="设备编码" :labelWidth='90' name="equipmentCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBarequipmentCode" v-model="formData.equipmentCode"
type="text" />
</uni-forms-item>
<uni-forms-item label="安装员" :labelWidth='90' name="installCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBarinstallBy" @change="selectinstallBy"
v-model="installCode" type="text" />
</uni-forms-item>
<uni-forms-item label="操作员" :labelWidth='90' name="operatorCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBaroperator" @change="selectoperator"
v-model="operatorCode" type="text" />
</uni-forms-item>
</uni-row>
</uni-forms>
<u-button type="primary" @click="submit">提交</u-button>
</view>
</template>
<script>
import {
listUseRecord,
getUseRecord,
delUseRecord,
addStartUse,
updateEndUse,
listEntity,
listMaterial,
listEquipment,
getEntity,
installBlade
} from "@/api/basic/cutter.js";
import {
listEmployee
} from "@/api/mes/jobIn.js";
export default {
data() {
return {
code: null,
formData: {
cutterBladeCode: null,
equipmentCode: null,
installBy: null,
operator: null
},
installCode: null,
operatorCode: null,
value: 0,
range: [],
entityOptions: [],
materialOptions: [],
rules: {
equipmentCode: {
rules: [{
required: true,
errorMessage: '请输入设备编码!',
trigger: 'blur'
},
{
pattern: '^[A-Z0-9]+$',
errorMessage: '请输入正确格式的设备编码!',
trigger: 'blur',
},
]
},
cutterBladeCode: {
rules: [{
required: true,
errorMessage: '请输入刀刃编码!'
}]
},
}
}
},
mounted() {},
methods: {
//扫描物料编码带出绑定的刀具信息
scanBarCode() {
if (this.formData.materialCode) {
console.log(this.formData.materialCode)
this.range = [];
//判断是否扫描二维码
if (typeof(this.formData.materialCode) === 'string') {
// this.formData.materialCode = this.code;
this.formData.materialName = this.materialOptions.find(item => item.materialCode == this.formData
.materialCode).materialName;
if (this.formData.materialCode != "") {
listEntity({
cutterMaterialCode: this.formData.materialCode,
cutterMaterialName: this.formData.materialName,
}).then((resp) => {
this.range = resp.rows;
for (var i = 0; i < resp.rows.length; i++) {
this.range[i].value = resp.rows[i].id;
this.range[i].text = resp.rows[i].entityCode + ':' + (!resp.rows[i].pieceNo ?
'' : resp.rows[i].pieceNo) + ':' + (!resp.rows[i].batchNo ? '' : resp
.rows[i].batchNo)
}
this.entityOptions = resp.rows;
});
} else {
this.entityOptions = [];
}
} else if (typeof(this.formData.materialCode) === 'object') {
if (this.formData.materialCode.id) {
this.formData.cutterEntityId = this.formData.materialCode.id;
getEntity(this.formData.materialCode.id).then(async res => {
this.range.push(res.data);
this.entityOptions = this.range;
this.formData.cutterEntityCode = this.range[0].entityCode;
this.range[0].value = this.range[0].id;
this.range[0].text = this.range[0].entityCode + ':' + (!this.range[0].pieceNo ?
'' : this.range[0].pieceNo) + ':' + (!this.range[0].batchNo ? '' : this
.range[0].batchNo)
})
}
this.formData.materialName = this.formData.materialCode.cutterMaterialName;
this.formData.materialCode = this.formData.materialCode.cutterMaterialCode;
}
}
},
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['qrCode', 'barCode'],
success: function(res) {
_this.formData.cutterBladeCode = res.result;
}
});
},
//根据设备编码获取设备id
getEquipmentId() {
if (this.formData.equipmentCode) {
listEquipment({
equipmentCode: this.formData.equipmentCode
}).then((resp) => {
if (resp.rows.length > 0) {
this.formData.equipmentId = resp.rows[0].id;
}
});
}
},
scanBarequipmentCode() {
const _this = this;
uni.scanCode({
scanType: ['qrCode', 'barCode'],
success: function(res) {
_this.formData.equipmentCode = res.result;
}
});
},
selectoperator(code) {
listEmployee({
empCode: code
}).then(async res => {
if (res.rows.length > 0) {
this.formData.operator = res.rows[0].name;
} else {
this.$modal.msg("未查询到该人员,请重新输入!")
}
})
},
selectinstallBy(code) {
listEmployee({
empCode: code
}).then(async res => {
if (res.rows.length > 0) {
this.formData.installBy = res.rows[0].name;
} else {
this.$modal.msg("未查询到该人员,请重新输入!")
}
})
},
scanBarinstallBy() {
const _this = this;
uni.scanCode({
scanType: ['qrCode', 'barCode'],
success: function(res) {
_this.formData.installCode = res.result;
_this.selectinstallBy(res.result);
}
});
},
scanBaroperator() {
const _this = this;
uni.scanCode({
scanType: ['qrCode', 'barCode'],
success: function(res) {
_this.formData.operatorCode = res.result;
_this.selectoperator(res.result);
}
});
},
submit() {
this.$refs.form.validate().then(async res => {
if (this.formData.equipmentCode && this.formData.cutterBladeCode) {
console.log(this.formData);
//判断安装员是否填入
setTimeout(() => {
if (this.formData.installBy) {
this.$modal.loading('提交中')
installBlade(this.formData).then(res => {
this.$modal.closeLoading();
this.$modal.msgSuccess("刀刃上机成功!")
setTimeout(() => {
this.$tab.switchTab("/pages/work/index");
}, 500);
})
} else {
this.$modal.msg("请输入安装员!")
}
}, 500);
}
})
}
}
}
</script>
<style>
</style>

234
pages/basic/cutterEnd.vue Normal file
View File

@@ -0,0 +1,234 @@
<template>
<view>
<uni-forms ref="form" :modelValue="formData" :rules="rules">
<uni-row>
<uni-forms-item label="刀柄编码" :labelWidth='90' name="cutterShankCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" v-model="formData.cutterShankCode"
type="text" />
</uni-forms-item>
<uni-forms-item label="设备编码" :labelWidth='90' name="equipmentCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBarequipmentCode" v-model="formData.equipmentCode"
type="text" />
</uni-forms-item>
<uni-forms-item label="拆卸员" :labelWidth='90' name="removeCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBarremoveBy" @change="selectremoveBy"
v-model="removeCode" type="text" />
</uni-forms-item>
<uni-forms-item label="操作员" :labelWidth='90' name="operatorCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBaroperator" @change="selectoperator"
v-model="operatorCode" type="text" />
</uni-forms-item>
</uni-row>
</uni-forms>
<u-button type="primary" @click="submit">提交</u-button>
</view>
</template>
<script>
import {
listUseRecord,
getUseRecord,
delUseRecord,
addStartUse,
updateEndUse,
listEntity,
listMaterial,
listEquipment,
getEntity,
removeShank
} from "@/api/basic/cutter.js";
import {
listEmployee
} from "@/api/mes/jobIn.js";
export default {
data() {
return {
code: null,
formData: {
cutterShankCode: null,
equipmentCode: null,
removeBy: null,
operator: null
},
removeCode: null,
operatorCode: null,
value: 0,
range: [],
entityOptions: [],
materialOptions: [],
rules: {
equipmentCode: {
rules: [{
required: true,
errorMessage: '请输入设备编码!'
},
{
pattern: '^[A-Z0-9]+$',
errorMessage: '请输入正确格式的设备编码!',
trigger: 'blur',
},
]
},
cutterShankCode: {
rules: [{
required: true,
errorMessage: '请输入刀柄编码!'
}]
},
}
}
},
mounted() {},
methods: {
//扫描物料编码带出绑定的刀具信息
scanBarCode() {
if (this.formData.materialCode) {
console.log(this.formData.materialCode)
this.range = [];
//判断是否扫描二维码
if (typeof(this.formData.materialCode) === 'string') {
// this.formData.materialCode = this.code;
this.formData.materialName = this.materialOptions.find(item => item.materialCode == this.formData
.materialCode).materialName;
if (this.formData.materialCode != "") {
listEntity({
cutterMaterialCode: this.formData.materialCode,
cutterMaterialName: this.formData.materialName,
}).then((resp) => {
this.range = resp.rows;
for (var i = 0; i < resp.rows.length; i++) {
this.range[i].value = resp.rows[i].id;
this.range[i].text = resp.rows[i].entityCode + ':' + (!resp.rows[i].pieceNo ?
'' : resp.rows[i].pieceNo) + ':' + (!resp.rows[i].batchNo ? '' : resp
.rows[i].batchNo)
}
this.entityOptions = resp.rows;
});
} else {
this.entityOptions = [];
}
} else if (typeof(this.formData.materialCode) === 'object') {
if (this.formData.materialCode.id) {
this.formData.cutterEntityId = this.formData.materialCode.id;
getEntity(this.formData.materialCode.id).then(async res => {
this.range.push(res.data);
this.entityOptions = this.range;
this.formData.cutterEntityCode = this.range[0].entityCode;
this.range[0].value = this.range[0].id;
this.range[0].text = this.range[0].entityCode + ':' + (!this.range[0].pieceNo ?
'' : this.range[0].pieceNo) + ':' + (!this.range[0].batchNo ? '' : this
.range[0].batchNo)
})
}
this.formData.materialName = this.formData.materialCode.cutterMaterialName;
this.formData.materialCode = this.formData.materialCode.cutterMaterialCode;
}
}
},
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['qrCode', 'barCode'],
success: function(res) {
_this.formData.cutterShankCode = res.result;
}
});
},
//根据设备编码获取设备id
getEquipmentId() {
if (this.formData.equipmentCode) {
listEquipment({
equipmentCode: this.formData.equipmentCode
}).then((resp) => {
if (resp.rows.length > 0) {
this.formData.equipmentId = resp.rows[0].id;
}
});
}
},
scanBarequipmentCode() {
const _this = this;
uni.scanCode({
scanType: ['qrCode', 'barCode'],
success: function(res) {
_this.formData.equipmentCode = res.result;
// _this.getEquipmentId();
}
});
},
selectoperator(code) {
listEmployee({
empCode: code
}).then(async res => {
if (res.rows.length > 0) {
this.formData.operator = res.rows[0].name;
} else {
this.$modal.msg("未查询到该人员,请重新输入!")
}
})
},
selectremoveBy(code) {
listEmployee({
empCode: code
}).then(async res => {
if (res.rows.length > 0) {
this.formData.removeBy = res.rows[0].name;
} else {
this.$modal.msg("未查询到该人员,请重新输入!")
}
})
},
scanBarremoveBy() {
const _this = this;
uni.scanCode({
scanType: ['qrCode', 'barCode'],
success: function(res) {
_this.formData.removeCode = res.result;
_this.selectremoveBy(res.result);
}
});
},
scanBaroperator() {
const _this = this;
uni.scanCode({
scanType: ['qrCode', 'barCode'],
success: function(res) {
_this.formData.operatorCode = res.result;
_this.selectoperator(res.result);
}
});
},
submit() {
this.$refs.form.validate().then(async res => {
if (this.formData.equipmentCode && this.formData.cutterShankCode) {
console.log(this.formData);
//判断安装员是否填入
setTimeout(() => {
if (this.formData.removeBy) {
this.$modal.loading('提交中')
removeShank(this.formData).then(res => {
this.$modal.closeLoading();
this.$modal.msgSuccess("刀柄下机成功!")
setTimeout(() => {
this.$tab.switchTab("/pages/work/index");
}, 500);
})
} else {
this.$modal.msg("请输入拆卸员!")
}
}, 500);
}
})
}
}
}
</script>
<style>
</style>

235
pages/basic/cutterStart.vue Normal file
View File

@@ -0,0 +1,235 @@
<template>
<view>
<uni-forms ref="form" :model="formData" :rules="rules">
<uni-row>
<uni-forms-item label="刀柄编码" :labelWidth='90' name="cutterShankCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" v-model="formData.cutterShankCode"
type="text" />
</uni-forms-item>
<uni-forms-item label="设备编码" :labelWidth='90' name="equipmentCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBarequipmentCode" v-model="formData.equipmentCode"
type="text" />
</uni-forms-item>
<uni-forms-item label="安装员" :labelWidth='90' name="installCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBarinstallBy" @change="selectinstallBy"
v-model="installCode" type="text" />
</uni-forms-item>
<uni-forms-item label="操作员" :labelWidth='90' name="operatorCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBaroperator" @change="selectoperator"
v-model="operatorCode" type="text" />
</uni-forms-item>
</uni-row>
</uni-forms>
<u-button type="primary" @click="submit">提交</u-button>
</view>
</template>
<script>
import {
listUseRecord,
getUseRecord,
delUseRecord,
addStartUse,
updateEndUse,
listEntity,
listMaterial,
listEquipment,
getEntity,
installShank
} from "@/api/basic/cutter.js";
import {
listEmployee
} from "@/api/mes/jobIn.js";
export default {
data() {
return {
code: null,
formData: {
cutterShankCode: null,
equipmentCode: null,
installBy: null,
operator: null
},
installCode: null,
operatorCode: null,
value: 0,
range: [],
entityOptions: [],
materialOptions: [],
rules: {
equipmentCode: {
rules: [{
required: true,
errorMessage: '请输入设备编码!',
trigger: 'blur'
},
{
pattern: '^[A-Z0-9]+$',
errorMessage: '请输入正确格式的设备编码!',
trigger: 'blur',
},
]
},
cutterShankCode: {
rules: [{
required: true,
errorMessage: '请输入刀柄编码!'
}]
},
}
}
},
mounted() {},
methods: {
//扫描物料编码带出绑定的刀具信息
scanBarCode() {
if (this.formData.materialCode) {
console.log(this.formData.materialCode)
this.range = [];
//判断是否扫描二维码
if (typeof(this.formData.materialCode) === 'string') {
// this.formData.materialCode = this.code;
this.formData.materialName = this.materialOptions.find(item => item.materialCode == this.formData
.materialCode).materialName;
if (this.formData.materialCode != "") {
listEntity({
cutterMaterialCode: this.formData.materialCode,
cutterMaterialName: this.formData.materialName,
}).then((resp) => {
this.range = resp.rows;
for (var i = 0; i < resp.rows.length; i++) {
this.range[i].value = resp.rows[i].id;
this.range[i].text = resp.rows[i].entityCode + ':' + (!resp.rows[i].pieceNo ?
'' : resp.rows[i].pieceNo) + ':' + (!resp.rows[i].batchNo ? '' : resp
.rows[i].batchNo)
}
this.entityOptions = resp.rows;
});
} else {
this.entityOptions = [];
}
} else if (typeof(this.formData.materialCode) === 'object') {
if (this.formData.materialCode.id) {
this.formData.cutterEntityId = this.formData.materialCode.id;
getEntity(this.formData.materialCode.id).then(async res => {
this.range.push(res.data);
this.entityOptions = this.range;
this.formData.cutterEntityCode = this.range[0].entityCode;
this.range[0].value = this.range[0].id;
this.range[0].text = this.range[0].entityCode + ':' + (!this.range[0].pieceNo ?
'' : this.range[0].pieceNo) + ':' + (!this.range[0].batchNo ? '' : this
.range[0].batchNo)
})
}
this.formData.materialName = this.formData.materialCode.cutterMaterialName;
this.formData.materialCode = this.formData.materialCode.cutterMaterialCode;
}
}
},
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['qrCode', 'barCode'],
success: function(res) {
_this.formData.cutterShankCode = res.result;
}
});
},
//根据设备编码获取设备id
getEquipmentId() {
if (this.formData.equipmentCode) {
listEquipment({
equipmentCode: this.formData.equipmentCode
}).then((resp) => {
if (resp.rows.length > 0) {
this.formData.equipmentId = resp.rows[0].id;
}
});
}
},
scanBarequipmentCode() {
const _this = this;
uni.scanCode({
scanType: ['qrCode', 'barCode'],
success: function(res) {
_this.formData.equipmentCode = res.result;
// _this.getEquipmentId();
}
});
},
selectoperator(code) {
listEmployee({
empCode: code
}).then(async res => {
if (res.rows.length > 0) {
this.formData.operator = res.rows[0].name;
} else {
this.$modal.msg("未查询到该人员,请重新输入!")
}
})
},
selectinstallBy(code) {
listEmployee({
empCode: code
}).then(async res => {
if (res.rows.length > 0) {
this.formData.installBy = res.rows[0].name;
} else {
this.$modal.msg("未查询到该人员,请重新输入!")
}
})
},
scanBarinstallBy() {
const _this = this;
uni.scanCode({
scanType: ['qrCode', 'barCode'],
success: function(res) {
_this.formData.installCode = res.result;
_this.selectinstallBy(res.result);
}
});
},
scanBaroperator() {
const _this = this;
uni.scanCode({
scanType: ['qrCode', 'barCode'],
success: function(res) {
_this.formData.operatorCode = res.result;
_this.selectoperator(res.result);
}
});
},
submit() {
this.$refs.form.validate().then(async res => {
if (this.formData.equipmentCode && this.formData.cutterShankCode) {
console.log(this.formData);
//判断安装员是否填入
setTimeout(() => {
if (this.formData.installBy) {
this.$modal.loading('提交中')
installShank(this.formData).then(res => {
this.$modal.closeLoading();
this.$modal.msgSuccess("刀柄上机成功!")
setTimeout(() => {
this.$tab.switchTab("/pages/work/index");
}, 500);
})
} else {
this.$modal.msg("请输入安装员!")
}
}, 500);
}
})
}
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,166 @@
<template>
<view>
<uni-forms ref="form" :modelValue="formData" :rules="rules">
<uni-row>
<uni-forms-item label="刀柄编码" :labelWidth='90' name="shankCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" @change="scanbarshankCode"
v-model="formData.shankCode" type="text" />
</uni-forms-item>
<uni-forms-item label="已绑定刀刃编码" :labelWidth='90' name="oldbladeCode">
<uni-easyinput disabled v-model="oldbladeCode" type="text" />
</uni-forms-item>
<uni-forms-item label="刀刃编码" :labelWidth='90' name="bladeCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBarbladeCode" v-model="formData.bladeCode"
type="text" />
</uni-forms-item>
<uni-forms-item label="切换人" :labelWidth='90' name="updateBy">
<uni-easyinput suffixIcon="scan" @iconClick="scanBarupdateBy" @change="selectEmpCode"
v-model="updateBy" type="text" />
</uni-forms-item>
</uni-row>
</uni-forms>
<u-button type="primary" @click="submit">提交</u-button>
</view>
</template>
<script>
import {
listInstallRecord,
unbindRecord,
bindRecord
} from "@/api/basic/cutter.js";
import {
listEmployee
} from "@/api/mes/jobIn.js";
export default {
data() {
return {
formData: {
shankCode: null,
bladeCode: null,
},
//临时切换人编码
updateBy: null,
//切换人姓名
updateName: null,
//拆卸表单
unbindForm: {},
//安装表单
bindForm: {},
//旧刀刃编码
oldbladeCode: null,
rules: {
bladeCode: {
rules: [{
required: true,
errorMessage: '请输入刀刃编码!'
}]
},
shankCode: {
rules: [{
required: true,
errorMessage: '请输入刀柄编码!'
}]
},
}
}
},
mounted() {},
methods: {
selectEmpCode(code) {
this.updateName = null;
listEmployee({
empCode: code
}).then(async res => {
if (res.rows.length > 0) {
this.updateName = res.rows[0].name;
} else {
this.$modal.msg("未查询到该人员,请重新输入!")
}
})
},
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['qrCode', 'barCode'],
success: function(res) {
_this.formData.shankCode = res.result;
_this.formData.scanbarshankCode();
}
});
},
scanbarshankCode() {
this.oldbladeCode = null;
if (this.formData.shankCode) {
listInstallRecord({
shankCode: this.formData.shankCode,
removeTime: null
}).then(async res => {
//判断是否存在已绑定且未拆卸的刀具
console.log(res);
for (var i in res.rows) {
if (!res.rows[i].removeTime) {
console.log(res.rows[i].bladeCode)
this.oldbladeCode = res.rows[i].bladeCode;
}
}
});
}
},
scanBarbladeCode() {
const _this = this;
uni.scanCode({
scanType: ['qrCode', 'barCode'],
success: function(res) {
_this.formData.bladeCode = res.result;
}
});
},
scanBarupdateBy() {
const _this = this;
uni.scanCode({
scanType: ['qrCode', 'barCode'],
success: function(res) {
_this.formData.updateBy = res.result;
_this.selectEmpCode(res.result);
}
});
},
submit() {
this.$refs.form.validate().then(async res => {
if (this.formData.bladeCode && this.formData.shankCode) {
console.log(this.updateName)
if (this.updateName) {
this.unbindForm = {
shankCode: this.formData.shankCode,
bladeCode: this.oldbladeCode,
removeBy: this.updateName
}
//拆卸
unbindRecord(this.unbindForm);
this.bindForm = this.formData
this.bindForm.installBy = this.updateName;
//由于bindRecord接口过快导致切换人没有时间赋值故设置定时器
setTimeout(() => {
this.$modal.loading('提交中')
bindRecord(this.bindForm).then(res => {
this.$modal.closeLoading();
this.$modal.msgSuccess("刀具切换成功!")
setTimeout(() => {
this.$tab.switchTab("/pages/work/index");
}, 500);
})
}, 500);
} else {
this.$modal.msg("请输入切换人!")
}
}
})
}
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,132 @@
<template>
<view>
<uni-forms ref="form" :modelValue="formData" :rules="rules">
<uni-row>
<uni-forms-item label="刀柄编码" :labelWidth='90' name="shankCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" v-model="formData.shankCode" type="text" />
</uni-forms-item>
<uni-forms-item label="刀刃编码" :labelWidth='90' name="bladeCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBarbladeCode" v-model="formData.bladeCode"
type="text" />
</uni-forms-item>
<uni-forms-item label="拆卸员" :labelWidth='90' name="removeCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBarremoveBy" @change="selectremoveBy"
v-model="removeCode" type="text" />
</uni-forms-item>
</uni-row>
</uni-forms>
<u-button type="primary" @click="submit">提交</u-button>
</view>
</template>
<script>
import {
listUseRecord,
getUseRecord,
delUseRecord,
addStartUse,
updateEndUse,
listEntity,
listMaterial,
listEquipment,
getEntity,
unbindRecord
} from "@/api/basic/cutter.js";
import {
listEmployee
} from "@/api/mes/jobIn.js";
export default {
data() {
return {
formData: {
shankCode: null,
bladeCode: null,
removeBy: null,
},
removeCode: null,
rules: {
bladeCode: {
rules: [{
required: true,
errorMessage: '请输入刀刃编码!'
}]
},
shankCode: {
rules: [{
required: true,
errorMessage: '请输入刀柄编码!'
}]
},
}
}
},
mounted() {},
methods: {
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['qrCode', 'barCode'],
success: function(res) {
_this.formData.shankCode = res.result;
}
});
},
scanBarbladeCode() {
const _this = this;
uni.scanCode({
scanType: ['qrCode', 'barCode'],
success: function(res) {
_this.formData.bladeCode = res.result;
}
});
},
selectremoveBy(code) {
listEmployee({
empCode: code
}).then(async res => {
if (res.rows.length > 0) {
this.formData.removeBy = res.rows[0].name;
} else {
this.$modal.msg("未查询到该人员,请重新输入!")
}
})
},
scanBarremoveBy() {
const _this = this;
uni.scanCode({
scanType: ['qrCode', 'barCode'],
success: function(res) {
_this.formData.removeCode = res.result;
_this.selectremoveBy(res.result);
}
});
},
submit() {
this.$refs.form.validate().then(async res => {
if (this.formData.bladeCode && this.formData.shankCode) {
console.log(this.formData);
setTimeout(() => {
if (this.formData.removeBy) {
this.$modal.loading('提交中')
unbindRecord(this.formData).then(res => {
this.$modal.closeLoading();
this.$modal.msgSuccess("刀具拆卸成功!")
setTimeout(() => {
this.$tab.switchTab("/pages/work/index");
}, 500);
})
} else {
this.$modal.msg("请输入拆卸员!")
}
}, 500);
}
})
}
}
}
</script>
<style>
</style>

120
pages/basic/empEqpEnd.vue Normal file
View File

@@ -0,0 +1,120 @@
<template>
<view>
<uni-forms ref="form" :modelValue="formData" :rules="rules">
<uni-row>
<uni-col :span="24">
<uni-forms-item label="员工编码" :labelWidth='90' name="empCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" @confirm="search"
v-model="formData.empCode" type="text" />
</uni-forms-item>
</uni-col>
<uni-col :span="24" style="margin-bottom: 10px;">
该员工已绑定设备<br><span
v-for="item in searchEmpWithEqp">{{item.equipmentCode+':'+item.equipmentTitle}}<br></span>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="设备编码" :labelWidth='90' name="eqpCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar1" v-model="formData.eqpCode" type="text" />
</uni-forms-item>
</uni-col>
</uni-row>
</uni-forms>
<u-button type="primary" @click="submit">提交</u-button>
</view>
</template>
<script>
import {
addStart,
addEnd,
listEmpEqpHistory
} from '@/api/basic/empEqpHistory.js'
export default {
data() {
return {
formData: {
empCode: null,
eqpCode: null
},
searchEmpWithEqp: [],
rules: {
empCode: {
rules: [{
required: true,
errorMessage: '请输入员工编码!'
}]
},
eqpCode: {
rules: [{
required: true,
errorMessage: '请输入设备编码!'
}, {
pattern: '^[A-Z0-9]+$',
errorMessage: '请输入正确格式的设备编码!',
trigger: 'blur',
}]
}
}
}
},
methods: {
//根据员工编码来查询已上机但并未下机的设备
search() {
this.searchEmpWithEqp = [];
listEmpEqpHistory({
empCode: this.formData.empCode
}).then(async res => {
if (res.rows.length > 0) {
for (var i in res.rows) {
//判断是否下机
if (!res.rows[i].endTime) {
this.searchEmpWithEqp.push({
equipmentCode: res.rows[i].equipmentCode,
equipmentTitle: res.rows[i].equipmentTitle
});
}
}
}
})
},
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['qrCode', 'barCode'],
success: function(res) {
_this.formData.empCode = res.result;
_this.search();
}
});
},
scanBar1() {
const _this = this;
uni.scanCode({
scanType: ['qrCode', 'barCode'],
success: function(res) {
_this.formData.eqpCode = res.result;
}
});
},
submit() {
this.$refs.form.validate().then(res => {
if (this.formData.empCode && this.formData.eqpCode) {
this.$modal.loading('提交中')
addEnd(this.formData).then(res => {
this.$modal.closeLoading();
this.$modal.msgSuccess("下机成功!")
setTimeout(() => {
this.$tab.switchTab("/pages/work/index");
}, 500);
})
}
})
}
}
}
</script>
<style>
</style>

121
pages/basic/empEqpStart.vue Normal file
View File

@@ -0,0 +1,121 @@
<template>
<view>
<uni-forms ref="form" :modelValue="formData" :rules="rules">
<uni-row>
<uni-col :span="24">
<uni-forms-item label="员工编码" :labelWidth='90' name="empCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" @confirm="search"
v-model="formData.empCode" type="text" />
</uni-forms-item>
</uni-col>
<uni-col :span="24" style="margin-bottom: 10px;">
该员工已绑定设备<br><span v-for="item,index in searchEmpWithEqp"
:key="index">{{item.equipmentCode+':'+item.equipmentTitle}}</span></br>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="设备编码" :labelWidth='90' name="eqpCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar1" v-model="formData.eqpCode" type="text" />
</uni-forms-item>
</uni-col>
</uni-row>
</uni-forms>
<u-button type="primary" @click="submit">提交</u-button>
</view>
</template>
<script>
import {
addStart,
addEnd,
listEmpEqpHistory
} from '@/api/basic/empEqpHistory.js'
export default {
data() {
return {
formData: {
empCode: null,
eqpCode: null
},
searchEmpWithEqp: [],
rules: {
empCode: {
rules: [{
required: true,
errorMessage: '请输入员工编码!'
}]
},
eqpCode: {
rules: [{
required: true,
errorMessage: '请输入设备编码!'
},
{
pattern: '^[A-Z0-9]+$',
errorMessage: '请输入正确格式的设备编码!',
trigger: 'blur',
}
]
}
}
}
},
methods: {
//根据员工编码来查询已上机但并未下机的设备
search() {
this.searchEmpWithEqp = []
listEmpEqpHistory({
empCode: this.formData.empCode
}).then(async res => {
if (res.rows.length > 0) {
for (var i in res.rows) {
//判断是否下机
if (!res.rows[i].endTime) {
this.searchEmpWithEqp.push({
equipmentCode: res.rows[i].equipmentCode,
equipmentTitle: res.rows[i].equipmentTitle
});
}
}
}
})
},
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['qrCode', 'barCode'],
success: function(res) {
_this.formData.empCode = res.result;
_this.search();
}
});
},
scanBar1() {
const _this = this;
uni.scanCode({
scanType: ['qrCode', 'barCode'],
success: function(res) {
_this.formData.eqpCode = res.result;
}
});
},
submit() {
this.$refs.form.validate().then(res => {
if (this.formData.empCode && this.formData.eqpCode) {
this.$modal.loading('提交中')
addStart(this.formData).then(res => {
this.$modal.closeLoading();
this.$modal.msgSuccess("上机成功!")
setTimeout(() => {
this.$tab.switchTab("/pages/work/index");
}, 500);
})
}
})
}
}
}
</script>
<style>
</style>