View1.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334
  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. this.confirmDisabled = true
  189. let valid = this.uniqueCode!=''? true: false;
  190. if(!valid){
  191. this.$message({
  192. message: "零件编码" + this.$t("rules.require"),
  193. type: "warning"
  194. })
  195. this.confirmDisabled = false
  196. return false
  197. }
  198. 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) => {
  199. res = res.data;
  200. if (res.isSuccess) {
  201. // 通知列表
  202. this.$emit("success");
  203. // 通知列表-并关闭弹出框
  204. this.$emit("close");
  205. }
  206. }).finally(()=>{
  207. this.confirmDisabled = false
  208. });
  209. },
  210. // table的当前行值变化后
  211. handleCurrentChange(val) {
  212. // 设置当前行
  213. this.currentRow = val;
  214. },
  215. initWidth () {
  216. this.screenWidth = document.body.clientWidth
  217. if (this.screenWidth < 550) {
  218. return '95%'
  219. } else if (this.screenWidth < 990) {
  220. return '580px'
  221. } else if (this.screenWidth < 1400) {
  222. return '600px'
  223. } else {
  224. return '650px'
  225. }
  226. },
  227. setTenant (val) {
  228. this.tenant = { ...val }
  229. // 添加数据
  230. this.tableData.records = []
  231. // 添加数据
  232. this.tableData.records.push({
  233. no: this.tenant.clampNo,
  234. name: this.tenant.clampName
  235. })
  236. this.tableData1.records = []
  237. // 添加数据
  238. this.tableData1.records.push({
  239. meterialCode: this.tenant.meterialCode,
  240. equipmentName: this.tenant.equipmentName,
  241. tradeMark: this.tenant.tradeMark,
  242. armorPic: this.tenant.armorPic,
  243. })
  244. // 更新改任务的开始时间
  245. taskMgrApi.updateTaskStatus({ "id" : this.tenant.id, "updateType" : "begin"}).then((res) => {
  246. res = res.data;
  247. if (res.isSuccess) {
  248. console.log("update task startTime success");
  249. }
  250. });
  251. },
  252. close () {
  253. this.$emit('close')
  254. },
  255. generate(){
  256. this.uniqueCode = this.uuid(32,16)
  257. },
  258. uuid(len, radix) {
  259. var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');
  260. var uuid = [], i;
  261. radix = radix || chars.length;
  262. if (len) {
  263. // Compact form
  264. for (i = 0; i < len; i++) uuid[i] = chars[0 | Math.random()*radix];
  265. } else {
  266. // rfc4122, version 4 form
  267. var r;
  268. // rfc4122 requires these characters
  269. uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-';
  270. uuid[14] = '4';
  271. // Fill in random data. At i==19 set the high bits of clock sequence as
  272. // per rfc4122, sec. 4.1.5
  273. for (i = 0; i < 36; i++) {
  274. if (!uuid[i]) {
  275. r = 0 | Math.random()*16;
  276. uuid[i] = chars[(i == 19) ? (r & 0x3) | 0x8 : r];
  277. }
  278. }
  279. }
  280. return uuid.join('').toLowerCase();
  281. }
  282. }
  283. }
  284. </script>
  285. <style lang="scss" scoped>
  286. .dialog-footer{
  287. text-align: center;
  288. padding: 30px;
  289. }
  290. .titleP{
  291. position: relative;
  292. font-size: 16px;
  293. padding-left: 15px;
  294. }
  295. .titleP:before{
  296. content: '';
  297. position: absolute;
  298. left: 0;
  299. top: 3px;
  300. width: 5px;
  301. height: 80%;
  302. background: #0F79DC;
  303. }
  304. .comtable{
  305. width: 100%;
  306. border-left: 1px solid #CCCCCC;
  307. border-top: 1px solid #CCCCCC;
  308. }
  309. .comtable td{
  310. border-right: 1px solid #CCCCCC;
  311. border-bottom: 1px solid #CCCCCC;
  312. }
  313. .blodTd{
  314. background: #EEEEEE;
  315. color: #333333;
  316. }
  317. </style>