| New file |
| | |
| | | <script setup> |
| | | |
| | | import {reactive, ref} from "vue"; |
| | | import {useRouter} from 'vue-router' |
| | | import request from "@/utils/request"; |
| | | import {ElMessage} from "element-plus"; |
| | | import deepClone from "@/utils/deepClone"; |
| | | import {Search} from "@element-plus/icons-vue"; |
| | | import useUserInfoStore from "@/stores/userInfo"; |
| | | import { useI18n } from 'vue-i18n' |
| | | import footSum from "@/hook/footSum"; |
| | | |
| | | //语言获取 |
| | | const { t } = useI18n() |
| | | |
| | | |
| | | const userStore = useUserInfoStore() |
| | | const username = userStore.user.userName |
| | | const userid = userStore.user.userId |
| | | let router = useRouter() |
| | | let produceList = ref([]) |
| | | const dialogFormVisible = ref(false) |
| | | const getTableRow = (row,type) =>{ |
| | | switch (type) { |
| | | case 'edit' :{ |
| | | //alert('我接收到子组件传送的编辑信息') |
| | | router.push({path: '/main/reportingWorks/ReportingWorkDetail', query: { id: row.id }}) |
| | | break |
| | | } |
| | | case 'delete':{ |
| | | alert('我接收到子组件传送的删除信息') |
| | | break |
| | | } |
| | | case 'setType':{ |
| | | alert('我接收到子组件传送的反审状态') |
| | | break |
| | | } |
| | | } |
| | | } |
| | | |
| | | let pageNum=ref(1) |
| | | let total = reactive({ |
| | | pageTotal : 0, |
| | | dataTotal : 0, |
| | | pageSize : 100 |
| | | }) |
| | | |
| | | let selectDate = ref(["",""]) |
| | | |
| | | //筛选条件,有外键需要先定义明细里面的数据 |
| | | let filterData = ref({ |
| | | |
| | | |
| | | }) |
| | | |
| | | //第一次调用 |
| | | request.post(`/Replenish/SelectReplenish/1/${total.pageSize}/${selectDate.value}`,filterData.value).then((res) => { |
| | | |
| | | if(res.code==200){ |
| | | total.dataTotal = res.data.total.total*1 |
| | | total.pageTotal= res.data.total.pageTotal |
| | | |
| | | selectDate.value = res.data.selectDate |
| | | pageNum.value=1 |
| | | |
| | | produceList = deepClone(res.data.data) |
| | | xGrid.value.loadData(produceList) |
| | | gridOptions.loading=false |
| | | }else{ |
| | | ElMessage.warning(res.msg) |
| | | } |
| | | }) |
| | | |
| | | const changeFilterEvent = (event, option, $panel,) => { |
| | | // 手动触发筛选 |
| | | $panel.changeOption(event, !!option.data, option) |
| | | } |
| | | function filterChanged(column){ |
| | | gridOptions.loading=true |
| | | //筛选条件发生变化条件发生变化 |
| | | let value = column.datas[0]!=undefined?column.datas[0]:'' |
| | | value = value.trim() |
| | | //判断是否存在外键 |
| | | if (column.property.indexOf('.')>-1){ |
| | | const columnArr = column.property.split('.') |
| | | filterData.value[columnArr[0]] = { |
| | | [columnArr[1]]:value |
| | | } |
| | | }else{ |
| | | filterData.value[column.property] = value |
| | | } |
| | | request.post(`/Replenish/SelectReplenish/1/${total.pageSize}/${selectDate.value}`,filterData.value).then((res) => { |
| | | |
| | | if(res.code==200){ |
| | | total.dataTotal = res.data.total.total*1 |
| | | total.pageTotal= res.data.total.pageTotal |
| | | |
| | | selectDate.value = res.data.selectDate |
| | | pageNum.value=1 |
| | | |
| | | produceList = deepClone(res.data.data) |
| | | xGrid.value.loadData(produceList) |
| | | gridOptions.loading=false |
| | | }else{ |
| | | ElMessage.warning(res.msg) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | //子组件接收参数 |
| | | const xGrid = ref() |
| | | const gridOptions = reactive({ |
| | | border: "full",//表格加边框 |
| | | keepSource: true,//保持源数据 |
| | | align: 'center',//文字居中 |
| | | stripe:true,//斑马纹 |
| | | rowConfig: {isCurrent: true, isHover: true,height: 30},//鼠标移动或选择高亮 |
| | | id: 'SelectReplenish', |
| | | showFooter: true,//显示脚 |
| | | printConfig: {}, |
| | | importConfig: {}, |
| | | exportConfig: {}, |
| | | scrollY:{ enabled: true },//开启虚拟滚动 |
| | | showOverflow:true, |
| | | columnConfig: { |
| | | resizable: true, |
| | | useKey: true |
| | | }, |
| | | 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',title: t('basicData.check'), width: 80,fixed:"left"}, |
| | | {type: 'seq', fixed: "left", title: t('basicData.Number'), width: 50}, |
| | | {field: 'reviewStatus',title: t('basicData.review'), width: 50, slots: { default: 'state' }}, |
| | | {field: 'patchId', width: 120, title: t('replenish.patchNumber'), filters: [{data: ''}], slots: {filter: 'num1_filter'}}, |
| | | {field: 'orderId', width: 120, title: t('order.orderId'), showOverflow: "ellipsis", filters: [{data: ''}], slots: {filter: 'num1_filter'}}, |
| | | {field: 'processId', width: 140, title: t('processCard.processId'), filters: [{data: ''}], slots: {filter: 'num1_filter'}}, |
| | | {field: 'project', width: 120, title: t('order.project'), filters: [{data: ''}], slots: {filter: 'num1_filter'}}, |
| | | {field: 'batch', width: 80, title: t('order.batch'), showOverflow: "ellipsis", filters: [{data: ''}], slots: {filter: 'num1_filter'}}, |
| | | {field: 'glassNumber', width: 100, title: t('reportingWorks.glassNumber')}, |
| | | {field: 'orderSort', width: 100, title:t('order.OrderNum'), filters: [{data: ''}], slots: {filter: 'num1_filter'}}, |
| | | {field: 'technologyNumber', width: 80, title: t('replenish.mark'), showOverflow: "ellipsis", filters: [{data: ''}], slots: {filter: 'num1_filter'}}, |
| | | {field: 'patchType', width: 100, title: t('reportingWorks.breakageType'), filters: [{data: ''}], slots: {filter: 'num1_filter'}}, |
| | | {field: 'patchReason', width: 120, title: t('reportingWorks.breakageReason'), filters: [{data: ''}], slots: {filter: 'num1_filter'}}, |
| | | {field: 'responsibleEquipment', width: 120, title: t('reportingWorks.responsibleEquipment'), filters: [{data: ''}], slots: {filter: 'num1_filter'}}, |
| | | {field: 'responsibleTeam', width: 120, title: t('reportingWorks.responsibleTeam'), filters: [{data: ''}], slots: {filter: 'num1_filter'}}, |
| | | {field: 'patchProcesses', width: 120, title: t('reportingWorks.reportingProcess'), filters: [{data: ''}], slots: {filter: 'num1_filter'}}, |
| | | //{field: 'building_number',width: 120, title: '楼层编号', filters: [{data: ''}], slots: {filter: 'num1_filter'},filterMethod:filterChanged}, |
| | | {field: 'glassAddress', width: 90, title: t('replenish.sliceMarking'), filters: [{data: ''}], slots: {filter: 'num1_filter'}}, |
| | | {field: 'patchNum', width: 80, title: t('order.quantity'), filters: [{data: ''}], slots: {filter: 'num1_filter'}}, |
| | | {field: 'patchArea', width: 120, title: t('order.area'), filters: [{data: ''}], slots: {filter: 'num1_filter'}}, |
| | | {field: 'width', width: 80, title: t('order.width'), filters: [{data: ''}], slots: {filter: 'num1_filter'}}, |
| | | {field: 'height', width: 80, title: t('order.height'), filters: [{data: ''}], slots: {filter: 'num1_filter'}}, |
| | | {field: 'shape', width: 80, title: t('order.shape'), filters: [{data: ''}], slots: {filter: 'num1_filter'}}, |
| | | {field: 'qualityInspector', width: 100, title: t('reportingWorks.qualityInspector'), filters: [{data: ''}], slots: {filter: 'num1_filter'}}, |
| | | {field: 'reviewer', width: 100, title: t('productStock.reviewed'), filters: [{data: ''}], slots: {filter: 'num1_filter'}}, |
| | | {field: 'createTime', width: 100, title: t('productStock.productionDate')}, |
| | | {field: 'updateTime', width: 120, title: t('productStock.approvedDate')}, |
| | | {field: 'productName', width: 120, title: t('order.product'), filters: [{data: ''}], slots: {filter: 'num1_filter'}}, |
| | | {field: 'reportingWorkId', width: 100,title: t('reportingWorks.reportingWorkId'),filters: [{data: ''}], slots: {filter: 'num1_filter'}}, |
| | | |
| | | ],//表头按钮 |
| | | |
| | | toolbarConfig: { |
| | | buttons: [ |
| | | { |
| | | 'name': t('basicData.review'),status: 'primary', |
| | | 'code':'add' |
| | | }, |
| | | { |
| | | 'name': t('basicData.delete'),status: 'primary', |
| | | 'code':'delete' |
| | | }, |
| | | { |
| | | 'name': t('basicData.cancelReview'),status: 'primary', |
| | | 'code':'cancelReview' |
| | | } |
| | | ], |
| | | /*import: false, |
| | | export: true, |
| | | print: true,*/ |
| | | zoom: true, |
| | | custom: true |
| | | }, |
| | | //脚部求和 |
| | | footerMethod ({ columns, data }) {//页脚函数 |
| | | let footList=['patch_num','patch_area'] |
| | | return[ |
| | | columns.map((column, columnIndex) => { |
| | | if (columnIndex === 0) { |
| | | return t('basicData.total') |
| | | } |
| | | if (footList.includes(column.field)) { |
| | | return footSum(data, column.field) |
| | | } |
| | | return '' |
| | | }) |
| | | ] |
| | | } |
| | | |
| | | }) |
| | | |
| | | const gridEvents = { |
| | | toolbarButtonClick ({ code }) { |
| | | const $grid = xGrid.value |
| | | if ($grid) { |
| | | switch (code) { |
| | | case 'add': { |
| | | const $table = xGrid.value |
| | | if ($table) { |
| | | const selectRecords = $table.getCheckboxRecords() |
| | | if (selectRecords.length === 0) { |
| | | ElMessage.warning(t('productStock.unselectedData')) |
| | | return |
| | | } |
| | | let flowData = ref({ |
| | | |
| | | userId:userid, |
| | | userName:username, |
| | | patchLog:selectRecords |
| | | |
| | | }) |
| | | request.post("/Replenish/updateReplenish",flowData.value).then((res) => { |
| | | if(res.code==200 && res.data===true){ |
| | | ElMessage.success(t('basicData.msg.ReviewSuccess')) |
| | | router.push({path:'/main/Replenish/SelectReplenish',query:{random:Math.random()}}) |
| | | |
| | | }else{ |
| | | ElMessage.warning(t('basicData.msg.reviewFail')) |
| | | } |
| | | }) |
| | | } |
| | | return |
| | | |
| | | } |
| | | case 'delete': { |
| | | const $table = xGrid.value |
| | | if ($table) { |
| | | const selectRecords = $table.getCheckboxRecords() |
| | | if (selectRecords.length === 0) { |
| | | ElMessage.warning(t('productStock.unselectedData')) |
| | | return |
| | | } |
| | | let flowData = ref({ |
| | | userId:userid, |
| | | userName:username, |
| | | patchLog:selectRecords |
| | | |
| | | }) |
| | | request.post("/Replenish/deleteReplenish",flowData.value).then((res) => { |
| | | if(res.code==200 && res.data===true){ |
| | | ElMessage.success(t('basicData.msg.deleteSuccess')) |
| | | router.push({path:'/main/Replenish/SelectReplenish',query:{random:Math.random()}}) |
| | | |
| | | }else{ |
| | | ElMessage.warning(t('basicData.msg.deleteFail')) |
| | | } |
| | | }) |
| | | } |
| | | return |
| | | |
| | | } |
| | | case 'cancelReview': { |
| | | const $table = xGrid.value |
| | | if ($table) { |
| | | const selectRecords = $table.getCheckboxRecords() |
| | | if (selectRecords.length === 0) { |
| | | ElMessage.warning(t('productStock.unselectedData')) |
| | | return |
| | | } |
| | | let flowData = ref({ |
| | | |
| | | userId:userid, |
| | | userName:username, |
| | | patchLog:selectRecords |
| | | |
| | | }) |
| | | request.post("/Replenish/updateCancelReview",flowData.value).then((res) => { |
| | | if(res.code==200 && res.data===true){ |
| | | ElMessage.success(t('basicData.msg.cancelReviewSuccess')) |
| | | router.push({path:'/main/Replenish/SelectReplenish',query:{random:Math.random()}}) |
| | | |
| | | }else{ |
| | | ElMessage.warning(t('basicData.msg.cancelReviewFailWork')) |
| | | } |
| | | }) |
| | | } |
| | | return |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | | }, |
| | | |
| | | } |
| | | |
| | | |
| | | const selectOrderList = ()=>{ |
| | | request.post(`/Replenish/SelectReplenish/${pageNum.value}/${total.pageSize}/${selectDate.value}`,filterData.value).then((res) => { |
| | | if(res.code==200){ |
| | | console.log(res.data) |
| | | if (res.data.total!=null){ |
| | | total.dataTotal = res.data.total.total*1 |
| | | total.pageTotal= res.data.total.pageTotal |
| | | } |
| | | selectDate.value = res.data.selectDate |
| | | |
| | | produceList = deepClone(res.data.data) |
| | | xGrid.value.loadData(produceList) |
| | | gridOptions.loading=false |
| | | }else{ |
| | | ElMessage.warning(res.msg) |
| | | router.push("/login") |
| | | } |
| | | }) |
| | | } |
| | | |
| | | const changeDate = ()=>{ |
| | | selectOrderList() |
| | | } |
| | | |
| | | //页脚跳转 |
| | | const handlePageChange = ({ currentPage, pageSize }) => { |
| | | total.pageTotal = pageSize |
| | | pageNum.value=currentPage |
| | | |
| | | selectOrderList() |
| | | } |
| | | |
| | | const checkBoxConfig = { |
| | | checkMethod: ({ row }) => { |
| | | if (row['review_status']===1){ |
| | | return row.disable |
| | | }else{ |
| | | return !row.disable |
| | | } |
| | | |
| | | }, |
| | | reserve:true |
| | | } |
| | | |
| | | |
| | | |
| | | </script> |
| | | |
| | | <template> |
| | | <div class="main-div-customer"> |
| | | <el-header height="auto" style="padding: 0;margin:0"> |
| | | <el-date-picker |
| | | v-model="selectDate" |
| | | type="daterange" |
| | | :start-placeholder="$t('basicData.startDate')" |
| | | :end-placeholder="$t('basicData.endDate')" |
| | | format="YYYY-MM-DD" |
| | | value-format="YYYY-MM-DD" |
| | | |
| | | /> |
| | | <el-button @click="changeDate" style="margin-top: -5px" id="searchButton" type="primary" :icon="Search">{{$t('basicData.search')}}</el-button> |
| | | </el-header> |
| | | |
| | | <vxe-grid |
| | | @filter-change="filterChanged" |
| | | height="100%" |
| | | class="mytable-scrollbar" |
| | | ref="xGrid" |
| | | v-bind="gridOptions" |
| | | v-on="gridEvents" |
| | | |
| | | |
| | | > |
| | | <!-- :checkbox-config="checkBoxConfig" @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>{{ row[item.field] }}</span> |
| | | </li> |
| | | </ul> |
| | | </template> |
| | | |
| | | <!--左边固定显示的插槽--> |
| | | <template #button_slot="{ row }"> |
| | | <el-button @click="getTableRow(row,'delete')" link type="primary" size="small">{{$t('basicData.delete')}}</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" |
| | | @keyup.enter.native="$panel.confirmFilter()" |
| | | @input="changeFilterEvent($event, option, $panel)"/> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <template #state="{ row,column}"> |
| | | <el-checkbox |
| | | v-if="row[column.field] === 1" |
| | | @click.native.prevent |
| | | :checked="true"/> |
| | | <el-checkbox |
| | | v-else |
| | | @click.native.prevent |
| | | :checked="false"/> |
| | | </template> |
| | | |
| | | <template #pager> |
| | | <!--使用 pager 插槽--> |
| | | <vxe-pager |
| | | @page-change="handlePageChange" |
| | | :layouts="[ 'PrevPage', 'Jump','PageCount', 'NextPage', 'Total']" |
| | | v-model:current-page="pageNum" |
| | | v-model:page-size="total.pageSize" |
| | | v-model:pager-count="total.pageTotal" |
| | | :total="total.dataTotal" |
| | | > |
| | | </vxe-pager> |
| | | </template> |
| | | |
| | | |
| | | </vxe-grid> |
| | | </div> |
| | | </template> |
| | | |
| | | <style scoped> |
| | | .main-div-customer{ |
| | | width: 99%; |
| | | height: 94%; |
| | | } |
| | | #head{ |
| | | width:40%; |
| | | } |
| | | </style> |