qms/src/views/modules/gage/components/gageSearch.vue
2023-07-14 15:36:21 +08:00

223 lines
6.0 KiB
Vue

<!--
* @Author: zwq
* @Date: 2023-01-04 10:29:40
* @LastEditors: zhp
* @LastEditTime: 2023-07-13 09:13:44
* @Description:
-->
<template>
<el-form :model="dataForm" ref="dataForm" @keyup.enter.native="dataFormSubmitHandle()" label-width="120px">
<el-form-item prop="code" :label="$t('gage.code')">
<el-input v-model="dataForm.code" :placeholder="$t('gage.code')"></el-input>
</el-form-item>
<el-form-item prop="name" :label="$t('gage.name')">
<el-input v-model="dataForm.customSamplingCode" :placeholder="$t('gage.name')"></el-input>
</el-form-item>
<el-form-item prop="measuringToolAccuracy" :label="$t('gage.measuringToolAccuracy')">
<el-input v-model="dataForm.measuringToolAccuracy" :placeholder="$t('gage.measuringToolAccuracy')"></el-input>
</el-form-item>
<el-form-item prop="gageStatus" :label="$t('gage.gageStatus')">
<el-select v-model="dataForm.gageStatus" :placeholder="$t('gage.gageStatus')">
<el-option v-for="item in gageStatusList" :key="item.id" :label="item.name" :value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item prop="gageTypeId" :label="$t('gage.gageTypeName')">
<el-select v-model="dataForm.gageTypeId" :placeholder="$t('gage.gageTypeName')">
<el-option v-for="item in gageTypeList" :key="item.id" :label="item.name" :value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item prop="belongPerson" :label="$t('gage.belongPersonName')">
<el-select v-model="dataForm.belongPerson" :placeholder="$t('gage.belongPersonName')">
<el-option v-for="item in userList" :key="item.id" :label="item.realName" :value="item.id">
</el-option>
</el-select>
</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: "/sys/params/",
// infoURL: "/sys/params",
// },
urlOptions: {
getCustomerPageListURL: "/quality/qmsTransferScheme/page",
getGageTypeList: '/gage/qmsGageType/page',
getUserList: '/sys/user/page',
},
visible: false,
gageStatusList: [
{
id: 0,
name: '在用'
},
{
id: 1,
name: '备用'
},
{
id: 2,
name: '停用'
},
{
id: 3,
name: '封存'
},
{
id: 4,
name: '报废'
},
{
id: 5,
name: '降级使用'
}
],
listQuery: {
page: 1,
limit:999
},
gageTypeList: [],
userList:[],
dataForm: {
name: null,
code: null,
measuringToolAccuracy: null,
gageStatus: null,
belongPerson: null,
gageTypeId: null,
},
options: [{
value: 0,
label: '不可用'
},
{
value: 1,
label: '可用'
}],
};
},
computed: {
// dataRule() {
// return {
// paramCode: [
// {
// required: true,
// message: this.$t("validate.required"),
// trigger: "blur",
// },
// ],
// paramValue: [
// {
// required: true,
// message: this.$t("validate.required"),
// trigger: "blur",
// },
// ],
// };
// },
},
mounted () {
this.getDict();
},
methods: {
// init(id) {
// this.dataForm.id = id || "";
// this.visible = true;
// this.$nextTick(() => {
// this.$refs["dataForm"].resetFields();
// if (this.dataForm.id) {
// this.getInfo();
// }
// });
// },
// 获取信息
// getInfo() {
// this.$http
// .get(`/sys/params/${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.getGageTypeList, {
params: this.listQuery
})
.then(({ data: res }) => {
if (res.code === 0) {
console.log(res.data);
this.gageTypeList = res.data.list
}
})
.catch(() => {
})
this.$http
.get(this.urlOptions.getUserList, {
params: this.listQuery
})
.then(({ data: res }) => {
if (res.code === 0) {
console.log(res.data);
this.userList = res.data.list
}
})
.catch(() => {
})
},
handleConditionSearch() {
this.$emit("successSubmit", this.dataForm);
},
// dataFormSubmitHandle: debounce(
// function () {
// // console.log(1111);
// // this.visible = false;
// this.$emit("successSubmit", this.dataForm.key);
// // this.$refs["dataForm"].validate((valid) => {
// // if (!valid) {
// // return false;
// // }
// // this.$http[!this.dataForm.id ? "post" : "put"](
// // "/sys/params",
// // 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: () => {
// // },
// // });
// // })
// // .catch(() => {});
// // });
// },
// 1000,
// { leading: true, trailing: false }
// ),
},
};
</script>