| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446 |
- r++<template>
- <div class="ele-body">
- <el-card shadow="never" v-loading="loading">
- <order-search @search="reload" ref="searchRef"> </order-search>
- <!-- 数据表格 -->
- <ele-pro-table
- ref="table"
- :columns="newColumns"
- :datasource="datasource"
- :cache-key="cacheKeyUrl"
- :height="tableHeight"
- @sort-change="onSortChange"
- @columns-change="handleColumnChange"
- @fullscreen-change="fullscreenChange"
- :pageSize="20"
- >
- <template v-slot:code="{ row }">
- <!-- <el-link type="primary" :underline="false" @click="goDetail(row)"> -->
- {{ row.code }}
- <!-- </el-link> -->
- </template>
- <template v-slot:sourceType="{ row }">
- <span v-if="row.sourceType == 1">生产计划</span>
- <span v-if="row.sourceType == 2">临时生产计划</span>
- <span v-if="row.sourceType == 3">受托转订单</span>
- </template>
- <template v-slot:workOrderType="{ row }">
- <span v-if="row.workOrderType == 1">普通订单</span>
- <span v-if="row.workOrderType == 2">临时订单</span>
- <span v-if="row.workOrderType == 3">受托订单</span>
- </template>
- <template v-slot:priority="{ row }">
- <div style="display: flex">
- <el-input
- v-model="row.priority"
- type="number"
- size="mini"
- :min="0"
- :max="10"
- @change="priorityChange(row)"
- style="width: 80px"
- ></el-input>
- <el-popover
- placement="right"
- width="200"
- trigger="hover"
- content="数值越大优先级越高(0-3普通, 4-6优先, 7-10紧急)"
- >
- <div class="sort-wrap" slot="reference">
- <i class="el-icon-caret-top" @click="sortTop(row)"></i>
- <i class="el-icon-caret-bottom" @click="sortBottom(row)"></i>
- </div>
- </el-popover>
- </div>
- </template>
- <template v-slot:status="{ row }">
- <span :class="{ 'ele-text-danger': row.status == 3 }">
- {{ statusFormatter(row.status) }}
- </span>
- </template>
- <template v-slot:crewNames="{ row }">
- <span v-if="row.crewNames">
- {{ row.crewNames }}
- </span>
- <span v-if="row.workstationNames">
- {{ row.workstationNames }}
- </span>
- </template>
- </ele-pro-table>
- </el-card>
- <el-dialog :visible.sync="visible" title="选择班组" width="400px">
- <el-select v-model="releasParams.teamId">
- <el-option
- v-for="item in teamList"
- :value="item.id"
- :key="item.id"
- :label="item.name"
- ></el-option>
- </el-select>
- <div class="footer" slot="footer">
- <el-button @click="visible = false">取消</el-button>
- <el-button type="primary">确定</el-button>
- </div>
- </el-dialog>
- </div>
- </template>
- <script>
- import {
- getList,
- releaseWorkOrder,
- updatePriority,
- fieldModel
- } from '@/api/produceWord/index.js';
- import OrderSearch from './components/order-search.vue';
- import { debounce } from 'lodash';
- import tableColumnsMixin from '@/mixins/tableColumnsMixin';
- export default {
- mixins: [tableColumnsMixin],
- components: {
- OrderSearch
- },
- data() {
- return {
- visible: false,
- loading: false,
- releasParams: {
- teamId: '',
- id: ''
- },
- teamList: [],
- newColumns: [],
- statusOpt: [
- { label: '待生产', value: 4 },
- { label: '生产中', value: 5 },
- { label: '已完成', value: 6 },
- { label: '已延期', value: 7 },
- { label: '待下达', value: 8 }
- ],
- cacheKeyUrl: '0c2fb832-mes-produceWord',
- columnsVersion: 0,
- tableHeight: 'calc(100vh - 380px)'
- };
- },
- computed: {
- // 表格列配置
- columns() {
- const num = this.columnsVersion;
- return [
- {
- columnKey: 'index',
- label: '序号',
- type: 'index',
- width: 55,
- align: 'center',
- showOverflowTooltip: true,
- fixed: 'left'
- },
- {
- prop: 'batchNo',
- label: '批次号',
- align: 'center',
- minWidth: 100,
- showOverflowTooltip: true
- },
- {
- prop: 'code',
- slot: 'code',
- label: '生产订单号',
- align: 'center',
- minWidth: 110,
- showOverflowTooltip: true
- },
- {
- prop: 'productionPlanCode',
- label: '计划编码',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'produceRoutingName',
- label: '工艺路线',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'productCode',
- label: '编码',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'productionCodes',
- label: '生产编号',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'productName',
- label: '名称',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'brandNo',
- label: '牌号',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'sourceType',
- label: '来源类型',
- slot: 'sourceType',
- align: 'center',
- minWidth: 110,
- showOverflowTooltip: true
- },
- {
- prop: 'sourceCode',
- label: '来源编码',
- align: 'center',
- minWidth: 110,
- showOverflowTooltip: true
- },
- {
- prop: 'workOrderType',
- label: '订单类型',
- slot: 'workOrderType',
- align: 'center',
- minWidth: 110,
- showOverflowTooltip: true
- },
- {
- prop: 'model',
- label: '型号',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'colorKey',
- label: '颜色',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- prop: 'modelKey',
- label: '机型',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- prop: 'specification',
- label: '规格',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'priority',
- label: '优先级',
- align: 'center',
- minWidth: 120,
- slot: 'priority',
- sortable: 'custom',
- showOverflowTooltip: true
- },
- {
- prop: 'formingNum',
- label: '要求生产数量',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- prop: 'formingWeight',
- 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: 'completeTime',
- label: '实际完成时间',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- prop: 'createTime',
- label: '创建时间',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 110,
- sortable: 'custom'
- },
- {
- prop: 'status',
- slot: 'status',
- label: '状态',
- align: 'center',
- formatter: (row) => {
- const obj = this.statusOpt.find((i) => i.value == row.status);
- return obj && obj.label;
- }
- },
- {
- prop: 'teamName',
- label: '班组',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 140
- },
- {
- prop: 'crewNames',
- label: '人员/工位',
- align: 'center',
- slot: 'crewNames',
- showOverflowTooltip: true,
- minWidth: 160
- }
- // {
- // columnKey: 'action',
- // label: '操作',
- // width: 90,
- // align: 'center',
- // resizable: false,
- // fixed: 'right',
- // slot: 'action',
- // showOverflowTooltip: true
- // }
- ];
- }
- },
- created() {
- this.getFieldModel();
- },
- methods: {
- statusFormatter(status) {
- const obj = this.statusOpt.find((i) => i.value == status);
- return obj && obj.label;
- },
- /* 表格数据源 */
- datasource({ page, limit, where }) {
- if (where.status) {
- where.statusList = [];
- where.statusList.push(where.status);
- } else {
- where.statusList = [4, 5, 6, 7];
- }
- return getList({
- pageNum: page,
- size: limit,
- ...where,
- ...this.sort
- });
- },
- /* 刷新表格 */
- reload(where) {
- this.$nextTick(() => {
- this.$refs.table.reload({ page: 1, where });
- });
- },
- onSortChange(e) {
- let sort = {
- orderBy: e.order,
- sortName: e.prop
- };
- this.sort = sort;
- this.reload();
- },
- fullscreenChange(fullscreen) {
- if (fullscreen) {
- this.tableHeight = 'calc(100vh - 120px)';
- } else {
- this.tableHeight = 'calc(100vh - 380px)';
- }
- },
- getFieldModel() {
- fieldModel({ fieldModel: 't_main_category' }).then((res) => {
- let newRes = res.map((m) => {
- return {
- prop: 'extField.' + m.prop,
- label: m.label,
- align: 'center',
- showOverflowTooltip: true
- };
- });
- this.newColumns = [...this.columns, ...newRes];
- this.getTabColumns();
- this.$forceUpdate();
- });
- },
- sortTop(row) {
- row.priority = Number(row.priority) + 1;
- this.priorityChange(row);
- },
- sortBottom(row) {
- if (row.priority <= 1) {
- return;
- }
- row.priority = Number(row.priority) - 1;
- this.priorityChange(row);
- },
- priorityChange(row) {
- if (row.priority > 10) {
- row.priority = 10; // 如果大于 10,则设置为 10
- } else if (row.priority < 0) {
- row.priority = 0; // 如果小于 0,则设置为 0
- }
- this.priorityFn(row);
- },
- priorityFn: debounce(function (row) {
- let params = {
- id: row.id,
- priority: row.priority
- };
- updatePriority(params).then((res) => {});
- }, 800)
- }
- };
- </script>
- <style lang="scss" scoped></style>
|