| | |
| | | v-model="filterText" |
| | | placeholder="è¾å
¥å
³é®åè¿è¡è¿æ»¤" |
| | | /> |
| | | <el-button type="text" @click="getAllStandard">å
¨é¨</el-button> |
| | | <el-button type="text">å
¨é¨</el-button> |
| | | <el-tree |
| | | ref="tree" |
| | | class="filter-tree" |
| | | :data="standardTree" |
| | | :props="defaultProps" |
| | | node-key="id" |
| | | highlight-current |
| | | default-expand-all |
| | | :filter-node-method="filterNode" |
| | | :render-content="renderContent" |
| | |
| | | <el-form-item> |
| | | <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" @click="showFormInfo">{{ selectedNodeType }}</el-button> |
| | | <el-button type="primary" icon="el-icon-plus" @click="addTreeFormVisible = true">æ°å¢</el-button> |
| | | </div> |
| | | </div> |
| | | <div class="table-box"> |
| | | <el-table |
| | | ref="tableData" |
| | | :cell-style="{textAlign: 'center'}" |
| | | :header-cell-style="{border:'0px',background:'#f5f7fa',color:'#606266',boxShadow: 'inset 0 1px 0 #ebeef5',textAlign: 'center'}" |
| | | row-key="id" |
| | | max-height="680" |
| | | :tree-props="{children: 'children', hasChildren: 'hasChildren'}" |
| | | :cell-style="{textAlign: 'left'}" |
| | | :header-cell-style="{border:'0px',background:'#f5f7fa',color:'#606266',boxShadow: 'inset 0 1px 0 #ebeef5',textAlign: 'left'}" |
| | | :data="tableData" |
| | | style="width: 100%" |
| | | > |
| | | <el-table-column |
| | | type="index" |
| | | label="åºå·" |
| | | min-width="50" |
| | | /> |
| | | <!-- å¤ç¨ --> |
| | | <el-table-column |
| | | v-for="(item,index) in tablespecifications" |
| | | :key="index" |
| | | :prop="item.prop" |
| | | :label="item.label" |
| | | :min-width="item.minWidth" |
| | | /> |
| | | <template v-if="showTableCurrent===2"> |
| | | <el-table-column |
| | | prop="spe_state" |
| | | label="ç¶æ" |
| | | min-width="150" |
| | | width="100px" |
| | | > |
| | | <template slot-scope="scope"> |
| | | <el-tag |
| | | :type="scope.row.spe_state === 0 ? 'primary' : 'success'" |
| | | disable-transitions |
| | | >{{ scope.row.spe_state === 0 ? 'å·²åç¨' : 'å·²å¯ç¨' }}</el-tag> |
| | | <template v-if="scope.row.index+1" slot-scope="scope"> |
| | | {{ scope.row.index+1 }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | label="æä½" |
| | | min-width="150" |
| | | prop="father" |
| | | label="åç§°" |
| | | width="320px" |
| | | > |
| | | <template slot-scope="scope"> |
| | | <el-button |
| | | type="text" |
| | | size="small" |
| | | :style="{marginRight:'8px'}" |
| | | @click="specificationDetails(scope.row)" |
| | | >æ¥ç</el-button> |
| | | <el-popover |
| | | v-model="scope.row.visible" |
| | | placement="top" |
| | | width="30" |
| | | > |
| | | <div style="text-align: center; margin: 0" @click=" getRowID(scope.row)"> |
| | | <div> |
| | | <el-button size="mini" type="text" @click="dialogFormVisible4=true">ç¼è¾</el-button> |
| | | </div> |
| | | <div> |
| | | <el-button size="mini" type="text" @click="dialogFormVisible5 = true">åç¨</el-button> |
| | | </div> |
| | | </div> |
| | | <el-button slot="reference" type="text"><i class="el-icon-more" /></el-button> |
| | | </el-popover> |
| | | <el-tag size="mini" :type="scope.row.father? '':'success'" :style="{borderRadius: '40%',marginRight: '12px'}">{{ scope.row.father? '01':'02' }}</el-tag> {{ scope.row.father || scope.row.name }} |
| | | </template> |
| | | </el-table-column> |
| | | </template> |
| | | <el-table-column |
| | | prop="unit" |
| | | label="åä½" |
| | | width="300px" |
| | | /> |
| | | <el-table-column |
| | | prop="required" |
| | | label="æ å" |
| | | width="300px" |
| | | /> |
| | | <el-table-column |
| | | prop="internal" |
| | | label="å
æ§å¶" |
| | | width="300px" |
| | | /> |
| | | </el-table> |
| | | <!-- å¼¹åºè¡¨å页 --> |
| | | <div> |
| | | <!-- æ·»å æ å --> |
| | | <el-dialog title="æ·»å æ å" :visible.sync="dialogFormVisible1" width="33%"> |
| | | <el-form :model="standardForm" :rules="rulesStandard"> |
| | | <el-form-item label="æ åå·" label-width="100px" prop="standardnumber"> |
| | | <el-input v-model="standardForm.standardnumber" autocomplete="off" /> |
| | | </el-form-item> |
| | | <el-form-item label="æ ååç§°" label-width="100px" prop="standardname"> |
| | | <el-input v-model="standardForm.standardname" autocomplete="off" /> |
| | | </el-form-item> |
| | | <el-form-item label="è±æåç§°" label-width="100px" prop="standardenname"> |
| | | <el-input v-model="standardForm.engname" autocomplete="off" /> |
| | | </el-form-item> |
| | | <el-form-item label="ç¶çº§åç±»" label-width="100px"> |
| | | <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" width="30%"> |
| | | <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" width="30%"> |
| | | <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" width="30%"> |
| | | <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="[10, 15, 20, 25]" |
| | | :page-size="pageParams.pageNo" |
| | | :page-size="pageParams.pageSize" |
| | | layout="total, sizes, prev, pager, next, jumper" |
| | | :total="pageParams.total" |
| | | @size-change="handleSizeChange" |
| | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <el-dialog class="addTree" title="æ·»å ææ " width="28%" :visible.sync="addTreeFormVisible" @close="closeAddTreeForm"> |
| | | <el-form v-model="addTreeForm" label-position="top"> |
| | | <el-form-item label="ä¸çº§"> |
| | | <el-cascader |
| | | v-model="addTreeForm.addTypeArr" |
| | | :options="formTypeOptions" |
| | | :props="{ ...defaultProps,checkStrictly: true }" |
| | | clearable |
| | | @change="changeCascader" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item v-show="addTreeForm.addTypeArr.length<2" label="ç©æåç§°"> |
| | | <el-input v-model="addTreeForm.materialName" /> |
| | | </el-form-item> |
| | | <el-form-item v-show="addTreeForm.addTypeArr.length<3" label="æ§è¡æ å"> |
| | | <el-input v-model="addTreeForm.standardName" /> |
| | | </el-form-item> |
| | | <el-form-item v-show="addTreeForm.addTypeArr.length<4" label="è§æ ¼åå·"> |
| | | <el-input v-model="addTreeForm.specificationsName" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button type="primary" @click="subAddTreeForm">ç¡® å®</el-button> |
| | | <el-button @click="addTreeFormVisible = false">å æ¶</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import { getStandardsList, getSerialNumberList, getSpecificationsList, getStandardsListOfPage, addStandards, addSerialNumber, addSpecifications, updateSpecifications, updateSpeState } from '@/api/standardLibrary' |
| | | import { getMaterialList, getProductList, getProductSonList, |
| | | addMaterial, addStandards, addSpecifications |
| | | } from '@/api/standardLibrary' |
| | | export default { |
| | | data() { |
| | | return { |
| | | dialogFormVisible1: false, |
| | | dialogFormVisible2: false, |
| | | dialogFormVisible3: false, |
| | | dialogFormVisible4: false, |
| | | dialogFormVisible5: false, |
| | | visible: false, |
| | | addTreeFormVisible: false, |
| | | filterText: '', |
| | | // æ ååºbomæ |
| | | standardTree: [], |
| | | // bomç,é»è®¤å¼ |
| | | // bomç,é»è®¤é
ç½®å¼ |
| | | defaultProps: { |
| | | children: 'children', |
| | | label: 'label' |
| | | label: 'name', |
| | | value: 'id' |
| | | }, |
| | | // æ¥è¯¢æ¡ä»¶ |
| | | searchData: { |
| | |
| | | // å页忰 |
| | | pageParams: { |
| | | pageNo: 1, |
| | | pageSize: 10, |
| | | pageSize: 12, |
| | | total: 0 |
| | | }, |
| | | tablespecifications: [ |
| | | ], |
| | | // éä¸èç¹å¯¹åºçè¡¨æ ¼ 0 æ¯æ å表 1æ¯åå·è¡¨ 2è§æ ¼è¡¨ |
| | | showTableCurrent: 0, |
| | | // éä¸çèç¹æ°æ® |
| | | 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: '100px', |
| | | rulesStandard: { |
| | | standardnumber: [ |
| | | { |
| | | required: true, message: '请è¾å
¥æ åå·', trigger: 'blur' |
| | | selectData: {}, |
| | | formTypeOptions: [], |
| | | addTreeForm: { |
| | | addTypeArr: [] |
| | | } |
| | | ], |
| | | 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: { |
| | |
| | | }, |
| | | created() { |
| | | this.getStandardTree() |
| | | this.getAllStandard() |
| | | }, |
| | | methods: { |
| | | filterNode(value, data) { |
| | |
| | | }, |
| | | // è·åbomæ çæ åæ°æ® |
| | | async getStandardTree() { |
| | | this.selectedNodeType = 'æ·»å æ å' |
| | | const { data: standard } = await getStandardsList()// è·åæææ å |
| | | // console.log(standard)// è·åæææ å |
| | | this.standardTree = standard.map(item => { |
| | | item.serialNumber = item.serialNumber?.map(childrenItem => ({ ...childrenItem, label: childrenItem.name })) |
| | | return { ...item, label: item.name, children: item.serialNumber } |
| | | const { data } = await getMaterialList() |
| | | console.log(data) |
| | | this.standardTree = data.map(item => { |
| | | let name = null |
| | | switch (item.type) { |
| | | case 1: |
| | | name = 'åææ' |
| | | break |
| | | case 2: |
| | | name = 'åæå' |
| | | break |
| | | case 3: |
| | | name = 'æå' |
| | | break |
| | | } |
| | | return { |
| | | ...item, id: item.type, name |
| | | } |
| | | }) |
| | | // console.log(this.standardTree) |
| | | console.log(this.standardTree) |
| | | // formTypeOptions |
| | | // é»è®¤ç¬¬ä¸ä¸ªå级èç¹æç´¢ï¼æ°å¢é
置项 |
| | | const treeOptions = JSON.parse(JSON.stringify(this.standardTree)) |
| | | this.getDefault(treeOptions, 0) |
| | | console.log(treeOptions) |
| | | this.formTypeOptions = treeOptions |
| | | this.$nextTick().then(() => { |
| | | const firstNode = document.querySelector('.el-tree-node .el-tree-node__children .el-tree-node .el-tree-node__children .el-tree-node .el-tree-node__children .el-tree-node') |
| | | firstNode.click() |
| | | // console.log(firstNode) |
| | | }) |
| | | }, |
| | | getDefault(arr, index) { |
| | | for (const item of arr) { |
| | | if (item.children && item.children?.length > 0) { |
| | | // æåèç¹ |
| | | this.getDefault(item.children, index + 1) |
| | | if (index === 2) { |
| | | item.children = null |
| | | } |
| | | } |
| | | // else { |
| | | // // if ('children' in item) { |
| | | // // // |
| | | // // } else { |
| | | // // // console.log(index, item) |
| | | // // } |
| | | // } |
| | | } |
| | | }, |
| | | // ç¹å»bomæ èç¹æ¹æ³ |
| | | async nodeClick(data, node, element) { |
| | | // console.log('data', data) |
| | | // console.log('children' in data) |
| | | // æ¯åèç¹ |
| | | if (node.level === 4) { |
| | | // console.log(data, node) |
| | | // åä¸éä¸èç¹ |
| | | this.selectData = data |
| | | // eslint-disable-next-line prefer-const |
| | | this.getTableByClick(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) |
| | | }, |
| | | async getTableByClick(data) { |
| | | // eslint-disable-next-line prefer-const |
| | | let { data: { row, total }} = await getProductList({ pageNo: this.pageParams.pageNo, pageSize: this.pageParams.pageSize, specificationsId: data.id }) |
| | | // console.log(row) |
| | | this.pageParams.total = total |
| | | row = row.map((item, index) => ({ ...item, index })) |
| | | for (const item of row) { |
| | | if (item.children) { |
| | | const res = await getProductSonList({ fatherName: item.father }) |
| | | item.children = res.data |
| | | item.id = item.father |
| | | } |
| | | } |
| | | this.tableData = row |
| | | }, |
| | | specificationDetails(row) { |
| | | // 跳转产åè§æ ¼è¯¦æ
页 |
| | | this.$router.push(`/standardLibrary/SpecificationDetails/${row.id}`) |
| | | }, |
| | | // è·åå½åè§æ ¼çè¡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) |
| | | this.pageParams.total = total |
| | | this.tableData = row |
| | | this.tablespecifications = [ |
| | | { |
| | | prop: 'name', |
| | | label: 'æ ååç§°', |
| | | minWidth: '150px' |
| | | }, |
| | | { |
| | | prop: 'eng_name', |
| | | label: 'æ åè±æåç§°', |
| | | minWidth: '150px' |
| | | }, |
| | | { |
| | | prop: 'createTime', |
| | | label: 'å建æ¶é´', |
| | | minWidth: '150px' |
| | | } |
| | | ] |
| | | this.showTableCurrent = 0 |
| | | }, |
| | | // è·å对åºåå·ä¸çææè§æ ¼ |
| | | async getSerialNumber(data) { |
| | | const { data: { row, total }} = await getSerialNumberList({ standardsId: data.id, ...this.pageParams }) |
| | | console.log('ç¹å»ç¶èç¹', row)// æ ¹æ®æ åè·åå¯¹åºæ åä¸çè§æ ¼ |
| | | this.tableData = row |
| | | this.pageParams.total = total |
| | | this.tablespecifications = [ |
| | | { |
| | | prop: 'name', |
| | | label: 'åå·åç§°', |
| | | minWidth: '150px' |
| | | } |
| | | ] |
| | | this.showTableCurrent = 1 |
| | | }, |
| | | // è·åæ åä¸å¯¹åºçææåå· |
| | | async getSpecifications(data) { |
| | | const { data: { row, total }} = await getSpecificationsList({ serialNumberId: data.id, ...this.pageParams }) |
| | | // console.log(row) |
| | | this.tableData = row |
| | | this.pageParams.total = total |
| | | this.tablespecifications = [ |
| | | { |
| | | prop: 'name', |
| | | label: '产ååç§°', |
| | | minWidth: '150px' |
| | | }, |
| | | { |
| | | prop: 'username', |
| | | label: 'æ´æ°äºº', |
| | | minWidth: '100px' |
| | | }, |
| | | { |
| | | prop: 'updateTime', |
| | | label: 'æ´æ°æ¶é´', |
| | | minWidth: '150px' |
| | | }, |
| | | { |
| | | prop: 'vel', |
| | | label: 'çæ¬', |
| | | minWidth: '150px' |
| | | } |
| | | ] |
| | | 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) { |
| | | case 0: |
| | | this.getAllStandard() |
| | | break |
| | | case 1: |
| | | this.getSerialNumber(this.selectNode) |
| | | break |
| | | case 2: |
| | | this.getSpecifications(this.selectNode) |
| | | break |
| | | } |
| | | }, |
| | | handleSizeChange(val) { |
| | | console.log(`æ¯é¡µ ${val} æ¡`) |
| | | this.pageParams.pageSize = val |
| | | this.judgment() |
| | | this.getTableByClick(this.selectData) |
| | | }, |
| | | handleCurrentChange(val) { |
| | | console.log(`å½å页: ${val}`) |
| | | this.pageParams.pageNo = val |
| | | this.judgment() |
| | | this.getTableByClick(this.selectData) |
| | | }, |
| | | // æ¥è¯¢æé® |
| | | filteredTableData() { |
| | |
| | | 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 |
| | | }, |
| | | renderContent(h, { node, data, store }) { |
| | | // console.log('data', data) |
| | | // console.log('node', node) |
| | | // 夿æ¯å¦æ¯ç¶èç¹ææä»¶å¤¹ |
| | | const isFolder = ('children') in data |
| | | return ( |
| | | <span> |
| | | <span class='tree-node'> |
| | | {isFolder ? ( |
| | | <i |
| | | class={node.expanded ? 'el-icon-folder-opened blue-folder' : 'el-icon-folder blue-folder'} |
| | |
| | | ) : ( |
| | | <i class='el-icon-document blue-folder'></i> |
| | | )} |
| | | <span> {data.label}</span> |
| | | <div class='tree-lable'>[{node.level}] {data.name}</div> |
| | | </span> |
| | | ) |
| | | }, |
| | | async subAddTreeForm() { |
| | | this.addTreeFormVisible = false |
| | | console.log(this.addTreeForm.addTypeArr.length) |
| | | let res = null |
| | | try { |
| | | switch (this.addTreeForm.addTypeArr.length) { |
| | | case 1: |
| | | console.log(this.addTreeForm) |
| | | res = await addMaterial({ ...this.addTreeForm, type: this.addTreeForm.addTypeArr.pop() }) |
| | | break |
| | | case 2: |
| | | console.log(this.addTreeForm) |
| | | res = await addStandards({ ...this.addTreeForm, materialId: this.addTreeForm.addTypeArr.pop() }) |
| | | break |
| | | case 3: |
| | | console.log(this.addTreeForm) |
| | | res = await addSpecifications({ ...this.addTreeForm, standardId: this.addTreeForm.addTypeArr.pop() }) |
| | | break |
| | | } |
| | | } catch (error) { |
| | | this.$message.error('æ·»å 失败') |
| | | } |
| | | |
| | | console.log(res) |
| | | this.$message.success('æ·»å æå') |
| | | this.addTreeForm = {} |
| | | this.getStandardTree() |
| | | this.getTableByClick(this.selectData) |
| | | }, |
| | | changeCascader(data) { |
| | | console.log(data) |
| | | this.addTreeForm.addTypeArr = data |
| | | }, |
| | | closeAddTreeForm() { |
| | | this.addTreeForm = { |
| | | addTypeArr: [] |
| | | } |
| | | console.log(this.addTreeForm) |
| | | } |
| | | /** è¡¨æ ¼æè¡ç¹å»äºä»¶ */ |
| | | // handleRowClick(row, column, event) { |
| | | // // 夿å½åè¡æ¯å¦æåéï¼è¥æ²¡æåç»æå¤ç |
| | | // // console.log(row) |
| | | // if (!row.children) return |
| | | // this.$refs.tableData.toggleRowExpansion(row) |
| | | // } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | |
| | | // el-tableè¡¨æ ¼å¯¹é½ |
| | | ::v-deep .el-table__row:not([class*="el-table__row--level-"]) { |
| | | td:nth-child(2){ |
| | | padding-left: 23px !important; |
| | | } |
| | | } |
| | | // .dialogform { |
| | | // transform: translate(-50%, -50%); |
| | | // top: 50% !important; |
| | |
| | | display: flex; |
| | | height: 100%; |
| | | min-height: calc(100vh - 88px); |
| | | max-height: calc(100vh - 88px); |
| | | padding: 15px; |
| | | >div{ |
| | | padding: 20px; |
| | |
| | | } |
| | | .library-bom{ |
| | | flex: 2; |
| | | // width: 20%; |
| | | // height: 100%; |
| | | max-height: 100%; |
| | | margin-right: 12px; |
| | | overflow-y: scroll; |
| | | .el-tree { |
| | | // margin-top: 12px; |
| | | ::v-deep .el-tree-node__content{ |
| | | height: 24px !important; |
| | | font-size: 16px; |
| | | display: inline-block !important; |
| | | font-size: 18px; |
| | | // display: inline-block !important; |
| | | padding: 2px; |
| | | color: #333; |
| | | // color: #333; |
| | | .tree-node{ |
| | | display: flex; |
| | | align-items: center; |
| | | height: 20px; |
| | | } |
| | | .tree-lable{ |
| | | height: 100%; |
| | | line-height: 23px; |
| | | font-size: 12px; |
| | | padding-left: 8px; |
| | | } |
| | | .blue-folder{ |
| | | color: rgb(64, 158, 255) |
| | | } |
| | |
| | | // } |
| | | } |
| | | .library-table{ |
| | | // height: 100%; |
| | | flex: 8; |
| | | max-height: 100%; |
| | | // flex: 8; |
| | | margin-left: 12px; |
| | | display: flex; |
| | | flex-direction: column; |
| | | |
| | | // overflow-y: scroll; |
| | | .table-header{ |
| | | display: flex; |
| | | justify-content: space-between; |
| | |
| | | // padding: 20px 20px 10px 20px; |
| | | display: flex; |
| | | flex-direction: column; |
| | | justify-content: space-between; |
| | | |
| | | .el-table { |
| | | flex: 1; |
| | | // flex: 1; |
| | | // max-height: 680px; |
| | | // overflow-y: scroll; |
| | | } |
| | | >div:nth-child(2){ |
| | | >div:nth-child(3){ |
| | | // height: 20px; |
| | | display: flex; |
| | | justify-content: end; |
| | | margin: 10px 0; |
| | |
| | | } |
| | | } |
| | | } |
| | | .addTree{ |
| | | .el-form-item{ |
| | | margin-bottom: 10px; |
| | | } |
| | | .el-cascader{ |
| | | width: 100%; |
| | | } |
| | | } |
| | | } |
| | | </style> |