301 lines
8.1 KiB
Vue
301 lines
8.1 KiB
Vue
<!--
|
|
* @Author: zhp
|
|
* @Date: 2023-02-14 15:02:26
|
|
* @LastEditTime: 2023-05-24 16:36:43
|
|
* @LastEditors: zhp
|
|
* @Description:
|
|
-->
|
|
<template>
|
|
<el-form :model="dataForm" ref="dataForm" @keyup.enter.native="dataFormSubmitHandle()" label-width="130px">
|
|
<el-form-item prop="inspectionStage" :label="$t('quality.inspectionStage')">
|
|
<el-select v-model="dataForm.inspectionStage" :placeholder="$t('quality.inspectionStage')">
|
|
<el-option v-for="item in inspectionStageList" :key="item.id" :label="item.name" :value="item.id">
|
|
</el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item prop="inspectionType" :label="$t('quality.inspectionStage')">
|
|
<el-select v-model="dataForm.inspectionType" :placeholder="$t('quality.inspectionStage')">
|
|
<el-option v-for="item in inspectionTypeList" :key="item.id" :label="item.name" :value="item.id">
|
|
</el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item prop="supplierId" :label="$t('quality.supplierName')">
|
|
<el-select v-model="dataForm.supplierId" :placeholder="$t('quality.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-form-item prop="productId" :label="$t('quality.productName')">
|
|
<el-select v-model="dataForm.productId" :placeholder="$t('quality.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-form-item prop="transferOutId" :label="$t('quality.transferOutName')">
|
|
<el-select v-model="dataForm.transferOutId" :placeholder="$t('quality.transferOutName')">
|
|
<el-option v-for="item in transferSchemeList" :key="item.id" :label="item.transferSchemeName" :value="item.id">
|
|
</el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item prop="transferInId" :label="$t('quality.transferInName')">
|
|
<el-select v-model="dataForm.transferInId" :placeholder="$t('quality.transferInName')">
|
|
<el-option v-for="item in transferSchemeList" :key="item.id" :label="item.transferSchemeName" :value="item.id">
|
|
</el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item prop="dataSources" :label="$t('quality.dataSources')">
|
|
<el-input v-model="dataForm.dataSources" :placeholder="$t('quality.dataSources')"></el-input>
|
|
</el-form-item>
|
|
</el-form>
|
|
</template>
|
|
|
|
<script>
|
|
import debounce from "lodash/debounce";
|
|
import basicAdd from "@/mixins/basic-add";
|
|
export default {
|
|
mixins: [basicAdd],
|
|
data() {
|
|
return {
|
|
urlOptions: {
|
|
submitURL: "/quality/qmsTransferRecords",
|
|
getSupplierList: "/supplier/qmsSupplier/page",
|
|
getProductList: "/basic/qmsProduct/page",
|
|
infoURL: "/quality/qmsTransferRecords/{id}",
|
|
getTransferSchemeListURL: '/quality/qmsTransferScheme/page'
|
|
},
|
|
supplierList: [],
|
|
productList: [],
|
|
transferSchemeList:[],
|
|
options: [{
|
|
value: 0,
|
|
label: '不可用'
|
|
},
|
|
{
|
|
value: 1,
|
|
label: '可用'
|
|
}],
|
|
inspectionStageList: [
|
|
{
|
|
id: 0,
|
|
name: '进货检验 ',
|
|
},
|
|
{
|
|
id: 1,
|
|
name: '成品检验',
|
|
},
|
|
{
|
|
id: 2,
|
|
name: '出货检验',
|
|
}
|
|
],
|
|
inspectionTypeList: [
|
|
{
|
|
id: 0,
|
|
name: '监控',
|
|
},
|
|
{
|
|
id: 1,
|
|
name: '电芯来料检验',
|
|
},
|
|
{
|
|
id: 2,
|
|
name: 'IQC抽检',
|
|
},
|
|
{
|
|
id: 3,
|
|
name: 'IQC抽检2',
|
|
},
|
|
{
|
|
id: 4,
|
|
name: '原料抽检',
|
|
},
|
|
{
|
|
id: 5,
|
|
name: '进货外观检验',
|
|
},
|
|
{
|
|
id: 6,
|
|
name: '库内原料检验',
|
|
},
|
|
{
|
|
id: 7,
|
|
name: ' 来料检验',
|
|
},
|
|
{
|
|
id: 8,
|
|
name: '胶片',
|
|
},
|
|
{
|
|
id: 9,
|
|
name: ' 抽检',
|
|
},
|
|
{
|
|
id: 10,
|
|
name: '巡检 ',
|
|
},
|
|
{
|
|
id: 11,
|
|
name: '首检',
|
|
},
|
|
{
|
|
id: 12,
|
|
name: '末检',
|
|
},
|
|
{
|
|
id: 13,
|
|
name: '实时监测',
|
|
},
|
|
{
|
|
id: 14,
|
|
name: 'FQC抽检',
|
|
},
|
|
{
|
|
id: 16,
|
|
name: 'OQC抽检',
|
|
}
|
|
],
|
|
visible: false,
|
|
dataForm: {
|
|
id: null,
|
|
inspectionStage:null,
|
|
inspectionType: null,
|
|
productId: null,
|
|
supplierId: null,
|
|
supplierName: null,
|
|
dataSources: null,
|
|
transferInId: null,
|
|
transferInName: null,
|
|
transferOutId: 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",
|
|
// },
|
|
// ],
|
|
};
|
|
},
|
|
},
|
|
methods: {
|
|
init(id, ) {
|
|
this.dataForm.id = id || ""
|
|
// console.log(11111)
|
|
// this.dataForm.dictTypeId = dictTypeId || "";
|
|
this.visible = true
|
|
this.$nextTick(() => {
|
|
this.$refs["dataForm"].resetFields();
|
|
if (this.dataForm.id) {
|
|
this.getInfo()
|
|
} else {
|
|
// this.getCode()
|
|
}
|
|
});
|
|
},
|
|
getData() {
|
|
this.$http.post(this.urlOptions.getSupplierList)
|
|
.then(({ data: res }) => {
|
|
if (res.code === 0) {
|
|
console.log(res);
|
|
this.supplierList = res.data.list
|
|
}
|
|
})
|
|
.catch(() => {
|
|
})
|
|
this.$http.post(this.urlOptions.getProductList)
|
|
.then(({ data: res }) => {
|
|
if (res.code === 0) {
|
|
console.log(res);
|
|
this.productList = res.data.list
|
|
}
|
|
})
|
|
.catch(() => {
|
|
})
|
|
this.$http.post(this.urlOptions.getTransferSchemeListURL)
|
|
.then(({ data: res }) => {
|
|
if (res.code === 0) {
|
|
console.log(res);
|
|
this.transferSchemeList = res.data.list
|
|
}
|
|
})
|
|
.catch(() => {
|
|
})
|
|
},
|
|
// getCode() {
|
|
// this.$http.post(this.urlOptions.getCodeURL)
|
|
// .then(({ data: res }) => {
|
|
// if (res.code === 0) {
|
|
// console.log(res);
|
|
// this.dataForm.customSamplingCode = res.data
|
|
// }
|
|
// })
|
|
// .catch(() => {
|
|
// });
|
|
// },
|
|
// 获取信息
|
|
getInfo() {
|
|
this.$http
|
|
.get(`/quality/qmsTransferRecords/${this.dataForm.id}`)
|
|
.then(({ data: res }) => {
|
|
if (res.code !== 0) {
|
|
return this.$message.error(res.msg);
|
|
}
|
|
this.dataForm = {
|
|
...this.dataForm,
|
|
...res.data,
|
|
};
|
|
})
|
|
.catch(() => {});
|
|
},
|
|
// 表单提交
|
|
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: () => {
|
|
console.log(1111);
|
|
this.visible = false;
|
|
this.$emit("successSubmit");
|
|
},
|
|
});
|
|
})
|
|
.catch(() => {});
|
|
});
|
|
},
|
|
1000,
|
|
{ leading: true, trailing: false }
|
|
),
|
|
},
|
|
};
|
|
</script>
|