| | |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary">查询</el-button> |
| | | <el-button type="primary" plain>重置</el-button> |
| | | <el-button type="primary" @click="filteredTableData">查询</el-button> |
| | | <el-button type="primary" plain @click="resetBtn">重置</el-button> |
| | | <!-- <el-button type="text">高级搜索<i class="el-icon-arrow-down el-icon--right" /></el-button> --> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | <div class="serve-btn"> |
| | | <el-button type="primary" icon="el-icon-plus">新增人员</el-button> |
| | | <el-button type="primary" icon="el-icon-plus" @click="showFormInfo">{{ selectedNodeType }}</el-button> |
| | | </div> |
| | | </div> |
| | | <div class="table-box"> |
| | |
| | | label="序号" |
| | | min-width="50" |
| | | /> |
| | | <!-- 复用 --> |
| | | <el-table-column |
| | | v-for="(item,index) in tablespecifications" |
| | | :key="index" |
| | |
| | | placement="top" |
| | | width="30" |
| | | > |
| | | <div style="text-align: center; margin: 0"> |
| | | <div @click=" getRowID(scope.row)" style="text-align: center; margin: 0"> |
| | | <div> |
| | | <el-button size="mini" type="text">编辑</el-button> |
| | | <el-button size="mini" @click="dialogFormVisible4=true" type="text">编辑</el-button> |
| | | </div> |
| | | <div> |
| | | <el-button size="mini" type="text">停用</el-button> |
| | | <el-button size="mini" @click="dialogFormVisible5 = true" type="text">停用</el-button> |
| | | </div> |
| | | </div> |
| | | <el-button slot="reference" type="text"><i class="el-icon-more" /></el-button> |
| | |
| | | </template> |
| | | </el-table-column> |
| | | </template> |
| | | |
| | | </el-table> |
| | | <!-- 弹出表单页 --> |
| | | <div> |
| | | <!-- 添加标准 --> |
| | | <el-dialog title="添加标准" :visible.sync="dialogFormVisible1"> |
| | | <el-form ref="standardForm" :model="standardForm" :rules="rulesStandard"> |
| | | <el-form-item label="标准号" :label-width="formLabelWidth" prop="standardnumber"> |
| | | <el-input v-model="standardForm.standardnumber" autocomplete="off" /> |
| | | </el-form-item> |
| | | <el-form-item label="标准名称" :label-width="formLabelWidth" prop="standardname"> |
| | | <el-input v-model="standardForm.standardname" autocomplete="off" /> |
| | | </el-form-item> |
| | | <el-form-item label="英文名称" :label-width="formLabelWidth" prop="standardenname"> |
| | | <el-input v-model="standardForm.engname" autocomplete="off" /> |
| | | </el-form-item> |
| | | <el-form-item label="父级分类" :label-width="formLabelWidth"> |
| | | <el-select v-model="standardForm.type" placeholder="请选择"> |
| | | <el-option label="原材料" value="0" /> |
| | | <el-option label="电线电缆" value="1" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button @click="dialogFormVisible1 = false">取 消</el-button> |
| | | <el-button type="primary" @click="submitForm">确 定</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | <!-- 添加型号 --> |
| | | <el-dialog title="添加型号" :visible.sync="dialogFormVisible2"> |
| | | <el-form ref="form" :model="modelForm" :rules="rulesModel"> |
| | | <el-form-item label="型号" :label-width="formLabelWidth" prop="model"> |
| | | <el-input v-model="modelForm.model" autocomplete="off" /> |
| | | </el-form-item> |
| | | <el-form-item label="型号名称" :label-width="formLabelWidth" prop="modelname"> |
| | | <el-input v-model="modelForm.modelname" autocomplete="off" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button @click="dialogFormVisible2 = false">取 消</el-button> |
| | | <el-button type="primary" @click="submitForm()">确 定</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | <!-- 添加规格 --> |
| | | <el-dialog title="添加规格" :visible.sync="dialogFormVisible3"> |
| | | <el-form ref="form" :model="specificationForm" :rules="rulesspecification"> |
| | | <el-form-item label="规格名称" :label-width="formLabelWidth" prop="name"> |
| | | <el-input v-model="specificationForm.name" autocomplete="off" /> |
| | | </el-form-item> |
| | | <el-form-item label="规格编号" :label-width="formLabelWidth" prop="number"> |
| | | <el-input v-model="specificationForm.number" autocomplete="off" /> |
| | | </el-form-item> |
| | | <el-form-item label="上方填写生产指令号" :label-width="formLabelWidth" prop="instruct"> |
| | | <el-input v-model="specificationForm.instruct" autocomplete="off" /> |
| | | </el-form-item> |
| | | <el-form-item label="电压等级" :label-width="formLabelWidth"> |
| | | <el-select v-model="specificationForm.voltageLevel" placeholder="请选择电压等级"> |
| | | <el-option label="分类1" value="test" /> |
| | | <el-option label="分类2" value="2" /> |
| | | <el-option label="分类3" value="3" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="主线芯截面" :label-width="formLabelWidth"> |
| | | <el-select v-model="specificationForm.crossSection" placeholder="请选择主线芯截面"> |
| | | <el-option label="分类1" value="test" /> |
| | | <el-option label="分类2" value="2" /> |
| | | <el-option label="分类3" value="3" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="主线芯芯数" :label-width="formLabelWidth"> |
| | | <el-select v-model="specificationForm.numberOfCores" placeholder="请选择主线芯芯数"> |
| | | <el-option label="分类1" value="test" /> |
| | | <el-option label="分类2" value="2" /> |
| | | <el-option label="分类3" value="3" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button @click="dialogFormVisible3 = false">取 消</el-button> |
| | | <el-button type="primary" @click="submitForm()">确 定</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | <!-- 编辑规格 --> |
| | | <el-dialog title="编辑规格" :visible.sync="dialogFormVisible4"> |
| | | <el-form ref="form" :model="editSpeForm" :rules="rulesspecification"> |
| | | <el-form-item label="规格名称" :label-width="formLabelWidth" prop="name"> |
| | | <el-input v-model="editSpeForm.name" autocomplete="off" /> |
| | | </el-form-item> |
| | | <el-form-item label="规格编号" :label-width="formLabelWidth" prop="number"> |
| | | <el-input v-model="editSpeForm.number" autocomplete="off" /> |
| | | </el-form-item> |
| | | <el-form-item label="上方填写生产指令号" :label-width="formLabelWidth" prop="instruct"> |
| | | <el-input v-model="editSpeForm.instruct" autocomplete="off" /> |
| | | </el-form-item> |
| | | <el-form-item label="电压等级" :label-width="formLabelWidth"> |
| | | <el-select v-model="editSpeForm.voltageLevel" placeholder="请选择电压等级"> |
| | | <el-option label="分类1" value="test" /> |
| | | <el-option label="分类2" value="2" /> |
| | | <el-option label="分类3" value="3" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="主线芯截面" :label-width="formLabelWidth"> |
| | | <el-select v-model="editSpeForm.crossSection" placeholder="请选择主线芯截面"> |
| | | <el-option label="分类1" value="test" /> |
| | | <el-option label="分类2" value="2" /> |
| | | <el-option label="分类3" value="3" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="主线芯芯数" :label-width="formLabelWidth"> |
| | | <el-select v-model="editSpeForm.numberOfCores" placeholder="请选择主线芯芯数"> |
| | | <el-option label="分类1" value="test" /> |
| | | <el-option label="分类2" value="2" /> |
| | | <el-option label="分类3" value="3" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="规格状态" :label-width="formLabelWidth"> |
| | | <el-select v-model="editSpeForm.spe_state" placeholder="请选择规格状态"> |
| | | <el-option label="停用" value="0" /> |
| | | <el-option label="正常" value="1" /> |
| | | <el-option label="草稿" value="-1" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button @click="dialogFormVisible4 = false">取 消</el-button> |
| | | <el-button type="primary" @click="handleEdit">确 定</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | <!-- 停用 --> |
| | | <el-dialog |
| | | title="提示" |
| | | :visible.sync="dialogFormVisible5" |
| | | width="30%"> |
| | | <span>确认停用吗?</span> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button @click="dialogFormVisible5 = false">取 消</el-button> |
| | | <el-button type="primary" @click="updateSpeState">确 定</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | </div> |
| | | <div> |
| | | <!-- 分页器 --> |
| | | <el-pagination |
| | | :current-page="pageParams.pageNo" |
| | | :page-sizes="[1, 2, 3, 4]" |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import { getStandardsList, getSerialNumberList, getSpecificationsList, getStandardsListOfPage } from '@/api/standardLibrary' |
| | | import { getStandardsList, getSerialNumberList, getSpecificationsList, getStandardsListOfPage, addStandards, addSerialNumber, addSpecifications, updateSpecifications, updateSpeState } from '@/api/standardLibrary' |
| | | export default { |
| | | data() { |
| | | return { |
| | | dialogFormVisible1: false, |
| | | dialogFormVisible2: false, |
| | | dialogFormVisible3: false, |
| | | dialogFormVisible4: false, |
| | | dialogFormVisible5: false, |
| | | visible: false, |
| | | filterText: '', |
| | | // 标准库bom树 |
| | |
| | | |
| | | } |
| | | ], |
| | | oldtableData: [], |
| | | // 分页参数 |
| | | pageParams: { |
| | | pageNo: 1, |
| | |
| | | // 选中节点对应的表格 0 是标准表 1是型号表 2规格表 |
| | | showTableCurrent: 0, |
| | | // 选中的节点数据 |
| | | selectNode: {} |
| | | selectNode: {}, |
| | | selectedNodeType: '添加标准', |
| | | standardForm: [{ |
| | | standardnumber: '', |
| | | standardname: '', |
| | | engname: '', |
| | | type: '' |
| | | }], |
| | | modelForm: [{ |
| | | model: '', |
| | | modelname: '' |
| | | }], |
| | | specificationForm: [{ |
| | | name: '', // 产品规格名称 |
| | | number: '', // 规格编号 |
| | | crossSection: '', |
| | | numberOfCores: '', |
| | | instruct: '', |
| | | voltageLevel: '' |
| | | }], |
| | | editSpeForm: [{ |
| | | crossSection: '', |
| | | instruct: '', |
| | | name: '', // 规格名称 |
| | | number: '', // 规格编号 |
| | | numberOfCores: '', |
| | | serialId: '', // 型号ID |
| | | spe_state: '', |
| | | voltageLevel: '' |
| | | }], |
| | | formLabelWidth: '120', |
| | | rulesStandard: { |
| | | standardnumber: [ |
| | | { |
| | | required: true, message: '请输入标准号', trigger: 'blur' |
| | | } |
| | | ], |
| | | standardname: [{ |
| | | required: true, message: '请输入标准名称', trigger: 'blur' |
| | | }], |
| | | standardenname: [ |
| | | { required: false, message: '请输入英文名称', trigger: 'blur' } |
| | | ] |
| | | }, |
| | | rulesModel: { |
| | | model: [ |
| | | { required: true, message: '请输入型号', trigger: 'blur' |
| | | }], |
| | | modelname: [{ |
| | | required: true, message: '请输入型号名称', trigger: 'blur' |
| | | }], |
| | | parentclassification: [ |
| | | { required: true, message: '请输入', trigger: 'blur' } |
| | | ] |
| | | }, |
| | | rulesspecification: { |
| | | number: [ |
| | | { required: true, message: '请输入规格编号', trigger: 'blur' |
| | | }], |
| | | name: [{ |
| | | required: true, message: '请输入规格名称', trigger: 'blur' |
| | | }], |
| | | instruct: [ |
| | | { required: true, message: '请输入上方填写生产指令号', trigger: 'blur' } |
| | | ] |
| | | }, |
| | | standardId: '', // 获取当前标准ID |
| | | modelId: '', // 获取当前型号ID |
| | | rowId: '' // 获取当前规格所在行ID |
| | | } |
| | | }, |
| | | watch: { |
| | |
| | | }, |
| | | // 获取bom树的标准数据 |
| | | async getStandardTree() { |
| | | this.selectedNodeType = '添加标准' |
| | | const { data: standard } = await getStandardsList()// 获取所有标准 |
| | | // console.log(standard)// 获取所有标准 |
| | | this.standardTree = standard.map(item => { |
| | |
| | | }, |
| | | // 点击bom树节点方法 |
| | | async nodeClick(data, node, element) { |
| | | console.log(data) |
| | | // console.log('data', data) |
| | | // console.log('children' in data) |
| | | // 是子节点 |
| | | if (!('children' in data)) { |
| | | // console.log('点击子节点', data) |
| | | this.selectedNodeType = '添加规格' |
| | | this.modelId = data.id |
| | | this.selectNode = data |
| | | // 获取点击子节点的表格 |
| | | await this.getSpecifications(data) |
| | | return |
| | | } |
| | | // 不是子节点 |
| | | this.selectedNodeType = '添加型号' |
| | | this.standardId = data.id |
| | | this.selectNode = data |
| | | await this.getSerialNumber(data) |
| | | }, |
| | | specificationDetails(row) { |
| | | // 跳转产品规格详情页 |
| | | console.log(row) |
| | | this.$router.push(`/standardLibrary/SpecificationDetails/${row.id}`) |
| | | }, |
| | | getRowID(row) { |
| | | // console.log(row.id) |
| | | this.id = row.id |
| | | }, |
| | | // 获取所有标准table |
| | | async getAllStandard() { |
| | | this.selectedNodeType = '添加标准' |
| | | // console.log(this.pageParams) |
| | | const { data: { row, total }} = await getStandardsListOfPage({ ...this.pageParams }) |
| | | console.log('得到所有标准==>', row) |
| | | // console.log('得到所有标准==>', row) |
| | | this.pageParams.total = total |
| | | this.tableData = row |
| | | this.tablespecifications = [ |
| | |
| | | // 获取标准下对应的所有型号 |
| | | async getSpecifications(data) { |
| | | const { data: { row, total }} = await getSpecificationsList({ serialNumberId: data.id, ...this.pageParams }) |
| | | console.log(row) |
| | | // console.log(row) |
| | | this.tableData = row |
| | | this.pageParams.total = total |
| | | this.tablespecifications = [ |
| | |
| | | ] |
| | | this.showTableCurrent = 2 |
| | | }, |
| | | // 展示弹出框 |
| | | showFormInfo() { |
| | | if (this.selectedNodeType === '添加标准') { |
| | | this.dialogFormVisible1 = true |
| | | } else if (this.selectedNodeType === '添加型号') { |
| | | this.dialogFormVisible2 = true |
| | | } else { |
| | | this.dialogFormVisible3 = true |
| | | } |
| | | }, |
| | | async submitForm() { |
| | | if (this.showTableCurrent === 0) { |
| | | await addStandards({ engName: this.standardForm.engname, |
| | | id: this.standardForm.standardnumber, |
| | | name: this.standardForm.standardname, |
| | | type: parseInt(this.standardForm.type) }) |
| | | this.dialogFormVisible1 = false |
| | | } else if (this.showTableCurrent === 1) { |
| | | await addSerialNumber({ id: this.modelForm.model, |
| | | name: this.modelForm.modelname, |
| | | standardsId: this.standardId // 关联标准ID |
| | | }) |
| | | this.dialogFormVisible2 = false |
| | | } else { |
| | | await addSpecifications({ crossSection: this.specificationForm.crossSection, |
| | | instruct: this.specificationForm.instruct, |
| | | name: this.specificationForm.name, |
| | | number: this.specificationForm.number, |
| | | numberOfCores: this.specificationForm.numberOfCores, |
| | | serialId: this.modelId, // 关联型号ID |
| | | voltageLevel: this.specificationForm.voltageLevel |
| | | }) |
| | | this.dialogFormVisible3 = false |
| | | } |
| | | }, |
| | | |
| | | // 分页条件改变时判断需要分页查询的方法 |
| | | judgment() { |
| | | switch (this.showTableCurrent) { |
| | |
| | | console.log(`当前页: ${val}`) |
| | | this.pageParams.pageNo = val |
| | | this.judgment() |
| | | }, |
| | | // 查询按钮 |
| | | filteredTableData() { |
| | | this.oldtableData = this.tableData |
| | | // 根据输入的关键字得到过滤后的数据,如果有就把过滤后的数据展示在页面上 |
| | | const filteredtabledata = this.tableData.filter(item => { |
| | | return item.name.includes(this.searchData.keyword) |
| | | }) |
| | | // console.log('filteredtabledata', filteredtabledata) |
| | | this.tableData = filteredtabledata |
| | | }, |
| | | // 重置按钮 |
| | | resetBtn() { |
| | | this.searchData.keyword = '' |
| | | this.tableData = this.oldtableData |
| | | }, |
| | | // 处理编辑规格 |
| | | async handleEdit() { |
| | | // console.log(this.id) |
| | | await updateSpecifications({ crossSection: this.editSpeForm.crossSection, |
| | | id: this.rowId, |
| | | instruct: this.editSpeForm.instruct, |
| | | name: this.editSpeForm.name, |
| | | number: this.editSpeForm.number, |
| | | numberOfCores: this.editSpeForm.numberOfCores, |
| | | serialId: this.modelId, // 关联型号ID |
| | | spe_state: this.editSpeForm.spe_state, |
| | | voltageLevel: this.editSpeForm.spe_state }) |
| | | this.dialogFormVisible4 = false |
| | | }, |
| | | // 停用 |
| | | async updateSpeState() { |
| | | await updateSpeState({ id: this.rowId, |
| | | spe_state: '0' }) |
| | | this.dialogFormVisible5 = false |
| | | } |
| | | } |
| | | } |