| | |
| | | <script setup> |
| | | |
| | | import {reactive} from "vue"; |
| | | import {reactive, ref} from "vue"; |
| | | import {useRouter} from 'vue-router' |
| | | import request from "@/utils/request"; |
| | | import deepClone from "@/utils/deepClone"; |
| | | import {ElDatePicker, ElMessage} from "element-plus"; |
| | | import {Search} from "@element-plus/icons-vue"; |
| | | import { useI18n } from 'vue-i18n' |
| | | import useUserInfoStore from "@/stores/userInfo"; |
| | | import footSum from "@/hook/footSum" |
| | | //语言获取 |
| | | const { t } = useI18n() |
| | | let router=useRouter() |
| | | const userStore = useUserInfoStore() |
| | | const username = userStore.user.userName |
| | | const getTableRow = (row,type) =>{ |
| | | switch (type) { |
| | | case 'edit' :{ |
| | | //alert('我接收到子组件传送的编辑信息') |
| | | router.push({path: '/main/reportingWorks/QualityInReviewDetail', query: { id: row.id }}) |
| | | router.push({path: '/main/reportingWorks/AddReportingWork', query: { reportingWorkId: row.reportingWorkId,reviewStatus:"1" }}) |
| | | break |
| | | } |
| | | case 'delete':{ |
| | |
| | | break |
| | | } |
| | | case 'setType':{ |
| | | alert('我接收到子组件传送的审核状态') |
| | | let startTime = form.date1[0] |
| | | let endTime = form.date1[1] |
| | | let state = optionVal.value |
| | | let inputVal = form.processId |
| | | request.post(`/reportingWork/updateQualityStatus/${row.reportingWorkId}/${username}`).then((res) => { |
| | | if (res.code == 200) { |
| | | ElMessage.success(t('processCard.modifySuccessfully')) |
| | | router.push({path: '/main/reportingWorks/QualityInspectionReview', query: {startTime:startTime,endTime:endTime,state:state,inputVal:inputVal, random:Math.random()}}) |
| | | } else { |
| | | |
| | | ElMessage.warning(res.msg) |
| | | } |
| | | }) |
| | | break |
| | | } |
| | | } |
| | | } |
| | | |
| | | //定义时间 |
| | | const form = reactive({ |
| | | date1: '', |
| | | processId:'', |
| | | }) |
| | | |
| | | |
| | | //定义转单状态 |
| | | const optionVal = ref('1') |
| | | const options = [ |
| | | { |
| | | value: '1', |
| | | label: t('reportingWorks.unqualified'), |
| | | }, |
| | | { |
| | | value: '2', |
| | | label: t('reportingWorks.qualified'), |
| | | }, |
| | | ] |
| | | |
| | | |
| | | //表尾求和 |
| | | const sumNum = (list, field) => { |
| | |
| | | return count.toFixed(2) |
| | | } |
| | | |
| | | //定义滚动条高度 |
| | | 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({ |
| | | order: { |
| | | project: '', |
| | | customerName:'' |
| | | }, |
| | | damageDetails: { |
| | | qualityInsStatus: '', |
| | | }, |
| | | |
| | | }) |
| | | //定义页面总页数 |
| | | let pageTotal = ref('') |
| | | //定义数据返回结果 |
| | | let produceList = ref([]) |
| | | //定义当前页数 |
| | | let pageNum=ref(1) |
| | | let pageState = null |
| | | |
| | | //获取七天前到当前时间 |
| | | function getNowTime() { |
| | | const start = new Date(new Date().getTime() - 3600 * 1000 * 24 * 7) |
| | | .toISOString() |
| | | .replace('T', ' ') |
| | | .slice(0, 10) //默认开始时间7天前 |
| | | const end = new Date(new Date().getTime()+3600 * 1000 * 24) |
| | | .toISOString() |
| | | .replace('T', ' ') |
| | | .slice(0, 10)//默认结束时间当前时间 |
| | | return [start, end] |
| | | } |
| | | |
| | | |
| | | //第一次加载获取近七天时间和默认状态 |
| | | form.date1 = getNowTime() |
| | | let startTime = form.date1[0] |
| | | let endTime = form.date1[1] |
| | | let state = optionVal.value |
| | | let total = reactive({ |
| | | pageTotal : 0, |
| | | dataTotal : 0, |
| | | pageSize : 100 |
| | | }) |
| | | let inputVal = form.processId |
| | | if (inputVal == '') { |
| | | inputVal = null |
| | | } |
| | | |
| | | //第一次加载数据 |
| | | request.post(`/reportingWork/selectQualityTesting/1/${total.pageSize}/${startTime}/${endTime}/${state}/${inputVal}`, filterData.value).then((res) => { |
| | | |
| | | if (res.code == 200) { |
| | | total.dataTotal = res.data.total.total*1 |
| | | total.pageTotal= res.data.total.pageTotal |
| | | pageTotal.value = res.data.total |
| | | produceList = produceList.value.concat(deepClone(res.data.data)) |
| | | xGrid.value.reloadData(produceList) |
| | | gridOptions.loading = false |
| | | } else { |
| | | ElMessage.warning(res.msg) |
| | | } |
| | | }) |
| | | |
| | | //页脚翻页查询 |
| | | const selectPageList = ()=>{ |
| | | let startTime = form.date1[0] |
| | | let endTime = form.date1[1] |
| | | request.post(`/reportingWork/selectQualityTesting/${pageNum.value}/${total.pageSize}/${startTime}/${endTime}/${state}/${inputVal}`,filterData.value).then((res) => { |
| | | if(res.code==200){ |
| | | |
| | | produceList = deepClone(res.data.data) |
| | | xGrid.value.reloadData(produceList) |
| | | }else{ |
| | | ElMessage.warning(res.msg) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | //点击查询 |
| | | const getWorkOrder = () => { |
| | | let startTime = form.date1[0] |
| | | let endTime = form.date1[1] |
| | | let state = optionVal.value |
| | | let inputVal = form.processId |
| | | if (inputVal == '') { |
| | | inputVal = null |
| | | } |
| | | request.post(`/reportingWork/selectQualityTesting/${pageNum.value}/${total.pageSize}/${startTime}/${endTime}/${state}/${inputVal}`, filterData.value).then((res) => { |
| | | if (res.code == 200) { |
| | | total.dataTotal = res.data.total.total*1 |
| | | total.pageTotal= res.data.total.pageTotal |
| | | pageTotal.value = res.data.total |
| | | produceList = deepClone(res.data.data) |
| | | produceList.forEach(item => { |
| | | if (item.damageDetails.qualityInsStatus === 2) { |
| | | item.damageDetails.qualityInsStatus = '已质检'; |
| | | } |
| | | else if (item.damageDetails.qualityInsStatus === 1){ |
| | | item.damageDetails.qualityInsStatus = '待质检'; |
| | | } |
| | | else if (item.damageDetails.qualityInsStatus === 0){ |
| | | item.damageDetails.qualityInsStatus = '无需质检'; |
| | | } |
| | | }); |
| | | xGrid.value.reloadData(produceList) |
| | | gridOptions.loading = false |
| | | } else { |
| | | ElMessage.warning(res.msg) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | //页脚跳转 |
| | | const handlePageChange = ({ currentPage, pageSize }) => { |
| | | pageNum.value=currentPage |
| | | total.pageTotal = pageSize |
| | | selectPageList() |
| | | } |
| | | |
| | | /*使用筛选,后端获取数据*/ |
| | | 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 |
| | | } |
| | | |
| | | //获取选中时间和是否转单状态 |
| | | let startTime = form.date1[0] |
| | | let endTime = form.date1[1] |
| | | let state = optionVal.value |
| | | let inputVal = form.processId |
| | | if (inputVal == '') { |
| | | inputVal = null |
| | | } |
| | | |
| | | request.post(`/reportingWork/selectQualityTesting/1/${total.pageSize}/${startTime}/${endTime}/${state}/${inputVal}`, filterData.value).then((res) => { |
| | | if (res.code == 200) { |
| | | total.dataTotal = res.data.total.total*1 |
| | | total.pageTotal=parseInt(res.data.total) |
| | | pageNum.value=1 |
| | | produceList = deepClone(res.data.data) |
| | | xGrid.value.reloadData(produceList) |
| | | gridOptions.loading=false |
| | | } else { |
| | | ElMessage.warning(res.msg) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | /*后端返回结果多层嵌套展示*/ |
| | | const hasDecimal = (value) => { |
| | | const regex = /\./; // 定义正则表达式,查找小数点 |
| | | return regex.test(value); // 返回true/false |
| | | } |
| | | |
| | | //子组件接收参数 |
| | | |
| | | const xGrid = ref() |
| | | const gridOptions = reactive({ |
| | | border: "full",//表格加边框 |
| | | keepSource: true,//保持源数据 |
| | | align: 'center',//文字居中 |
| | | stripe:true,//斑马纹 |
| | | rowConfig: {isCurrent: true, isHover: true,height: 50},//鼠标移动或选择高亮 |
| | | id: 'CustomerList', |
| | | rowConfig: {isCurrent: true, isHover: true,height: 30},//鼠标移动或选择高亮 |
| | | id: 'QualityInspectionReview', |
| | | showFooter: true,//显示脚 |
| | | printConfig: {}, |
| | | importConfig: {}, |
| | |
| | | showStatus: true |
| | | },//表头参数 |
| | | columns:[ |
| | | {type:'expand',fixed:"left",slots: { content:'content' },width: 50}, |
| | | {title: '操作', width: 120, slots: { default: 'button_slot' },fixed:"left"}, |
| | | { type: 'seq',fixed:"left", title: '自序', width: 50 }, |
| | | {type:'expand',fixed:"left",slots: { content:'content' }}, |
| | | {title: t('basicData.operate'), width: 100, slots: { default: 'button_slot' },fixed:"left"}, |
| | | { type: 'seq',fixed:"left", title: t('basicData.Number'),}, |
| | | |
| | | {field: 'reportingWorkNo',width: 120, title: '报工编号',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true, }, |
| | | {field: 'reportingWorkTime',width: 120, title: '报工时间', sortable: true,showOverflow:"ellipsis" ,filters:[{ data: '' }],slots: { filter: 'num1_filter' }}, |
| | | {field: 'entryName',width: 120, title: '项目名称', sortable: true,filters:[{ data: '' }],slots: { filter: 'num1_filter' }}, |
| | | {field: 'customerName',width: 120, title: '客户名称',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true}, |
| | | {field: 'thisProcess',width: 100, title: '本工序', sortable: true,showOverflow:"ellipsis"}, |
| | | {field: 'teamName',width: 110, title: '报工班组', sortable: true}, |
| | | {field: 'finishedNumber',width: 100, title: '完工数量', sortable: true}, |
| | | {field: 'wornNumber', width: 100,title: '次破数量', sortable: true}, |
| | | {field: 'responsibilityProcess',width: 100, title: '责任工序', sortable: true}, |
| | | {field: 'previousProcess', width: 100,title: '上工序', sortable: true}, |
| | | {field: 'nextProcess',width: 100, title: '下工序', sortable: true}, |
| | | {field: 'qualityInspector',width: 120, title: '质检员', sortable: true}, |
| | | {field: 'qualityState',width: 120, title: '质检状态', sortable: true}, |
| | | {field: 'notes',width: 120, title: '备注', sortable: true} |
| | | {field: 'reportingWorkId',width: 130, title: t('reportingWorks.reportingWorkId'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }, }, |
| | | {field: 'reportingWorkTime',width: 120, title: t('reportingWorks.reportingWorkTime'),showOverflow:"ellipsis" }, |
| | | {field: 'processId',width: 130, title: t('processCard.processId'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }}, |
| | | {field: 'order.project',width: 120, title: t('order.project'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }}, |
| | | {field: 'order.customerName',width: 120, title: t('customer.customerName'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }}, |
| | | {field: 'thisProcess',width: 100, title: t('reportingWorks.thisProcess'),showOverflow:"ellipsis"}, |
| | | {field: 'thisCompletedQuantity',width: 100, title: t('reportingWorks.thisCompletedQuantity')}, |
| | | {field: 'thisWornQuantity', width: 100,title: t('reportingWorks.thisWornQuantity')}, |
| | | {field: 'teamsGroupsName',width: 110, title: t('reportingWorks.teamsType')}, |
| | | {field: 'deviceName',width: 110, title: t('reportingWorks.deviceType')}, |
| | | {field: 'previousProcess', width: 100,title: t('reportingWorks.previousProcess')}, |
| | | {field: 'nextProcess',width: 100, title: t('reportingWorks.nextProcess')}, |
| | | {field: 'qualityInspector',width: 120, title: t('reportingWorks.qualityInspector')}, |
| | | {field: 'qualityInsTime',width: 120, title: t('reportingWorks.qualityInsTime')}, |
| | | {field: 'damageDetails.qualityInsStatus',width: 120, title: t('reportingWorks.qualityInsStatus')} |
| | | ],//表头按钮 |
| | | |
| | | toolbarConfig: { |
| | |
| | | custom: true |
| | | }, |
| | | data: [ |
| | | { |
| | | reportingWorkNo: 'BG2312070001', |
| | | reportingWorkTime: '2023-12-01 08:01:22', |
| | | processCard: 'NG231207A01', |
| | | entryName: '信合春天里', |
| | | customerName: 'XXXX', |
| | | thisProcess: '中空', |
| | | teamName:"中空一班", |
| | | finishedNumber: '11', |
| | | wornNumber: '1', |
| | | responsibilityProcess: '钢化', |
| | | previousProcess:'钢化', |
| | | nextProcess:'包装', |
| | | qualityInspector: 'XXX', |
| | | qualityState: '1', |
| | | notes: '1)按企标2)每片玻璃标签贴室外面。内片玻璃打“3C商标”,统一打在玻璃“宽度”方向右下角4)按批次单独落架。', |
| | | }, |
| | | { |
| | | reportingWorkNo: 'BG2312070002', |
| | | reportingWorkTime: '2023-12-01 08:01:22', |
| | | processCard: 'NG231207A01', |
| | | entryName: '信合春天里', |
| | | customerName: 'XXXX', |
| | | thisProcess: '中空', |
| | | teamName:"中空一班", |
| | | finishedNumber: '11', |
| | | wornNumber: '1', |
| | | responsibilityProcess: '钢化', |
| | | previousProcess:'钢化', |
| | | nextProcess:'包装', |
| | | qualityInspector: 'XXX', |
| | | qualityState: '1', |
| | | notes: '1)按企标2)每片玻璃标签贴室外面。内片玻璃打“3C商标”,统一打在玻璃“宽度”方向右下角4)按批次单独落架。', |
| | | }, |
| | | { |
| | | reportingWorkNo: 'BG2312070003', |
| | | reportingWorkTime: '2023-12-01 08:01:22', |
| | | processCard: 'NG231207A01', |
| | | entryName: '信合春天里', |
| | | customerName: 'XXXX', |
| | | thisProcess: '中空', |
| | | teamName:"中空一班", |
| | | finishedNumber: '11', |
| | | wornNumber: '1', |
| | | responsibilityProcess: '钢化', |
| | | previousProcess:'钢化', |
| | | nextProcess:'包装', |
| | | qualityInspector: 'XXX', |
| | | qualityState: '1', |
| | | notes: '1)按企标2)每片玻璃标签贴室外面。内片玻璃打“3C商标”,统一打在玻璃“宽度”方向右下角4)按批次单独落架。', |
| | | }, |
| | | { |
| | | reportingWorkNo: 'BG2312070004', |
| | | reportingWorkTime: '2023-12-01 08:01:22', |
| | | processCard: 'NG231207A01', |
| | | entryName: '信合春天里', |
| | | customerName: 'XXXX', |
| | | thisProcess: '中空', |
| | | teamName:"中空一班", |
| | | finishedNumber: '11', |
| | | wornNumber: '1', |
| | | responsibilityProcess: '钢化', |
| | | previousProcess:'钢化', |
| | | nextProcess:'包装', |
| | | qualityInspector: 'XXX', |
| | | qualityState: '1', |
| | | notes: '1)按企标2)每片玻璃标签贴室外面。内片玻璃打“3C商标”,统一打在玻璃“宽度”方向右下角4)按批次单独落架。', |
| | | }, |
| | | |
| | | ],//table body实际数据 |
| | | //脚部求和 |
| | | footerMethod ({ columns, data }) {//页脚函数 |
| | | let footList=['finishedNumber','wornNumber'] |
| | | return[ |
| | | columns.map((column, columnIndex) => { |
| | | if (columnIndex === 0) { |
| | | return '合计:' |
| | | return t('basicData.total') |
| | | } |
| | | if (footList.includes(column.field)) { |
| | | return sumNum(data, column.field) |
| | | const List = ["thisCompletedQuantity",'thisWornQuantity','area','perimeter'] |
| | | if (List.includes(column.field)) { |
| | | return footSum(data, column.field) |
| | | } |
| | | return '' |
| | | }) |
| | |
| | | |
| | | <template> |
| | | <div class="main-div-customer"> |
| | | <div style="width: 600px"> |
| | | <div id="selectForm"> |
| | | <el-row :gutter="0"> |
| | | <!-- <el-input placeholder="流程卡号" v-model="form.name" style="width: 200px"/>--> |
| | | <!-- --> |
| | | <!-- <select class="processesSt">--> |
| | | <!-- <option value="未审核">未审核</option>--> |
| | | <!-- <option value="已审核">已审核</option>--> |
| | | <!-- </select>--> |
| | | |
| | | <el-date-picker |
| | | v-model="value" |
| | | v-model="form.date1" |
| | | type="daterange" |
| | | start-placeholder="开始时间" |
| | | end-placeholder="结束时间" |
| | | format="YYYY/MM/DD" |
| | | value-format="YYYY-MM-DD" |
| | | :start-placeholder="$t('basicData.startDate')" |
| | | :end-placeholder="$t('basicData.endDate')" |
| | | :default-time="defaultTime" |
| | | |
| | | /> |
| | | |
| | | <el-button type="primary">查询</el-button> |
| | | <el-select :default-first-option="true" ref="getSelect" style="width: 100px" v-model="optionVal" class="m-2" |
| | | > |
| | | <el-option |
| | | v-for="item in options" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | |
| | | <el-input v-model="form.processId" clearable :placeholder="$t('processCard.processId')" style="width: 130px"></el-input> |
| | | |
| | | <el-button |
| | | @click="getWorkOrder" |
| | | id="select" |
| | | type="primary" :icon="Search">{{$t('basicData.search')}} |
| | | |
| | | </el-button> |
| | | </el-row> |
| | | |
| | | </div> |
| | | <vxe-grid |
| | | max-height="100%" |
| | | height="100%" |
| | | @filter-change="filterChanged" |
| | | class="mytable-scrollbar" |
| | | ref="xGrid" |
| | |
| | | <!-- 下拉显示所有信息插槽--> |
| | | <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 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 @click="getTableRow(row,'edit')" link type="primary" size="small">编辑</el-button> |
| | | <el-button @click="getTableRow(row,'setType')" link type="primary" size="small">审核</el-button> |
| | | <!-- <el-button @click="getTableRow(row,'edit')" link type="primary" size="small">编辑</el-button>--> |
| | | <el-button @click="getTableRow(row,'edit')" |
| | | v-if="userStore.user.permissions.indexOf('QualityInspectionReview.edit') > -1" |
| | | link |
| | | type="primary" |
| | | size="small"> |
| | | {{ $t('basicData.edit') }} |
| | | </el-button> |
| | | <el-button v-if="row.damageDetails.qualityInsStatus==='已质检'||row.damageDetails.qualityInsStatus==='无需质检'" disabled @click="getTableRow(row,'setType')" link type="primary" size="small">{{ $t('basicData.review') }}</el-button> |
| | | <el-button v-else @click="getTableRow(row,'setType')" link type="primary" size="small">{{ $t('basicData.review') }}</el-button> |
| | | </template> |
| | | |
| | | <template #num1_filter="{ column, $panel }"> |
| | |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <template #pager> |
| | | <!--使用 pager 插槽--> |
| | | <!-- 'PrevJump','NextJump', --> |
| | | <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> |
| | |
| | | <style scoped> |
| | | .main-div-customer{ |
| | | width: 99%; |
| | | height: 100%; |
| | | height: 95%; |
| | | } |
| | | #selectForm { |
| | | width: 60%; |
| | | text-align: center; |
| | | } |
| | | </style> |