初始化仓库

This commit is contained in:
tao
2025-12-18 14:11:48 +08:00
parent e96f277a68
commit 54ec472bd4
1107 changed files with 158756 additions and 0 deletions

287
pages/tpm/repairTaskAdd.vue Normal file
View File

@@ -0,0 +1,287 @@
<template>
<view style="background-color: #fff;">
<!-- <uni-collapse> -->
<uni-forms ref="form" :modelValue="formData" :rules="rules">
<!-- <uni-collapse-item title="新增模具维修" :open="true"> -->
<uni-forms-item label="任务号" :labelWidth='90' name="taskCode">
<uni-easyinput type="text" v-model="formData.taskCode" />
</uni-forms-item>
<uni-forms-item label="任务名" :labelWidth='90' name="taskName">
<uni-easyinput type="text" v-model="formData.taskName" />
</uni-forms-item>
<uni-forms-item label="类型" :labelWidth='90' name="type" v-if="!formData.taskId">
<uni-data-select v-model="formData.type" :localdata="repairTypeOptions" />
</uni-forms-item>
<uni-forms-item label="状态" :labelWidth='90' name="status">
<u-radio-group v-model="formData.status" placement="row">
<u-radio v-for="(item, index) in taskStatusOptions" :key="index" :label="item.text"
:name="item.value">
</u-radio>
</u-radio-group>
</uni-forms-item>
<uni-forms-item label="备注" :labelWidth='90' name="remark">
<uni-easyinput v-model="formData.remark" type="text" />
</uni-forms-item>
<u-divider :text="'新增故障'" v-if="formData.taskId"></u-divider>
<view v-if="formData.taskId">
<uni-forms-item label="故障号" :labelWidth='90' name="breakdownCode">
<uni-easyinput v-model="formData.breakdownCode" disabled type="text" />
</uni-forms-item>
<uni-forms-item label="故障名" :labelWidth='90' name="breakdownName">
<uni-easyinput v-model="formData.breakdownName" type="text" />
</uni-forms-item>
<uni-forms-item label="故障类型" :labelWidth='90' name="type" v-if="formData.taskId">
<uni-data-select v-model="formData.type" :localdata="breakdownTypeOptions" />
</uni-forms-item>
<uni-forms-item label="设备编码" :labelWidth='90' name="type" v-if="formData.taskId">
<uni-easyinput suffixIcon="scan" @iconClick="scanBarEquipmentCode" v-model="formData.equipmentCode"
type="text" @confirm="confirmEquipmentCode" />
</uni-forms-item>
<!-- <uni-forms-item label="维修人" :labelWidth='90' name="operatorCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBarOperatorCode" @confirm="confirmOperatorCode"
v-model="formData.operatorCode" type="text" style="margin-bottom: 10px;" />
<uni-data-select v-model="formData.operatorCode" :localdata="empList" />
</uni-forms-item> -->
</view>
<!-- </uni-collapse-item> -->
</uni-forms>
<!-- </uni-collapse> -->
<u-button type="success" v-if="!formData.taskId" @click="taskSubmit">新建任务</u-button>
<u-button type="primary" v-if="formData.taskId" @click="breakSubmit">新建故障</u-button>
</view>
</template>
<script>
import {
listTask,
getTask,
delTask,
addTask,
updateTask,
} from "@/api/tpm/repairTask";
import {
listBreakdown,
getBreakdown,
delBreakdown,
addBreakdown,
updateBreakdown,
} from "@/api/tpm/repairBreakdown";
import {
getDicts
} from "@/api/system/dict/dictData.js";
import {
listEquipment
} from "@/api/mes/jobReport.js";
export default {
mounted() {
getDicts("tpm_repair_type").then(res => {
this.repairTypeOptions = res.data.map(dict => {
return {
text: dict.dictLabel,
value: dict.dictValue,
diasble: false
}
});
})
getDicts("tpm_task_status").then(res => {
this.taskStatusOptions = res.data.map(dict => {
return {
text: dict.dictLabel,
value: dict.dictValue,
diasble: false
}
});
})
getDicts("tpm_breakdown_type").then(res => {
this.breakdownTypeOptions = res.data.map(dict => {
return {
text: dict.dictLabel,
value: dict.dictValue,
diasble: false
}
});
})
listEmployee().then((res) => {
this.empList = res.rows.map(item => {
item.text = item.empCode + ':' + item.name
item.value = item.empCode
return item
});
})
},
data() {
return {
empList: [],
repairTypeOptions: [],
breakdownTypeOptions: [],
taskStatusOptions: [],
formData: {
taskCode: null,
taskName: null,
type: null,
status: "0",
mouldUuid: null,
mouldName: null,
remark: null,
breakdownCode: null,
breakdownName: null,
operatorId: null,
operatorCode: null,
mouldId: null,
taskId: null,
taskType: null
},
rules: {
// saleOutTaskCode: {
// rules: [{
// required: true,
// errorMessage: '请输入销售出库任务单!'
// }]
// },
}
}
},
methods: {
deleteDetail(index) {
this.formData.wmsSaleOutDetailList.splice(index, 1);
},
clickDetail(itemIndex, {
position,
index
}) {
if (index == 0) {
this.deleteDetail(itemIndex);
}
},
//扫描设备编码带出设备信息
confirmEquipmentCode() {
if (this.formData.equipmentCode) {
listEquipment({
equipmentCode: this.formData.equipmentCode
}).then(res => {
if (res.rows.length > 0) {
this.formData.equipmentId = res.rows[0].id
} else {
this.$modal.msg("未查询到该设备,请重新输入!")
}
})
}
},
scanBarEquipmentCode() {
const _this = this;
uni.scanCode({
scanType: ['qrCode', 'barCode'],
success: function(res) {
_this.formData.equipmentCode = res.result;
_this.confirmEquipmentCode()
}
});
},
// scanBarOperatorCode() {
// const _this = this;
// uni.scanCode({
// scanType: ['qrCode', 'barCode'],
// success: function(res) {
// _this.formData.operatorCode = res.result;
// _this.confirmOperatorCode()
// }
// });
// },
// confirmOperatorCode() {
// listEmployee({
// empCode: this.formData.operatorCode
// }).then(async res => {
// if (res.rows.length == 0) {
// this.$modal.msg("未查询到该人员,请重新输入!")
// this.formData.operatorCode = null;
// }
// })
// },
taskSubmit() {
const _this = this;
this.$refs.form.validate().then(res => {
uni.showModal({
title: '提示',
content: '您确定新建该任务吗?',
success: function(res) {
if (res.confirm) {
console.log(_this.formData)
if (_this.formData.taskName == null || _this.formData.taskName == "") {
_this.$modal.msg("任务名不得为空,请输入!")
} else {
_this.$modal.loading('提交中')
addTask(_this.formData).then(async res => {
let obj = res.tpmEquipmentRepairTask
_this.formData.taskId = obj.id;
_this.formData.taskCode = obj.taskCode;
_this.formData.taskType = obj.type;
_this.$modal.msgSuccess("新建任务成功!");
_this.$modal.closeLoading();
});
}
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
});
},
breakSubmit() {
const _this = this;
this.$refs.form.validate().then(res => {
uni.showModal({
title: '提示',
content: '您确定新建该故障吗?',
success: function(res) {
if (res.confirm) {
if (_this.formData.breakdownName == null || _this.formData
.breakdownName == "") {
_this.$modal.msg("故障名不得为空,请输入!")
} else {
// let obj = _this.empList.find(item => _this.formData.operatorCode ==
// item.value)
// if (obj !== undefined) {
// _this.formData.operatorId = obj.id
// }
console.log(_this.formData)
_this.$modal.loading('提交中')
addBreakdown(_this.formData).then(async res => {
_this.$modal.msgSuccess("新建故障成功!");
_this.$modal.closeLoading();
setTimeout(() => {
_this.$tab.switchTab(
"/pages/work/index");
}, 500);
});
}
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
});
},
}
}
</script>
<style>
.divider {
display: flex;
align-items: center;
justify-content: center;
margin-top: 10px;
margin-bottom: 10px;
height: 1px;
background-color: #F1F1F1;
}
.divider span {
padding: 5px;
}
</style>