更新模块
This commit is contained in:
427
src/views/modules/code/components/deliveryInspection-add.vue
Normal file
427
src/views/modules/code/components/deliveryInspection-add.vue
Normal file
@@ -0,0 +1,427 @@
|
||||
<!--
|
||||
* @Author: zhp
|
||||
* @Date: 2023-02-14 15:02:26
|
||||
* @LastEditTime: 2023-06-20 15:04:28
|
||||
* @LastEditors: zhp
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<el-form :model="dataForm" ref="dataForm" @keyup.enter.native="dataFormSubmitHandle()" label-width="120px">
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="8">
|
||||
<el-form-item prop="factoryId" :label="$t('code.factoryName')">
|
||||
<el-select v-model="dataForm.factoryId" :placeholder="$t('code.factoryName')">
|
||||
<el-option v-for="item in factoryList" :key="item.id" :label="item.factoryName" :value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item prop="inspectionTime" :label="$t('code.inspectionTime')">
|
||||
<el-date-picker v-model="dataForm.inspectionTime" type="datetime" :placeholder="$t('code.inspectionTime')"
|
||||
format='yyyy-MM-dd HH:mm:ss' valueFormat='yyyy-MM-ddTHH:mm:ss'>
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item prop="orderNumber" :label="$t('code.orderNumber')">
|
||||
<el-input v-model="dataForm.orderNumber" :placeholder="$t('code.orderNumber')"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="8">
|
||||
<el-form-item prop="batchNo" :label="$t('code.batchNo')">
|
||||
<el-input v-model="dataForm.batchNo" :placeholder="$t('code.batchNo')"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item prop="inspectionType" :label="$t('code.inspectionType')">
|
||||
<el-select v-model="dataForm.inspectionType" :placeholder="$t('code.inspectionType')">
|
||||
<el-option v-for="item in inspectionTypeList" :key="item.value" :label="item.label" :value="item.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item prop="recheck" :label="$t('code.recheck')">
|
||||
<el-switch v-model="dataForm.recheck" :active-value="1" :inactive-value="0">
|
||||
</el-switch>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="8">
|
||||
<el-form-item prop="productId" :label="$t('code.productName')">
|
||||
<el-select v-model="dataForm.productId" :placeholder="$t('code.productName')">
|
||||
<el-option v-for="item in productList" :key="item.id" :label="item.name" :value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item prop="supplierId" :label="$t('code.supplierName')">
|
||||
<el-select v-model="dataForm.supplierId" :placeholder="$t('code.supplierName')">
|
||||
<el-option v-for="item in supplierList" :key="item.id" :label="item.name" :value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item prop="batchQuantity" :label="$t('code.batchQuantity')">
|
||||
<el-input v-model="dataForm.batchQuantity" :placeholder="$t('code.batchQuantity')"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="8">
|
||||
<el-form-item prop="inspectionQuantity" :label="$t('code.inspectionQuantity')">
|
||||
<el-input v-model="dataForm.inspectionQuantity" :placeholder="$t('code.inspectionQuantity')"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item prop="batchSize" :label="$t('code.batchSize')">
|
||||
<el-input v-model="dataForm.batchSize" :placeholder="$t('code.batchSize')"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item prop="samplesQuantity" :label="$t('code.samplesQuantity')">
|
||||
<el-input v-model="dataForm.samplesQuantity" :placeholder="$t('code.samplesQuantity')"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="8">
|
||||
<el-form-item prop="companyId" :label="$t('code.companyName')">
|
||||
<el-select v-model="dataForm.companyId" :placeholder="$t('code.companyName')">
|
||||
<el-option v-for="item in unitList" :key="item.dictValue" :label="item.dictLabel" :value="item.dictValue">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item prop="userId" :label="$t('code.username')">
|
||||
<el-select v-model="dataForm.userId" :placeholder="$t('code.username')">
|
||||
<el-option v-for="item in unitList" :key="item.id" :label="item.realName" :value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item prop="inspectionStatus" :label="$t('code.inspectionStatus')">
|
||||
<el-select v-model="dataForm.inspectionStatus" :placeholder="$t('code.inspectionStatus')">
|
||||
<el-option v-for="item in inspectionStatusList" :key="item.id" :label="item.name" :value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="8">
|
||||
<el-form-item prop="customSamplingId" :label="$t('code.customSampling')">
|
||||
<el-select v-model="dataForm.customSamplingId" :placeholder="$t('code.customSampling')">
|
||||
<el-option v-for="item in samplingPlanList" :key="item.id" :label="item.sampleRange" :value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import debounce from "lodash/debounce";
|
||||
import basicAdd from "@/mixins/basic-add";
|
||||
export default {
|
||||
mixins: [basicAdd],
|
||||
data() {
|
||||
return {
|
||||
urlOptions: {
|
||||
submitURL: "/code/deliveryInspection",
|
||||
infoURL: "/code/deliveryInspection/{id}",
|
||||
getFactoryURL: '/code/factory/page',
|
||||
getProductURL: '/basic/product/page',
|
||||
getSupplierURL: '/supplier/qmsSupplier/page',
|
||||
getDictDataList: '/sys/dict/data/page',
|
||||
getUserURL: '/sys/user/page',
|
||||
getSamplingPlanURL: '/quality/qmsSamplingPlan/page'
|
||||
},
|
||||
supplierList: [],
|
||||
userList: [],
|
||||
samplingPlanList:[],
|
||||
inspectionStatusList: [
|
||||
{
|
||||
id: 0,
|
||||
name: '未登记'
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
name: '已登记'
|
||||
}
|
||||
],
|
||||
unitList:[],
|
||||
productList: [],
|
||||
factoryList:[],
|
||||
visible: false,
|
||||
listQuery: {
|
||||
limit: 999,
|
||||
page:1
|
||||
},
|
||||
inspectionTypeList: [{
|
||||
value: 0,
|
||||
label: '监控'
|
||||
},
|
||||
{
|
||||
value: 1,
|
||||
label: '电芯来料检验'
|
||||
},
|
||||
{
|
||||
value: 2,
|
||||
label: 'IQC抽检'
|
||||
},
|
||||
{
|
||||
value: 3,
|
||||
label: 'IQC抽检2'
|
||||
},
|
||||
{
|
||||
value: 4,
|
||||
label: '原料抽检'
|
||||
},
|
||||
{
|
||||
value: 5,
|
||||
label: '进货外观检验'
|
||||
},
|
||||
{
|
||||
value: 6,
|
||||
label: '库内原料检验'
|
||||
},
|
||||
{
|
||||
value: 7,
|
||||
label: '来料检验'
|
||||
},
|
||||
{
|
||||
value: 8,
|
||||
label: '胶片'
|
||||
},
|
||||
{
|
||||
value: 9,
|
||||
label: '抽检'
|
||||
},
|
||||
{
|
||||
value: 10,
|
||||
label: '巡检'
|
||||
}, {
|
||||
value: 11,
|
||||
label: '首检'
|
||||
},
|
||||
{
|
||||
value: 12,
|
||||
label: '末检'
|
||||
},
|
||||
{
|
||||
value: 13,
|
||||
label: '实时监测'
|
||||
},
|
||||
{
|
||||
value: 14,
|
||||
label: 'FQC抽检'
|
||||
},
|
||||
{
|
||||
value: 15,
|
||||
label: 'OQC抽检'
|
||||
},
|
||||
],
|
||||
dataForm: {
|
||||
id:null,
|
||||
batchNo: null,
|
||||
batchSize: null,
|
||||
checkoutTime: null,
|
||||
companyId: null,
|
||||
factoryId: null,
|
||||
inspectionPlan: null,
|
||||
inspectionQuantity: null,
|
||||
inspectionStatus: null,
|
||||
inspectionTime: null,
|
||||
inspectionType: null,
|
||||
orderNumber: null,
|
||||
productCode: null,
|
||||
productId: null,
|
||||
recheck: null,
|
||||
remark: null,
|
||||
samplesQuantity: null,
|
||||
shiftId: null,
|
||||
source: null,
|
||||
supplierId: null,
|
||||
teamId: null,
|
||||
userId: null,
|
||||
},
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
dataRule() {
|
||||
return {
|
||||
dictLabel: [
|
||||
{
|
||||
required: true,
|
||||
message: this.$t("validate.required"),
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
dictValue: [
|
||||
{
|
||||
required: true,
|
||||
message: this.$t("validate.required"),
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
sort: [
|
||||
{
|
||||
required: true,
|
||||
message: this.$t("validate.required"),
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.getDict()
|
||||
},
|
||||
methods: {
|
||||
init(id, ) {
|
||||
this.dataForm.id = id || ""
|
||||
// this.dataForm.dictTypeId = dictTypeId || "";
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs["dataForm"].resetFields();
|
||||
if (this.dataForm.id) {
|
||||
this.getInfo();
|
||||
}
|
||||
});
|
||||
},
|
||||
// 获取信息
|
||||
getInfo() {
|
||||
this.$http
|
||||
.get(`/code/deliveryInspection/${this.dataForm.id}`)
|
||||
.then(({ data: res }) => {
|
||||
if (res.code !== 0) {
|
||||
return this.$message.error(res.msg);
|
||||
}
|
||||
this.dataForm = {
|
||||
...this.dataForm,
|
||||
...res.data,
|
||||
};
|
||||
})
|
||||
.catch(() => {})
|
||||
},
|
||||
getDict() {
|
||||
this.$http
|
||||
.get(this.urlOptions.getSamplingPlanURL, {
|
||||
params: this.listQuery
|
||||
})
|
||||
.then(({ data: res }) => {
|
||||
if (res.code === 0) {
|
||||
console.log(res);
|
||||
this.samplingPlanList = res.data.list
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
})
|
||||
this.$http
|
||||
.get(this.urlOptions.getUserURL, {
|
||||
params: this.listQuery
|
||||
})
|
||||
.then(({ data: res }) => {
|
||||
if (res.code === 0) {
|
||||
console.log(res);
|
||||
this.userList = res.data.list
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
})
|
||||
this.$http
|
||||
.get(this.urlOptions.getProductURL, {
|
||||
params: this.listQuery
|
||||
})
|
||||
.then(({ data: res }) => {
|
||||
if (res.code === 0) {
|
||||
console.log(res);
|
||||
this.productList = res.data.list
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
})
|
||||
this.$http
|
||||
.get(this.urlOptions.getDictDataList, {
|
||||
params: {
|
||||
limit: 999,
|
||||
page: 1,
|
||||
dictTypeId: '1665966021935190018'
|
||||
}
|
||||
})
|
||||
.then(({ data: res }) => {
|
||||
if (res.code === 0) {
|
||||
console.log(res);
|
||||
this.unitList = res.data.list
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
})
|
||||
this.$http
|
||||
.get(this.urlOptions.getSupplierURL, {
|
||||
params: this.listQuery
|
||||
})
|
||||
.then(({ data: res }) => {
|
||||
if (res.code === 0) {
|
||||
console.log(res);
|
||||
this.supplierList = res.data.list
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
})
|
||||
this.$http
|
||||
.get(this.urlOptions.getFactoryURL, {
|
||||
params: this.listQuery
|
||||
})
|
||||
.then(({ data: res }) => {
|
||||
if (res.code === 0) {
|
||||
console.log(res);
|
||||
this.factoryList = res.data.list
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
})
|
||||
// console.log(111111);
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmitHandle: debounce(
|
||||
function () {
|
||||
this.$refs["dataForm"].validate((valid) => {
|
||||
if (!valid) {
|
||||
return false;
|
||||
}
|
||||
this.$http[!this.dataForm.id ? "post" : "put"](this.urlOptions.submitURL, this.dataForm)
|
||||
.then(({ data: res }) => {
|
||||
if (res.code !== 0) {
|
||||
return this.$message.error(res.msg);
|
||||
}
|
||||
this.$message({
|
||||
message: this.$t("prompt.success"),
|
||||
type: "success",
|
||||
duration: 500,
|
||||
onClose: () => {
|
||||
this.visible = false;
|
||||
console.log(1111);
|
||||
this.$emit("successSubmit");
|
||||
},
|
||||
});
|
||||
})
|
||||
.catch(() => {});
|
||||
});
|
||||
},
|
||||
1000,
|
||||
{ leading: true, trailing: false }
|
||||
),
|
||||
},
|
||||
};
|
||||
</script>
|
||||
Reference in New Issue
Block a user