| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310 |
- <template>
- <div>
- <ele-pro-table
- ref="table"
- :columns="columns"
- height="calc(100vh - 280px)"
- width="100%"
- :datasource="datasource"
- :selection.sync="selection"
- @selection-change="handleSelectionChange"
- cache-key="produceOrderZ"
- highlight-current-row
- @row-click="rowClick"
- :need-page="false"
- >
- <template v-slot:toolbar>
- <div class="rx-bc">
- <div class="c_title">工单列表 </div>
- <div>
- <el-input
- style="width: 180px"
- clearable
- v-model="code"
- placeholder="请输入工单号"
- />
- <el-button size="mini" type="primary" style="margin: 0 5px" @click="handleSearch">查询</el-button>
- </div>
- </div>
- </template>
- <template v-slot:code="{ row }">
- <el-link type="primary" @click="handRoute(row)" :underline="false">{{
- row.code
- }}</el-link>
- </template>
- <template v-slot:singleReport="{ row }">
- <el-tag size="mini"> {{ row.singleReport == 1 ? '单个报工' : '批量报工' }}</el-tag>
- </template>
- <template v-slot:formingNum="{ row }">
- <span> {{ row.formingNum }} {{ row.unit }} </span>
- </template>
- <template v-slot:formingWeight="{ row }">
- <span> {{ row.formingNum }} {{ row.weightUnit }} </span>
- </template>
- </ele-pro-table>
- <routings
- v-if="routingShow"
- :routeObj="routeObj"
- @closeRoute="closeRoute"
- ></routings>
- </div>
- </template>
- <script>
- import { workorderPage2 } from '@/api/produce/workOrder.js';
- import routings from './routings.vue';
- import { isFullscreen } from 'ele-admin';
- export default {
- components: { routings },
- data() {
- return {
- loading: false,
- selection: [],
- routeObj: {},
- routingShow: false,
- code: '',
- internalIsFullscreen: isFullscreen() // 初始值
- };
- },
- computed: {
- // 表格列配置
- columns() {
- return [
- {
- width: 45,
- type: 'selection',
- columnKey: 'selection',
- align: 'center',
- fixed: true
- },
- {
- columnKey: 'index',
- label: '序号',
- type: 'index',
- width: 55,
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'batchNo',
- label: '批次号',
- align: 'center'
- },
- {
- prop: 'code',
- slot: 'code',
- label: '生产工单号',
- align: 'center',
- minWidth: '160'
- },
- {
- prop: 'productCode',
- label: '产品编码',
- align: 'center',
- minWidth: '160',
- showOverflowTooltip: true,
-
- },
- {
- prop: 'productName',
- label: '产品名称',
- align: 'center',
- showOverflowTooltip: true,
- },
- {
- prop: 'singleReport',
- slot: 'singleReport',
- label: '报工类型',
- align: 'center',
- width: 100
- },
- {
- prop: 'brandNo',
- label: '牌号',
- align: 'center',
- showOverflowTooltip: true,
- },
- {
- prop: 'model',
- label: '型号',
- align: 'center',
- showOverflowTooltip: true,
- },
- {
- prop: 'priority',
- label: '优先级',
- align: 'center',
- minWidth: 120
- },
- {
- prop: 'formingNum',
- label: '要求生产数量',
- align: 'center',
- slot: 'formingNum',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- prop: 'formingWeight',
- label: '要求生产重量',
- slot: 'formingWeight',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- prop: 'formedNum',
- label: '已生产数量',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- prop: 'formedWeight',
- label: '已生产重量',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- prop: 'planStartTime',
- label: '计划开始时间',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- prop: 'planCompleteTime',
- label: '计划结束时间',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- prop: 'startTime',
- label: '实际开始时间',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- prop: 'createTime',
- label: '创建时间',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 110
- }
- ];
- },
- taskObj() {
- return this.$store.state.user.taskObj;
- }
- },
- watch: {
- taskObj: {
- handler(val) {
- this.reload();
- },
- immediate: true,
- deep: true
- }
- },
- created() {},
- mounted() {
- // 添加窗口resize事件监听器
- window.addEventListener('resize', this.handleResize);
- },
- beforeDestroy() {
- // 组件销毁前移除事件监听器,防止内存泄漏
- window.removeEventListener('resize', this.handleResize);
- },
- methods: {
- /* 表格数据源 */
- datasource({ page, where }) {
- return workorderPage2({
- pageNum: page,
- size: 500,
- workOrderId: this.$route.query.workOrderId
- ? this.$route.query.workOrderId
- : null,
- taskId: this.taskObj && this.taskObj.id,
- code: this.code,
- ...where
- });
- },
- handleSearch() {
- this.reload()
- },
- /* 刷新表格 */
- reload(where) {
- this.$nextTick(() => {
- this.$refs.table.reload({ page: 1, where });
- });
- },
- handleSelectionChange(val) {
- let initReportValue = val[0] && val[0].singleReport;
- let allSame = true;
- val.forEach((item) => {
- if (item.singleReport !== initReportValue) {
- allSame = false;
- }
- });
- if (!allSame) {
- return this.$message.warning('请选择报工类型相同的工单');
- }
- let ids = [];
- ids = val.map((item) => {
- return item.id;
- });
- console.log(ids);
- this.$emit('workSelect', ids);
- },
- rowClick(e) {
- this.$emit('rowClick', e, this.taskObj.id);
- },
- handRoute(row) {
- this.routeObj = row;
- this.routingShow = true;
- },
- closeRoute() {
- this.routingShow = false;
- },
- handleResize() {
- this.internalIsFullscreen = isFullscreen();
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- </style>
|