| | |
| | | <script lang="ts" setup> |
| | | import { ref } from 'vue' |
| | | import { ElTable } from 'element-plus' |
| | | import {ArrowLeftBold} from "@element-plus/icons-vue"; |
| | | import request from "@/utils/request"; |
| | | import deepClone from "@/utils/deepClone"; |
| | | import {ElMessage} from "element-plus"; |
| | | import {useRouter} from "vue-router"; |
| | | import GlassType from '@/components/basic/product/GlassType.vue' |
| | | <script setup> |
| | | |
| | | interface User { |
| | | //销售单号 |
| | | selection:string |
| | | //产品编号 |
| | | productID: string |
| | | //产品名称 |
| | | productName: string |
| | | //总数量 |
| | | total: string |
| | | //总面积 |
| | | totalArea:string |
| | | //周长 |
| | | perimeter:string |
| | | } |
| | | |
| | | const multipleTableRef = ref<InstanceType<typeof ElTable>>() |
| | | const multipleSelection = ref<User[]>([]) |
| | | |
| | | const handleSelectionChange = (val: User[]) => { |
| | | multipleSelection.value = val |
| | | } |
| | | const router = useRouter() |
| | | let flag = $ref(true) |
| | | function intoCreateProduct(){ |
| | | if(flag){ |
| | | router.push('/main/workOrder/SelectAddWorkOrder') |
| | | }else { |
| | | router.push('/main/workOrder/SelectAddWorkOrder') |
| | | import {reactive} from "vue"; |
| | | import {useRouter} from 'vue-router' |
| | | let router=useRouter() |
| | | const getTableRow = (row,type) =>{ |
| | | switch (type) { |
| | | case 'edit' :{ |
| | | //alert('我接收到子组件传送的编辑信息') |
| | | router.push({path: '/main/workOrder/addWorkOrder', query: { id: row.id }}) |
| | | break |
| | | } |
| | | case 'delete':{ |
| | | alert('我接收到子组件传送的删除信息') |
| | | break |
| | | } |
| | | } |
| | | flag=!flag |
| | | } |
| | | |
| | | //表尾求和 |
| | | const sumNum = (list, field) => { |
| | | let count = 0 |
| | | list.forEach(item => { |
| | | count += Number(item[field]) |
| | | }) |
| | | return count.toFixed(2) |
| | | } |
| | | |
| | | const tableData: User[] = [ |
| | | { |
| | | selection: 'NG231201', |
| | | productID: '9001010208000021', |
| | | productName: '6mm超白UD60平钢(外)+12A(结)+6mm超白平钢(内)', |
| | | total:"123", |
| | | totalArea:"1233.12", |
| | | perimeter:"133" |
| | | //子组件接收参数 |
| | | |
| | | const gridOptions = reactive({ |
| | | border: "full",//表格加边框 |
| | | keepSource: true,//保持源数据 |
| | | align: 'center',//文字居中 |
| | | stripe:true,//斑马纹 |
| | | rowConfig: {isCurrent: true, isHover: true,height: 50},//鼠标移动或选择高亮 |
| | | id: 'CustomerList', |
| | | showFooter: true,//显示脚 |
| | | printConfig: {}, |
| | | importConfig: {}, |
| | | exportConfig: {}, |
| | | scrollY:{ enabled: true },//开启虚拟滚动 |
| | | showOverflow:true, |
| | | columnConfig: { |
| | | resizable: true, |
| | | useKey: true |
| | | }, |
| | | { |
| | | selection: 'NG231201', |
| | | productID: '9001010203000008', |
| | | productName: '6mm超白LYDE-80平钢(外)+12Ar(结)+6mm超白平钢(内)', |
| | | total:"123", |
| | | totalArea:"1233.12", |
| | | perimeter:"133" |
| | | filterConfig: { //筛选配置项 |
| | | remote: true |
| | | }, |
| | | ] |
| | | customConfig: { |
| | | storage: true |
| | | }, |
| | | editConfig: { |
| | | trigger: 'click', |
| | | mode: 'row', |
| | | showStatus: true |
| | | },//表头参数 |
| | | columns:[ |
| | | {type:'expand',fixed:"left",slots: { content:'content' },width: 50}, |
| | | { type: 'checkbox',fixed:"left", title: '选择', width: 80 }, |
| | | { type: 'seq',fixed:"left", title: '自序', width: 50 }, |
| | | {field: 'salesOrderNo', title: '销售单号',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true, }, |
| | | {field: 'productID', title: '产品编号', sortable: true,showOverflow:"ellipsis" ,filters:[{ data: '' }],slots: { filter: 'num1_filter' }}, |
| | | {field: 'productName', title: '产品名称',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true}, |
| | | {field: 'total', title: '总数量', sortable: true}, |
| | | {field: 'totalArea', title: '总面积', sortable: true}, |
| | | {field: 'perimeter', title: '周长', sortable: true,showOverflow:"ellipsis"}, |
| | | ],//表头按钮 |
| | | |
| | | toolbarConfig: { |
| | | buttons: [ |
| | | {code: 'print_lck', name: '保存',status:'primary' ,icon:'vxe-icon-save'}, |
| | | ], |
| | | import: false, |
| | | export: true, |
| | | print: true, |
| | | zoom: true, |
| | | custom: true |
| | | }, |
| | | data: [ |
| | | { |
| | | salesOrderNo: 'NG231201', |
| | | productID: '9001010208000021', |
| | | productName: '6mm超白UD60平钢(外)+12A(结)+6mm超白平钢(内)', |
| | | total:"123", |
| | | totalArea:"1233.12", |
| | | perimeter:"133" |
| | | }, |
| | | { |
| | | salesOrderNo: 'NG231201', |
| | | productID: '9001010203000008', |
| | | productName: '6mm超白LYDE-80平钢(外)+12Ar(结)+6mm超白平钢(内)', |
| | | total:"123", |
| | | totalArea:"1233.12", |
| | | perimeter:"133" |
| | | }, |
| | | ],//table body实际数据 |
| | | //脚部求和 |
| | | footerMethod ({ columns, data }) {//页脚函数 |
| | | let footList=['total','totalArea'] |
| | | return[ |
| | | columns.map((column, columnIndex) => { |
| | | if (columnIndex === 0) { |
| | | return '合计:' |
| | | } |
| | | if (footList.includes(column.field)) { |
| | | return sumNum(data, column.field) |
| | | } |
| | | return '' |
| | | }) |
| | | ] |
| | | } |
| | | |
| | | }) |
| | | |
| | | |
| | | |
| | | </script> |
| | | |
| | | <template> |
| | | <div > |
| | | <div id="headerButton"> |
| | | <div class="main-div-customer"> |
| | | <vxe-grid |
| | | max-height="100%" |
| | | @filter-change="filterChanged" |
| | | class="mytable-scrollbar" |
| | | ref="xGrid" |
| | | v-bind="gridOptions" |
| | | |
| | | <el-button type="primary">保存</el-button> |
| | | > |
| | | <!-- @toolbar-button-click="toolbarButtonClickEvent"--> |
| | | <!-- 下拉显示所有信息插槽--> |
| | | <template #content="{ row}"> |
| | | <ul class="expand-wrapper"> |
| | | <li v-for="(item,key,index) in row"> |
| | | <span style="font-weight: bold">{{key+': '}}</span> |
| | | <span>{{ item }}</span> |
| | | </li> |
| | | </ul> |
| | | </template> |
| | | |
| | | <!--左边固定显示的插槽--> |
| | | <template #button_slot="{ row }"> |
| | | <el-button @click="getTableRow(row,'edit')" link type="primary" size="small">转工单</el-button> |
| | | <el-button @click="getTableRow(row,'delete')" link type="primary" size="small">删除</el-button> |
| | | </template> |
| | | |
| | | <template #num1_filter="{ column, $panel }"> |
| | | <div> |
| | | <div v-for="(option, index) in column.filters" :key="index"> |
| | | <input type="type" v-model="option.data" @input="changeFilterEvent($event, option, $panel)"/> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | |
| | | </vxe-grid> |
| | | </div> |
| | | <el-table |
| | | ref="multipleTableRef" |
| | | :data="tableData" |
| | | style="width: 100%" |
| | | @selection-change="handleSelectionChange" |
| | | > |
| | | <el-table-column type="selection" width="55" /> |
| | | <el-table-column label="销售单号" width="120"> |
| | | <template #default="scope">{{ scope.row.selection }}</template> |
| | | </el-table-column> |
| | | <el-table-column property="productID" label="产品编号" :show-overflow-tooltip='true'/> |
| | | <el-table-column property="productName" label="产品名称" width="280" show-overflow-tooltip :show-overflow-tooltip='true'/> |
| | | <el-table-column property="total" label="总数量" /> |
| | | <el-table-column property="totalArea" label="总面积" /> |
| | | <el-table-column property="perimeter" label="周长" /> |
| | | </el-table> |
| | | </div> |
| | | </template> |
| | | |
| | | <style scoped> |
| | | #headerButton{ |
| | | width: 200px; |
| | | float: right; |
| | | .main-div-customer{ |
| | | width: 99%; |
| | | height: 100%; |
| | | } |
| | | </style> |