View1.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  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. currentIndex: 0, //上下料站默认序号
  149. spanArr: [], // 【组序】合并单元格
  150. spanArr2: [], // 【优先级】合并单元格
  151. }
  152. },
  153. // 实例已经在内存中创建好,此时data和methods已将ok,如果要操作data中的数据或是调用methods中的方法,最早只能在created中操作
  154. created() {
  155. },
  156. computed: {
  157. isVisible: {
  158. get () {
  159. return this.dialogVisible
  160. },
  161. set () {
  162. this.close()
  163. }
  164. }
  165. },
  166. mounted () {
  167. window.onresize = () => {
  168. return (() => {
  169. this.width = this.initWidth()
  170. })()
  171. }
  172. },
  173. methods: {
  174. prev(){
  175. if (this.active-- < 0) this.active = 0;
  176. },
  177. next(){
  178. // TODO 写入rfid内容(子盘信息和夹具信息)
  179. taskMgrApi.procesRfid({ "id" : this.tenant.id, "clampId" : this.tenant.clampId,rfidType: "write" }).then((res) => {
  180. res = res.data;
  181. if (res.isSuccess) {
  182. }
  183. });
  184. if (this.active++ > 1) this.active = 0;
  185. },
  186. submitForm(){
  187. // 更新改任务的开始时间
  188. // TODO 写入rfid内容,工件信息、原材料R
  189. this.confirmDisabled = true
  190. let valid = this.uniqueCode!=''? true: false;
  191. if(!valid){
  192. this.$message({
  193. message: "零件编码" + this.$t("rules.require"),
  194. type: "warning"
  195. })
  196. this.confirmDisabled = false
  197. return false
  198. }
  199. taskMgrApi.updateTaskStatus({ "id" : this.tenant.id,"meterialId":this.tenant.meterialId, "uniqueCode":this.uniqueCode, "taskNodeId": this.tenant.taskNodeId, "updateType" : "end", "processType" : "1", "updateUser" : this.$store.state.account.user.id, "positionIndex": this.currentIndex}).then((res) => {
  200. res = res.data;
  201. if (res.isSuccess) {
  202. console.log(res.isSuccess);
  203. // 通知列表
  204. this.$emit("success");
  205. // 通知列表-并关闭弹出框
  206. this.$emit("close");
  207. }
  208. }).finally(()=>{
  209. this.confirmDisabled = false
  210. });
  211. },
  212. // table的当前行值变化后
  213. handleCurrentChange(val) {
  214. // 设置当前行
  215. this.currentRow = val;
  216. },
  217. initWidth () {
  218. this.screenWidth = document.body.clientWidth
  219. if (this.screenWidth < 550) {
  220. return '95%'
  221. } else if (this.screenWidth < 990) {
  222. return '580px'
  223. } else if (this.screenWidth < 1400) {
  224. return '600px'
  225. } else {
  226. return '650px'
  227. }
  228. },
  229. setTenant (val) {
  230. this.tenant = { ...val }
  231. console.log(this.tenant)
  232. this.currentIndex = this.tenant.currentStationName.substr(-1)
  233. // 添加数据
  234. this.tableData.records = []
  235. // 添加数据
  236. this.tableData.records.push({
  237. no: this.tenant.clampNo,
  238. name: this.tenant.clampName
  239. })
  240. this.tableData1.records = []
  241. // 添加数据
  242. this.tableData1.records.push({
  243. meterialCode: this.tenant.meterialCode,
  244. equipmentName: this.tenant.equipmentName,
  245. tradeMark: this.tenant.tradeMark,
  246. armorPic: this.tenant.armorPic,
  247. })
  248. // 更新改任务的开始时间
  249. taskMgrApi.updateTaskStatus({ "id" : this.tenant.id, "updateType" : "begin", "taskNodeId": this.tenant.taskNodeId, "positionIndex": this.currentIndex}).then((res) => {
  250. res = res.data;
  251. if (res.isSuccess) {
  252. console.log("update task startTime success");
  253. }
  254. });
  255. },
  256. close () {
  257. this.$emit('close')
  258. },
  259. generate(){
  260. taskMgrApi.generateMarkCode({ "id" : this.tenant.id}).then((res) => {
  261. res = res.data;
  262. if (res.isSuccess) {
  263. this.uniqueCode = res.data.uniqueCode
  264. }
  265. });
  266. // this.uniqueCode = this.uuid(32,16)
  267. },
  268. uuid(len, radix) {
  269. var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');
  270. var uuid = [], i;
  271. radix = radix || chars.length;
  272. if (len) {
  273. // Compact form
  274. for (i = 0; i < len; i++) uuid[i] = chars[0 | Math.random()*radix];
  275. } else {
  276. // rfc4122, version 4 form
  277. var r;
  278. // rfc4122 requires these characters
  279. uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-';
  280. uuid[14] = '4';
  281. // Fill in random data. At i==19 set the high bits of clock sequence as
  282. // per rfc4122, sec. 4.1.5
  283. for (i = 0; i < 36; i++) {
  284. if (!uuid[i]) {
  285. r = 0 | Math.random()*16;
  286. uuid[i] = chars[(i == 19) ? (r & 0x3) | 0x8 : r];
  287. }
  288. }
  289. }
  290. return uuid.join('').toLowerCase();
  291. }
  292. }
  293. }
  294. </script>
  295. <style lang="scss" scoped>
  296. .dialog-footer{
  297. text-align: center;
  298. padding: 30px;
  299. }
  300. .titleP{
  301. position: relative;
  302. font-size: 16px;
  303. padding-left: 15px;
  304. }
  305. .titleP:before{
  306. content: '';
  307. position: absolute;
  308. left: 0;
  309. top: 3px;
  310. width: 5px;
  311. height: 80%;
  312. background: #0F79DC;
  313. }
  314. .comtable{
  315. width: 100%;
  316. border-left: 1px solid #CCCCCC;
  317. border-top: 1px solid #CCCCCC;
  318. }
  319. .comtable td{
  320. border-right: 1px solid #CCCCCC;
  321. border-bottom: 1px solid #CCCCCC;
  322. }
  323. .blodTd{
  324. background: #EEEEEE;
  325. color: #333333;
  326. }
  327. </style>