View3.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-row>
  12. <p style="margin-top:0;text-align:center;font-size:18px;">{{$t("runCenter.form.viewSched.name")}}
  13. <span style="float:right;margin-right:20px;font-size:14px;">{{$t("runCenter.form.viewSched.bomNo")+":"}}{{tenant.no}}</span>
  14. </p>
  15. <table class="comtable" border="0" cellspacing="0" cellpadding="6">
  16. <tr>
  17. <td class="blodTd" align="center" width="120">{{$t("runCenter.form.viewSched.procedureNo")+":"}}</td>
  18. <td width="200">{{tenant.taskNo}}</td>
  19. <td class="blodTd" align="center" width="120">{{$t("runCenter.form.viewSched.status")+":"}}</td>
  20. <td width="120">
  21. <el-tag v-if="tenant.status == 0" type="info">{{$t("runCenter.common.schedulStatus.noStart")}}</el-tag>
  22. <el-tag v-if="tenant.status == 1" type="">{{$t("runCenter.common.schedulStatus.run")}}</el-tag>
  23. <el-tag v-if="tenant.status == 2" type="success">{{$t("runCenter.common.schedulStatus.finished")}}</el-tag>
  24. </td>
  25. </tr>
  26. <tr>
  27. <td class="blodTd" align="center">{{$t("runCenter.form.viewSched.procedureDesc")+":"}}</td>
  28. <td>{{tenant.taskName}}</td>
  29. <td class="blodTd" align="center">{{$t("runCenter.form.viewSched.content")+":"}}</td>
  30. <td width="200">{{tenant.content}}</td>
  31. </tr>
  32. <tr>
  33. <td class="blodTd" align="center">{{$t("runCenter.form.viewSched.prepareWorkHours")+":"}}</td>
  34. <td>{{tenant.time}}分钟</td>
  35. <td class="blodTd" align="center">{{$t("runCenter.form.viewSched.procedurePosition")+":"}}</td>
  36. <td>{{tenant.currentStationName}}</td>
  37. </tr>
  38. <tr>
  39. <td class="blodTd" align="center">{{$t("runCenter.form.viewSched.startTime")+":"}}</td>
  40. <td>{{tenant.startTime}}</td>
  41. <td class="blodTd" align="center">{{$t("runCenter.form.viewSched.endTime")+":"}}</td>
  42. <td>{{tenant.endTime}}</td>
  43. </tr>
  44. </table>
  45. </el-row>
  46. <!-- 拆除零件 -->
  47. <el-row>
  48. <p class="titleP" style="margin-top:15px;color:#000;font-size:18px;" >ST1 拆除零件 </p>
  49. <!-- Table数据 -->
  50. <el-table
  51. ref="table"
  52. v-loading="loading"
  53. :data="tableData.records"
  54. border
  55. fit
  56. style="width: 100%;"
  57. >
  58. <!-- 材料编码 -->
  59. <el-table-column prop="meterialCode" :label='$t("prepare.table.tools.no")' align="center" ></el-table-column>
  60. <!-- 材料牌号 -->
  61. <el-table-column prop="tradeMark" :label='$t("prepare.table.tools.type")' align="center" ></el-table-column>
  62. <!-- 材料名称 -->
  63. <el-table-column prop="equipmentName" :label='$t("prepare.table.tools.name")' align="center"></el-table-column>
  64. <el-table-column prop="name" :label='$t("prepare.table.tools.name")' align="center">
  65. <template slot-scope="{ row }">
  66. <el-button size="small" type="primary" @click.native="printCode(row)" round >打印零件编码</el-button>
  67. </template>
  68. </el-table-column>
  69. </el-table>
  70. </el-row>
  71. <!-- 拆除夹具 -->
  72. <el-row v-show="false">
  73. <p class="titleP" style="margin-top:15px;color:#000;font-size:18px;">ST2 拆除夹具 <el-button size="small" type="primary" @click.native="release" round>拆除夹具</el-button></p>
  74. <el-tag size="medium" style="margin:10px;font-size:15px;"> 人工拆除夹具并放入夹具库</el-tag>
  75. </el-row>
  76. <div slot="footer" class="dialog-footer">
  77. <el-button v-if="unFeedingCount>0 || (unFeedingCount==0 && unBaitingCount==1)" type="primary" :disabled="confirmDisabled" @click="submitForm">{{ $t('machining.buttons.finished') }}</el-button>
  78. <el-button v-if="unFeedingCount==0 && unBaitingCount>0" type="primary" :disabled="confirmDisabled" @click="storageForm">{{ $t('machining.buttons.inFinished') }}</el-button>
  79. </div>
  80. </div>
  81. </el-dialog>
  82. </template>
  83. <script>
  84. // 列表查询的共通参数
  85. import { initQueryParams } from '@/utils/commons'
  86. import taskMgrApi from "@/api/runManageCenter/taskMgr"
  87. import taskNodMgrApi from "@/api/machiningClient/machiningClient"
  88. import machiningClientApi from "@/api/machiningClient/machiningClient"
  89. export default {
  90. name: 'TaskView',
  91. components: { },
  92. props: {
  93. dialogVisible: {
  94. type: Boolean,
  95. default: false
  96. }
  97. },
  98. data () {
  99. return {
  100. screenWidth: 0,
  101. confirmDisabled: false,
  102. callRobotFlag: false,
  103. unBaitingCount: 0,
  104. unFeedingCount: 0,
  105. width: this.initWidth(),
  106. tenant: {},
  107. queryParams: initQueryParams({}),
  108. RFIDParams: {
  109. url: "192.168.11.130",
  110. port: "102",
  111. taskId: "",
  112. taskNodeId: "",
  113. data: {
  114. content: "",
  115. positionIndex: ""
  116. }
  117. },
  118. loading: false,
  119. tenantViewVisible: false,
  120. tableKey: 0,
  121. tableData: {
  122. total: 0
  123. },
  124. tableData1: [],
  125. tableData2: [],
  126. currentRow: null, // 当前选择的行
  127. spanArr: [], // 【组序】合并单元格
  128. spanArr2: [], // 【优先级】合并单元格
  129. }
  130. },
  131. // 实例已经在内存中创建好,此时data和methods已将ok,如果要操作data中的数据或是调用methods中的方法,最早只能在created中操作
  132. created() {
  133. // 加载列表数据
  134. // this.fetch()
  135. },
  136. computed: {
  137. isVisible: {
  138. get () {
  139. return this.dialogVisible
  140. },
  141. set () {
  142. this.close()
  143. }
  144. }
  145. },
  146. mounted () {
  147. window.onresize = () => {
  148. return (() => {
  149. this.width = this.initWidth()
  150. })()
  151. }
  152. },
  153. methods: {
  154. confirmBaiting(){
  155. let valid = this.tenant.taskNodeId!=''? true: false;
  156. if(!valid){
  157. this.$message({
  158. message: "任务ID" + this.$t("rules.require"),
  159. type: "warning"
  160. })
  161. return false
  162. }
  163. console.log(this.tenant)
  164. taskMgrApi.confirmBaiting({ "taskNodeId":this.tenant.taskNodeId}).then((res) => {
  165. res = res.data
  166. if (res.isSuccess) {
  167. this.unBaitingCount = res.data.unBaitingCount
  168. this.unFeedingCount = res.data.unFeedingCount
  169. }
  170. });
  171. },
  172. release(){
  173. // 上下料站拆除夹具
  174. taskMgrApi.releaseClamp({ "id" : this.tenant.id}).then((res) => {
  175. res = res.data;
  176. if (res.isSuccess) {
  177. // 通知列表
  178. this.$emit("success");
  179. }
  180. });
  181. },
  182. printCode(row){
  183. this.loading = true
  184. taskNodMgrApi.printCode({"uniqueCode" : this.tenant.uniqueCode, "taskNodeId" : row.taskNodeId }).then((res) => {
  185. res = res.data;
  186. if (res.isSuccess) {
  187. // 通知列表
  188. this.$emit("success");
  189. // // 通知列表-并关闭弹出框
  190. // this.$emit("close");
  191. }
  192. }).finally(()=>{
  193. this.loading = false
  194. });
  195. },
  196. storageForm(){
  197. machiningClientApi.checkStockNode({"taskNodeId": this.tenant.taskNodeId}).then((res)=>{
  198. res = res.data;
  199. if (res.isSuccess) {
  200. if(res.data){
  201. this.submitForm()
  202. }else{
  203. this.callRobot()
  204. }
  205. }
  206. })
  207. },
  208. submitForm(){
  209. this.confirmDisabled = true
  210. taskMgrApi.updateTaskStatus({ "id" : this.tenant.id, "updateType" : "end","processType" : "3","updateUser" : this.$store.state.account.user.id}).then((res) => {
  211. res = res.data;
  212. if (res.isSuccess) {
  213. // 通知列表
  214. this.$emit("success");
  215. // 通知列表-并关闭弹出框
  216. this.$emit("close");
  217. }
  218. }).finally(()=>{
  219. this.confirmDisabled = false
  220. });
  221. },
  222. callRobot(){
  223. this.callRobotFlag = false
  224. machiningClientApi.callRobot({ "taskNodeId" : this.tenant.taskNodeId, "callType":"2"}).then((res) => {
  225. res = res.data
  226. if (res.isSuccess) {
  227. // 通知列表
  228. this.$emit("success");
  229. // 通知列表-并关闭弹出框
  230. this.$emit("close");
  231. }
  232. }).finally(()=>{
  233. this.callRobotFlag = true
  234. });
  235. },
  236. initWidth () {
  237. this.screenWidth = document.body.clientWidth
  238. if (this.screenWidth < 550) {
  239. return '95%'
  240. } else if (this.screenWidth < 990) {
  241. return '580px'
  242. } else if (this.screenWidth < 1400) {
  243. return '600px'
  244. } else {
  245. return '650px'
  246. }
  247. },
  248. setTenant (val) {
  249. this.tenant = { ...val }
  250. // 添加数据
  251. this.tableData.records = []
  252. this.tableData.records.push({
  253. meterialCode: this.tenant.meterialCode,
  254. equipmentName: this.tenant.equipmentName,
  255. tradeMark: this.tenant.tradeMark,
  256. armorPic: this.tenant.armorPic,
  257. })
  258. if(!this.tenant.uniqueCode){
  259. this.RFIDParams.taskId = this.tenant.id
  260. this.RFIDParams.taskNodeId = this.tenant.taskNodeId
  261. this.RFIDParams.data.positionIndex = this.tenant.currentStationName.substr(-1)
  262. /*let that = this
  263. machiningClientApi.read(this.RFIDParams).then(res => {
  264. if(res.data.result){
  265. this.$message({
  266. message: "RFID: "+res.data.result,
  267. type: "success"
  268. })
  269. that.tenant.uniqueCode = res.data.result
  270. }
  271. });*/
  272. }
  273. this.confirmBaiting()
  274. },
  275. close () {
  276. this.$emit('close')
  277. },
  278. }
  279. }
  280. </script>
  281. <style lang="scss" scoped>
  282. .dialog-footer{
  283. text-align: center;
  284. padding: 30px;
  285. }
  286. .titleP{
  287. position: relative;
  288. font-size: 16px;
  289. padding-left: 15px;
  290. }
  291. .titleP:before{
  292. content: '';
  293. position: absolute;
  294. left: 0;
  295. top: 3px;
  296. width: 5px;
  297. height: 80%;
  298. background: #0F79DC;
  299. }
  300. .comtable{
  301. width: 100%;
  302. border-left: 1px solid #CCCCCC;
  303. border-top: 1px solid #CCCCCC;
  304. }
  305. .comtable td{
  306. border-right: 1px solid #CCCCCC;
  307. border-bottom: 1px solid #CCCCCC;
  308. }
  309. .blodTd{
  310. background: #EEEEEE;
  311. color: #333333;
  312. }
  313. </style>