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.

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