| | |
| | | <script lang="ts" setup> |
| | | import { reactive } from 'vue' |
| | | import {ArrowLeftBold} from "@element-plus/icons-vue"; |
| | | import {useRouter} from "vue-router"; |
| | | <script setup> |
| | | |
| | | // do not use same name with ref |
| | | const form = reactive({ |
| | | name: '', |
| | | region: '', |
| | | date1: '', |
| | | date2: '', |
| | | delivery: false, |
| | | type: [], |
| | | resource: '', |
| | | desc: '', |
| | | import request from "@/utils/request" |
| | | import deepClone from "@/utils/deepClone" |
| | | import {ElDatePicker, ElMessage} from "element-plus" |
| | | import {nextTick, onMounted, onUnmounted, reactive, ref, watch} from "vue" |
| | | import {useRouter} from 'vue-router' |
| | | import {useI18n} from 'vue-i18n' |
| | | import {changeFilterEvent, filterChanged} from "@/hook" |
| | | import useUserInfoStore from '@/stores/userInfo' |
| | | import footSum from "@/hook/footSum" |
| | | //语言获取 |
| | | const {t} = useI18n() |
| | | const userStore = useUserInfoStore() |
| | | let router = useRouter() |
| | | const getTableRow = (row, type) => { |
| | | switch (type) { |
| | | case 'edit' : { |
| | | //alert('我接收到子组件传送的编辑信息') |
| | | router.push({ |
| | | path: '/main/processCard/AddProcessCard', |
| | | query: {orderId: row.order_id, productionId: row.production_id, quantity:row.quantity} |
| | | }) |
| | | break |
| | | } |
| | | } |
| | | } |
| | | |
| | | //定义滚动条高度 |
| | | let scrollTop = ref(null) |
| | | let scrollHeight = ref(null) |
| | | let clientHeight = ref(null) |
| | | const scrollEvnt = (row) => { |
| | | // 内容高度 |
| | | scrollTop.value = row.$event.target.scrollTop |
| | | scrollHeight.value = row.$event.target.scrollHeight |
| | | clientHeight.value = row.$event.target.clientHeight |
| | | } |
| | | |
| | | //筛选条件,有外键需要先定义明细里面的数据 |
| | | let filterData = ref({ |
| | | |
| | | orderGlassDetail: { |
| | | productionId: '', |
| | | }, |
| | | orderDetail: { |
| | | orderId: '', |
| | | productId: '', |
| | | productName: '', |
| | | } |
| | | |
| | | |
| | | }) |
| | | const router = useRouter() |
| | | //定义页面总页数 |
| | | let pageTotal = ref('') |
| | | //定义数据返回结果 |
| | | let produceList = ref([]) |
| | | //定义当前页数 |
| | | let pageNum = $ref(1) |
| | | let pageState = null |
| | | |
| | | const tableData = [ |
| | | { |
| | | salesOrderNo: 'NG231201', |
| | | productionOrderNo: 'NG231201A', |
| | | productID: '9001010203000008', |
| | | productName: '5mm白玻平钢(外)+0.76PVB透明+5mm白玻平钢(内)', |
| | | total: '169', |
| | | TotalArea: '175.31', |
| | | perimeter: '99.84', |
| | | const {currentRoute} = useRouter() |
| | | const route = currentRoute.value |
| | | let id = route.query.orderId |
| | | |
| | | // 第一次加载查询 |
| | | request.post(`/processCard/detailsSelect/${id}`, filterData.value).then((res) => { |
| | | |
| | | if (res.code == 200) { |
| | | produceList = produceList.value.concat(deepClone(res.data.data)) |
| | | xGrid.value.reloadData(produceList) |
| | | gridOptions.loading = false |
| | | } else { |
| | | ElMessage.warning(res.msg) |
| | | } |
| | | }) |
| | | |
| | | //表尾求和 |
| | | const sumNum = (list, field) => { |
| | | let count = 0 |
| | | list.forEach(item => { |
| | | count += Number(item[field]) |
| | | }) |
| | | return count.toFixed(2) |
| | | } |
| | | |
| | | |
| | | const hasDecimal = (value) => { |
| | | const regex = /\./; // 定义正则表达式,查找小数点 |
| | | return regex.test(value); // 返回true/false |
| | | } |
| | | |
| | | //子组件接收参数 |
| | | const xGrid = ref() |
| | | const gridOptions = reactive({ |
| | | loading: true, |
| | | border: "full",//表格加边框 |
| | | keepSource: true,//保持源数据 |
| | | align: 'center',//文字居中 |
| | | stripe: true,//斑马纹 |
| | | rowConfig: {isCurrent: true, isHover: true, height: 30},//鼠标移动或选择高亮 |
| | | id: 'SplittingDetails', |
| | | showFooter: true,//显示脚 |
| | | printConfig: {}, |
| | | importConfig: {}, |
| | | exportConfig: {}, |
| | | scrollX: {enabled: true}, |
| | | scrollY: {enabled: true, gt: 0},//开启虚拟滚动 |
| | | showOverflow: true, |
| | | columnConfig: { |
| | | resizable: true, |
| | | useKey: true |
| | | }, |
| | | { |
| | | salesOrderNo: 'NG231201', |
| | | productionOrderNo: 'NG231201B', |
| | | productID: '9001010208000018', |
| | | productName: '6mm可钢LOW-E-85平钢(外)+12A(结)+6mm白玻平钢(内)', |
| | | total: '169', |
| | | TotalArea: '175.31', |
| | | perimeter: '99.84', |
| | | filterConfig: { //筛选配置项 |
| | | // remote: true |
| | | }, |
| | | { |
| | | salesOrderNo: 'NG231201', |
| | | productionOrderNo: 'NG231201C', |
| | | productID: '9001010203000021', |
| | | productName: '6mm超白UD60平钢(外)+12A(结)+6mm超白平钢(内)', |
| | | total: '169', |
| | | TotalArea: '175.31', |
| | | perimeter: '99.84', |
| | | customConfig: { |
| | | storage: true |
| | | }, |
| | | ] |
| | | editConfig: { |
| | | trigger: 'click', |
| | | mode: 'row', |
| | | showStatus: true |
| | | },//表头参数 |
| | | columns: [ |
| | | {type: 'expand', fixed: "left", slots: {content: 'content'}, width: 50}, |
| | | {title: t('basicData.operate'), width: 80, slots: {default: 'button_slot'}, fixed: "left"}, |
| | | {type: 'seq', fixed: "left", title: t('basicData.Number'), width: 50}, |
| | | { |
| | | field: 'order_id', |
| | | title: t('order.orderId'), |
| | | filters: [{data: ''}], |
| | | slots: {filter: 'num1_filter'}, |
| | | filterMethod: filterChanged |
| | | }, |
| | | { |
| | | field: 'production_id', |
| | | title: t('workOrder.productionId'), |
| | | showOverflow: "ellipsis", |
| | | filters: [{data: ''}], |
| | | slots: {filter: 'num1_filter'}, |
| | | filterMethod: filterChanged |
| | | }, |
| | | { |
| | | field: 'product_id', |
| | | title: t('order.productId'), |
| | | filters: [{data: ''}], |
| | | slots: {filter: 'num1_filter'}, |
| | | filterMethod: filterChanged |
| | | }, |
| | | { |
| | | field: 'product_name', |
| | | title: t('order.product'), |
| | | filters: [{data: ''}], |
| | | slots: {filter: 'num1_filter'}, |
| | | filterMethod: filterChanged |
| | | }, |
| | | {field: 'quantity', title: t('order.quantity'), showOverflow: "ellipsis"}, |
| | | {field: 'compute_gross_area', title: t('order.area'),}, |
| | | {field: 'perimeter', title: t('workOrder.perimeter'),}, |
| | | ],//表头按钮 |
| | | |
| | | toolbarConfig: { |
| | | // buttons: [ |
| | | // {code: 'editCheckbox', name: t('basicData.edit'), status: 'primary'}, |
| | | // ], |
| | | zoom: true, |
| | | custom: true |
| | | }, |
| | | data: null,//表格数据 |
| | | //脚部求和 |
| | | footerMethod ({ columns, data }) {//页脚函数 |
| | | return[ |
| | | columns.map((column, columnIndex) => { |
| | | if (columnIndex === 0) { |
| | | return t('basicData.total') |
| | | } |
| | | const List = ["quantity",'compute_gross_area','perimeter'] |
| | | if (List.includes(column.field)) { |
| | | return footSum(data, column.field) |
| | | } |
| | | return '' |
| | | }) |
| | | ] |
| | | } |
| | | |
| | | }) |
| | | |
| | | |
| | | </script> |
| | | |
| | | <template> |
| | | <div> |
| | | <div class="main-div-customer"> |
| | | <vxe-grid |
| | | ref="xGrid" |
| | | class="mytable-scrollbar" |
| | | height="100%" |
| | | v-bind="gridOptions" |
| | | |
| | | <el-table :data="tableData" border style="width: 100%" height="100%"> |
| | | <el-table-column sortable prop="salesOrderNo" label="销售单号" width="110" > |
| | | <template v-slot="scope"> |
| | | <router-link :to="{path:'AddProcessCard'}" >{{scope.row.salesOrderNo}}</router-link> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="productionOrderNo" label="生产订单号" width="125" /> |
| | | <el-table-column prop="productID" label="产品编号" width="155" /> |
| | | <el-table-column prop="productName" label="产品名称" :show-overflow-tooltip='true' width="180" /> |
| | | <el-table-column prop="total" label="总数量" width="75" /> |
| | | <el-table-column prop="TotalArea" label="总面积" width="100" /> |
| | | <el-table-column prop="perimeter" label="周长" width="75" /> |
| | | </el-table><!-- <h1>{{msg}}</h1> --> |
| | | |
| | | > |
| | | <!-- @toolbar-button-click="toolbarButtonClickEvent"--> |
| | | <!-- 下拉显示所有信息插槽--> |
| | | <template #content="{ row }"> |
| | | <ul class="expand-wrapper"> |
| | | <li v-for="(item,index) in gridOptions.columns" v-show="item.field!=undefined "> |
| | | <span style="font-weight: bold">{{ item.title + ': ' }}</span> |
| | | <span v-if="hasDecimal(item.field)">{{ row[item.field.split('.')[0]][item.field.split('.')[1]] }}</span> |
| | | <span v-else>{{ row[item.field] }}</span> |
| | | |
| | | </li> |
| | | </ul> |
| | | </template> |
| | | |
| | | <!--左边固定显示的插槽--> |
| | | <template #button_slot="{ row }"> |
| | | <!-- <el-button link size="small" type="primary" @click="getTableRow(row,'edit')">{{ $t('basicData.edit') }}--> |
| | | <!-- </el-button>--> |
| | | <el-button @click="getTableRow(row,'edit')" |
| | | v-if="userStore.user.permissions.indexOf('splittingDetails.edit') > -1" |
| | | link |
| | | type="primary" |
| | | size="small"> |
| | | {{ $t('basicData.edit') }} |
| | | </el-button> |
| | | </template> |
| | | |
| | | <template #num1_filter="{ column, $panel }"> |
| | | <div> |
| | | <div v-for="(option, index) in column.filters" :key="index"> |
| | | <input type="text" |
| | | v-model="option.data" |
| | | @keyup.enter.native="$panel.confirmFilter()" |
| | | @input="changeFilterEvent($event, option, $panel)"/> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | |
| | | </vxe-grid> |
| | | </div> |
| | | </template> |
| | | |
| | | <style scoped> |
| | | |
| | | |
| | | .main-div-customer { |
| | | width: 99%; |
| | | height: 100%; |
| | | } |
| | | </style> |