View1.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420
  1. <template>
  2. <el-dialog
  3. :title="$t(&quot;common.view&quot;)"
  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.procedurePosition}}</td>
  41. </tr>
  42. <tr>
  43. <td class="blodTd" align="center">{{$t("runCenter.form.viewSched.startTime")+":"}}</td>
  44. <td>{{tenant.bomDesc}}</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="no" :label='$t("prepare.table.tools.no")' align="center" ></el-table-column>
  84. <!-- 编号 -->
  85. <el-table-column prop="type" :label='$t("prepare.table.tools.type")' align="center" ></el-table-column>
  86. <!-- 名称 -->
  87. <el-table-column prop="name" :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.clampImg"
  95. fit="fill"></el-image>
  96. </div>
  97. </template>
  98. </el-table-column>
  99. <!-- 备注 -->
  100. <el-table-column prop="remark" :label='$t("prepare.table.tools.name")' align="center"></el-table-column>
  101. </el-table>
  102. </el-row>
  103. <!-- 输入唯一码 -->
  104. <el-row v-show="this.active>1">
  105. <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>
  106. <el-input v-model="uniqueCode" placeholder="输入零件编码"></el-input>
  107. </el-row>
  108. <div slot="footer" class="dialog-footer">
  109. <el-button plain type="info" @click.native="prev" v-show="this.active>1" >返回上一步</el-button>
  110. <el-button type="primary" :disabled="confirmDisabled" @click.native="next" v-show="this.active==1">已完成,下一步</el-button>
  111. <el-button type="primary" :disabled="confirmDisabled" @click.native="submitForm" v-show="this.active>1">上料完成</el-button>
  112. </div>
  113. </div>
  114. </el-dialog>
  115. </template>
  116. <script>
  117. // 【分页】组件
  118. import Pagination from "@/components/Pagination"
  119. // 【自动化程序管理】-API
  120. import automatedProcessesApi from "@/api/prepareProductMgr/automatedProcesses"
  121. // 【产品工艺版本管理】-API
  122. import technologyVersionApi from "@/api/prepareProductMgr/technologyVersion"
  123. // 【机加工人端】-API
  124. import machiningClientApi from "@/api/machiningClient/machiningClient"
  125. // 列表查询的共通参数
  126. import { initQueryParams } from '@/utils/commons'
  127. export default {
  128. name: 'TaskView',
  129. components: { Pagination },
  130. props: {
  131. dialogVisible: {
  132. type: Boolean,
  133. default: false
  134. }
  135. },
  136. data () {
  137. return {
  138. active: 1,
  139. screenWidth: 0,
  140. confirmDisabled: false,
  141. width: this.initWidth(),
  142. tenant: {},
  143. queryParams: initQueryParams({}),
  144. loading: false,
  145. uniqueCode: '',
  146. tenantViewVisible: false,
  147. tableKey: 0,
  148. tableData: {
  149. total: 0
  150. },
  151. tableData1: {
  152. total: 0
  153. },
  154. tableData2: [],
  155. currentRow: null, // 当前选择的行
  156. spanArr: [], // 【组序】合并单元格
  157. spanArr2: [], // 【优先级】合并单元格
  158. }
  159. },
  160. // 实例已经在内存中创建好,此时data和methods已将ok,如果要操作data中的数据或是调用methods中的方法,最早只能在created中操作
  161. created() {
  162. // 加载列表数据
  163. // this.fetch()
  164. },
  165. computed: {
  166. isVisible: {
  167. get () {
  168. return this.dialogVisible
  169. },
  170. set () {
  171. this.close()
  172. }
  173. }
  174. },
  175. mounted () {
  176. window.onresize = () => {
  177. return (() => {
  178. this.width = this.initWidth()
  179. })()
  180. }
  181. },
  182. methods: {
  183. prev(){
  184. if (this.active-- < 0) this.active = 0;
  185. },
  186. next(){
  187. if (this.active++ > 1) this.active = 0;
  188. },
  189. submitForm(){
  190. /*
  191. let obj = {
  192. taskNode: this.tenant,
  193. meterialList: this.tableData1,
  194. procedureTrayList: this.tableData2
  195. }
  196. console.log("表单数据:", obj)
  197. // return false
  198. machiningClientApi.finishTaskNode(obj).then((response) => {
  199. const res = response.data
  200. if (res.isSuccess) {
  201. this.isVisible = false
  202. this.$message({
  203. message: this.$t('tips.updateSuccess'),
  204. type: 'success'
  205. })
  206. // 通知列表
  207. this.$emit("success");
  208. }
  209. }).finally(() => {
  210. this.confirmDisabled = false
  211. return true
  212. }) */
  213. this.isVisible = false;
  214. },
  215. // table的当前行值变化后
  216. handleCurrentChange(val) {
  217. // 设置当前行
  218. this.currentRow = val;
  219. },
  220. initWidth () {
  221. this.screenWidth = document.body.clientWidth
  222. if (this.screenWidth < 550) {
  223. return '95%'
  224. } else if (this.screenWidth < 990) {
  225. return '580px'
  226. } else if (this.screenWidth < 1400) {
  227. return '600px'
  228. } else {
  229. return '650px'
  230. }
  231. },
  232. setTenant (val) {
  233. this.tenant = { ...val }
  234. // 加载上部门2个数据
  235. this.fetch()
  236. // 加载下部分2个数据
  237. //this.getDetail(val)
  238. },
  239. close () {
  240. this.$emit('close')
  241. },
  242. fetch (params = {}) {
  243. this.loading = true
  244. //日期区间-参数
  245. if (this.queryParams.timeRange) {
  246. this.queryParams.map.createTime_st = this.queryParams.timeRange[0]
  247. this.queryParams.map.createTime_ed = this.queryParams.timeRange[1]
  248. }
  249. // 分页-参数
  250. this.queryParams.current = params.current ? params.current : this.queryParams.current
  251. this.queryParams.size = params.size ? params.size : this.queryParams.size
  252. // 条件-参数
  253. console.log("列表的row数据:", this.tenant)
  254. /*
  255. automatedProcessesApi.taskAutoNodeList({taskId: this.tenant.taskId, procedureId: this.tenant.procedureId, orderId: this.tenant.orderId}).then(response => {
  256. const res = response.data
  257. if (res.isSuccess) {
  258. this.tableData.records = res.data
  259. }
  260. // eslint-disable-next-line no-return-assign
  261. }).finally(() => this.loading = false) */
  262. this.tableData.records = [{'no':'龙威夹','type':'&230','name':'龙威'}];
  263. this.tableData1.records = [{'no':'龙威夹','type':'&230','name':'龙威','clampImg':require(`@/assets/yunMap/clampImg.png`),'remark':'备注'}];
  264. this.loading = false;
  265. },
  266. //获得数据相同的行数
  267. rowspanFiled(data, filed) {
  268. let spanArr5 = [];
  269. data.forEach((item,index) => {
  270. if( index === 0){
  271. spanArr5.push(1);
  272. this.position = 0;
  273. }else{
  274. if(data[index].groupSort === data[index-1].groupSort && data[index][filed] === data[index-1][filed]){
  275. spanArr5[this.position] += 1;
  276. spanArr5.push(0);
  277. }else{
  278. spanArr5.push(1);
  279. this.position = index;
  280. }
  281. }
  282. })
  283. return spanArr5;
  284. },
  285. //合并
  286. objectSpanMethod({ row, column, rowIndex, columnIndex }) { //表格合并行
  287. if (columnIndex === 0) {
  288. let _row = this.spanArr[rowIndex];
  289. let _col = _row > 0 ? 1 : 0;
  290. return {
  291. rowspan: _row,
  292. colspan: _col
  293. }
  294. }
  295. if(columnIndex === 1){
  296. let _row = this.spanArr2[rowIndex];
  297. let _col = _row > 0 ? 1 : 0;
  298. return {
  299. rowspan: _row,
  300. colspan: _col
  301. }
  302. }
  303. },
  304. //合并
  305. objectSpanMethod({ row, column, rowIndex, columnIndex }) { //表格合并行
  306. if (columnIndex === 0) {
  307. let _row = this.spanArr[rowIndex];
  308. let _col = _row > 0 ? 1 : 0;
  309. return {
  310. rowspan: _row,
  311. colspan: _col
  312. }
  313. }
  314. if(columnIndex === 1){
  315. let _row = this.spanArr2[rowIndex];
  316. let _col = _row > 0 ? 1 : 0;
  317. return {
  318. rowspan: _row,
  319. colspan: _col
  320. }
  321. }
  322. },
  323. // 根据【工艺id】查询详情信息
  324. getDetail(obj){
  325. /*
  326. machiningClientApi.getTaskNodeProcessAnalysis(obj).then(res => {
  327. res = res.data
  328. if(res.isSuccess){
  329. console.log("详情信息:", res.data)
  330. // 给各个组件赋值
  331. // 把【设备】的数据,给【程序】使用
  332. // this.setProgram(eqList)
  333. // 获取【所需原材料】数据
  334. this.tableData1 = this.setKeyList(res.data.meterialList)
  335. // 获取【托盘夹具组】数据
  336. this.tableData2 = this.setKeyList(res.data.procedureTrayList, 'tray')
  337. // 要合并列的准备数据
  338. if(this.tableData2.length > 0){
  339. this.spanArr = this.rowspanFiled(this.tableData2, "groupSort")
  340. this.spanArr2 = this.rowspanFiled(this.tableData2, "groupPrority")
  341. }
  342. }
  343. }) */
  344. },
  345. // 赋值前处理-添加key数据健
  346. setKeyList(list, flag){
  347. if(list.length > 0){
  348. let arr = []
  349. list.forEach(item => {
  350. // 添加唯一键
  351. item.key = ''+ Math.random()
  352. // 如果是托盘夹具的时候,组装分类
  353. if(flag == 'tray'){
  354. // 把【组序】和【优先级】改成字符串
  355. //item.groupSort = ''+ item.groupSort
  356. //item.groupPrority = ''+ item.groupPrority
  357. // 给图片一个列表数据,jjImgList
  358. item.jjImgList = []
  359. if(!!item.armorPic){
  360. item.jjImgList.push(item.armorPic)
  361. }
  362. // 添加类型
  363. if(item.bizType == '1'){
  364. item.category = {key: '03',data: '托盘'}
  365. }else{
  366. item.category = {key: '02',data: '夹具'}
  367. }
  368. }
  369. arr.push(item)
  370. })
  371. list = arr
  372. }
  373. return list
  374. }
  375. }
  376. }
  377. </script>
  378. <style lang="scss" scoped>
  379. .dialog-footer{
  380. text-align: center;
  381. padding: 30px;
  382. }
  383. .titleP{
  384. position: relative;
  385. font-size: 16px;
  386. padding-left: 15px;
  387. }
  388. .titleP:before{
  389. content: '';
  390. position: absolute;
  391. left: 0;
  392. top: 3px;
  393. width: 5px;
  394. height: 80%;
  395. background: #0F79DC;
  396. }
  397. .comtable{
  398. width: 100%;
  399. border-left: 1px solid #CCCCCC;
  400. border-top: 1px solid #CCCCCC;
  401. }
  402. .comtable td{
  403. border-right: 1px solid #CCCCCC;
  404. border-bottom: 1px solid #CCCCCC;
  405. }
  406. .blodTd{
  407. background: #EEEEEE;
  408. color: #333333;
  409. }
  410. </style>