| | |
| | | import GlassType from "@/components/sd/product/GlassType.vue" |
| | | import {useRouter} from 'vue-router' |
| | | import Sortable from 'sortablejs' |
| | | import BasicTable from '@/components/basic/BasicTable.vue' |
| | | import BasicTable from '@/components/sd/product/BasicTable.vue' |
| | | import {VXETable} from "vxe-table"; |
| | | |
| | | import { useI18n } from 'vue-i18n' |
| | | import useUserInfoStore from '@/stores/userInfo' |
| | | import footSum from "@/hook/footSum" |
| | | import useOrderInfoStore from "@/stores/sd/order/orderInfo" |
| | | //语言获取 |
| | | const { t } = useI18n() |
| | | const userStore = useUserInfoStore() |
| | | const orderInfo = useOrderInfoStore() |
| | | |
| | | let productGlassTypeStore = useProductGlassTypeStore() |
| | | let router = useRouter() |
| | | let isButtonDisabled=false |
| | | |
| | | const getTableRow = (row, type) => { |
| | | switch (type) { |
| | | case 'edit' : { |
| | | //alert('我接收到子组件传送的编辑信息') |
| | | router.push({path: '/main/workOrder/addWorkOrder', query: {orderId: row.orderId}}) |
| | | break |
| | | } |
| | | case 'delete': { |
| | | //console.log(row.orderDetail.productName) |
| | | //request.post('/workOrder/deleteOrderWork/${row.orderId}', ,row.orderDetail.productName).then((res) => { |
| | | request.post(`/workOrder/deleteOrderWork/${row.orderId}/${row.orderDetail.productName}`).then((res) => { |
| | | if (res.code == 200) { |
| | | ElMessage.success("删除成功") |
| | | location.reload(); |
| | | } else { |
| | | ElMessage.warning(res.msg) |
| | | router.push("/login") |
| | | } |
| | | let startTime = form.date1[0] |
| | | let endTime = form.date1[1] |
| | | let state = optionVal.value |
| | | request.post(`/workOrder/deleteOrderWork/${row.orderId}/${row.productionId}`).then((res) => { |
| | | if (res.code == 200 && res.data===true) { |
| | | ElMessage.success(t('workOrder.deleteOk')) |
| | | router.push({path: '/main/workOrder/SelectWorkOrder', query: {startTime:startTime,endTime:endTime,state:state,random:Math.random()}}) |
| | | } else { |
| | | |
| | | ElMessage.warning(t('workOrder.deleteNo')) |
| | | |
| | | } |
| | | }) |
| | | break |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | function padLeftZero(str) { |
| | | return ('00' + str).substr(str.length) |
| | | } |
| | | |
| | | //定义时间 |
| | |
| | | |
| | | |
| | | //定义转单状态 |
| | | const optionVal = ref('0') |
| | | const optionVal = ref('1') |
| | | const options = [ |
| | | { |
| | | value: '0', |
| | | label: '已转', |
| | | label: t('workOrder.convert'), |
| | | }, |
| | | { |
| | | value: '1', |
| | | label: '未转', |
| | | label: t('workOrder.unConverted'), |
| | | }, |
| | | ] |
| | | |
| | |
| | | let pageNum = $ref(1) |
| | | let pageState = null |
| | | |
| | | //获取七天前到当前时间 |
| | | //获取3天前到当前时间 |
| | | function getNowTime() { |
| | | const start = new Date(new Date().getTime() - 3600 * 1000 * 24 * 7) |
| | | const start = new Date(new Date().getTime() - 3600 * 1000 * 24 * 15) |
| | | .toISOString() |
| | | .replace('T', ' ') |
| | | .slice(0, 10) //默认开始时间7天前 |
| | | const end = new Date(new Date().getTime()) |
| | | 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 |
| | | const getFirst = () => { |
| | | //第一次加载获取近3天时间和默认状态 |
| | | //form.date1 = getNowTime() |
| | | if (orderInfo.workOrderDate[0]=="" && orderInfo.workOrderDate[1]==""){ |
| | | orderInfo.workOrderDate=getNowTime() |
| | | } |
| | | let startTime = orderInfo.workOrderDate[0] |
| | | let endTime = orderInfo.workOrderDate[1] |
| | | let state = optionVal.value |
| | | |
| | | //第一次加载数据 |
| | | request.post(`/workOrder/orderGlassDetail/${startTime}/${endTime}/${state}`, filterData.value).then((res) => { |
| | | |
| | | request.post(`/workOrder/orderGlassDetail/${startTime}/${endTime}/${state}`, filterData.value).then((res) => { |
| | | if (res.code == 200) { |
| | | 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) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | if (res.code == 200) { |
| | | console.log(res.data.data) |
| | | 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 getWorkOrder = () => { |
| | | |
| | | let startTime = form.date1[0] |
| | | let endTime = form.date1[1] |
| | | let startTime = orderInfo.workOrderDate[0] |
| | | let endTime = orderInfo.workOrderDate[1] |
| | | let selectState = optionVal.value |
| | | request.post(`/workOrder/orderGlassDetail/${startTime}/${endTime}/${selectState}`, filterData.value).then((res) => { |
| | | if (res.code == 200) { |
| | | |
| | | //isButtonDisabled=false |
| | | pageTotal.value = res.data.total |
| | | xGrid.value.loadData(res.data.data) |
| | | gridOptions.loading = false |
| | |
| | | $panel.changeOption(event, !!option.data, option) |
| | | } |
| | | |
| | | //筛选时查询 |
| | | function filterChanged(column) { |
| | | gridOptions.loading = true |
| | | //筛选条件发生变化条件发生变化 |
| | |
| | | } |
| | | |
| | | //获取选中时间和是否转单状态 |
| | | let startTime = form.date1[0] |
| | | let endTime = form.date1[1] |
| | | let startTime = orderInfo.workOrderDate[0] |
| | | let endTime = orderInfo.workOrderDate[1] |
| | | let selectState = optionVal.value |
| | | |
| | | request.post(`/workOrder/orderGlassDetail/${startTime}/${endTime}/${selectState}`, filterData.value).then((res) => { |
| | |
| | | } |
| | | |
| | | //子组件接收参数 |
| | | |
| | | const xGrid = ref() |
| | | const gridOptions = reactive({ |
| | | loading: true, |
| | |
| | | align: 'center',//文字居中 |
| | | stripe: true,//斑马纹 |
| | | rowConfig: {isCurrent: true, isHover: true,height: 30},//鼠标移动或选择高亮 |
| | | id: 'demo_1', |
| | | id: 'selectWorkOrder', |
| | | showFooter: true,//显示脚 |
| | | printConfig: {}, |
| | | importConfig: {}, |
| | |
| | | mode: 'row', |
| | | showStatus: true |
| | | },//表头参数 |
| | | checkboxConfig: { |
| | | labelField: 'name', |
| | | checkMethod: ({ row }) => { |
| | | return optionVal.value === '1' |
| | | } |
| | | }, |
| | | columns: [ |
| | | {type: 'expand', fixed: "left", slots: {content: 'content'}, width: 50}, |
| | | {title: '操作', width: 110, slots: {default: 'button_slot'}, fixed: "left"}, |
| | | {type: 'seq', fixed: "left", title: '自序', width: 50}, |
| | | {field: 'orderId', title: '销售单号', filters: [{data: ''}], slots: {filter: 'num1_filter'}, width: 110}, |
| | | {type: 'checkbox', fixed: "left", title: t('basicData.check'), width: 80}, |
| | | {title: t('basicData.operate'), width: 110, slots: {default: 'button_slot'}, fixed: "left"}, |
| | | {type: 'seq', fixed: "left", title: t('basicData.Number'), width: 50}, |
| | | {field: 'orderId', title: t('order.orderId'), filters: [{data: ''}], slots: {filter: 'num1_filter'}, width: 110}, |
| | | {field: 'order.customerName', title: t('processCard.customerName'), filters: [{data: ''}], slots: {filter: 'num1_filter'}, width: 110}, |
| | | { |
| | | field: 'productionId', |
| | | title: '生产订单号', |
| | | title: t('workOrder.productionId'), |
| | | showOverflow: "ellipsis", |
| | | filters: [{data: ''}], |
| | | slots: {filter: 'num1_filter'} |
| | | , width: 130 |
| | | }, |
| | | {field: 'order.batch', title: '批次', filters: [{data: ''}], slots: {filter: 'num1_filter'}, width: 110}, |
| | | {field: 'orderDetail.productName', title: '产品名称', filters: [{data: ''}], slots: {filter: 'num1_filter'}, width: 210}, |
| | | {field: 'orderDetail.computeArea', title: '单片总面积', showOverflow: "ellipsis", width: 110}, |
| | | {field: 'orderDetail.quantity', title: '总数量', width: 70}, |
| | | {field: 'orderDetail.computeGrossArea', title: '成品总面积',}, |
| | | {field: 'orderDetail.perimeter', title: '周长', showOverflow: "ellipsis"}, |
| | | {field: 'orderDetail.bendRadius', title: '半径',}, |
| | | {field: 'orderDetail.processingNote', title: '加工要求',} |
| | | {field: 'order.batch', title: t('order.batch'), filters: [{data: ''}], slots: {filter: 'num1_filter'}, width: 110}, |
| | | {field: 'order.project', title: t('order.project'), filters: [{data: ''}], slots: {filter: 'num1_filter'}, width: 210}, |
| | | {field: 'order.orderType', title: t('order.orderType'), showOverflow: "ellipsis", width: 110}, |
| | | {field: 'orderDetail.grossArea', title: t('order.grossArea'), width: 70}, |
| | | {field: 'orderDetail.quantity', title: t('order.quantity'),}, |
| | | {field: 'order.creator', title: t('order.creator'),}, |
| | | {field: 'founder', title: t('product.creator'),}, |
| | | {field: 'order.processingNote', title: t('order.processingNote'), filters: [{data: ''}], slots: {filter: 'num1_filter'},}, |
| | | ],//表头按钮 |
| | | data: null,//表格数据 |
| | | toolbarConfig: { |
| | | // buttons: [{ |
| | | // |
| | | // }], |
| | | import: false, |
| | | export: true, |
| | | print: true, |
| | | buttons: [ |
| | | {'code': 'transferOrder', 'name': t('workOrder.transferOrder'),status: 'primary'} |
| | | ], |
| | | // import: false, |
| | | // export: true, |
| | | // print: true, |
| | | zoom: true, |
| | | custom: true |
| | | }, |
| | | //脚部求和 |
| | | footerMethod({columns, data}) {//页脚函数 |
| | | let footList = ['', '', ''] |
| | | return [ |
| | | footerMethod ({ columns, data }) {//页脚函数 |
| | | 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 = ["orderDetail.grossArea",'orderDetail.quantity'] |
| | | if (List.includes(column.field)) { |
| | | return footSum(data, column.field) |
| | | } |
| | | return '' |
| | | }) |
| | |
| | | } |
| | | |
| | | }) |
| | | const gridEvents = { |
| | | async toolbarButtonClick({code}) { |
| | | const $grid = xGrid.value |
| | | if ($grid) { |
| | | switch (code) { |
| | | case 'transferOrder': { |
| | | const idList = [] |
| | | $grid.getCheckboxRecords().forEach(item => { |
| | | idList.push(item.orderId) |
| | | }) |
| | | router.push({path: '/main/workOrder/addWorkOrder', query: {orderId:idList.join(',')}}) |
| | | break |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | onMounted(() => { |
| | | getFirst() |
| | | }) |
| | | </script> |
| | | |
| | | <template> |
| | |
| | | <div id="selectForm"> |
| | | <el-row :gutter="0"> |
| | | <el-date-picker |
| | | v-model="form.date1" |
| | | v-model="orderInfo.workOrderDate" |
| | | type="daterange" |
| | | format="YYYY/MM/DD" |
| | | value-format="YYYY-MM-DD" |
| | | start-placeholder="开始时间" |
| | | end-placeholder="结束时间" |
| | | :start-placeholder="$t('basicData.startDate')" |
| | | :end-placeholder="$t('basicData.endDate')" |
| | | :default-time="defaultTime" |
| | | |
| | | /> |
| | | |
| | | <el-select :default-first-option="true" ref="getSelect" style="width: 120px" v-model="optionVal" class="m-2" |
| | | placeholder="是否转工单"> |
| | | <el-select |
| | | :default-first-option="true" |
| | | ref="getSelect" style="width: 130px" |
| | | v-model="optionVal" |
| | | class="m-2" |
| | | @change="getWorkOrder" |
| | | > |
| | | <el-option |
| | | v-for="item in options" |
| | | :key="item.value" |
| | |
| | | |
| | | <el-button |
| | | @click="getWorkOrder" |
| | | :disabled="isButtonDisabled" |
| | | id="select" |
| | | type="primary" :icon="Search">查询 |
| | | type="primary" :icon="Search">{{$t('basicData.search')}} |
| | | </el-button> |
| | | </el-row> |
| | | |
| | |
| | | class="mytable-scrollbar" |
| | | ref="xGrid" |
| | | v-bind="gridOptions" |
| | | v-on="gridEvents" |
| | | |
| | | > |
| | | <!-- @toolbar-button-click="toolbarButtonClickEvent"--> |
| | |
| | | |
| | | <!--左边固定显示的插槽--> |
| | | <template #button_slot="{ row }"> |
| | | <el-button :class="{disable: optionVal== 0}" :disabled="optionVal == 0" @click="getTableRow(row,'edit')" link type="primary" size="small">转工单</el-button> |
| | | <el-button :class="{disable: optionVal== 1}" :disabled="optionVal == 1" @click="getTableRow(row,'delete')" link type="primary" size="small">删除</el-button> |
| | | <!-- <el-button :class="{disable: optionVal== 0}" :disabled="optionVal == 0" @click="getTableRow(row,'edit')" link type="primary" size="small">{{$t('workOrder.transferOrder')}}</el-button>--> |
| | | <!-- <el-button :class="{disable: optionVal== 0}" :disabled="optionVal == 0"--> |
| | | <!-- @click="getTableRow(row,'edit')"--> |
| | | <!-- v-if="userStore.user.permissions.indexOf('SelectWorkOrder.edit') > -1"--> |
| | | <!-- link--> |
| | | <!-- type="primary"--> |
| | | <!-- size="small">--> |
| | | <!-- {{$t('workOrder.transferOrder')}}--> |
| | | <!-- </el-button>--> |
| | | |
| | | <!-- <el-button :class="{disable: optionVal== 1}" :disabled="optionVal == 1" @click="getTableRow(row,'delete')" link type="primary" size="small">{{$t('basicData.delete')}}</el-button>--> |
| | | <el-popconfirm @confirm="getTableRow(row,'delete')" :title="$t('searchOrder.deleteConfirm')"> |
| | | <template #reference> |
| | | <el-button :class="{disable: optionVal== 1}" :disabled="optionVal == 1" link type="primary" size="small">{{ $t('basicData.delete') }}</el-button> |
| | | </template> |
| | | </el-popconfirm> |
| | | </template> |
| | | |
| | | <template #num1_filter="{ column, $panel }"> |