| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090 |
- <!-- 我的工单 -->
- <template>
- <div class="works">
- <el-form :model="dataForm" :inline="true">
- <el-form-item label="选择用户">
- <user-component
- v-model="dataForm.userId"
- :user-id="dataForm.userId"
- @userSelected="userChanged"
- />
- </el-form-item>
- <el-form-item>
- <el-button @click="queryData()" v-reClick>查询</el-button>
- <el-button @click="batchStart()" v-reClick v-if="dataForm.state === '1'">批量开始</el-button>
- <el-button @click="batchFinishOrCheck()" v-reClick v-if="dataForm.state === '2'">批量报工/通过</el-button>
- </el-form-item>
- </el-form>
- <el-tabs v-model="dataForm.state" @tab-click="queryData">
- <el-tab-pane label="未开始" name="1"></el-tab-pane>
- <el-tab-pane label="待操作" name="2"></el-tab-pane>
- <el-tab-pane label="已完成" name="3"></el-tab-pane>
- </el-tabs>
- <el-table
- :data="dataList"
- border
- v-loading="dataListLoading"
- style="width: 100%;"
- @selection-change="handleSelectionChange"
- >
- <el-table-column
- type="selection"
- :selectable="selected"
- width="55">
- </el-table-column>
- <el-table-column label="序号" type="index" width="50" align="center">
- </el-table-column>
- <el-table-column
- prop="ranks"
- header-align="center"
- align="center"
- min-width="140"
- :show-tooltip-when-overflow="true"
- label="级别"
- >
- <template slot-scope="scope">
- <span>
- {{
- rankTypeOption.findIndex((t) => t.value == scope.row.ranks) > -1
- ? rankTypeOption.find((t) => t.value == scope.row.ranks).label
- : ''
- }}
- </span>
- </template>
- </el-table-column>
- <el-table-column
- prop="taskType"
- header-align="center"
- align="center"
- min-width="160"
- label="工单类型"
- >
- <template slot-scope="scope">
- <span>
- {{
- taskTypeOption.findIndex((t) => t.value == scope.row.taskType) > -1
- ? taskTypeOption.find((t) => t.value == scope.row.taskType).label
- : ''
- }}
- </span>
- </template>
- </el-table-column>
- <el-table-column
- prop="taskName"
- header-align="center"
- align="center"
- min-width="140"
- :show-tooltip-when-overflow="true"
- label="工单名称"
- >
- </el-table-column>
- <el-table-column
- prop="content"
- header-align="center"
- align="center"
- min-width="140"
- :show-tooltip-when-overflow="true"
- label="工单内容"
- >
- </el-table-column>
- <el-table-column
- prop="planCompletionTime"
- header-align="center"
- align="center"
- min-width="160"
- label="规定完成时间"
- >
- </el-table-column>
- <el-table-column
- prop="attachList"
- header-align="center"
- align="center"
- width="80"
- label="工单附件"
- >
- <template slot-scope="scope">
- <el-button :disabled="!scope.row.attachList || scope.row.attachList.length === 0" type="text" size="small" @click="changeDetails(scope.row.attachList)">查看</el-button>
- </template>
- </el-table-column>
- <el-table-column
- prop="attachListComplete"
- header-align="center"
- align="center"
- width="80"
- label="报工附件"
- >
- <template slot-scope="scope">
- <el-button :disabled="!scope.row.attachListComplete || scope.row.attachListComplete.length === 0" type="text" size="small" @click="changeDetails(scope.row.attachListComplete)">查看</el-button>
- </template>
- </el-table-column>
- <el-table-column
- prop="historicalOperationRecords"
- header-align="center"
- align="center"
- width="160"
- :show-tooltip-when-overflow="true"
- label="操作记录"
- >
- </el-table-column>
- <el-table-column
- prop="nextOperator"
- header-align="center"
- align="center"
- min-width="140"
- :show-tooltip-when-overflow="true"
- label="下道工序"
- >
- </el-table-column>
- <el-table-column
- prop="backExplain"
- header-align="center"
- align="center"
- min-width="140"
- :show-tooltip-when-overflow="true"
- label="退回说明"
- >
- </el-table-column>
- <el-table-column
- prop="remark"
- header-align="center"
- align="center"
- min-width="160"
- :show-tooltip-when-overflow="true"
- label="备注"
- >
- </el-table-column>
- <el-table-column
- prop="receiverName"
- header-align="center"
- align="center"
- width="160"
- :show-tooltip-when-overflow="true"
- label="操作人"
- >
- </el-table-column>
- <el-table-column
- v-if="opColVisible"
- fixed="right"
- header-align="center"
- align="center"
- width="180"
- label="操作"
- >
- <template slot-scope="scope">
- <el-button
- v-if="isAuth('work:clt:start') && Number(scope.row.state) < 2"
- :disabled="Number(scope.row.state) === 0"
- type="text"
- size="small"
- @click="startTask(scope.row.taskId)"
- >开始</el-button
- >
- <!-- <el-button v-if="isAuth('work:clt:start')" type="text" size="small" @click="startTask(scope.row.taskId)">开始</el-button>-->
- <el-button
- v-if="isAuth('work:clt:transfer') && Number(scope.row.state) !== 3"
- type="text"
- size="small"
- @click="transferTask(scope.row)"
- >转单</el-button
- >
- <el-button
- v-if="
- isAuth('work:clt:complete') &&
- Number(scope.row.state) === 2 &&
- (scope.row.taskType == null ||
- scope.row.taskType === 'start' ||
- scope.row.taskType === 'produce' ||
- scope.row.taskType === 'routine')
- "
- type="text"
- size="small"
- @click="completeTask(scope.row.taskId)"
- >报工</el-button
- >
- <el-button
- v-if="
- isAuth('work:clt:check') &&
- Number(scope.row.state) === 2 &&
- (scope.row.taskType === 'check' ||
- scope.row.taskType === 't-check')
- "
- type="text"
- size="small"
- @click="checkTask(scope.row.taskId, 1)"
- >通过</el-button
- >
- <el-button
- v-if="
- isAuth('work:clt:check') &&
- Number(scope.row.state) === 2 &&
- (scope.row.taskType === 'check' ||
- scope.row.taskType === 't-check')
- "
- type="text"
- size="small"
- @click="checkTask(scope.row.taskId, 2)"
- >不通过</el-button
- >
- <el-button
- v-if="
- isAuth('work:clt:damage') &&
- Number(scope.row.state) === 2 &&
- (scope.row.taskType == null || scope.row.taskType === 'produce')
- "
- type="text"
- size="small"
- @click="damageTask(scope.row.nodeId, scope.row.productionId)"
- >报损</el-button
- >
- <el-button
- v-if="
- isAuth('work:clt:check') &&
- Number(scope.row.state) === 2 &&
- scope.row.taskType !== 'routine'
- "
- type="text"
- size="small"
- @click="submitTask(scope.row.nodeId, scope.row.productionId, scope.row.taskId)"
- >提审理单</el-button
- >
- </template>
- </el-table-column>
- </el-table>
- <el-pagination
- @size-change="sizeChangeHandle"
- @current-change="currentChangeHandle"
- :current-page="pageIndex"
- :page-sizes="[10, 20, 50, 100]"
- :page-size="pageSize"
- :total="totalPage"
- layout="total, sizes, prev, pager, next, jumper"
- >
- </el-pagination>
- <el-dialog
- title="移交任务"
- width="30%"
- :visible.sync="transferDialogFormVisible"
- >
- <el-form
- :model="transferDialogForm"
- :rules="transferDialogFormRules"
- ref="transferDialogForm"
- >
- <!-- <el-form-item label="检验类型" prop="checkType" label-width="120px">
- <el-select v-model="transferDialogForm.checkType" placeholder="请选择检验类型">
- <el-option label="通过" value="1"></el-option>
- <el-option label="不通过" value="2"></el-option>
- </el-select>
- </el-form-item> -->
- <el-form-item label="移交类型" prop="transferType" label-width="120px">
- <el-select
- v-model="transferDialogForm.transferType"
- placeholder="请选择移交类型"
- >
- <el-option label="工作移交" value="1"></el-option>
- </el-select>
- </el-form-item>
- <el-form-item
- label="移交用户"
- prop="transferUserId"
- label-width="120px"
- >
- <user-component v-if="transferDialogForm.taskType === 'routine'" v-model="transferDialogForm.transferUserId" :user-id.sync="transferDialogForm.transferUserId"></user-component>
- <el-select
- v-else
- v-model="transferDialogForm.transferUserId"
- placeholder="请选择移交用户"
- >
- <el-option
- v-for="item in transferUserList"
- :key="item.userId"
- :label="item.name"
- :value="item.userId"
- >
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item
- label="移交说明"
- prop="transferExplain"
- label-width="120px"
- >
- <el-input
- v-model="transferDialogForm.transferExplain"
- placeholder="请输入"
- ></el-input>
- </el-form-item>
- </el-form>
- <div slot="footer">
- <el-button @click="transferDialogFormVisible = false">取 消</el-button>
- <el-button type="primary" @click="transferSubmit" v-reClick>确 定</el-button>
- </div>
- </el-dialog>
- <el-dialog
- title="检验任务"
- width="50%"
- :visible.sync="checkDialogFormVisible"
- >
- <el-form
- :model="checkDialogForm"
- :rules="checkDialogFormRules"
- ref="checkDialogForm"
- >
- <el-form-item
- label="完成记录说明"
- prop="operationRecords"
- label-width="120px"
- >
- <el-input
- v-model="checkDialogForm.operationRecords"
- type="textarea"
- :rows="2"
- placeholder="请输入"
- ></el-input>
- </el-form-item>
- <el-form-item label="附件" prop="attachList" label-width="120px">
- <upload-component :accept="'*'" v-model="checkDialogForm.attachList" />
- </el-form-item>
- <el-form-item label="发生工序节点" prop="disqualificationNodeId" label-width="120px" v-if="checkDialogForm.checkType === 2">
- <el-select v-model="checkDialogForm.disqualificationNodeId">
- <el-option v-for="item in techOptions" :key="item.id" :value="item.id" :label="item.nodeName"></el-option>
- </el-select>
- </el-form-item>
- <el-row v-if="checkDialogForm.checkType !== 2">
- <el-table
- :data="checkDialogForm.prodProductionRecordList"
- style="width: 100%"
- >
- <el-table-column prop="pageNo" label="页次/图区"> </el-table-column>
- <el-table-column prop="inspectionParam" label="检查参数">
- </el-table-column>
- <el-table-column prop="inspectionMethod" label="检验方法">
- <template slot-scope="scope">
- <span>{{
- inspectionMethodOptions[scope.row.inspectionMethod]
- }}</span>
- </template>
- </el-table-column>
- <el-table-column prop="allowValues" label="允许值">
- </el-table-column>
- <el-table-column prop="measureRecord1" label="实测记录1">
- <template slot-scope="scope">
- <el-form-item
- :prop="
- 'prodProductionRecordList.' +
- scope.$index +
- '.measureRecord1'
- "
- :rules="checkDialogFormRules.measureRecord1"
- label-width="0px"
- >
- <el-input v-model="scope.row.measureRecord1"></el-input>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column prop="measureRecord2" label="实测纪录2">
- <template slot-scope="scope">
- <el-form-item
- :prop="
- 'prodProductionRecordList.' +
- scope.$index +
- '.measureRecord2'
- "
- :rules="checkDialogFormRules.measureRecord2"
- label-width="0px"
- >
- <el-input v-model="scope.row.measureRecord2"></el-input>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column prop="remarks" label="备注">
- <template slot-scope="scope">
- <el-form-item
- :prop="
- 'prodProductionRecordList.' + scope.$index + '.remarks'
- "
- label-width="0px"
- >
- <el-input v-model="scope.row.remarks"></el-input>
- </el-form-item>
- </template>
- </el-table-column>
- </el-table>
- </el-row>
- </el-form>
- <div slot="footer">
- <el-button @click="checkDialogFormVisible = false">取 消</el-button>
- <el-button type="primary" @click="checkSubmit" v-reClick>确 定</el-button>
- </div>
- </el-dialog>
- <el-dialog
- title="操作损坏"
- width="30%"
- :visible.sync="damageDialogFormVisible"
- >
- <el-form
- :model="damageDialogForm"
- :rules="damageDialogFormRules"
- ref="damageDialogForm"
- >
- <el-form-item label="损坏原因" prop="damageReason" label-width="80px">
- <el-input
- v-model="damageDialogForm.damageReason"
- type="textarea"
- :rows="2"
- placeholder="请输入"
- ></el-input>
- </el-form-item>
- </el-form>
- <div slot="footer">
- <el-button @click="damageDialogFormVisible = false">取 消</el-button>
- <el-button type="primary" @click="damageSubmit" v-reClick>确 定</el-button>
- </div>
- </el-dialog>
- <el-dialog
- title="完成任务"
- width="30%"
- :visible.sync="finishDialogFormVisible"
- >
- <el-form
- :model="finishDialogForm"
- :rules="finishDialogFormRules"
- ref="finishDialogForm"
- >
- <el-form-item
- label="完成记录说明"
- prop="operationRecords"
- label-width="120px"
- >
- <el-input
- v-model="finishDialogForm.operationRecords"
- type="textarea"
- :rows="2"
- placeholder="请输入"
- ></el-input>
- </el-form-item>
- <el-form-item label="附件" prop="attachList" label-width="120px">
- <upload-component :accept="'*'" v-model="finishDialogForm.attachList" />
- </el-form-item>
- </el-form>
- <div slot="footer">
- <el-button @click="finishDialogFormVisible = false">取 消</el-button>
- <el-button type="primary" @click="finishSubmit" v-reClick>确 定</el-button>
- </div>
- </el-dialog>
- <!-- 提审理单 -->
- <el-dialog
- title="提审理单"
- width="50%"
- :visible.sync="submitDialogFormVisible"
- >
- <el-form
- :model="submitDialogForm"
- :rules="submitDialogFormRules"
- ref="submitDialogForm"
- >
- <el-form-item
- label="完成记录说明"
- prop="operationRecords"
- label-width="120px"
- >
- <el-input
- v-model="submitDialogForm.operationRecords"
- type="textarea"
- :rows="2"
- placeholder="请输入"
- ></el-input>
- </el-form-item>
- <el-form-item label="发生工序节点" prop="disqualificationNodeId" label-width="120px" >
- <el-select v-model="submitDialogForm.disqualificationNodeId">
- <el-option v-for="item in techOptions" :key="item.id" :value="item.id" :label="item.nodeName"></el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="附件" prop="attachList" label-width="120px">
- <upload-component :accept="'*'" v-model="submitDialogForm.attachList" />
- </el-form-item>
- </el-form>
- <div slot="footer">
- <el-button @click="submitDialogFormVisible = false">取 消</el-button>
- <el-button type="primary" @click="submitSubmit" v-reClick>确 定</el-button>
- </div>
- </el-dialog>
- <!-- 文件预览 -->
- <preview-component v-if="previewVisible" ref="preview" />
- <attach-detail-dialog ref="attachDetail"/>
- </div>
- </template>
- <script>
- import {
- getMyTaskList,
- startTask,
- transferTask,
- completeTask,
- checkTask,
- damageTask,
- getTaskDetail,
- getTechList,
- batchStart,
- batchCheckTask,
- batchCompleteTask,
- submitTask
- } from '@/api/task'
- import { workTypeMasterList } from '@/api/worktype'
- import templateList from '../warehouse/template-list'
- import PreviewComponent from '../common/preview-component'
- import UserComponent from '@/views/modules/common/user-component'
- import { taskTypeOption, rankTypeOption } from '@/utils/enums'
- import AttachDetailDialog from '../common/attach-detail-dialog'
- import UploadComponent from '../common/upload-component-v2'
- export default {
- components: { UserComponent, PreviewComponent, templateList, AttachDetailDialog, UploadComponent },
- name: 'work',
- computed: {
- userId: {
- get () {
- return this.$store.state.user.id
- }
- }
- },
- watch: {
- 'dataForm.userId' (value) {
- this.opColVisible =
- Number(this.dataForm.state) !== 3 && value === this.userId
- },
- 'dataForm.state' (value) {
- this.opColVisible = this.dataForm.userId
- ? Number(value) !== 3 && this.dataForm.userId === this.userId
- : Number(value) !== 3
- }
- },
- data () {
- return {
- previewVisible: false,
- addOrUpdateVisible: false,
- opColVisible: true,
- dataForm: {
- state: '1'
- },
- dataList: [],
- pageIndex: 1,
- pageSize: 10,
- totalPage: 0,
- dataListLoading: false,
- dataListSelections: [],
- // optionsState: [
- // {
- // code: '1',
- // value: '未开始'
- // },
- // {
- // code: '2',
- // value: '待操作'
- // },
- // {
- // code: '3',
- // value: '已完成'
- // }
- // ],
- transferDialogFormVisible: false,
- transferDialogForm: {},
- finishDialogFormVisible: false,
- finishDialogForm: {},
- finishDialogFormRules: {
- operationRecords: [
- { required: true, message: '完成记录说明不能为空', trigger: 'blur' }
- ]
- },
- transferUserList: [],
- transferDialogFormRules: {
- transferType: [
- { required: true, message: '请选择移交类型', trigger: 'blur' }
- ],
- transferUserId: [
- { required: true, message: '请选择移交用户', trigger: 'blur' }
- ]
- },
- checkDialogFormVisible: false,
- checkDialogForm: {
- checkType: '',
- operationRecords: '',
- notes: '',
- prodProductionRecordList: []
- },
- checkDialogBatch: false, // 是否是批量操作
- checkDialogFormRules: {
- operationRecords: [
- { required: true, message: '完成记录说明不能为空', trigger: 'blur' }
- ],
- checkType: [{ required: true, message: '请选择', trigger: 'blur' }],
- disqualificationNodeId: [{ required: true, message: '请选择', trigger: 'blur' }],
- measureRecord1: [
- { required: true, message: '请输入', trigger: 'blur' }
- ],
- measureRecord2: [
- { required: true, message: '请输入', trigger: 'blur' }
- ]
- },
- damageDialogFormVisible: false,
- damageDialogForm: {},
- damageDialogFormRules: {
- damageReason: [{ required: true, message: '请输入', trigger: 'blur' }]
- },
- // 是否显示进度条列
- showProgress: true,
- inspectionMethodOptions: {
- 1: '游标卡尺',
- 2: '千分尺',
- 3: '高度尺',
- 4: '百分表',
- 5: 'R规',
- 6: '环规、塞规',
- 7: '游标角度尺',
- 8: '三坐标',
- 9: '模具',
- 10: '样板',
- 11: '夹具',
- 12: '目测',
- 13: '组合测量',
- 14: '精密测量',
- 15: '敲击',
- 16: '测厚仪',
- 17: '其他'
- },
- taskTypeOption: taskTypeOption,
- rankTypeOption: rankTypeOption,
- techOptions: [],
- multipleSelection: [], // 多选的数据
- submitDialogFormVisible: false,
- submitDialogForm: {
- taskId: undefined,
- operationRecords: '',
- notes: '',
- prodProductionRecordList: []
- },
- submitDialogFormRules: {
- operationRecords: [
- { required: true, message: '完成记录说明不能为空', trigger: 'blur' }
- ],
- disqualificationNodeId: [{ required: true, message: '请选择', trigger: 'blur' }]
- }
- }
- },
- created () {
- let state = this.$route.query.state
- if (state) {
- this.dataForm.state = state
- }
- this.getDataList()
- },
- methods: {
- // 查询
- queryData () {
- this.pageIndex = 1
- this.showProgress = this.dataForm.state !== '2'
- this.getDataList()
- },
- // 获取数据列表
- getDataList () {
- this.dataListLoading = true
- let params = {
- current: this.pageIndex,
- size: this.pageSize,
- state: this.dataForm.state,
- userId: this.dataForm.userId ? this.dataForm.userId : null
- }
- getMyTaskList(params).then(({ data }) => {
- if (data && data.code === '200') {
- this.dataList = data.data.records
- this.totalPage = Number(data.data.total)
- } else {
- this.dataList = []
- this.totalPage = 0
- }
- this.dataListLoading = false
- })
- },
- // 每页数
- sizeChangeHandle (val) {
- this.pageSize = val
- this.pageIndex = 1
- this.getDataList()
- },
- // 当前页
- currentChangeHandle (val) {
- this.pageIndex = val
- this.getDataList()
- },
- // 多选
- selectionChangeHandle (val) {
- this.dataListSelections = val
- },
- // 开始
- startTask (taskId) {
- this.$confirm('是否开始任务?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- })
- .then(() => {
- startTask({ taskId }).then(({ data }) => {
- if (data && data.code === '200') {
- this.$message({
- type: 'success',
- message: '操作成功!'
- })
- this.getDataList()
- } else {
- this.$message({
- type: 'error',
- message: data.msg
- })
- }
- })
- })
- .catch(() => {
- this.$message({
- type: 'info',
- message: '已取消'
- })
- })
- },
- // 移交
- transferTask (item) {
- let {taskId, workTypeId, taskType} = item
- this.transferDialogFormVisible = true
- this.transferDialogForm.taskId = taskId
- this.transferDialogForm.taskType = taskType
- if (taskType !== 'routine') {
- workTypeMasterList(workTypeId).then(({ data }) => {
- if (data && data.code === '200') {
- this.transferUserList = data.data
- }
- })
- }
- },
- // 确认移交
- transferSubmit () {
- this.$refs['transferDialogForm'].validate((valid) => {
- if (valid) {
- transferTask(this.transferDialogForm).then(({ data }) => {
- if (data && data.code === '200') {
- this.$message({
- type: 'success',
- message: '移交成功!'
- })
- this.transferDialogFormVisible = false
- this.getDataList()
- } else {
- this.$message({
- type: 'error',
- message: data.msg
- })
- }
- })
- }
- })
- },
- // 完成
- completeTask (taskId) {
- this.finishDialogFormVisible = true
- this.finishDialogForm.taskId = taskId
- },
- // 确认完成
- finishSubmit () {
- this.$refs['finishDialogForm'].validate((valid) => {
- if (valid) {
- let submitData = this.finishDialogForm
- if (this.checkDialogBatch) {
- // 批量
- batchCompleteTask(submitData).then(({ data }) => {
- if (data && data.code === '200') {
- this.$message({
- type: 'success',
- message: '操作成功!'
- })
- this.finishDialogFormVisible = false
- this.checkDialogBatch = false
- this.getDataList()
- } else {
- this.$message({
- type: 'error',
- message: data.msg
- })
- }
- })
- } else {
- completeTask(submitData).then(({ data }) => {
- if (data && data.code === '200') {
- this.$message({
- type: 'success',
- message: '操作成功!'
- })
- this.finishDialogFormVisible = false
- this.getDataList()
- } else {
- this.$message({
- type: 'error',
- message: data.msg
- })
- }
- })
- }
- }
- })
- },
- // 检验
- checkTask (taskId, checkType) {
- this.checkDialogForm.taskId = taskId
- if (checkType === 1) {
- // 查询工艺详情
- getTaskDetail(this.checkDialogForm.taskId).then(({ data }) => {
- if (data && data.code === '200') {
- let list = data.data.prodProductionRequireList
- if (list && list.length > 0) {
- list.map((item) => {
- item.requireId = item.id
- })
- }
- this.checkDialogForm.prodProductionRecordList = list
- }
- })
- this.checkDialogForm.checkType = checkType
- this.passTask()
- } else {
- this.checkDialogForm.checkType = 2
- getTechList(this.checkDialogForm.taskId).then(({data}) => {
- if (data && data.code === '200') {
- this.techOptions = data.data
- }
- })
- this.refuseTask()
- }
- },
- // 通过
- passTask () {
- this.checkDialogFormVisible = true
- },
- // 不通过
- refuseTask () {
- this.checkDialogFormVisible = true
- },
- // 确认检验
- checkSubmit () {
- this.$refs['checkDialogForm'].validate((valid) => {
- if (valid) {
- let submitData = this.checkDialogForm
- // console.log(submitData);
- if (this.checkDialogBatch) {
- batchCheckTask(submitData).then(({ data }) => {
- if (data && data.code === '200') {
- this.$message({
- type: 'success',
- message: '批量检验成功!'
- })
- this.checkDialogFormVisible = false
- this.checkDialogBatch = false
- this.getDataList()
- } else {
- this.$message({
- type: 'error',
- message: data.msg
- })
- }
- })
- } else {
- checkTask(submitData).then(({ data }) => {
- if (data && data.code === '200') {
- this.$message({
- type: 'success',
- message: '检验成功!'
- })
- this.checkDialogFormVisible = false
- this.getDataList()
- } else {
- this.$message({
- type: 'error',
- message: data.msg
- })
- }
- })
- }
- }
- })
- },
- // 操作损坏
- damageTask (nodeId, productionId) {
- this.damageDialogFormVisible = true
- this.damageDialogForm.nodeId = nodeId
- this.damageDialogForm.productionId = productionId
- },
- // 确认操作损坏
- damageSubmit () {
- this.$refs['damageDialogForm'].validate((valid) => {
- if (valid) {
- let submitData = this.damageDialogForm
- damageTask(submitData).then(({ data }) => {
- if (data && data.code === '200') {
- this.$message({
- type: 'success',
- message: '操作成功!'
- })
- this.damageDialogFormVisible = false
- this.getDataList()
- } else {
- this.$message({
- type: 'error',
- message: data.msg
- })
- }
- })
- }
- })
- },
- // 预览
- previewFile (fileName, url) {
- this.previewVisible = true
- this.$nextTick(() => {
- this.$refs.preview.init(fileName, url)
- })
- },
- // 计算进度百分比,返回0到100的整数
- getPercentage (completeNum, totalNum) {
- completeNum = completeNum == null ? 0 : parseInt(completeNum)
- totalNum = totalNum == null ? 100 : parseInt(totalNum)
- if (totalNum === 0) {
- return 100
- }
- return (completeNum / totalNum).toFixed(2) * 100
- },
- // 用户选择
- userChanged (val) {
- this.dataForm.userId = val
- this.getDataList()
- },
- changeDetails (attachList) {
- this.$nextTick(() => {
- this.$refs.attachDetail.init(attachList)
- })
- },
- // 多选-选中事件
- handleSelectionChange (val) {
- this.multipleSelection = val
- },
- selected (row, index) {
- if (this.multipleSelection.length === 0) {
- return true
- }
- if (this.multipleSelection.length > 0 && this.multipleSelection[0].nodeId === row.nodeId) {
- return true
- }
- return false
- },
- // 批量开始
- batchStart () {
- this.$confirm('是否批量开始任务?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- })
- .then(() => {
- if (this.multipleSelection.length === 0) {
- this.$message({
- type: 'error',
- message: '请先选择数据,再操作批量开始'
- })
- } else {
- let param = {
- taskIds: this.multipleSelection.map(t => t.taskId)
- }
- batchStart(param).then(({ data }) => {
- if (data && data.code === '200') {
- this.$message({
- type: 'success',
- message: '操作成功!'
- })
- this.multipleSelection = []
- this.queryData()
- } else {
- this.$message({
- type: 'error',
- message: data.msg
- })
- }
- })
- }
- })
- .catch(() => {
- this.$message({
- type: 'info',
- message: '已取消'
- })
- })
- },
- // 批量报工 或 批量通过
- batchFinishOrCheck () {
- this.checkDialogBatch = true
- this.checkDialogForm.taskIds = this.multipleSelection.map(t => t.taskId)
- // 检验、总检 -> 批量通过
- if (this.multipleSelection[0].taskType === 'check' || this.multipleSelection[0].taskType === 't-check') {
- this.checkDialogForm.taskIds = this.multipleSelection.map(t => t.taskId)
- this.checkTask(this.checkDialogForm.taskIds[0], 1)
- }
- // 常规 -> 批量报工
- if (this.multipleSelection[0].taskType === 'routine' || this.multipleSelection[0].taskType === 'produce' || this.multipleSelection[0].taskType === 'start') {
- this.finishDialogFormVisible = true
- this.finishDialogForm.taskIds = this.multipleSelection.map(t => t.taskId)
- }
- },
- submitTask (nodeId, productionId, taskId) {
- this.submitDialogForm = {
- taskIds: [taskId]
- }
- getTechList(taskId).then(({data}) => {
- if (data && data.code === '200') {
- this.techOptions = data.data
- }
- })
- this.submitDialogFormVisible = true
- },
- submitSubmit () {
- this.$refs['submitDialogForm'].validate((valid) => {
- if (valid) {
- submitTask(this.submitDialogForm).then(({ data }) => {
- if (data && data.code === '200') {
- this.$message({
- type: 'success',
- message: '操作成功!'
- })
- this.submitDialogFormVisible = false
- this.getDataList()
- } else {
- this.$message({
- type: 'error',
- message: data.msg
- })
- }
- })
- }
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- /deep/ .el-tabs .el-tabs__header {
- margin: 0;
- }
- </style>
|