| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530 |
- <template>
- <div class="ele-body">
- <el-card shadow="never" v-loading="loading">
- <seek-page :seekList="seekList" @search="search"></seek-page>
- <!-- <button @click="btnPrint">打印</button> -->
- <!-- <produceOrder-search @search="reload" ref="searchRef" :statusOpt="statusOpt" :planType="planType"
- :activeName="activeName">
- </produceOrder-search> -->
- <el-tabs v-model="tabValue" type="card" @tab-click="handleTabClick">
- <!-- <el-tab-pane label="未完成工单" name="first"></el-tab-pane>
- <el-tab-pane label="已完成工单" name="second"></el-tab-pane> -->
- <el-tab-pane label="我的工单" name="1"></el-tab-pane>
- <el-tab-pane label="生产中" name="5"></el-tab-pane>
- <el-tab-pane label="待生产" name="4"></el-tab-pane>
- <el-tab-pane label="已完成" name="6"></el-tab-pane>
- <el-tab-pane label="已延期" name="7"></el-tab-pane>
- <el-tab-pane label="已终止" name="10"></el-tab-pane>
- </el-tabs>
- <!-- 数据表格 -->
- <!-- :cache-key="cacheKeyUrl" -->
- <ele-pro-table
- ref="table"
- :key="activeName"
- :initLoad="false"
- :columns="columns"
- :datasource="datasource"
- row-key="code"
- :selection.sync="selection"
- @sort-change="onSortChange"
- autoAmendPage
- :parse-data="parseData"
- @columns-change="handleColumnChange"
- :cache-key="cacheKeyUrl"
- :pageSize="20"
- :height="tableHeight"
- @fullscreen-change="fullscreenChange"
- >
- <template v-slot:toolbar>
- <!-- <el-button type="success">新建</el-button> -->
- <el-button type="success" @click="toPause()">暂停</el-button>
- <el-button type="success" @click="toTermination()">终止</el-button>
- <!-- <el-button type="primary">工单刷新</el-button> -->
- <!-- <el-button type="success" @click="handlePicking">领料</el-button> -->
- <el-button type="success" @click="toEnd()">批量完结</el-button>
- <!-- <el-button type="success" @click="handleCreate">创建工单</el-button> -->
- <!-- <el-button type="success">工单操作控制</el-button> -->
- <el-button type="success" @click="allPrinting()"
- >批量打印二维码</el-button
- >
- <el-button type="success" @click="cardPrinting()"
- >工艺卡打印</el-button
- >
- <el-button type="success" @click="originCode()">朔源码</el-button>
- <el-button v-if="tabValue == '6'" type="success" @click="batchRelease"
- >批量放行</el-button
- >
- </template>
- <template v-slot:code="{ row }">
- <el-link type="primary" :underline="false" @click="goDetail(row)">
- {{ row.code }}
- </el-link>
- </template>
- <template v-slot:QRcode="{ row }">
- <el-link type="primary" :underline="false" @click="handleQRcode(row)"
- >生成二维码
- </el-link>
- </template>
- <template v-slot:apsWorkOrderCode="{ row }">
- <label>{{ row.apsWorkOrderCode || '' }}</label>
- </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:formingNum="{ row }">
- <span> {{ row.formingNum }} </span>
- </template>
- <template v-slot:formingWeight="{ row }">
- <span> {{ row.formingWeight }} {{ row.weightUnit }} </span>
- </template>
- <template v-slot:teamId="{ row }">
- <el-link
- type="primary"
- :underline="false"
- @click="openDotLineDetail('plan', row)"
- >查看详情</el-link
- >
- </template>
- <template v-slot:taskId="{ row }">
- <el-link
- type="primary"
- :underline="false"
- @click="openDotLineDetail('task', row)"
- >查看详情</el-link
- >
- </template>
- <template v-slot:singleReport="{ row }">
- <span v-if="row.singleReport == 0">批量报工</span>
- <span v-if="row.singleReport == 1">单个报工</span>
- </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:entrustStatus="{ row }">
- <div v-if="row.entrustStatus">
- <span v-if="row.entrustStatus == 1">未请托</span>
- <span v-if="row.entrustStatus == 2">请托中</span>
- <span v-if="row.entrustStatus == 3">请托完成</span>
- </div>
- <span v-else>未请托</span>
- </template>
- <template v-slot:outsourceStatus="{ row }">
- <div v-if="row.outsourceStatus">
- <span v-if="row.outsourceStatus == 1">未委外</span>
- <span v-if="row.outsourceStatus == 2">委外中</span>
- <span v-if="row.outsourceStatus == 3">完成委外</span>
- </div>
- </template>
- <template #taskName="{ row }">
- <div v-if="taskNameMap[row.id]?.length" class="task-flow">
- <template v-for="(item, index) in taskNameMap[row.id]">
- <el-tag
- :key="item.taskId"
- size="mini"
- effect="dark"
- :type="getTaskTagTypeByStatus(item.flag)"
- >
- {{ item.taskTypeName }}
- </el-tag>
- <!-- 箭头 -->
- <span
- v-if="index < taskNameMap[row.id].length - 1"
- class="task-arrow"
- >
- →
- </span>
- </template>
- </div>
- <span v-else>—</span>
- </template>
- <template v-slot:status="{ row }">
- <span :class="{ 'ele-text-danger': row.status == 3 }">
- {{ statusFormatter(row.status) }}
- </span>
- </template>
- <!-- 操作列 -->
- <template v-slot:action="{ row }">
- <template v-if="activeName == 'second'">
- <el-link
- type="primary"
- :underline="false"
- v-if="row.status == 6"
- @click="toCancel(row)"
- >
- 取消完结
- </el-link></template
- >
- <el-link
- v-if="row.clientEnvironmentId == 21"
- type="primary"
- :underline="false"
- @click="routing(row)"
- >
- 更改工艺路线
- </el-link>
- <template>
- <el-link type="primary" :underline="false" @click="toView(row)">
- 序列号
- </el-link></template
- >
- <template v-if="activeName != 'second'">
- <el-link
- v-if="
- (row.status == 4 || row.status == 5 || row.status == 7) &&
- row.isSplit == 0
- "
- type="primary"
- :underline="false"
- @click="handleOrderPublish(row)"
- >
- 报工
- </el-link>
- <!-- <el-link
- v-if="
- row.status == 4 && row.isSplit == 0 && clientEnvironmentId != 9
- "
- type="primary"
- :underline="false"
- @click="toUnpack(row)"
- >
- 拆分
- </el-link> -->
- <el-link
- v-if="row.status == 4 && row.isSplit == 0"
- type="primary"
- :underline="false"
- @click="toEnd(row)"
- >
- 完结
- </el-link>
- <el-link
- v-if="dispatchBtn(row)"
- type="primary"
- :underline="false"
- @click="toReleaseOpen(row)"
- >
- 任务派单
- </el-link>
- </template>
- <el-link
- v-if="
- tabValue == '6' &&
- row.checklistStatus != 1 &&
- row.checklistStatus != 2
- "
- type="primary"
- @click="toRelease(row)"
- >放行单</el-link
- >
- </template>
- </ele-pro-table>
- </el-card>
- <print ref="printRef"></print>
- <printSr ref="printSrRef"></printSr>
- <printTg ref="printTgRef"></printTg>
- <printCard ref="printCardRef"></printCard>
- <createDialog ref="createRef" @success="createSuccess" />
- <unpackDialog ref="unpackRef" @success="createSuccess" />
- <pickingDialog ref="PickingRef" />
- <detailsPop ref="detailsRef"> </detailsPop>
- <EquipmentDialog ref="equipmentRef" @choose="choose"></EquipmentDialog>
- <xlhView ref="xlhRef"></xlhView>
- <workReport ref="workReport"></workReport>
- <releaseDialog
- ref="releaseRef"
- :current="dispatchRow"
- :dispatchVisible.sync="dispatchVisible"
- @createSuccess="createSuccess"
- v-if="dispatchVisible"
- />
- <planDotLineReleaseDialog
- ref="planDotLineReleaseDialogRef"
- :current="dispatchRow"
- :dispatchVisible.sync="planDotLineReleaseDialogVisible"
- @createSuccess="createSuccess"
- v-if="planDotLineReleaseDialogVisible"
- />
- <originCode ref="originCodeRef" />
- <checkAdd
- ref="checkAddRef"
- @confirm="checkAddConfirm('add', $event)"
- ></checkAdd>
- <checkDetails ref="checkDetailsRef" @reload="reload"></checkDetails>
- <dotLinePopup ref="dotLinePopupRef"></dotLinePopup>
- </div>
- </template>
- <script>
- import releaseDialog from './components/releaseDialog';
- import workReport from './workReport.vue';
- import {
- getPage,
- batchCompletion,
- cancelCompletion,
- updatePriority,
- update,
- getTaskIdByInstanceId,
- updateStatusPause,
- updateStatusTerminate,
- getMyPage
- } from '@/api/produceOrder/index.js';
- import xlhView from './components/xlhView.vue';
- import { fieldModel } from '@/api/produceWord/index.js';
- import produceOrderSearch from './components/produceOrder-search.vue';
- import createDialog from './components/createDialog.vue';
- import unpackDialog from './components/unpackDialog.vue';
- import pickingDialog from './components/pickingDialog.vue';
- import print from './components/print.vue';
- import printSr from './components/printSr';
- import printTg from './components/printTg';
- import printCard from './print.vue';
- import EquipmentDialog from './components/EquipmentDialog.vue';
- import detailsPop from './components/details/index.vue';
- import { parameterGetByCode } from '@/api/system/dictionary-data';
- import { debounce } from 'lodash';
- import tableColumnsMixin from '@/mixins/tableColumnsMixin';
- import originCode from './originCode.vue';
- import checkAdd from '@/views/checklistManagement/components/checkAdd.vue';
- import checkDetails from '@/views/checklistManagement/components/checkDetails.vue';
- import { getTaskInstanceList } from '@/api/produce/job';
- import planDotLineReleaseDialog from './components/releaseDialog/planDotLineReleaseDialog.vue';
- import dotLinePopup from './components/details/dotLinePopup.vue';
- export default {
- mixins: [tableColumnsMixin],
- components: {
- releaseDialog,
- produceOrderSearch,
- pickingDialog,
- createDialog,
- unpackDialog,
- print,
- printSr,
- printTg,
- printCard,
- detailsPop,
- EquipmentDialog,
- xlhView,
- workReport,
- originCode,
- checkAdd,
- checkDetails,
- planDotLineReleaseDialog,
- dotLinePopup
- },
- data() {
- return {
- activeName: 'first',
- tabValue: '5',
- id: '',
- where: {},
- // 加载状态
- loading: false,
- pageType: 'add',
- dialogTitle: '',
- isBindPlan: false,
- statusOpt: {
- first: [
- { label: '所有状态', value: '5,4' },
- { label: '待生产', value: '4' },
- { label: '生产中', value: '5' }
- // { label: '已延期', value: '7' }
- ],
- second: [{ label: '已完成', value: '6' }]
- },
- planType: [
- { label: '所有计划类型', value: null },
- { label: '内销计划', value: '1' },
- { label: '外销计划', value: '2' },
- { label: '预制计划', value: '3' }
- ],
- selection: [],
- columns: [],
- cacheKeyUrl: '7cc8e5d2-mes-produceOrder',
- columnsVersion: 0,
- dispatchVisible: false,
- dispatchRow: {},
- tableHeight: 'calc(100vh - 375px)',
- workDataList: [],
- taskNameMap: {},
- planDotLine: false,
- planDotLineReleaseDialogVisible: false
- };
- },
- computed: {
- // 表格列配置
- seekList() {
- return [
- {
- label: '关键字:',
- value: 'keyWord',
- type: 'input',
- placeholder: ''
- },
- {
- label: '生产工单号:',
- value: 'code',
- type: 'input',
- placeholder: '',
- labelWidth: 100
- },
- {
- label: '生产订单号:',
- value: 'apsWorkOrderCode',
- type: 'input',
- labelWidth: 100
- },
- {
- label: '计划编号:',
- value: 'productionPlanCode',
- type: 'input',
- width: 240
- },
- {
- label: '计划类型:',
- value: 'planType',
- type: 'select',
- placeholder: '',
- width: 240,
- // 加载状态
- planList: this.planType
- },
- {
- label: '工艺路线',
- value: 'produceRoutingName',
- type: 'input',
- placeholder: '',
- width: 240
- },
- {
- label: '产品编码',
- value: 'productCode',
- type: 'input',
- placeholder: '',
- width: 240
- },
- {
- label: '产品名称:',
- value: 'productName',
- type: 'input',
- placeholder: '',
- width: 240
- },
- {
- label: '牌号',
- value: 'brandNo',
- type: 'input',
- placeholder: '',
- width: 240
- },
- {
- label: '型号',
- value: 'model',
- type: 'input',
- placeholder: '',
- width: 240
- },
- // {
- // label: "状态:",
- // value: 'status',
- // type: "select",
- // placeholder: '',
- // width: 240,
- // // 加载状态
- // planList: this.statusOpt.first
- // },
- // {
- // label: '班组:',
- // value: 'teamId',
- // type: 'select',
- // multiple: false, // 是否多选
- // filterable: true, // 是否可搜索
- // placeholder: '',
- // width: 240,
- // // 加载状态
- // planList: this.statusOpt.first
- // },
- {
- label: '创建时间:',
- value: 'createTime',
- type: 'date',
- dateType: 'daterange',
- placeholder: '',
- width: 240,
- // 加载状态
- planList: this.statusOpt.first
- }
- ];
- },
- basicColumns() {
- const num = this.columnsVersion;
- const opt = {
- first: [
- // {
- // prop: 'deliveryTime',
- // label: '预测交货日期',
- // align: 'center',
- // showOverflowTooltip: true,
- // minWidth: 110
- // }
- ],
- second: [
- {
- prop: 'completeTime',
- label: '完成时间',
- align: 'center'
- },
- {
- prop: 'cycle',
- label: '生产周期',
- align: 'center'
- }
- ]
- };
- return [
- {
- width: 45,
- type: 'selection',
- columnKey: 'selection',
- align: 'center',
- fixed: 'left'
- },
- {
- prop: 'batchNo',
- label: '批次号',
- align: 'center',
- minWidth: 130,
- showOverflowTooltip: true
- },
- {
- prop: 'lineNumber',
- label: '行号',
- align: 'center',
- minWidth: 130,
- showOverflowTooltip: true
- },
- {
- prop: 'code',
- slot: 'code',
- label: '生产工单号',
- align: 'center',
- minWidth: 110,
- showOverflowTooltip: true
- },
- // {
- // prop: 'originalCode',
- // label: '原始工单号',
- // align: 'center',
- // minWidth: 110
- // },
- {
- prop: 'QRcode',
- slot: 'QRcode',
- label: '二维码',
- align: 'center',
- minWidth: 110,
- showOverflowTooltip: true
- },
- {
- prop: 'apsWorkOrderCode',
- label: '生产订单号',
- slot: 'apsWorkOrderCode',
- align: 'center',
- minWidth: 110,
- 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: 'productionPlanCode',
- label: '计划编号',
- align: 'center',
- minWidth: 110,
- showOverflowTooltip: true
- },
- {
- prop: 'planType',
- label: '计划类型',
- align: 'center',
- showOverflowTooltip: true,
- formatter: (row) => {
- const obj = this.planType.find((i) => i.value == row.planType);
- return obj && obj.label;
- }
- },
- {
- prop: 'bomType',
- label: '生产类型',
- align: 'center',
- showOverflowTooltip: true,
- width: 120,
- formatter: (row) => {
- if (row.bomType == 1) {
- return '产品(PBOM)';
- }
- if (row.bomType == 2) {
- return '加工(MBOM)';
- }
- if (row.bomType == 3) {
- return '装配(ABOM)';
- }
- // if (row.bomType == 4) {
- // return '装配(EBOM)';
- // }
- return '';
- }
- },
- {
- prop: 'bomCategoryName',
- label: 'BOM版本',
- align: 'center',
- width: 130,
- showOverflowTooltip: true,
- formatter: (row) => {
- if (row.bomCategoryName) {
- return `${row.bomCategoryName} (V${row.bomCategoryVersions}.0)`;
- }
- return '';
- }
- },
- {
- prop: 'produceRoutingName',
- label: '工艺路线',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'productCode',
- label: '编码',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'colorKey',
- label: '颜色',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- prop: 'modelKey',
- label: '机型',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- prop: 'productName',
- label: '名称',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'model',
- label: '型号',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'specification',
- label: '规格',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'productionCodes',
- label: '生产编号',
- align: 'center',
- minWidth: 150,
- showOverflowTooltip: true
- },
- {
- prop: 'brandNo',
- label: '牌号',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'taskName',
- slot: 'taskName',
- label: '工序进度',
- align: 'center',
- minWidth: 280
- },
- {
- prop: 'singleReport',
- slot: 'singleReport',
- label: '报工类型',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'outsourceStatus',
- label: '委外状态',
- align: 'center',
- slot: 'outsourceStatus',
- showOverflowTooltip: true
- },
- {
- prop: 'teamId',
- label: '计划布点',
- align: 'center',
- slot: 'teamId',
- showOverflowTooltip: true
- },
- {
- prop: 'taskId',
- label: '任务布点',
- align: 'center',
- slot: 'taskId',
- showOverflowTooltip: true
- },
- {
- prop: 'priority',
- label: '优先级',
- align: 'center',
- minWidth: 120,
- slot: 'priority',
- sortable: 'custom'
- },
- {
- prop: 'formingNum',
- label: '要求生产数量',
- align: 'center',
- slot: 'formingNum',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- prop: 'unit',
- label: '单位',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- prop: 'factoriesName',
- label: '所属工厂',
- align: 'center',
- 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: 150,
- sortable: 'custom'
- },
- {
- prop: 'planCompleteTime',
- label: '计划结束时间',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 150,
- sortable: 'custom'
- },
- {
- prop: 'startTime',
- label: '实际开始时间',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 150,
- sortable: 'custom'
- },
- {
- prop: 'completeTime',
- label: '实际完成时间',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 150,
- sortable: 'custom'
- },
- ...opt[this.activeName],
- {
- prop: 'createTime',
- label: '创建时间',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 150,
- sortable: 'custom'
- },
- // {
- // prop: 'status',
- // slot: 'status',
- // label: '状态',
- // align: 'center',
- // formatter: (row) => {
- // const obj = this.statusOpt[this.activeName].find(
- // (i) => i.value == row.status
- // );
- // return obj && obj.label;
- // }
- // },
- {
- prop: 'deviceName',
- slot: 'deviceName',
- label: '设备名称',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'entrustStatus',
- label: '请托状态',
- align: 'center',
- slot: 'entrustStatus',
- showOverflowTooltip: true
- },
- {
- prop: 'crewNames',
- slot: 'crewNames',
- label: '报工人员',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'teamName',
- label: '班组',
- align: 'center',
- showOverflowTooltip: true
- }
- ];
- },
- dispatchBtn() {
- return (row) => {
- if (Number(row.taskId) == NaN || Number(row.taskId) <= 0) {
- return false;
- }
- return !!row.taskId;
- };
- },
- clientEnvironmentId() {
- return this.$store.state.user.info.clientEnvironmentId;
- }
- },
- watch: {
- activeName: {
- handler() {
- if (this.activeName) {
- this.where.status = this.statusOpt[this.activeName][0].value;
- this.reload();
- }
- },
- immediate: true
- }
- },
- created() {
- const isWt = this.$route.query?.isWt;
-
- if (isWt) {
- this.tabValue = '1';
- this.$nextTick(() => {
- const item = JSON.parse(this.$route.query?.item);
- const way = this.$route.query?.way;
- console.log(item);
- if (way == 'todo') {
- this.handleOrderPublish(item)
- } else {
- this.goDetail(item)
- }
- })
- }
- this.getFieldModel();
- this.getPlanDotLine();
- },
- mounted() {
- this.reload();
- },
- methods: {
- getPlanDotLine() {
- parameterGetByCode({
- code: 'plan_dot_line'
- }).then((res) => {
- if (res) {
- this.planDotLine = res.value == '1' ? true : false;
- }
- });
- },
- //派单
- toReleaseOpen(row) {
- getTaskIdByInstanceId(row.taskId)
- .then((res) => {
- if (res) {
- this.dispatchRow = { ...row };
- this.dispatchRow.initialWeight = row.formingWeight
- ? row.formingWeight + row.weightUnit
- : '';
- this.dispatchRow.taskInstanceId = res;
- if (this.planDotLine) {
- this.planDotLineReleaseDialogVisible = true;
- } else {
- this.dispatchVisible = true;
- }
- }
- })
- .catch((err) => {
- this.$message.error(err.message);
- });
- },
- search(e) {
- if (Array.isArray(e.createTime) && e.createTime.length) {
- e.createTimeStart = e.createTime[0];
- e.createTimeEnd = e.createTime[1];
- }
- this.reload(e);
- },
- // 查看序列号
- toView(row) {
- this.$refs.xlhRef.open(row);
- },
- handlePicking() {
- this.$router.push({
- path: '/produceOrder/picking'
- });
- },
- statusFormatter(status) {
- const obj = this.statusOpt[this.activeName].find(
- (i) => i.value == status
- );
- return obj && obj.label;
- },
- btnPrint() {
- const url = this.$router.resolve({ path: '/print' }).href; // 获取目标URL路径的完整URL字符串
- window.open(url, '_blank');
- // this.$router.push({
- // path: '/print'
- // });
- },
- routing(row) {
- this.id = row.id;
- this.$refs.equipmentRef.open();
- },
- handleTabClick() {
- if (this.tabValue == '6') {
- this.activeName = 'second';
- } else {
- this.activeName = 'first';
- }
- this.reload();
- },
- async loadTaskNames(list) {
- for (const row of list) {
- try {
- const res = await getTaskInstanceList(row.id);
- const findIndex = res.findIndex(
- (item) => item.taskId == row.taskId
- );
- const markedList = res.map((item, index) => {
- let flag = 'after';
- if (findIndex != -1) {
- if (index < findIndex) {
- flag = '4';
- } else if (index === findIndex) {
- flag = '3';
- } else {
- flag = '1';
- }
- }
- return {
- ...item,
- flag
- };
- });
- this.$set(this.taskNameMap, row.id, markedList);
- // this.$set(
- // this.taskNameMap,
- // row.taskId,
- // res.list.map((i) => i.name)
- // );
- // console.log(res, '工序数据');
- } catch (e) {
- this.$set(this.taskNameMap, row.id, []);
- }
- }
- this.$nextTick(() => {
- this.$refs.table?.doLayout?.();
- });
- },
- getTaskTagTypeByStatus(status) {
- return (
- {
- 1: 'info',
- 2: 'primary',
- 3: 'warning',
- 4: 'success'
- }[status] || ''
- );
- },
- originCode() {
- if (!this.selection.length) {
- return this.$message.warning('请至少选择一条工单!');
- }
- if (this.selection.length > 1) {
- return this.$message.warning('只能选择一条工单');
- }
- this.$refs.originCodeRef.open(this.selection[0].id);
- },
- /* 表格数据源 */
- async datasource({ page, limit, where, order }) {
- console.log(this.tabValue, '888');
- let statusList = this.tabValue == 1 ? [4, 5, 7] : [this.tabValue];
- let params = {
- ...where,
- ...order,
- queryTermination: this.tabValue == '10' ? 1 : 0,
- pageNum: page,
- size: limit,
- ...this.sort
- };
- // 只有 tabValue == 1 才可能需要 workCenterIds 字段,可根据业务决定是否添加
- if (this.tabValue == 1) {
- params.workCenterIds = this.$store.state.user.info.workCenterIds;
- }
- const URL = this.tabValue == 1 ? getMyPage : getPage;
- let res = await URL({ ...params, statusList });
- this.loadTaskNames(res.list);
- // let res = await URL({ ...params, statusList });
- // await Promise.all(
- // res.list.map(async (row) => {
- // const tasks = await getTaskInstanceList(row.id);
- // row._taskList = tasks;
- // })
- // );
- return res;
- },
- getWorkData() {
- if (this.$refs.table.getData().length != 0) {
- // const data = this.deep()
- }
- },
- onSortChange(e) {
- let sort = {
- orderBy: e.order,
- sortName: e.prop
- };
- this.sort = sort;
- this.reload();
- },
- flattenArray(arr) {
- var result = []; // 存放结果的数组
- for (let i = 0; i < arr.length; i++) {
- if (Array.isArray(arr[i].subWorkOrder)) {
- let _arr = [];
- _arr = _arr.concat(arr[i].subWorkOrder);
- delete arr[i].subWorkOrder;
- result.push(arr[i]);
- result.push(..._arr);
- } else {
- result.push(arr[i]);
- }
- }
- return result;
- },
- /* 数据转为树形结构 */
- parseData(data) {
- return {
- ...data,
- list: this.$util.toTreeData({
- data: data.list,
- count: data.total,
- idField: 'code',
- parentIdField: 'originalCode'
- })
- };
- },
- /* 数据转为树形结构 */
- createSuccess() {
- this.reload();
- },
- handleCreate() {
- this.$refs.createRef.open(0);
- },
- // 发布工单
- handleOrderPublish(row) {
- this.$refs.workReport.open(row);
- // this.$router.push({
- // path: '/produce',
- // query: {
- // workOrderId: row.id
- // }
- // });
- // this.$router.push({
- // path: '/produceOrder/workReport',
- // query: {
- // workOrderId: row.id
- // }
- // });
- },
- fullscreenChange(fullscreen) {
- if (fullscreen) {
- this.tableHeight = 'calc(100vh - 120px)';
- } else {
- this.tableHeight = 'calc(100vh - 375px)';
- }
- },
- getFieldModel() {
- fieldModel({ fieldModel: 't_main_category' }).then((res) => {
- const privateColumn = [
- {
- columnKey: 'action',
- label: '操作',
- width: 250,
- align: 'center',
- resizable: false,
- fixed: 'right',
- slot: 'action',
- showOverflowTooltip: true
- }
- ];
- let newRes = res.map((m) => {
- return {
- prop: 'extField.' + m.prop,
- label: m.label,
- align: 'center',
- showOverflowTooltip: true
- };
- });
- this.columns = [...this.basicColumns, ...newRes, ...privateColumn];
- this.getTabColumns();
- this.$forceUpdate();
- });
- },
- toPause() {
- if (!this.selection.length) {
- return this.$message.warning('请至少选择一条工单!');
- }
- let ids = [];
- this.selection.forEach((item) => {
- ids.push(item.id);
- });
- this.$confirm(`是否要暂停工单?`, '提醒', {
- confirmButtonText: '确认',
- cancelButtonText: '取消',
- type: 'warning'
- })
- .then(() => {
- updateStatusPause(ids).then((res) => {
- this.$message.success('成功');
- this.reload();
- });
- })
- .catch(() => {});
- },
- toTermination() {
- if (!this.selection.length) {
- return this.$message.warning('请至少选择一条工单!');
- }
- let ids = [];
- this.selection.forEach((item) => {
- ids.push(item.id);
- });
- this.$confirm(`是否要终止工单?`, '提醒', {
- confirmButtonText: '确认',
- cancelButtonText: '取消',
- type: 'warning'
- })
- .then(() => {
- updateStatusTerminate(ids).then((res) => {
- this.$message.success('成功');
- this.reload();
- });
- })
- .catch(() => {});
- },
- // 完结与批量完结
- toEnd(row) {
- if (row) {
- this.$confirm(`是否要完结工单【${row.code}】?`, '提醒', {
- confirmButtonText: '确认',
- cancelButtonText: '取消',
- type: 'warning'
- })
- .then(() => {
- batchCompletion([row.id]).then((res) => {
- this.$message.success('成功');
- this.reload();
- });
- })
- .catch(() => {});
- } else {
- if (!this.selection.length) {
- return this.$message.warning('请至少选择一条工单!');
- }
- const ids = [];
- this.selection.map((item) => {
- ids.push(item.id);
- });
- const h = this.$createElement;
- this.$msgbox({
- title: '提醒',
- message: h('p', null, [
- h('span', null, '是否要完结 '),
- h(
- 'span',
- { style: 'color: #70B603' },
- `${this.selection.length}`
- ),
- h('span', null, ' 条工单?')
- ]),
- showCancelButton: true,
- confirmButtonText: '确认',
- cancelButtonText: '取消',
- type: 'warning'
- })
- .then(() => {
- batchCompletion(ids).then((res) => {
- this.$message.success('成功');
- this.reload();
- });
- })
- .catch(() => {});
- }
- },
- // 取消完结
- toCancel(row) {
- cancelCompletion([row.id]).then((res) => {
- this.$message.success('成功');
- this.reload();
- });
- },
- // 拆分
- toUnpack(row) {
- this.$refs.unpackRef.open(row);
- },
- handleTabChange() {
- this.$refs.searchRef.reset();
- },
- /* 刷新表格 */
- reload(where = {}) {
- this.$nextTick(() => {
- where.statusList = (
- where.status || this.statusOpt[this.activeName][0].value
- ).split(',');
- this.$refs.table.reload({ page: 1, where });
- });
- },
- // 生产工单跳转
- goDetail(row) {
- this.$refs.detailsRef.open(row);
- },
- openDotLineDetail(type, row) {
- this.$refs.dotLinePopupRef?.open(type, row);
- },
- handleDelete({ id }) {
- this.$confirm('确定删除当前数据?', '提示').then(async () => {
- await del(id);
- this.$message.success('删除成功!');
- this.reload();
- });
- },
- handleQRcode(row) {
- console.log('clientEnvironmentId', this.clientEnvironmentId);
- if (this.clientEnvironmentId == 2) {
- this.$refs.printSrRef.open([row.id]);
- } else if (this.clientEnvironmentId == 3) {
- this.$refs.printTgRef.open([row.id]);
- } else {
- this.$refs.printRef.open([row.id]);
- }
- },
- allPrinting() {
- let ids = this.findAllIds(this.selection);
- if (this.clientEnvironmentId == 2) {
- this.$refs.printSrRef.open(ids);
- } else if (this.clientEnvironmentId == 3) {
- this.$refs.printTgRef.open(ids);
- } else {
- this.$refs.printRef.open(ids);
- }
- },
- // 工艺卡打印
- cardPrinting() {
- if (this.selection.length < 1) {
- return this.$message.warning('请选择一条工单!');
- }
- let ids = this.findAllIds(this.selection);
- this.$refs.printCardRef.open(ids);
- },
- findAllIds(nodes) {
- let ids = [];
- nodes.forEach((node) => {
- ids.push(node.id); // 添加当前节点的id
- if (node.children && node.children.length > 0) {
- // 递归调用自身来处理子节点
- ids = ids.concat(this.findAllIds(node.children));
- }
- });
- return ids;
- },
- choose(row) {
- this.updateFn(row);
- },
- async updateFn(row) {
- let req = {
- id: this.id, //工艺路线id false
- produceRoutingId: row[0].id, //工艺路线id false
- produceRoutingName: row[0].name
- };
- const res = await update(req);
- this.reload();
- },
- 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),
- // 批量放行
- batchRelease() {
- if (!this.selection.length) {
- return this.$message.warning('请至少选择一条工单!');
- }
- console.log('this.selection', this.selection);
- const productCode = this.selection[0].productCode;
- const batchNo = this.selection[0].batchNo;
- const isSame = this.selection.every(
- (item) => item.productCode === productCode && item.batchNo === batchNo
- );
- const item = this.selection.find(
- (item) => item.checklistStatus === 1 || item.checklistStatus === 2
- );
- if (item) {
- this.$message.warning(
- `工单【${item.code}】已生成或已完成放行单,不能重复放行`
- );
- return;
- }
- if (!isSame) {
- this.$message.warning('请选择同产品同批次号工单发起批量放行');
- return;
- }
- // 添加
- this.$refs.checkAddRef?.open('add', '1', this.selection);
- },
- // 单个放行
- toRelease(row) {
- this.$refs.checkAddRef?.open('add', '1', [row]);
- },
- // 确定放行
- checkAddConfirm(type, data) {
- this.$refs.checkDetailsRef?.open(type, data);
- }
- }
- };
- </script>
- <style scoped>
- .task-flow {
- display: flex;
- align-items: center;
- flex-wrap: wrap;
- }
- .task-arrow {
- margin: 0 6px;
- color: #999;
- font-weight: bold;
- }
- </style>
|