质量管理
This commit is contained in:
65
src/views/extend/processEquValueBom/SmallTitle.vue
Normal file
65
src/views/extend/processEquValueBom/SmallTitle.vue
Normal file
@@ -0,0 +1,65 @@
|
||||
<!--
|
||||
* @Author: zhp
|
||||
* @Date: 2023-11-07 19:28:13
|
||||
* @LastEditTime: 2023-11-08 14:11:43
|
||||
* @LastEditors: zhp
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<div :class="[className, { 'p-0': noPadding }]">
|
||||
<slot />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
size: {
|
||||
// 取值范围: xl lg md sm
|
||||
type: String,
|
||||
default: 'de',
|
||||
validator: function (val) {
|
||||
return ['xl', 'lg', 'de', 'md', 'sm'].indexOf(val) !== -1;
|
||||
},
|
||||
},
|
||||
noPadding: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
className: function () {
|
||||
return `${this.size}-title`;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
$pxls: (xl, 28px) (lg, 24px) (de, 20px) (md, 18px) (sm, 16px);
|
||||
$mgr: 8px;
|
||||
@each $size, $height in $pxls {
|
||||
.#{$size}-title {
|
||||
font-size: 18px;
|
||||
line-height: $height;
|
||||
color: #000;
|
||||
font-weight: 500;
|
||||
font-family: '微软雅黑', 'Microsoft YaHei', Arial, Helvetica, sans-serif;
|
||||
|
||||
&::before {
|
||||
content: '';
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
width: 4px;
|
||||
height: $height + 2px;
|
||||
border-radius: 1px;
|
||||
margin-right: $mgr;
|
||||
background-color: #0b58ff;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.p-0 {
|
||||
padding: 0;
|
||||
}
|
||||
</style>
|
||||
391
src/views/extend/processEquValueBom/add-or-updata.vue
Normal file
391
src/views/extend/processEquValueBom/add-or-updata.vue
Normal file
@@ -0,0 +1,391 @@
|
||||
<!--
|
||||
* @Author: zwq
|
||||
* @Date: 2021-11-18 14:16:25
|
||||
* @LastEditors: zhp
|
||||
* @LastEditTime: 2023-11-09 14:49:16
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<el-drawer :visible.sync="visible" :show-close="false" :wrapper-closable="false" class="drawer" size="50%">
|
||||
<small-title slot="title" :no-padding="true">
|
||||
{{ isdetail ? '详情' : !dataForm.id ? '新增' : '编辑' }}
|
||||
</small-title>
|
||||
<div class="content">
|
||||
<div class="visual-part">
|
||||
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()"
|
||||
label-width="100px" label-position="top">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="设备名称" prop="equipmentId">
|
||||
<el-select v-model="dataForm.equipmentId" filterable :disabled="isdetail" style="width: 100%"
|
||||
@change="getCode" placeholder="请选择设备名称">
|
||||
<el-option v-for="dict in equipmentList" :key=" dict.id" :label="dict.name" :value="dict.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="设备编码" prop="equipmentCode">
|
||||
<el-input v-model="dataForm.equipmentCode" clearable :disabled="isdetail" placeholder="请输入设备编码" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="参数Bom编码" prop="code">
|
||||
<el-input v-model="dataForm.code" clearable :disabled="isdetail" placeholder="请输入参数Bom编码" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="设备参数BOM名称" prop="name">
|
||||
<el-input v-model="dataForm.name" clearable :disabled="isdetail" placeholder="请输入设备参数BOM名称" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="当前状态" prop="enabled">
|
||||
<el-switch v-model="dataForm.enabled" :active-value="1" :inactive-value="0" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="dataForm.remark" :disabled="isdetail" clearable placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<div class="drawer-body__footer">
|
||||
<el-button style="" @click="goback()">取消</el-button>
|
||||
<el-button v-if="isdetail" type="primary" @click="goEdit()">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button v-else type="primary" @click="dataFormSubmit()">确定</el-button>
|
||||
</div>
|
||||
|
||||
<div class="attr-list" v-if="idAttrShow">
|
||||
<small-title style="margin: 16px 0; padding-left: 8px" :no-padding="true">
|
||||
设备物料明细
|
||||
</small-title>
|
||||
|
||||
<div v-if="!isdetail" class="action_btn">
|
||||
<template>
|
||||
<span style="display: inline-block;">
|
||||
<el-button type="text" @click="addNew()" icon="el-icon-plus">新增</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</div>
|
||||
<base-table :table-props="tableProps" :page="listQuery.pageNo" :limit="listQuery.pageSize"
|
||||
:table-data="productAttrList">
|
||||
<method-btn v-if="!isdetail" slot="handleBtn" :width="120" label="操作" :method-list="tableBtn"
|
||||
@clickBtn="handleClick" />
|
||||
</base-table>
|
||||
<pagination v-show="listQuery.total > 0" :total="listQuery.total" :page.sync="listQuery.pageNo"
|
||||
:limit.sync="listQuery.pageSize" :page-sizes="[5, 10, 15]" @pagination="getList" />
|
||||
|
||||
<div class="drawer-body__footer">
|
||||
<el-button type="primary" @click="goback()">关闭</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<attr-add v-if="addOrUpdateVisible" ref="addOrUpdate" :product-id="dataForm.id" @refreshDataList="getList" />
|
||||
</el-drawer>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import basicAdd from '../../core/mixins/basic-add';
|
||||
import {
|
||||
getProcessEquValueBom,
|
||||
createProcessEquValueBom,
|
||||
updateProcessEquValueBom,
|
||||
getEquipmentList,
|
||||
processEquValueBomDetPage,
|
||||
deleteProcessEquValueBomDet
|
||||
} from '@/api/extend/processEquValueBom';
|
||||
import SmallTitle from './SmallTitle';
|
||||
import { parseTime } from '../../core/mixins/code-filter';
|
||||
import attrAdd from './attr-add';
|
||||
// import {DICT_TYPE, getDictDatas} from "@/utils/dict";
|
||||
|
||||
const tableBtn = [
|
||||
{
|
||||
type: 'edit',
|
||||
btnName: '编辑',
|
||||
},
|
||||
{
|
||||
type: 'delete',
|
||||
btnName: '删除',
|
||||
},
|
||||
];
|
||||
const tableProps = [
|
||||
{
|
||||
prop: 'valueName',
|
||||
label: '参数名称',
|
||||
},
|
||||
{
|
||||
prop: 'valueCode',
|
||||
label: '参数编码',
|
||||
},
|
||||
{
|
||||
prop: 'standardMinValue',
|
||||
label: '最小值(标准)',
|
||||
},
|
||||
{
|
||||
prop: 'standardMaxValue',
|
||||
label: '最大值(标准)',
|
||||
},
|
||||
{
|
||||
prop: 'minValue',
|
||||
label: '最小值(工艺)',
|
||||
},
|
||||
{
|
||||
prop: 'manValue',
|
||||
label: '最大值(工艺)',
|
||||
},
|
||||
{
|
||||
prop: 'defaultValue',
|
||||
label: '标准值(工艺)',
|
||||
},
|
||||
{
|
||||
prop: 'remark',
|
||||
label: '备注',
|
||||
},
|
||||
];
|
||||
|
||||
const topBtnConfig = [
|
||||
{
|
||||
type: 'add',
|
||||
btnName: 'btn.add'
|
||||
}
|
||||
]
|
||||
|
||||
export default {
|
||||
mixins: [basicAdd],
|
||||
components: { SmallTitle, attrAdd },
|
||||
data() {
|
||||
return {
|
||||
tableBtn,
|
||||
tableProps,
|
||||
topBtnConfig,
|
||||
addOrUpdateVisible: false,
|
||||
urlOptions: {
|
||||
isGetCode: false,
|
||||
// codeURL: getCode,
|
||||
createURL:createProcessEquValueBom,
|
||||
updateURL: updateProcessEquValueBom,
|
||||
infoURL: getProcessEquValueBom,
|
||||
},
|
||||
listQuery: {
|
||||
pageSize: 10,
|
||||
pageNo: 1,
|
||||
total: 0,
|
||||
},
|
||||
equipmentList:[],
|
||||
dataForm: {
|
||||
id: undefined,
|
||||
code: undefined,
|
||||
name: '',
|
||||
equipmentId: undefined,
|
||||
equipmentCode: undefined,
|
||||
enabled:undefined,
|
||||
// area: undefined,
|
||||
// specifications: undefined,
|
||||
// processTime: 0,
|
||||
remark: undefined,
|
||||
// unit: undefined
|
||||
},
|
||||
productAttrList: [],
|
||||
visible: false,
|
||||
isdetail: false,
|
||||
idAttrShow: false,
|
||||
dataRule: {
|
||||
// code: [{ required: true, message: "设备物料编码不能为空", trigger: "blur" }],
|
||||
name: [{ required: true, message: "设备参数名称不能为空", trigger: "blur" }],
|
||||
equipmentId: [{ required: true, message: "设备名称不能为空", trigger: "change" }],
|
||||
// : [{ required: true, message: "产品类型不能为空", trigger: "change" }],
|
||||
// processTime: [{ required: true, message: "产线生产单位用时不能为空", trigger: "blur" }]
|
||||
}
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.getDict()
|
||||
},
|
||||
methods: {
|
||||
getCode(val) {
|
||||
this.equipmentList.forEach((ele) => {
|
||||
if (val === ele.id) {
|
||||
this.dataForm.equipmentCode = ele.code
|
||||
}
|
||||
})
|
||||
},
|
||||
// clickTopBtn(val) {
|
||||
// if (val === 'add') {
|
||||
// this.addNew()
|
||||
// }
|
||||
// },
|
||||
initData() {
|
||||
this.productAttrList.splice(0);
|
||||
this.listQuery.total = 0;
|
||||
},
|
||||
getDict() {
|
||||
getEquipmentList().then((res) => {
|
||||
|
||||
// console.log(res);
|
||||
// console.log(response);
|
||||
this.equipmentList = res.data
|
||||
})
|
||||
},
|
||||
handleClick(raw) {
|
||||
if (raw.type === 'delete') {
|
||||
this.$confirm(
|
||||
`确定对${
|
||||
raw.data.valueName
|
||||
? '[物料名称为' + raw.data.valueName + ']'
|
||||
: '[序号为' + raw.data.valueName + ']'
|
||||
}进行删除操作?`,
|
||||
'提示',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
}
|
||||
)
|
||||
.then(() => {
|
||||
deleteProcessEquValueBomDet(raw.data.id).then(({ data }) => {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getList();
|
||||
},
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch(() => {});
|
||||
} else {
|
||||
this.addNew(raw.data.id);
|
||||
}
|
||||
},
|
||||
getList() {
|
||||
// 获取产品属性列表
|
||||
processEquValueBomDetPage({
|
||||
...this.listQuery,
|
||||
bomId: this.dataForm.id,
|
||||
}).then((response) => {
|
||||
this.productAttrList = response.data.list;
|
||||
this.listQuery.total = response.data.total;
|
||||
});
|
||||
},
|
||||
init(id, isdetail) {
|
||||
this.initData();
|
||||
console.log(isdetail);
|
||||
this.isdetail = isdetail || false;
|
||||
this.dataForm.id = id || undefined;
|
||||
this.visible = true;
|
||||
if (id) {
|
||||
this.idAttrShow = true
|
||||
} else {
|
||||
this.idAttrShow = false
|
||||
}
|
||||
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields();
|
||||
|
||||
if (this.dataForm.id) {
|
||||
// 获取产品详情
|
||||
this.urlOptions.infoURL({
|
||||
bomId: id,
|
||||
pageNo: 1,
|
||||
pageSize:10
|
||||
}).then(response => {
|
||||
this.dataForm = response.data
|
||||
// this.dataForm.unit = String(this.dataForm.unit)
|
||||
// this.dataForm.ValueType = String(this.dataForm.ValueType)
|
||||
// this.dataForm.productType = String(this.dataForm.productType)
|
||||
});
|
||||
// 获取产品属性列表
|
||||
this.getList();
|
||||
} else {
|
||||
if (this.urlOptions.isGetCode) {
|
||||
this.getCode()
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
goback() {
|
||||
this.$emit('refreshDataList');
|
||||
this.visible = false;
|
||||
// this.initData();
|
||||
},
|
||||
goEdit() {
|
||||
this.isdetail = false;
|
||||
},
|
||||
// 新增 / 修改
|
||||
addNew(id) {
|
||||
this.addOrUpdateVisible = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id,this.dataForm.id,this.dataForm.equipmentId);
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
.drawer >>> .el-drawer {
|
||||
border-radius: 8px 0 0 8px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.drawer >>> .el-form-item__label {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.drawer >>> .el-drawer__header {
|
||||
margin: 0;
|
||||
padding: 32px 32px 24px;
|
||||
border-bottom: 1px solid #dcdfe6;
|
||||
}
|
||||
.drawer >>> .el-drawer__body {
|
||||
flex: 1;
|
||||
height: 1px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.drawer >>> .content {
|
||||
padding: 30px 24px;
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
/* height: 100%; */
|
||||
}
|
||||
|
||||
.drawer >>> .visual-part {
|
||||
flex: 1 auto;
|
||||
max-height: 76vh;
|
||||
overflow: hidden;
|
||||
overflow-y: scroll;
|
||||
padding-right: 10px; /* 调整滚动条样式 */
|
||||
}
|
||||
|
||||
.drawer >>> .el-form,
|
||||
.drawer >>> .attr-list {
|
||||
padding: 0 16px;
|
||||
}
|
||||
|
||||
.drawer-body__footer {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
padding: 18px;
|
||||
}
|
||||
.action_btn {
|
||||
float: right;
|
||||
margin: 5px 15px;
|
||||
font-size: 14px;
|
||||
}
|
||||
.add {
|
||||
color: #0b58ff;
|
||||
}
|
||||
</style>
|
||||
189
src/views/extend/processEquValueBom/attr-add.vue
Normal file
189
src/views/extend/processEquValueBom/attr-add.vue
Normal file
@@ -0,0 +1,189 @@
|
||||
<!--
|
||||
* @Author: zhp
|
||||
* @Date: 2023-11-08 15:30:27
|
||||
* @LastEditTime: 2023-11-09 14:44:49
|
||||
* @LastEditors: zhp
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<el-dialog :visible.sync="visible" :width="'35%'" :append-to-body="true" :close-on-click-modal="false" class="dialog">
|
||||
<template #title>
|
||||
<slot name="title">
|
||||
<div class="titleStyle">
|
||||
{{ !dataForm.id ? '新增' : '编辑' }}
|
||||
</div>
|
||||
</slot>
|
||||
</template>
|
||||
|
||||
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="100px"
|
||||
@keyup.enter.native="dataFormSubmit()">
|
||||
<el-form-item label="参数名称" prop="paramId">
|
||||
<el-select v-model="dataForm.paramId" filterable placeholder="参数名称" @change="getData">
|
||||
<el-option v-for="dict in materialList" :key=" dict.id" :label="dict.name" :value="dict.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="参数编码" prop="code">
|
||||
<el-input v-model="dataForm.code" placeholder="请输入参数编码" clearable />
|
||||
</el-form-item> -->
|
||||
<el-form-item label="标准最小值" prop="standardMinValue">
|
||||
<el-input v-model="dataForm.standardMinValue" placeholder="请输入标准最小值" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="标准最大值" prop="standardMaxValue">
|
||||
<el-input v-model="dataForm.standardMaxValue" placeholder="请输入标准最大值" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="工艺最小值" prop="minValue">
|
||||
<el-input v-model="dataForm.minValue" placeholder="请输入工艺最小值" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="工艺最大值" prop="maxValue">
|
||||
<el-input v-model="dataForm.maxValue" placeholder="请输入工艺最大值" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="工艺标准值" prop="defaultValue">
|
||||
<el-input v-model="dataForm.defaultValue" placeholder="请输入工艺标准值" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="dataForm.remark" placeholder="请输入备注" clearable />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row style="text-align: right">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
|
||||
</el-row>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getProcessEquValueBomDet,
|
||||
createProcessEquValueBomDet,
|
||||
updateProcessEquValueBomDet,
|
||||
getValueList
|
||||
} from '@/api/extend/processEquValueBom';
|
||||
|
||||
export default {
|
||||
props: {
|
||||
productId: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
materialList:[],
|
||||
dataForm: {
|
||||
id: undefined,
|
||||
bomId: undefined,
|
||||
paramId:undefined,
|
||||
minValue:undefined,
|
||||
maxValue: undefined,
|
||||
defaultValue: undefined,
|
||||
standardMinValue: undefined,
|
||||
standardMaxValue: undefined,
|
||||
remark:null
|
||||
},
|
||||
equipmentId:null,
|
||||
dataRule: {
|
||||
attrName: [{ required: true, message: '名称不能为空', trigger: 'blur' }],
|
||||
},
|
||||
};
|
||||
},
|
||||
mounted () {
|
||||
},
|
||||
methods: {
|
||||
getData(val) {
|
||||
this.materialList.forEach((ele) => {
|
||||
if (val === ele.id) {
|
||||
console.log(ele)
|
||||
this.dataForm.code = ele.code
|
||||
this.dataForm.standardMinValue = ele.minValue
|
||||
this.dataForm.standardMaxValue = ele.maxValue
|
||||
// this.dataForm.code = ele.id
|
||||
}
|
||||
})
|
||||
},
|
||||
init(id, bomId, equipmentId) {
|
||||
console.log(equipmentId);
|
||||
this.dataForm.id = id || '';
|
||||
this.dataForm.bomId = bomId || '';
|
||||
this.equipmentId = equipmentId
|
||||
this.getDict()
|
||||
console.log(bomId);
|
||||
this.visible = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields();
|
||||
if (this.dataForm.id) {
|
||||
getProcessEquValueBomDet({
|
||||
id: this.dataForm.id
|
||||
}).then((res) => {
|
||||
this.dataForm = res.data;
|
||||
// this.dataForm.materialId = materialId;
|
||||
// this.dataForm.value = value;
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
getDict() {
|
||||
console.log(this.equipmentId);
|
||||
getValueList({
|
||||
id: this.equipmentId
|
||||
}).then((res) => [
|
||||
this.materialList = res.data,
|
||||
console.log(res)
|
||||
])
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
// 修改的提交
|
||||
if (this.dataForm.id) {
|
||||
updateProcessEquValueBomDet({
|
||||
...this.dataForm,
|
||||
productId: this.productId,
|
||||
}).then((response) => {
|
||||
this.$modal.msgSuccess('修改成功');
|
||||
this.visible = false;
|
||||
this.$emit('refreshDataList');
|
||||
});
|
||||
return;
|
||||
}
|
||||
// 添加的提交
|
||||
createProcessEquValueBomDet({
|
||||
...this.dataForm,
|
||||
productId: this.productId,
|
||||
}).then((response) => {
|
||||
this.$modal.msgSuccess('新增成功');
|
||||
this.visible = false;
|
||||
this.$emit('refreshDataList');
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.dialog >>> .el-dialog__body {
|
||||
padding: 30px 24px;
|
||||
}
|
||||
.dialog >>> .el-dialog__header {
|
||||
font-size: 16px;
|
||||
color: rgba(0, 0, 0, 0.85);
|
||||
font-weight: 500;
|
||||
padding: 13px 24px;
|
||||
border-bottom: 1px solid #e9e9e9;
|
||||
}
|
||||
.dialog >>> .el-dialog__header .titleStyle::before {
|
||||
content: '';
|
||||
display: inline-block;
|
||||
width: 4px;
|
||||
height: 16px;
|
||||
background-color: #0b58ff;
|
||||
border-radius: 1px;
|
||||
margin-right: 8px;
|
||||
position: relative;
|
||||
top: 2px;
|
||||
}
|
||||
</style>
|
||||
203
src/views/extend/processEquValueBom/index.vue
Normal file
203
src/views/extend/processEquValueBom/index.vue
Normal file
@@ -0,0 +1,203 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" />
|
||||
<base-table v-loading="dataListLoading" :table-props="tableProps" :page="listQuery.pageNo"
|
||||
:limit="listQuery.pageSize" :table-data="tableData">
|
||||
<method-btn v-if="tableBtn.length" slot="handleBtn" :width="120" label="操作" :method-list="tableBtn"
|
||||
@clickBtn="handleClick" />
|
||||
</base-table>
|
||||
<pagination :limit.sync="listQuery.pageSize" :page.sync="listQuery.pageNo" :total="listQuery.total"
|
||||
@pagination="getDataList" />
|
||||
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList" />
|
||||
<!-- <detail-or-update v-if="detailOrUpdateVisible" ref="detailOrUpdate" @refreshDataList="successSubmit" /> -->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AddOrUpdate from './add-or-updata';
|
||||
// import DetailOrUpdate from './detail-or-updata';
|
||||
|
||||
import basicPage from '../../core/mixins/basic-page';
|
||||
import StatusBtn from './statusBtn.vue'
|
||||
import {
|
||||
processEquValueBomPage,
|
||||
deleteProcessEquValueBom,
|
||||
getEquipmentList
|
||||
} from '@/api/extend/processEquValueBom';
|
||||
|
||||
const tableProps = [
|
||||
{
|
||||
prop: 'equipmentCode',
|
||||
label: '设备编码',
|
||||
},
|
||||
{
|
||||
prop: 'equipmentName',
|
||||
label: '设备名称'
|
||||
},
|
||||
{
|
||||
prop: 'code',
|
||||
label: '参数配方编码'
|
||||
},
|
||||
{
|
||||
prop: 'name',
|
||||
label: '参数配方名称'
|
||||
},
|
||||
{
|
||||
prop: 'enabled',
|
||||
label: '当前激活状态',
|
||||
subcomponent: StatusBtn
|
||||
},
|
||||
{
|
||||
prop: 'remark',
|
||||
label: '备注'
|
||||
},
|
||||
];
|
||||
|
||||
export default {
|
||||
mixins: [basicPage],
|
||||
data() {
|
||||
return {
|
||||
urlOptions: {
|
||||
getDataListURL: processEquValueBomPage,
|
||||
deleteURL: deleteProcessEquValueBom,
|
||||
// exportURL: exportFactoryExcel,
|
||||
},
|
||||
tableProps,
|
||||
tableBtn: [
|
||||
this.$auth.hasPermi(`extend:process-equ-value-bom:update`)
|
||||
? {
|
||||
type: 'edit',
|
||||
btnName: '编辑',
|
||||
}
|
||||
: undefined,
|
||||
this.$auth.hasPermi(`extend:process-equ-value-bom:detail`)
|
||||
? {
|
||||
type: 'detail',
|
||||
btnName: '详情',
|
||||
}
|
||||
: undefined,
|
||||
this.$auth.hasPermi(`extend:process-equ-value-bom:delete`)
|
||||
? {
|
||||
type: 'delete',
|
||||
btnName: '删除',
|
||||
}
|
||||
: undefined,
|
||||
].filter((v)=>v),
|
||||
tableData: [],
|
||||
detailOrUpdateVisible:false,
|
||||
formConfig: [
|
||||
{
|
||||
type: 'select',
|
||||
label: '设备名称',
|
||||
selectOptions: [],
|
||||
labelField: 'name',
|
||||
valueField: 'id',
|
||||
param: 'equipmentId',
|
||||
},
|
||||
{
|
||||
type: 'input',
|
||||
label: '物料配方名称',
|
||||
// selectOptions: [],
|
||||
// labelField: 'name',
|
||||
// valueField: 'id',
|
||||
param: 'name',
|
||||
},
|
||||
{
|
||||
type: 'input',
|
||||
label: '物料配方编码',
|
||||
// selectOptions: [],
|
||||
// labelField: 'name',
|
||||
// valueField: 'id',
|
||||
param: 'code',
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
btnName: '查询',
|
||||
name: 'search',
|
||||
color: 'primary',
|
||||
},
|
||||
{
|
||||
type: 'separate',
|
||||
},
|
||||
{
|
||||
type: this.$auth.hasPermi('extend:process-equ-value-bom:create') ? 'button' : '',
|
||||
btnName: '新增',
|
||||
name: 'add',
|
||||
color: 'success',
|
||||
plain: true
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
components: {
|
||||
AddOrUpdate,
|
||||
// DetailOrUpdate
|
||||
},
|
||||
created() {
|
||||
this.getDict()
|
||||
},
|
||||
methods: {
|
||||
otherMethods(val) {
|
||||
if (val.type === 'detail') {
|
||||
this.addOrUpdateVisible = true;
|
||||
this.addOrEditTitle = "详情";
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(val.data.id, true);
|
||||
});
|
||||
}
|
||||
},
|
||||
getDict() {
|
||||
getEquipmentList().then((res) => {
|
||||
// console.log(res);
|
||||
// console.log(response);
|
||||
this.formConfig[0].selectOptions = res.data.map((item) => {
|
||||
return {
|
||||
name: item.name,
|
||||
id: item.id
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
// 获取数据列表
|
||||
getDataList() {
|
||||
this.dataListLoading = true;
|
||||
this.urlOptions.getDataListURL(this.listQuery).then(response => {
|
||||
this.tableData = response.data.list;
|
||||
this.listQuery.total = response.data.total;
|
||||
this.dataListLoading = false;
|
||||
});
|
||||
},
|
||||
buttonClick(val) {
|
||||
switch (val.btnName) {
|
||||
case 'search':
|
||||
this.listQuery.pageNo = 1;
|
||||
this.listQuery.pageSize = 10;
|
||||
this.listQuery.equipmentId = val.equipmentId ? val.equipmentId : undefined;
|
||||
this.listQuery.name = val.name ? val.name : undefined;
|
||||
this.listQuery.name = val.name ? val.name : undefined;
|
||||
this.getDataList();
|
||||
break;
|
||||
case 'reset':
|
||||
this.$refs.searchBarForm.resetForm();
|
||||
this.listQuery = {
|
||||
pageSize: 10,
|
||||
pageNo: 1,
|
||||
total: 1,
|
||||
};
|
||||
this.getDataList();
|
||||
break;
|
||||
case 'add':
|
||||
this.addOrEditTitle = '新增';
|
||||
this.addOrUpdateVisible = true;
|
||||
this.addOrUpdateHandle();
|
||||
break;
|
||||
case 'export':
|
||||
this.handleExport();
|
||||
break;
|
||||
default:
|
||||
console.log(val);
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
67
src/views/extend/processEquValueBom/statusBtn.vue
Normal file
67
src/views/extend/processEquValueBom/statusBtn.vue
Normal file
@@ -0,0 +1,67 @@
|
||||
<!--
|
||||
* @Author: zhp
|
||||
* @Date: 2023-11-08 14:00:52
|
||||
* @LastEditTime: 2023-11-09 09:59:53
|
||||
* @LastEditors: zhp
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<el-switch v-model="state" type="text" size="small" @change="changeHandler" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
// processEquMaterialBomPage,
|
||||
updateProcessEquValueBom,
|
||||
// getWorkOrderList,
|
||||
// getTeamList
|
||||
} from '@/api/extend/processEquValueBom';
|
||||
export default {
|
||||
props: {
|
||||
injectData: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
state: false
|
||||
}
|
||||
},
|
||||
// computed: {
|
||||
// readonly() {
|
||||
// return !!this.injectData.readonly
|
||||
// }
|
||||
// },
|
||||
mounted() {
|
||||
this.mapToState()
|
||||
},
|
||||
|
||||
methods: {
|
||||
mapToState() {
|
||||
if (this.injectData.prop === 'enabled') {
|
||||
this.state = this.injectData.enabled === 1 ? true : false
|
||||
}
|
||||
},
|
||||
changeHandler() {
|
||||
// let params = {}
|
||||
let payload = {}
|
||||
// params.name = 'state'
|
||||
payload.id = this.injectData.id
|
||||
payload.enabled = this.state ? 1 : 0
|
||||
payload.code = this.injectData.code
|
||||
payload.name = this.injectData.name
|
||||
payload.equipmentId = this.injectData.equipmentId
|
||||
payload.remark = this.injectData.remark
|
||||
|
||||
// params.payload = payload
|
||||
updateProcessEquValueBom(payload).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.$modal.msgSuccess("操作成功");
|
||||
}
|
||||
})
|
||||
// this.$emit('emitData', params)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user