| | |
| | | min-width="50" |
| | | /> |
| | | <el-table-column |
| | | prop="name" |
| | | label="产品名称" |
| | | min-width="150" |
| | | v-for="(item,index) in tablespecifications" |
| | | :key="index" |
| | | :prop="item.prop" |
| | | :label="item.label" |
| | | :min-width="item.minWidth" |
| | | /> |
| | | <el-table-column |
| | | prop="username" |
| | | label="更新人" |
| | | min-width="100" |
| | | /> |
| | | <el-table-column |
| | | prop="updateTime" |
| | | label="更新时间" |
| | | min-width="150" |
| | | /> |
| | | <el-table-column |
| | | prop="vel" |
| | | label="版本" |
| | | min-width="100" |
| | | /> |
| | | <el-table-column |
| | | prop="spe_state" |
| | | label="状态" |
| | | min-width="150" |
| | | > |
| | | <template slot-scope="scope"> |
| | | <el-tag |
| | | :type="scope.row.spe_state === 0 ? 'primary' : 'success'" |
| | | disable-transitions |
| | | >{{ scope.row.spe_state === 0 ? '未同意' : '已同意' }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | label="操作" |
| | | min-width="150" |
| | | > |
| | | <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"> |
| | | <div> |
| | | <el-button size="mini" type="text">编辑</el-button> |
| | | <template v-if="showTableCurrent===2"> |
| | | <el-table-column |
| | | prop="spe_state" |
| | | label="状态" |
| | | min-width="150" |
| | | > |
| | | <template slot-scope="scope"> |
| | | <el-tag |
| | | :type="scope.row.spe_state === 0 ? 'primary' : 'success'" |
| | | disable-transitions |
| | | >{{ scope.row.spe_state === 0 ? '未同意' : '已同意' }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | label="操作" |
| | | min-width="150" |
| | | > |
| | | <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"> |
| | | <div> |
| | | <el-button size="mini" type="text">编辑</el-button> |
| | | </div> |
| | | <div> |
| | | <el-button size="mini" type="text">停用</el-button> |
| | | </div> |
| | | </div> |
| | | <div> |
| | | <el-button size="mini" type="text">停用</el-button> |
| | | </div> |
| | | </div> |
| | | <el-button slot="reference" type="text"><i class="el-icon-more" /></el-button> |
| | | </el-popover> |
| | | </template> |
| | | </el-table-column> |
| | | <el-button slot="reference" type="text"><i class="el-icon-more" /></el-button> |
| | | </el-popover> |
| | | </template> |
| | | </el-table-column> |
| | | </template> |
| | | |
| | | </el-table> |
| | | <div> |
| | | <el-pagination |
| | |
| | | :page-size="pageParams.pageNo" |
| | | layout="total, sizes, prev, pager, next, jumper" |
| | | :total="pageParams.total" |
| | | @size-change="handleSizeChange" |
| | | @current-change="handleCurrentChange" |
| | | /> |
| | | </div> |
| | | </div> |
| | |
| | | pageNo: 1, |
| | | pageSize: 10, |
| | | total: 3 |
| | | } |
| | | }, |
| | | tablespecifications: [ |
| | | ], |
| | | showTableCurrent: 0 |
| | | } |
| | | }, |
| | | watch: { |
| | |
| | | }, |
| | | created() { |
| | | this.getStandardTree() |
| | | this.getAllStandard() |
| | | }, |
| | | methods: { |
| | | filterNode(value, data) { |
| | | if (!value) return true |
| | | return data.label.indexOf(value) !== -1 |
| | | }, |
| | | // 获取bom树的标准数据 |
| | | async getStandardTree() { |
| | | const { data: standard } = await getStandardsList()// 获取所有标准 |
| | | console.log(standard)// 获取所有标准 |
| | | // 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 } |
| | | }) |
| | | console.log(this.standardTree) |
| | | // console.log(this.standardTree) |
| | | }, |
| | | // 点击bom树节点方法 |
| | | async nodeClick(data, node, element) { |
| | | console.log(data) |
| | | console.log('children' in data) |
| | | // console.log('children' in data) |
| | | if (!('children' in data)) { |
| | | console.log('点击子节点', data) |
| | | const { data: { row, total }} = await getSpecificationsList({ serialNumberId: data.id, specificationsName: data.label, pageNo: 1, pageSize: 10 }) |
| | | console.log(row) |
| | | this.tableData = row |
| | | this.pageParams.total = total |
| | | // console.log('点击子节点', data) |
| | | await this.getSpecifications(data) |
| | | return |
| | | } |
| | | const { data: { row, total }} = await getSerialNumberList({ standardsId: data.id, ...this.pageParams }) |
| | | // console.log('点击父节点', serialNumberList) |
| | | this.tableData = row |
| | | this.pageParams.total = total |
| | | await this.getSerialNumber(data) |
| | | }, |
| | | specificationDetails(row) { |
| | | // 跳转产品规格详情页 |
| | | console.log(row) |
| | | this.$router.push(`/standardLibrary/SpecificationDetails/${row.id}`) |
| | | }, |
| | | // 获取所有标准table |
| | | async getAllStandard() { |
| | | console.log(this.pageParams) |
| | | // 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 getSpecifications(data) { |
| | | const { data: { row, total }} = await getSpecificationsList({ serialNumberId: data.id, pageNo: 1, pageSize: 10 }) |
| | | 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 |
| | | }, |
| | | // 获取对应型号下的所有规格 |
| | | 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 |
| | | }, |
| | | handleSizeChange(val) { |
| | | console.log(`每页 ${val} 条`) |
| | | this.pageParams.pageSize = val |
| | | switch (this.showTableCurrent) { |
| | | case 0: |
| | | this.getAllStandard() |
| | | break |
| | | case 1: |
| | | this.getAllStandard() |
| | | break |
| | | case 2: |
| | | this.getAllStandard() |
| | | break |
| | | } |
| | | }, |
| | | handleCurrentChange(val) { |
| | | console.log(`当前页: ${val}`) |
| | | this.pageParams.pageNo = val |
| | | } |
| | | } |
| | | } |