12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082 |
- <!-- 我的工作台 -->
- <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)"
- >提审理单</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: {
- 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 () {
- this.submitDialogFormVisible = true
- },
- submitSubmit () {
- this.$refs['submitDialogForm'].validate((valid) => {
- if (valid) {
- let submitData = this.submitDialogForm
- submitTask(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
- })
- }
- })
- }
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- /deep/ .el-tabs .el-tabs__header {
- margin: 0;
- }
- </style>
|