赫艾前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

676 lines
21 KiB

3 years ago
  1. <template>
  2. <div class="mod-config">
  3. <el-form :inline="true" label-position="top" label-width="100px" >
  4. <el-form-item :label="'生产订单号'">
  5. <el-input v-model="searchData.orderNo" style="width: 130px"></el-input>
  6. </el-form-item>
  7. <el-form-item :label="'加工中心编码'">
  8. <el-input v-model="searchData.workCenterNo" style="width: 130px"></el-input>
  9. </el-form-item>
  10. <el-form-item >
  11. <span slot="label" style="" @click="getBaseList(5)"><a herf="#">产品编码</a></span>
  12. <el-input v-model="searchData.partNo" style="width: 120px"></el-input>
  13. </el-form-item>
  14. <el-form-item :label="'工序编号'">
  15. <el-input v-model="searchData.itemNo" style="width: 120px"></el-input>
  16. </el-form-item>
  17. <el-form-item :label="'加工中心编号'">
  18. <el-input v-model="searchData.workCenterNo" style="width: 120px"></el-input>
  19. </el-form-item>
  20. </el-form>
  21. <el-form :inline="true" label-position="top" label-width="100px" style="margin-top: 0px;">
  22. <el-form-item :label="'报工日期:'">
  23. <el-date-picker
  24. style="width: 130px"
  25. v-model="searchData.startDate"
  26. value-format="yyyy-MM-dd"
  27. placeholder="选择日期">
  28. </el-date-picker>
  29. </el-form-item>
  30. <el-form-item :label="'至: '">
  31. <el-date-picker
  32. style="width: 130px"
  33. v-model="searchData.endDate"
  34. type="date"
  35. value-format="yyyy-MM-dd"
  36. placeholder="选择日期">
  37. </el-date-picker>
  38. </el-form-item>
  39. <el-form-item >
  40. <span slot="label" style="" @click="getBaseList(26)"><a herf="#">操作员姓名</a></span>
  41. <el-input v-model="searchData.operatorName" style="width: 120px"></el-input>
  42. </el-form-item>
  43. <el-form-item >
  44. <span slot="label" style="" @click="getBaseList(88)"><a herf="#">机台ID</a></span>
  45. <el-input v-model="searchData.resourceId" style="width: 120px"></el-input>
  46. </el-form-item>
  47. <el-form-item :label="'班次'">
  48. <el-select v-model="searchData.shiftNo" style="width: 120px">
  49. <el-option label="全部" value=""></el-option>
  50. <el-option label="白班" value="白班"></el-option>
  51. <el-option label="晚班" value="晚班"></el-option>
  52. </el-select>
  53. </el-form-item>
  54. <el-form-item :label="' '">
  55. <el-button @click="search()" style="margin-left: 0px;margin-top:0px" type="primary">查询</el-button>
  56. <download-excel
  57. :fields="fields()"
  58. type="xls"
  59. :name="exportName"
  60. :fetch="createExportData"
  61. worksheet="导出信息"
  62. class="el-button el-button--primary el-button--medium">
  63. {{ '导出' }}
  64. </download-excel>
  65. </el-form-item>
  66. </el-form>
  67. <el-table
  68. :height="height"
  69. :data="tableData"
  70. border
  71. style="width: 100%">
  72. <el-table-column
  73. prop=""
  74. header-align="center"
  75. fixed="left"
  76. align="center"
  77. width="80"
  78. label="操作">
  79. <template slot-scope="scope" class="foo_container">
  80. <a type="text" size="small" v-if="scope.row.reverseflag==='N'" @click="cancelSfdc(scope.row)">取消报工</a>
  81. </template>
  82. </el-table-column>
  83. <el-table-column
  84. v-for="(item,index) in columnList" :key="index"
  85. :sortable="item.columnSortable"
  86. :prop="item.columnProp"
  87. header-align="center"
  88. :show-overflow-tooltip="item.showOverflowTooltip"
  89. :align="item.align"
  90. :fixed="item.fixed==''?false:item.fixed"
  91. :min-width="item.columnWidth"
  92. :label="item.columnLabel">
  93. <template slot-scope="scope">
  94. <span v-if="!item.columnHidden"> {{ scope.row[item.columnProp] }}</span>
  95. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
  96. style="width: 100px; height: 80px"/></span>
  97. </template>
  98. </el-table-column>
  99. </el-table>
  100. <el-dialog title="操作员明细" :close-on-click-modal="false" v-drag :visible.sync="operatorModalFlag" width="450px">
  101. <el-table
  102. height="200"
  103. :data="operatorModalList"
  104. border
  105. style="width: 100%">
  106. <el-table-column
  107. type="index"
  108. header-align="center"
  109. align="right"
  110. min-width="60"
  111. label="序号">
  112. </el-table-column>
  113. <el-table-column
  114. prop="operatorID"
  115. header-align="center"
  116. align="left"
  117. min-width="100"
  118. label="操作员ID">
  119. </el-table-column>
  120. <el-table-column
  121. prop="operatorName"
  122. header-align="center"
  123. align="left"
  124. min-width="120"
  125. label="操作员姓名">
  126. </el-table-column>
  127. </el-table>
  128. <el-footer style="height:40px;margin-top: 10px;text-align:center">
  129. <el-button type="primary" @click="operatorModalFlag = false">关闭</el-button>
  130. </el-footer>
  131. </el-dialog>
  132. <el-dialog title="不良原因" :close-on-click-modal="false" v-drag :visible.sync="defectModalFlag" width="450px">
  133. <el-table
  134. height="200"
  135. :data="defectModalList"
  136. border
  137. style="width: 100%">
  138. <el-table-column
  139. type="index"
  140. header-align="center"
  141. align="right"
  142. min-width="60"
  143. label="序号">
  144. </el-table-column>
  145. <el-table-column
  146. prop="defectCode"
  147. header-align="center"
  148. align="left"
  149. min-width="100"
  150. label="不良代码">
  151. </el-table-column>
  152. <el-table-column
  153. prop="defectDesc"
  154. header-align="center"
  155. align="left"
  156. min-width="120"
  157. label="不良原因">
  158. </el-table-column>
  159. <el-table-column
  160. prop="defectQty"
  161. header-align="center"
  162. align="right"
  163. min-width="120"
  164. label="不良数量">
  165. </el-table-column>
  166. </el-table>
  167. <el-footer style="height:40px;margin-top: 10px;text-align:center">
  168. <el-button type="primary" @click="defectModalFlag = false">关闭</el-button>
  169. </el-footer>
  170. </el-dialog>
  171. <!-- 动态列 -->
  172. <column v-if="visible" ref="column" @refreshData="getTableUserColumn" v-drag></column>
  173. <Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
  174. </div>
  175. </template>
  176. <script>
  177. import {
  178. getSfdcList,
  179. cancelSfdc,
  180. } from '@/api/production/generateReport.js'
  181. import Chooselist from '@/views/modules/common/Chooselist'
  182. import {
  183. saveTableDefaultList,
  184. getTableDefaultListLanguage,
  185. getTableUserListLanguage,
  186. removerDefault,
  187. removerUser
  188. } from "@/api/table.js"
  189. import column from "../common/column";
  190. // import {
  191. // printSeqNoLabel,
  192. // } from "@/views/modules/production/print_seqNo_label.js"
  193. export default {
  194. name: 'searchSOScheduleRouting',
  195. components: {
  196. Chooselist,column
  197. },
  198. data () {
  199. return {
  200. site: this.$store.state.user.site,
  201. // 导出+动态列 start
  202. exportData: [],
  203. userDev:this.$store.state.user.userDev,
  204. exportName: "派工单列表"+this.getStrDate(),
  205. columnList: [
  206. {
  207. tableId: "sfdcList",
  208. tableName: this.$route.meta.title,
  209. columnProp: "site",
  210. columnLabel: "工厂编号",
  211. columnHidden: false,
  212. columnImage: false,
  213. columnSortable: false,
  214. columnWidth: 60,
  215. format: null,
  216. functionId: this.$route.meta.menuId,
  217. sortLv: 0,
  218. status: true,
  219. fixed: '',
  220. serialNumber: null,
  221. columnType: null,
  222. align: 'left'
  223. }, {
  224. tableId: "sfdcList",
  225. tableName: this.$route.meta.title,
  226. columnProp: "assJobSeqNo",
  227. columnLabel: "派工单号",
  228. columnHidden: false,
  229. columnImage: false,
  230. columnSortable: false,
  231. columnWidth: 80,
  232. format: null,
  233. functionId: this.$route.meta.menuId,
  234. sortLv: 0,
  235. status: true,
  236. fixed: '',
  237. serialNumber: null,
  238. columnType: null,
  239. align: 'right'
  240. },
  241. {
  242. tableId: "sfdcList",
  243. tableName: this.$route.meta.title,
  244. columnProp: "orderNo",
  245. columnLabel: "生产订单号",
  246. columnHidden: false,
  247. columnImage: false,
  248. columnSortable: false,
  249. columnWidth: 80,
  250. format: null,
  251. functionId: this.$route.meta.menuId,
  252. sortLv: 0,
  253. status: true,
  254. fixed: '',
  255. serialNumber: null,
  256. columnType: null,
  257. align: 'left'
  258. }, {
  259. tableId: "sfdcList",
  260. tableName: this.$route.meta.title,
  261. columnProp: "itemNo",
  262. columnLabel: "工序号",
  263. columnHidden: false,
  264. columnImage: false,
  265. columnSortable: false,
  266. columnWidth: 60,
  267. format: null,
  268. functionId: this.$route.meta.menuId,
  269. sortLv: 0,
  270. status: true,
  271. fixed: '',
  272. serialNumber: null,
  273. columnType: null,
  274. align: 'right'
  275. }, {
  276. tableId: "sfdcList",
  277. tableName: this.$route.meta.title,
  278. columnProp: "operationDesc",
  279. columnLabel: "工序名称",
  280. columnHidden: false,
  281. columnImage: false,
  282. columnSortable: false,
  283. columnWidth: 120,
  284. format: null,
  285. functionId: this.$route.meta.menuId,
  286. sortLv: 0,
  287. status: true,
  288. fixed: '',
  289. serialNumber: null,
  290. columnType: null,
  291. align: 'left'
  292. }, {
  293. tableId: "sfdcList",
  294. tableName: this.$route.meta.title,
  295. columnProp: "seqNo",
  296. columnLabel: "次序号",
  297. columnHidden: false,
  298. columnImage: false,
  299. columnSortable: false,
  300. columnWidth: 50,
  301. format: null,
  302. functionId: this.$route.meta.menuId,
  303. sortLv: 0,
  304. status: true,
  305. fixed: '',
  306. serialNumber: null,
  307. columnType: null,
  308. align: 'right'
  309. }, {
  310. tableId: "sfdcList",
  311. tableName: this.$route.meta.title,
  312. columnProp: "partNo",
  313. columnLabel: "物料编码",
  314. columnHidden: false,
  315. columnImage: false,
  316. columnSortable: false,
  317. columnWidth: 70,
  318. format: null,
  319. functionId: this.$route.meta.menuId,
  320. sortLv: 0,
  321. status: true,
  322. fixed: '',
  323. serialNumber: null,
  324. columnType: null,
  325. align: 'left'
  326. }, {
  327. tableId: "sfdcList",
  328. tableName: this.$route.meta.title,
  329. columnProp: "workCenterNo",
  330. columnLabel: "加工中心编号",
  331. columnHidden: false,
  332. columnImage: false,
  333. columnSortable: false,
  334. columnWidth: 70,
  335. format: null,
  336. functionId: this.$route.meta.menuId,
  337. sortLv: 0,
  338. status: true,
  339. fixed: '',
  340. serialNumber: null,
  341. columnType: null,
  342. align: 'left'
  343. }, {
  344. tableId: "sfdcList",
  345. tableName: this.$route.meta.title,
  346. columnProp: "reportDate",
  347. columnLabel: "报工时间",
  348. columnHidden: false,
  349. columnImage: false,
  350. columnSortable: false,
  351. columnWidth: 130,
  352. format: null,
  353. functionId: this.$route.meta.menuId,
  354. sortLv: 0,
  355. status: true,
  356. fixed: '',
  357. serialNumber: null,
  358. columnType: null,
  359. align: 'left'
  360. }, {
  361. tableId: "sfdcList",
  362. tableName: this.$route.meta.title,
  363. columnProp: "operatorId",
  364. columnLabel: "操作员",
  365. columnHidden: false,
  366. columnImage: false,
  367. columnSortable: false,
  368. columnWidth: 70,
  369. format: null,
  370. functionId: this.$route.meta.menuId,
  371. sortLv: 0,
  372. status: true,
  373. fixed: '',
  374. serialNumber: null,
  375. columnType: null,
  376. align: 'left'
  377. }, {
  378. tableId: "sfdcList",
  379. tableName: this.$route.meta.title,
  380. columnProp: "operatorName",
  381. columnLabel: "操作员姓名",
  382. columnHidden: false,
  383. columnImage: false,
  384. columnSortable: false,
  385. columnWidth: 100,
  386. format: null,
  387. functionId: this.$route.meta.menuId,
  388. sortLv: 0,
  389. status: true,
  390. fixed: '',
  391. serialNumber: null,
  392. columnType: null,
  393. align: 'left'
  394. }, {
  395. tableId: "sfdcList",
  396. tableName: this.$route.meta.title,
  397. columnProp: "reverseflag",
  398. columnLabel: "是否已取消报工",
  399. columnHidden: false,
  400. columnImage: false,
  401. columnSortable: false,
  402. columnWidth: 80,
  403. format: null,
  404. functionId: this.$route.meta.menuId,
  405. sortLv: 0,
  406. status: true,
  407. fixed: '',
  408. serialNumber: null,
  409. columnType: null,
  410. align: 'left'
  411. }, {
  412. tableId: "sfdcList",
  413. tableName: this.$route.meta.title,
  414. columnProp: "reportQty",
  415. columnLabel: "报告数量",
  416. columnHidden: false,
  417. columnImage: false,
  418. columnSortable: false,
  419. columnWidth: 80,
  420. format: null,
  421. functionId: this.$route.meta.menuId,
  422. sortLv: 0,
  423. status: true,
  424. fixed: '',
  425. serialNumber: null,
  426. columnType: null,
  427. align: 'right'
  428. }, {
  429. tableId: "sfdcList",
  430. tableName: this.$route.meta.title,
  431. columnProp: "approveQty",
  432. columnLabel: "合格数量",
  433. columnHidden: false,
  434. columnImage: false,
  435. columnSortable: false,
  436. columnWidth: 80,
  437. format: null,
  438. functionId: this.$route.meta.menuId,
  439. sortLv: 0,
  440. status: true,
  441. fixed: '',
  442. serialNumber: null,
  443. columnType: null,
  444. align: 'right'
  445. }, {
  446. tableId: "sfdcList",
  447. tableName: this.$route.meta.title,
  448. columnProp: "reportedManfTime",
  449. columnLabel: "生产时间",
  450. columnHidden: false,
  451. columnImage: false,
  452. columnSortable: false,
  453. columnWidth: 70,
  454. format: null,
  455. functionId: this.$route.meta.menuId,
  456. sortLv: 0,
  457. status: true,
  458. fixed: '',
  459. serialNumber: null,
  460. columnType: null,
  461. align: 'right'
  462. }, {
  463. tableId: "sfdcList",
  464. tableName: this.$route.meta.title,
  465. columnProp: "shiftNo",
  466. columnLabel: "班次编号",
  467. columnHidden: false,
  468. columnImage: false,
  469. columnSortable: false,
  470. columnWidth: 70,
  471. format: null,
  472. functionId: this.$route.meta.menuId,
  473. sortLv: 0,
  474. status: true,
  475. fixed: '',
  476. serialNumber: null,
  477. columnType: null,
  478. align: 'left'
  479. }, {
  480. tableId: "sfdcList",
  481. tableName: this.$route.meta.title,
  482. columnProp: "resourceId",
  483. columnLabel: "机台编号",
  484. columnHidden: false,
  485. columnImage: false,
  486. columnSortable: false,
  487. columnWidth: 70,
  488. format: null,
  489. functionId: this.$route.meta.menuId,
  490. sortLv: 0,
  491. status: true,
  492. fixed: '',
  493. serialNumber: null,
  494. columnType: null,
  495. align: 'left'
  496. }, {
  497. tableId: "sfdcList",
  498. tableName: this.$route.meta.title,
  499. columnProp: "resourceDesc",
  500. columnLabel: "机台名称",
  501. columnHidden: false,
  502. columnImage: false,
  503. columnSortable: false,
  504. columnWidth: 100,
  505. format: null,
  506. functionId: this.$route.meta.menuId,
  507. sortLv: 0,
  508. status: true,
  509. fixed: '',
  510. serialNumber: null,
  511. columnType: null,
  512. align: 'left'
  513. }
  514. ],
  515. visible:false,
  516. queryTable: {
  517. userId: this.$store.state.user.name,
  518. functionId: this.$route.meta.menuId,
  519. tableId: "sfdcList",
  520. languageCode: this.$i18n.locale
  521. },
  522. // 导出 end
  523. height: 200,
  524. tableData: [],
  525. searchData: {
  526. orderNo: '',
  527. workCenterNo: '',
  528. partNo: '',
  529. site: this.$store.state.user.site,
  530. itemNo:'',
  531. startDate:new Date(),
  532. endDate:'',
  533. operatorName:'',
  534. resourceId:'',
  535. shiftNo:'',
  536. },
  537. operatorModalList:[],
  538. operatorModalFlag:false,
  539. defectModalList:[],
  540. defectModalFlag:false,
  541. }
  542. },
  543. mounted () {
  544. this.$nextTick(() => {
  545. this.height = window.innerHeight - 210
  546. this.height2 = window.innerHeight -100
  547. })
  548. },
  549. methods: {
  550. // 获取基础数据列表S
  551. getBaseList (val, type) {
  552. this.tagNo = val
  553. this.$nextTick(() => {
  554. let strVal = ''
  555. if (val === 24) {
  556. strVal = this.searchData.workCenterNo
  557. }
  558. if (val === 5) {
  559. strVal = this.searchData.partNo
  560. }
  561. if (val === 26) {
  562. strVal = this.searchData.operatorName
  563. }
  564. if (val === 88) {
  565. strVal = this.searchData.resourceId
  566. }
  567. this.$refs.baseList.init(val, strVal)
  568. })
  569. },
  570. /* 列表方法的回调 */
  571. getBaseData (val) {
  572. if (this.tagNo === 24) {
  573. this.searchData.workCenterNo = val.WorkCenterNo
  574. } else if (this.tagNo === 5) {
  575. this.searchData.partNo = val.PartNo
  576. }
  577. if (this.tagNo === 26) {
  578. this.searchData.operatorName = val.OperatorName
  579. }
  580. if (this.tagNo === 88) {
  581. this.searchData.resourceId = val.ResourceID
  582. }
  583. },
  584. search () {
  585. getSfdcList(this.searchData).then(({data}) => {
  586. this.tableData = data.rows
  587. })
  588. },
  589. cancelSfdc(row){
  590. this.$confirm(`确定取消此报工记录`, '提示', {
  591. confirmButtonText: '确定',
  592. cancelButtonText: '取消',
  593. type: 'warning'
  594. }).then(() => {
  595. cancelSfdc(row).then(({data}) => {
  596. if (data && data.code === 0) {
  597. this.search ();
  598. this.$message({
  599. message: '操作成功',
  600. type: 'success',
  601. duration: 1500,
  602. onClose: () => {
  603. }
  604. })
  605. }else {
  606. this.$alert(data.msg, '错误', {
  607. confirmButtonText: '确定'
  608. })
  609. }
  610. })
  611. })
  612. },
  613. // 导出+动态列
  614. fields() {
  615. let json = "{"
  616. this.columnList.forEach((item, index) => {
  617. if (index == this.columnList.length - 1) {
  618. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\""
  619. } else {
  620. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" + ","
  621. }
  622. })
  623. json += "}"
  624. let s = eval("(" + json + ")")
  625. return s
  626. },
  627. createExportData() {
  628. // 点击导出按钮之后,开始导出数据之前的执行函数,返回值为需要下载的数据
  629. return this.tableData;
  630. },
  631. getStrDate() {
  632. let dd = new Date();
  633. let Y = dd.getFullYear();
  634. let M = (dd.getMonth() + 1) < 10 ? "0" + (dd.getMonth() + 1) : (dd.getMonth() + 1);//获取当前月份的日期,不足10补0
  635. let D = dd.getDate() < 10 ? "0" + dd.getDate() : dd.getDate();//获取当前几号,不足10补0
  636. let H = dd.getHours() < 10 ? "0" + dd.getHours() : dd.getHours();
  637. let MM = dd.getMinutes() < 10 ? "0" + dd.getMinutes() : dd.getMinutes();
  638. let S = dd.getSeconds() < 10 ? "0" + dd.getSeconds() : dd.getSeconds();
  639. return Y + M + D + H + MM + S;
  640. },
  641. userSetting() {
  642. this.visible = true;
  643. this.$nextTick(() => {
  644. this.$refs.column.init(this.queryTable);
  645. });
  646. },
  647. },
  648. created () {
  649. // this.getTableUserColumn()
  650. }
  651. }
  652. </script>
  653. <style scoped>
  654. .input_left{
  655. text-align: left;
  656. }
  657. .input_reight{
  658. text-align: right;
  659. }
  660. /deep/ input::-webkit-inner-spin-button {
  661. -webkit-appearance: none !important;
  662. }
  663. input[type='number'] {
  664. -moz-appearance: textfield !important;
  665. }
  666. </style>