123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321 |
- <template>
- <el-dialog
- :title='$t("common.view")'
- width="80%"
- :append-to-body="true"
- :visible.sync="isVisible"
- class="tenant-view"
- >
- <div class="boxDiv">
- <!-- 任务信息 -->
- <el-steps :active="active" finish-status="success" simple style="margin:20px 0;">
- <el-step title="夹具安装" ></el-step>
- <el-step title="物料装夹" ></el-step>
- </el-steps>
- <el-row v-show="this.active==1">
- <p style="margin-top:0;text-align:center;font-size:18px;">{{$t("runCenter.form.viewSched.name")}}
- <span style="float:right;margin-right:20px;font-size:14px;">{{$t("runCenter.form.viewSched.bomNo")+":"}}{{tenant.no}}</span>
- </p>
- <table class="comtable" border="0" cellspacing="0" cellpadding="6">
- <tr>
- <td class="blodTd" align="center" width="120">{{$t("runCenter.form.viewSched.procedureNo")+":"}}</td>
- <td width="200">{{tenant.taskNo}}</td>
- <td class="blodTd" align="center" width="120">{{$t("runCenter.form.viewSched.status")+":"}}</td>
- <td width="120">
- <el-tag v-if="tenant.status == 0" type="info">{{$t("runCenter.common.schedulStatus.noStart")}}</el-tag>
- <el-tag v-if="tenant.status == 1" type="">{{$t("runCenter.common.schedulStatus.run")}}</el-tag>
- <el-tag v-if="tenant.status == 2" type="success">{{$t("runCenter.common.schedulStatus.finished")}}</el-tag>
- </td>
- </tr>
- <tr>
- <td class="blodTd" align="center">{{$t("runCenter.form.viewSched.procedureDesc")+":"}}</td>
- <td>{{tenant.taskName}}</td>
- <td class="blodTd" align="center">{{$t("runCenter.form.viewSched.content")+":"}}</td>
- <td width="200">{{tenant.content}}</td>
- </tr>
- <tr>
- <td class="blodTd" align="center">{{$t("runCenter.form.viewSched.prepareWorkHours")+":"}}</td>
- <td>{{tenant.time}}分钟</td>
- <td class="blodTd" align="center">{{$t("runCenter.form.viewSched.procedurePosition")+":"}}</td>
- <td>{{tenant.currentStationName}}</td>
- </tr>
- <tr>
- <td class="blodTd" align="center">{{$t("runCenter.form.viewSched.startTime")+":"}}</td>
- <td>{{tenant.startTime}}</td>
- <td class="blodTd" align="center">{{$t("runCenter.form.viewSched.endTime")+":"}}</td>
- <td>{{tenant.endTime}}</td>
- </tr>
- </table>
- </el-row>
- <!-- 安装夹具 -->
- <el-row v-show="this.active==1">
- <p class="titleP" style="margin-top:15px;color:#000;font-size:18px;" >ST1: 请安装夹具 <span style="color:red;margin-left:5px;font-size:14px;"></span></p>
- <!-- Table数据 -->
- <el-table
- ref="table"
- v-loading="loading"
- :data="tableData.records"
- border
- fit
- style="width: 100%;"
- >
- <!-- 编号 -->
- <el-table-column prop="no" :label='$t("prepare.table.tools.no")' align="center" ></el-table-column>
- <!-- 编号 -->
- <el-table-column prop="type" :label='$t("prepare.table.tools.type")' align="center" ></el-table-column>
- <!-- 名称 -->
- <el-table-column prop="name" :label='$t("prepare.table.tools.name")' align="center"></el-table-column>
- </el-table>
- </el-row>
- <!-- 装夹物料 -->
- <el-row v-show="this.active>1">
- <p class="titleP" style="margin-top:15px;color:#000;font-size:18px;" >ST2: 装夹物料</p>
- <!-- Table数据 -->
- <el-table
- ref="table1"
- v-loading="loading"
- :data="tableData1.records"
- border
- fit
- style="width: 100%;"
- >
- <!-- 材料编码 -->
- <el-table-column prop="meterialCode" :label='$t("prepare.table.tools.no")' align="center" ></el-table-column>
- <!-- 材料牌号 -->
- <el-table-column prop="tradeMark" :label='$t("prepare.table.tools.type")' align="center" ></el-table-column>
- <!-- 材料名称 -->
- <el-table-column prop="equipmentName" :label='$t("prepare.table.tools.name")' align="center"></el-table-column>
- <!-- 装夹方式 -->
- <el-table-column prop="clampImg" :label='$t("prepare.table.tools.clampImg")' align="center">
- <template slot-scope="{ row }">
- <div class="block">
- <el-image
- style="width: 60px; height: 60px"
- :src="row.armorPic"
- fit="fill"></el-image>
- </div>
- </template>
- </el-table-column>
- </el-table>
- </el-row>
- <!-- 输入唯一码 -->
- <el-row v-show="this.active>1">
- <p class="titleP" style="margin-top:15px;color:#000;font-size:18px;" >输入零件编码 <el-button size="small" type="primary" @click.native="generate" round>系统生成</el-button></p>
- <el-input v-model="uniqueCode" placeholder="输入零件编码"></el-input>
- </el-row>
- <div slot="footer" class="dialog-footer">
- <el-button plain type="info" @click.native="prev" v-show="this.active>1" >返回上一步</el-button>
- <el-button type="primary" :disabled="confirmDisabled" @click.native="next" v-show="this.active==1">已完成,下一步</el-button>
- <el-button type="primary" :disabled="confirmDisabled" @click.native="submitForm" v-show="this.active>1">上料完成</el-button>
- </div>
- </div>
- </el-dialog>
- </template>
- <script>
- // 【分页】组件
- import taskMgrApi from "@/api/runManageCenter/taskMgr";
- // 列表查询的共通参数
- import { initQueryParams } from '@/utils/commons'
- export default {
- name: 'TaskView',
- components: { },
- props: {
- dialogVisible: {
- type: Boolean,
- default: false
- }
- },
- data () {
- return {
- active: 1,
- screenWidth: 0,
- confirmDisabled: false,
- width: this.initWidth(),
- tenant: {},
- queryParams: initQueryParams({}),
- loading: false,
- uniqueCode: '',
- tenantViewVisible: false,
- tableKey: 0,
- tableData: {
- total: 0
- },
- tableData1: {
- total: 0
- },
- tableData2: [],
- currentRow: null, // 当前选择的行
- spanArr: [], // 【组序】合并单元格
- spanArr2: [], // 【优先级】合并单元格
- }
- },
- // 实例已经在内存中创建好,此时data和methods已将ok,如果要操作data中的数据或是调用methods中的方法,最早只能在created中操作
- created() {
- },
- computed: {
- isVisible: {
- get () {
- return this.dialogVisible
- },
- set () {
- this.close()
- }
- }
- },
- mounted () {
- window.onresize = () => {
- return (() => {
- this.width = this.initWidth()
- })()
- }
- },
- methods: {
- prev(){
- if (this.active-- < 0) this.active = 0;
- },
- next(){
- // TODO 写入rfid内容(子盘信息和夹具信息)
- taskMgrApi.procesRfid({ "id" : this.tenant.id, "clampId" : this.tenant.clampId,rfidType: "write" }).then((res) => {
- res = res.data;
- if (res.isSuccess) {
- }
- });
- if (this.active++ > 1) this.active = 0;
- },
- submitForm(){
- // 更新改任务的开始时间
- // TODO 写入rfid内容,工件信息、原材料R
- taskMgrApi.updateTaskStatus({ "id" : this.tenant.id,"meterialId":this.tenant.meterialId, "uniqueCode":this.uniqueCode, "updateType" : "end", "processType" : "1", "updateUser" : this.$store.state.account.user.id}).then((res) => {
- res = res.data;
- if (res.isSuccess) {
- // 通知列表
- this.$emit("success");
- // 通知列表-并关闭弹出框
- this.$emit("close");
- }
- });
- },
- // table的当前行值变化后
- handleCurrentChange(val) {
- // 设置当前行
- this.currentRow = val;
- },
- initWidth () {
- this.screenWidth = document.body.clientWidth
- if (this.screenWidth < 550) {
- return '95%'
- } else if (this.screenWidth < 990) {
- return '580px'
- } else if (this.screenWidth < 1400) {
- return '600px'
- } else {
- return '650px'
- }
- },
- setTenant (val) {
- this.tenant = { ...val }
- // 添加数据
- this.tableData.records = []
- // 添加数据
- this.tableData.records.push({
- no: this.tenant.clampNo,
- name: this.tenant.clampName
- })
- this.tableData1.records = []
- // 添加数据
- this.tableData1.records.push({
- meterialCode: this.tenant.meterialCode,
- equipmentName: this.tenant.equipmentName,
- tradeMark: this.tenant.tradeMark,
- armorPic: this.tenant.armorPic,
- })
- // 更新改任务的开始时间
- taskMgrApi.updateTaskStatus({ "id" : this.tenant.id, "updateType" : "begin"}).then((res) => {
- res = res.data;
- if (res.isSuccess) {
- console.log("update task startTime success");
- }
- });
- },
- close () {
- this.$emit('close')
- },
- generate(){
- this.uniqueCode = this.uuid(32,16)
- },
- uuid(len, radix) {
- var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');
- var uuid = [], i;
- radix = radix || chars.length;
- if (len) {
- // Compact form
- for (i = 0; i < len; i++) uuid[i] = chars[0 | Math.random()*radix];
- } else {
- // rfc4122, version 4 form
- var r;
- // rfc4122 requires these characters
- uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-';
- uuid[14] = '4';
- // Fill in random data. At i==19 set the high bits of clock sequence as
- // per rfc4122, sec. 4.1.5
- for (i = 0; i < 36; i++) {
- if (!uuid[i]) {
- r = 0 | Math.random()*16;
- uuid[i] = chars[(i == 19) ? (r & 0x3) | 0x8 : r];
- }
- }
- }
- return uuid.join('').toLowerCase();
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .dialog-footer{
- text-align: center;
- padding: 30px;
- }
- .titleP{
- position: relative;
- font-size: 16px;
- padding-left: 15px;
- }
- .titleP:before{
- content: '';
- position: absolute;
- left: 0;
- top: 3px;
- width: 5px;
- height: 80%;
- background: #0F79DC;
- }
- .comtable{
- width: 100%;
- border-left: 1px solid #CCCCCC;
- border-top: 1px solid #CCCCCC;
- }
- .comtable td{
- border-right: 1px solid #CCCCCC;
- border-bottom: 1px solid #CCCCCC;
- }
- .blodTd{
- background: #EEEEEE;
- color: #333333;
- }
- </style>
|