| | |
| | | import { useI18n } from 'vue-i18n' |
| | | import SelectProduct from "@/views/sd/product/SelectProduct.vue"; |
| | | import useUserInfoStore from "@/stores/userInfo"; |
| | | import footSum from "@/hook/footSum" |
| | | import userInfo from "@/stores/userInfo" |
| | | |
| | | //语言获取 |
| | | const { t } = useI18n() |
| | | const userStore = useUserInfoStore() |
| | | let router=useRouter() |
| | | const user=userInfo() |
| | | const getTableRow = (row,type) =>{ |
| | | switch (type) { |
| | | case 'edit' :{ |
| | |
| | | break |
| | | } |
| | | case 'delete':{ |
| | | request.post(`/reportingWork/deleteWork/${row.reportingWorkId}/${row.processId}/${row.thisProcess}`).then((res) => { |
| | | let userId=user.user.userId; |
| | | let userName=user.user.userName; |
| | | const str=row.processId |
| | | let processId=str.split('/')[0]; |
| | | request.post(`/reportingWork/deleteWork/${row.reportingWorkId}/${processId}/${row.thisProcess}/${userId}/${userName}`).then((res) => { |
| | | if (res.code == 200 && res.data===true) { |
| | | ElMessage.success(t('workOrder.deleteOk')) |
| | | router.push({path: '/main/reportingWorks/SelectReportingWorks', query: {random:Math.random()}}) |
| | | } else { |
| | | ElMessage.warning('删除失败,检查下工序是否已报工') |
| | | ElMessage.warning(t('processCard.deleteNoProcedure')) |
| | | } |
| | | }) |
| | | break |
| | |
| | | |
| | | //获取七天前到当前时间 |
| | | function getNowTime() { |
| | | const start = new Date(new Date().getTime()- 3600 * 1000 * 24 * 7) |
| | | const start = new Date(new Date().getTime()- 3600 * 1000 * 24 * 3) |
| | | .toISOString() |
| | | .replace('T', ' ') |
| | | .slice(0,10) //默认开始时间7天前 |
| | |
| | | total.pageTotal= res.data.total.pageTotal |
| | | pageTotal.value = res.data.total |
| | | produceList = produceList.value.concat(deepClone(res.data.data)) |
| | | xGrid.value.reloadData(produceList) |
| | | // 使用map方法来处理每个对象 |
| | | let modifiedCollection = produceList.map(item => { |
| | | if (item.reviewedState === 1) { |
| | | return { ...item, reviewedState: "已审核" }; |
| | | } |
| | | else if (item.reviewedState === 0) { |
| | | return { ...item, reviewedState: "未审核" }; |
| | | } |
| | | else if (item.reviewedState === 2){ |
| | | return { ...item, reviewedState: "审核不通过" }; |
| | | } |
| | | else { |
| | | // 其他情况保持不变 |
| | | return item; |
| | | } |
| | | }); |
| | | xGrid.value.reloadData(modifiedCollection) |
| | | gridOptions.loading = false |
| | | } else { |
| | | ElMessage.warning(res.msg) |
| | |
| | | |
| | | |
| | | produceList = deepClone(res.data.data) |
| | | xGrid.value.reloadData(produceList) |
| | | // 使用map方法来处理每个对象 |
| | | let modifiedCollection = produceList.map(item => { |
| | | if (item.reviewedState === 1) { |
| | | return { ...item, reviewedState: "已审核" }; |
| | | } |
| | | else if (item.reviewedState === 0) { |
| | | return { ...item, reviewedState: "未审核" }; |
| | | } |
| | | else if (item.reviewedState === 2){ |
| | | return { ...item, reviewedState: "审核不通过" }; |
| | | } |
| | | else { |
| | | // 其他情况保持不变 |
| | | return item; |
| | | } |
| | | }); |
| | | xGrid.value.reloadData(modifiedCollection) |
| | | }else{ |
| | | ElMessage.warning(res.msg) |
| | | } |
| | |
| | | total.dataTotal = res.data.total.total*1 |
| | | total.pageTotal= res.data.total.pageTotal |
| | | pageTotal.value = res.data.total |
| | | xGrid.value.loadData(res.data.data) |
| | | produceList=res.data.data |
| | | // 使用map方法来处理每个对象 |
| | | let modifiedCollection = produceList.map(item => { |
| | | if (item.reviewedState === 1) { |
| | | return { ...item, reviewedState: "已审核" }; |
| | | } |
| | | else if (item.reviewedState === 0) { |
| | | return { ...item, reviewedState: "未审核" }; |
| | | } |
| | | else if (item.reviewedState === 2){ |
| | | return { ...item, reviewedState: "审核不通过" }; |
| | | } |
| | | else { |
| | | // 其他情况保持不变 |
| | | return item; |
| | | } |
| | | }); |
| | | xGrid.value.reloadData(modifiedCollection) |
| | | gridOptions.loading = false |
| | | } else { |
| | | ElMessage.warning(res.msg) |
| | |
| | | } |
| | | |
| | | function filterChanged(column) { |
| | | gridOptions.loading = true |
| | | gridOptions.loading=true |
| | | //筛选条件发生变化条件发生变化 |
| | | let value = column.datas[0] != undefined ? column.datas[0] : '' |
| | | let value = column.datas[0]!=undefined?column.datas[0]:'' |
| | | value = value.trim() |
| | | //判断是否存在外键 |
| | | if (column.property.indexOf('.') > -1) { |
| | | const columnArr = column.property.split('.') |
| | | if (column.property.indexOf('.')>-1){ |
| | | const columnArr = column.property.split('.') |
| | | filterData.value[columnArr[0]] = { |
| | | [columnArr[1]]: value |
| | | [columnArr[1]]:value |
| | | } |
| | | } else { |
| | | }else{ |
| | | filterData.value[column.property] = value |
| | | } |
| | | |
| | |
| | | |
| | | request.post(`/reportingWork/selectReportingWork/1/${total.pageSize}/${startTime}/${endTime}/${inputVal}`, filterData.value).then((res) => { |
| | | if(res.code==200){ |
| | | pageTotal.value=res.data.total |
| | | total.dataTotal = res.data.total.total*1 |
| | | total.pageTotal=parseInt(res.data.total) |
| | | pageNum.value=1 |
| | | produceList = deepClone(res.data.data) |
| | | xGrid.value.loadData(produceList) |
| | | // 使用map方法来处理每个对象 |
| | | let modifiedCollection = produceList.map(item => { |
| | | if (item.reviewedState === 1) { |
| | | return { ...item, reviewedState: "已审核" }; |
| | | } |
| | | else if (item.reviewedState === 0) { |
| | | return { ...item, reviewedState: "未审核" }; |
| | | } |
| | | else if (item.reviewedState === 2){ |
| | | return { ...item, reviewedState: "审核不通过" }; |
| | | } |
| | | else { |
| | | // 其他情况保持不变 |
| | | return item; |
| | | } |
| | | }); |
| | | xGrid.value.reloadData(modifiedCollection) |
| | | gridOptions.loading=false |
| | | }else{ |
| | | ElMessage.warning(res.msg) |
| | |
| | | align: 'center',//文字居中 |
| | | stripe:true,//斑马纹 |
| | | rowConfig: {isCurrent: true, isHover: true,height: 30},//鼠标移动或选择高亮 |
| | | id: 'CustomerList', |
| | | id: 'SelectReportingWorks', |
| | | showFooter: true,//显示脚 |
| | | printConfig: {}, |
| | | importConfig: {}, |
| | |
| | | },//表头参数 |
| | | columns:[ |
| | | {type:'expand',fixed:"left",slots: { content:'content' },width: 50}, |
| | | {title: '操作', width: 140, slots: { default: 'button_slot' },fixed:"left"}, |
| | | { type: 'seq',fixed:"left", title: '自序', width: 50 }, |
| | | {field: 'reportingWorkId', width: 120, title: '报工编号',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, }, |
| | | {field: 'reportingWorkTime',width: 120, title: '报工时间' ,showOverflow:"ellipsis" ,filters:[{ data: '' }],slots: { filter: 'num1_filter' }}, |
| | | {field: 'orderId', width: 130,title: '销售单号' ,filters:[{ data: '' }],slots: { filter: 'num1_filter' }}, |
| | | {field: 'processId', width: 130,title: '流程卡号' ,filters:[{ data: '' }],slots: { filter: 'num1_filter' }}, |
| | | {field: 'order.project',width: 120, title: '项目名称',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, }, |
| | | {field: 'order.batch', width: 100,title: '批次' ,filters:[{ data: '' }],slots: { filter: 'num1_filter' }}, |
| | | |
| | | {field: 'thisProcess',width: 100, title: '本工序',filters:[{ data: '' }],slots: { filter: 'num1_filter' } }, |
| | | {field: 'thisCompletedQuantity',width: 120, title: '本工序完工' }, |
| | | {field: 'completedArea', width: 120,title: '完工面积', }, |
| | | {field: 'thisWornQuantity',width: 120, title: '本工序次破', }, |
| | | {field: 'wornArea',width: 120, title: '次破面积', }, |
| | | {field: 'deviceName', width: 100,title: '报工设备', }, |
| | | {field: 'teamsGroupsName',width: 120, title: '报工班组', }, |
| | | {field: 'reviewedState',width: 120, title: '审核状态', }, |
| | | {title: t('basicData.operate'), width: 140, slots: { default: 'button_slot' },fixed:"left"}, |
| | | { type: 'seq',fixed:"left", title: t('basicData.Number'), width: 50 }, |
| | | {field: 'reportingWorkId', width: 120, title: t('reportingWorks.reportingWorkId'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }, }, |
| | | {field: 'reportingWorkTime',width: 120, title: t('reportingWorks.reportingWorkTime') ,showOverflow:"ellipsis" ,filters:[{ data: '' }],slots: { filter: 'num1_filter' }}, |
| | | {field: 'orderId', width: 130,title: t('order.orderId') ,filters:[{ data: '' }],slots: { filter: 'num1_filter' }}, |
| | | {field: 'processId', width: 160,title: t('processCard.processId') ,filters:[{ data: '' }],slots: { filter: 'num1_filter' }}, |
| | | {field: 'order.project',width: 150, title: t('order.project'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }, }, |
| | | {field: 'order.batch', width: 100,title: t('order.batch') ,filters:[{ data: '' }],slots: { filter: 'num1_filter' }}, |
| | | {field: 'thisProcess',width: 100, title: t('reportingWorks.thisProcess'),filters:[{ data: '' }],slots: { filter: 'num1_filter' } }, |
| | | {field: 'thisCompletedQuantity',width: 120, title: t('reportingWorks.thisCompletedQuantity') }, |
| | | {field: 'completedArea', width: 120,title: t('reportingWorks.completedArea'), }, |
| | | {field: 'thisWornQuantity',width: 120, title: t('reportingWorks.thisWornQuantity'), }, |
| | | {field: 'wornArea',width: 120, title: t('reportingWorks.wornArea'), }, |
| | | {field: 'deviceName', width: 100,title: t('reportingWorks.deviceType'),filters:[{ data: '' }],slots: { filter: 'num1_filter' } }, |
| | | {field: 'teamsGroupsName',width: 120, title: t('reportingWorks.teamsType'),filters:[{ data: '' }],slots: { filter: 'num1_filter' } }, |
| | | {field: 'reviewedState',width: 120, title: t('processCard.reviewedState'), }, |
| | | {field: 'reviewed',width: 120, title: '审核人', }, |
| | | {field: 'notes',width: 120, title: t('basicData.remarks'), }, |
| | | |
| | | ],//表头按钮 |
| | | |
| | |
| | | data: [],//table body实际数据 |
| | | //脚部求和 |
| | | footerMethod ({ columns, data }) {//页脚函数 |
| | | let footList=['','','',''] |
| | | 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",'completedArea','thisWornQuantity','wornArea'] |
| | | if (List.includes(column.field)) { |
| | | return footSum(data, column.field) |
| | | } |
| | | return '' |
| | | }) |
| | |
| | | |
| | | </div> |
| | | <vxe-grid |
| | | max-height="100%" |
| | | height="100%" |
| | | @filter-change="filterChanged" |
| | | class="mytable-scrollbar" |
| | | ref="xGrid" |
| | |
| | | <template #button_slot="{ row }"> |
| | | <!-- <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('SelectReportingWorks.edit') > -1" |
| | | v-if="userStore.user.permissions.indexOf('selectReportingWorks.edit') > -1" |
| | | link |
| | | type="primary" |
| | | size="small"> |
| | | {{ $t('basicData.edit') }} |
| | | </el-button> |
| | | <el-popconfirm @confirm="getTableRow(row,'delete')" :title="$t('searchOrder.deleteConfirm')"> |
| | | <!-- <el-button @click="getTableRow(row,'delete')"--> |
| | | <!-- v-if="userStore.user.permissions.indexOf('basicData.delete') > -1"--> |
| | | <!-- link--> |
| | | <!-- type="primary"--> |
| | | <!-- size="small">--> |
| | | <!-- {{ $t('basicData.delete') }}--> |
| | | <!-- </el-button>--> |
| | | <el-popconfirm :title="$t('searchOrder.deleteConfirm')" @confirm="getTableRow(row,'delete')"> |
| | | <template #reference> |
| | | <el-button link type="primary" size="small">{{ $t('basicData.delete') }}</el-button> |
| | | <el-button link size="small" type="primary">{{ $t('basicData.delete') }}</el-button> |
| | | </template> |
| | | </el-popconfirm> |
| | | <!-- <el-popconfirm @confirm="getTableRow(row,'delete')" :title="$t('searchOrder.deleteConfirm')">--> |
| | | <!-- <template #reference>--> |
| | | <!-- <el-button link type="primary" size="small">{{ $t('basicData.delete') }}</el-button>--> |
| | | <!-- </template>--> |
| | | <!-- </el-popconfirm>--> |
| | | </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)"/> |
| | | <input type="type" v-model="option.data" |
| | | @keyup.enter.native="$panel.confirmFilter()" |
| | | @input="changeFilterEvent($event, option, $panel)"/> |
| | | </div> |
| | | </div> |
| | | </template> |
| | |
| | | <style scoped> |
| | | .main-div-customer{ |
| | | width: 99%; |
| | | height: 100%; |
| | | height: 96%; |
| | | } |
| | | #selectForm { |
| | | width: 45%; |