View1.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  1. <template>
  2. <el-dialog
  3. :title='$t("common.view")'
  4. width="80%"
  5. :append-to-body="true"
  6. :visible.sync="isVisible"
  7. class="tenant-view"
  8. >
  9. <div class="boxDiv">
  10. <!-- 任务信息 -->
  11. <el-steps :active="active" finish-status="success" simple style="margin:20px 0;">
  12. <el-step title="夹具安装" ></el-step>
  13. <el-step title="物料装夹" ></el-step>
  14. </el-steps>
  15. <el-row v-show="this.active==1">
  16. <p style="margin-top:0;text-align:center;font-size:18px;">{{$t("runCenter.form.viewSched.name")}}
  17. <span style="float:right;margin-right:20px;font-size:14px;">{{$t("runCenter.form.viewSched.bomNo")+":"}}{{tenant.no}}</span>
  18. </p>
  19. <table class="comtable" border="0" cellspacing="0" cellpadding="6">
  20. <tr>
  21. <td class="blodTd" align="center" width="120">{{$t("runCenter.form.viewSched.procedureNo")+":"}}</td>
  22. <td width="200">{{tenant.taskNo}}</td>
  23. <td class="blodTd" align="center" width="120">{{$t("runCenter.form.viewSched.status")+":"}}</td>
  24. <td width="120">
  25. <el-tag v-if="tenant.status == 0" type="info">{{$t("runCenter.common.schedulStatus.noStart")}}</el-tag>
  26. <el-tag v-if="tenant.status == 1" type="">{{$t("runCenter.common.schedulStatus.run")}}</el-tag>
  27. <el-tag v-if="tenant.status == 2" type="success">{{$t("runCenter.common.schedulStatus.finished")}}</el-tag>
  28. </td>
  29. </tr>
  30. <tr>
  31. <td class="blodTd" align="center">{{$t("runCenter.form.viewSched.procedureDesc")+":"}}</td>
  32. <td>{{tenant.taskName}}</td>
  33. <td class="blodTd" align="center">{{$t("runCenter.form.viewSched.content")+":"}}</td>
  34. <td width="200">{{tenant.content}}</td>
  35. </tr>
  36. <tr>
  37. <td class="blodTd" align="center">{{$t("runCenter.form.viewSched.prepareWorkHours")+":"}}</td>
  38. <td>{{tenant.time}}分钟</td>
  39. <td class="blodTd" align="center">{{$t("runCenter.form.viewSched.procedurePosition")+":"}}</td>
  40. <td>{{tenant.currentStationName}}</td>
  41. </tr>
  42. <tr>
  43. <td class="blodTd" align="center">{{$t("runCenter.form.viewSched.startTime")+":"}}</td>
  44. <td>{{tenant.startTime}}</td>
  45. <td class="blodTd" align="center">{{$t("runCenter.form.viewSched.endTime")+":"}}</td>
  46. <td>{{tenant.endTime}}</td>
  47. </tr>
  48. </table>
  49. </el-row>
  50. <!-- 安装夹具 -->
  51. <el-row v-show="this.active==1">
  52. <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>
  53. <!-- Table数据 -->
  54. <el-table
  55. ref="table"
  56. v-loading="loading"
  57. :data="tableData.records"
  58. border
  59. fit
  60. style="width: 100%;"
  61. >
  62. <!-- 编号 -->
  63. <el-table-column prop="no" :label='$t("prepare.table.tools.no")' align="center" ></el-table-column>
  64. <!-- 编号 -->
  65. <el-table-column prop="type" :label='$t("prepare.table.tools.type")' align="center" ></el-table-column>
  66. <!-- 名称 -->
  67. <el-table-column prop="name" :label='$t("prepare.table.tools.name")' align="center"></el-table-column>
  68. </el-table>
  69. </el-row>
  70. <!-- 装夹物料 -->
  71. <el-row v-show="this.active>1">
  72. <p class="titleP" style="margin-top:15px;color:#000;font-size:18px;" >ST2: 装夹物料</p>
  73. <!-- Table数据 -->
  74. <el-table
  75. ref="table1"
  76. v-loading="loading"
  77. :data="tableData1.records"
  78. border
  79. fit
  80. style="width: 100%;"
  81. >
  82. <!-- 材料编码 -->
  83. <el-table-column prop="meterialCode" :label='$t("prepare.table.tools.no")' align="center" ></el-table-column>
  84. <!-- 材料牌号 -->
  85. <el-table-column prop="tradeMark" :label='$t("prepare.table.tools.type")' align="center" ></el-table-column>
  86. <!-- 材料名称 -->
  87. <el-table-column prop="equipmentName" :label='$t("prepare.table.tools.name")' align="center"></el-table-column>
  88. <!-- 装夹方式 -->
  89. <el-table-column prop="clampImg" :label='$t("prepare.table.tools.clampImg")' align="center">
  90. <template slot-scope="{ row }">
  91. <div class="block">
  92. <el-image
  93. style="width: 60px; height: 60px"
  94. :src="row.armorPic"
  95. fit="fill"></el-image>
  96. </div>
  97. </template>
  98. </el-table-column>
  99. </el-table>
  100. </el-row>
  101. <!-- 输入唯一码 -->
  102. <el-row v-show="this.active>1">
  103. <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>
  104. <el-input v-model="uniqueCode" placeholder="输入零件编码"></el-input>
  105. </el-row>
  106. <div slot="footer" class="dialog-footer">
  107. <el-button plain type="info" @click.native="prev" v-show="this.active>1" >返回上一步</el-button>
  108. <el-button type="primary" :disabled="confirmDisabled" @click.native="next" v-show="this.active==1">已完成,下一步</el-button>
  109. <el-button type="primary" :disabled="confirmDisabled" @click.native="submitForm" v-show="this.active>1">上料完成</el-button>
  110. </div>
  111. </div>
  112. </el-dialog>
  113. </template>
  114. <script>
  115. // 【分页】组件
  116. import taskMgrApi from "@/api/runManageCenter/taskMgr";
  117. // 列表查询的共通参数
  118. import { initQueryParams } from '@/utils/commons'
  119. export default {
  120. name: 'TaskView',
  121. components: { },
  122. props: {
  123. dialogVisible: {
  124. type: Boolean,
  125. default: false
  126. }
  127. },
  128. data () {
  129. return {
  130. active: 1,
  131. screenWidth: 0,
  132. confirmDisabled: false,
  133. width: this.initWidth(),
  134. tenant: {},
  135. queryParams: initQueryParams({}),
  136. loading: false,
  137. uniqueCode: '',
  138. tenantViewVisible: false,
  139. tableKey: 0,
  140. tableData: {
  141. total: 0
  142. },
  143. tableData1: {
  144. total: 0
  145. },
  146. tableData2: [],
  147. currentRow: null, // 当前选择的行
  148. spanArr: [], // 【组序】合并单元格
  149. spanArr2: [], // 【优先级】合并单元格
  150. }
  151. },
  152. // 实例已经在内存中创建好,此时data和methods已将ok,如果要操作data中的数据或是调用methods中的方法,最早只能在created中操作
  153. created() {
  154. },
  155. computed: {
  156. isVisible: {
  157. get () {
  158. return this.dialogVisible
  159. },
  160. set () {
  161. this.close()
  162. }
  163. }
  164. },
  165. mounted () {
  166. window.onresize = () => {
  167. return (() => {
  168. this.width = this.initWidth()
  169. })()
  170. }
  171. },
  172. methods: {
  173. prev(){
  174. if (this.active-- < 0) this.active = 0;
  175. },
  176. next(){
  177. // TODO 写入rfid内容(子盘信息和夹具信息)
  178. taskMgrApi.procesRfid({ "id" : this.tenant.id, "clampId" : this.tenant.clampId,rfidType: "write" }).then((res) => {
  179. res = res.data;
  180. if (res.isSuccess) {
  181. }
  182. });
  183. if (this.active++ > 1) this.active = 0;
  184. },
  185. submitForm(){
  186. // 更新改任务的开始时间
  187. // TODO 写入rfid内容,工件信息、原材料R
  188. 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) => {
  189. res = res.data;
  190. if (res.isSuccess) {
  191. // 通知列表
  192. this.$emit("success");
  193. // 通知列表-并关闭弹出框
  194. this.$emit("close");
  195. }
  196. });
  197. },
  198. // table的当前行值变化后
  199. handleCurrentChange(val) {
  200. // 设置当前行
  201. this.currentRow = val;
  202. },
  203. initWidth () {
  204. this.screenWidth = document.body.clientWidth
  205. if (this.screenWidth < 550) {
  206. return '95%'
  207. } else if (this.screenWidth < 990) {
  208. return '580px'
  209. } else if (this.screenWidth < 1400) {
  210. return '600px'
  211. } else {
  212. return '650px'
  213. }
  214. },
  215. setTenant (val) {
  216. this.tenant = { ...val }
  217. // 添加数据
  218. this.tableData.records = []
  219. // 添加数据
  220. this.tableData.records.push({
  221. no: this.tenant.clampNo,
  222. name: this.tenant.clampName
  223. })
  224. this.tableData1.records = []
  225. // 添加数据
  226. this.tableData1.records.push({
  227. meterialCode: this.tenant.meterialCode,
  228. equipmentName: this.tenant.equipmentName,
  229. tradeMark: this.tenant.tradeMark,
  230. armorPic: this.tenant.armorPic,
  231. })
  232. // 更新改任务的开始时间
  233. taskMgrApi.updateTaskStatus({ "id" : this.tenant.id, "updateType" : "begin"}).then((res) => {
  234. res = res.data;
  235. if (res.isSuccess) {
  236. console.log("update task startTime success");
  237. }
  238. });
  239. },
  240. close () {
  241. this.$emit('close')
  242. },
  243. generate(){
  244. this.uniqueCode = this.uuid(32,16)
  245. },
  246. uuid(len, radix) {
  247. var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');
  248. var uuid = [], i;
  249. radix = radix || chars.length;
  250. if (len) {
  251. // Compact form
  252. for (i = 0; i < len; i++) uuid[i] = chars[0 | Math.random()*radix];
  253. } else {
  254. // rfc4122, version 4 form
  255. var r;
  256. // rfc4122 requires these characters
  257. uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-';
  258. uuid[14] = '4';
  259. // Fill in random data. At i==19 set the high bits of clock sequence as
  260. // per rfc4122, sec. 4.1.5
  261. for (i = 0; i < 36; i++) {
  262. if (!uuid[i]) {
  263. r = 0 | Math.random()*16;
  264. uuid[i] = chars[(i == 19) ? (r & 0x3) | 0x8 : r];
  265. }
  266. }
  267. }
  268. return uuid.join('').toLowerCase();
  269. }
  270. }
  271. }
  272. </script>
  273. <style lang="scss" scoped>
  274. .dialog-footer{
  275. text-align: center;
  276. padding: 30px;
  277. }
  278. .titleP{
  279. position: relative;
  280. font-size: 16px;
  281. padding-left: 15px;
  282. }
  283. .titleP:before{
  284. content: '';
  285. position: absolute;
  286. left: 0;
  287. top: 3px;
  288. width: 5px;
  289. height: 80%;
  290. background: #0F79DC;
  291. }
  292. .comtable{
  293. width: 100%;
  294. border-left: 1px solid #CCCCCC;
  295. border-top: 1px solid #CCCCCC;
  296. }
  297. .comtable td{
  298. border-right: 1px solid #CCCCCC;
  299. border-bottom: 1px solid #CCCCCC;
  300. }
  301. .blodTd{
  302. background: #EEEEEE;
  303. color: #333333;
  304. }
  305. </style>