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.

1090 lines
35 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
  1. <template>
  2. <div class="mod-config">
  3. <el-form :inline="true" label-position="top" :model="searchData" @keyup.enter.native="getDataList">
  4. <el-form-item :label="'BU'">
  5. <el-select v-model="searchData.buDesc" placeholder="请选择" clearable style="width: 130px">
  6. <el-option
  7. v-for = "i in userBuList"
  8. :key = "i.buNo"
  9. :label = "i.buDesc"
  10. :value = "i.buNo">
  11. </el-option>
  12. </el-select>
  13. </el-form-item>
  14. <el-form-item :label="'工序号'">
  15. <el-input v-model="searchData.operationNo" clearable style="width: 120px"></el-input>
  16. </el-form-item>
  17. <el-form-item :label="'工序名称'">
  18. <el-input v-model="searchData.operationName" clearable style="width: 120px"></el-input>
  19. </el-form-item>
  20. <el-form-item :label="' '">
  21. <el-button v-if="!authSearch" @click="getDataList">查询</el-button>
  22. <el-button v-if="!authSave" type="primary" @click="addModal">新增</el-button>
  23. <download-excel
  24. :fields="fields()"
  25. :data="exportData"
  26. type="xls"
  27. :name="exportName"
  28. :header="exportHeader"
  29. :footer="exportFooter"
  30. :fetch="createExportData"
  31. :before-generate="startDownload"
  32. :before-finish="finishDownload"
  33. worksheet="导出信息"
  34. class="el-button el-button--primary el-button--medium">
  35. {{ "导出" }}
  36. </download-excel>
  37. </el-form-item>
  38. </el-form>
  39. <el-table
  40. :height="height"
  41. :data="dataList"
  42. border
  43. style="width: 100%;">
  44. <el-table-column
  45. v-for="(item,index) in columnList" :key="index"
  46. :sortable="item.columnSortable"
  47. :prop="item.columnProp"
  48. :header-align="item.headerAlign"
  49. :show-overflow-tooltip="item.showOverflowTooltip"
  50. :align="item.align"
  51. :fixed="item.fixed==''?false:item.fixed"
  52. :min-width="item.columnWidth"
  53. :label="item.columnLabel">
  54. <template slot-scope="scope">
  55. <span v-if="!item.columnHidden">{{ scope.row[item.columnProp] }}</span>
  56. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  57. </template>
  58. </el-table-column>
  59. <el-table-column
  60. fixed="right"
  61. header-align="center"
  62. align="center"
  63. width="160"
  64. label="操作">
  65. <template slot-scope="scope">
  66. <el-link v-if="!authUpdate" style="cursor: pointer" @click="updateModal(scope.row)">修改</el-link>
  67. <el-link v-if="!authDelete" style="cursor: pointer" @click="delModal(scope.row)">删除</el-link>
  68. </template>
  69. </el-table-column>
  70. </el-table>
  71. <!-- 分页栏 -->
  72. <el-pagination
  73. @size-change="sizeChangeHandle"
  74. @current-change="currentChangeHandle"
  75. :current-page="pageIndex"
  76. :page-sizes="[20, 50, 100, 200, 500]"
  77. :page-size="pageSize"
  78. :total="totalPage"
  79. layout="total, sizes, prev, pager, next, jumper">
  80. </el-pagination>
  81. <el-dialog :title="modalData.title" :close-on-click-modal="false" v-drag :visible.sync="modalFlag" width="577px">
  82. <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
  83. <el-form-item label="工序号" prop="operationNo" :rules="rules.operationNo">
  84. <el-input v-model="modalData.operationNo" :disabled="modalDisableFlag" style="width: 140px"></el-input>
  85. </el-form-item>
  86. <el-form-item label="工序名称" prop="operationName" :rules="rules.operationName">
  87. <el-input v-model="modalData.operationName" style="width: 272px"></el-input>
  88. </el-form-item>
  89. <el-form-item label="BU" prop="bu" :rules="rules.bu">
  90. <el-select v-model="modalData.bu" placeholder="请选择" :disabled="modalDisableFlag" style="width: 100px">
  91. <el-option
  92. v-for = "i in userBuList"
  93. :key = "i.buNo"
  94. :label = "i.buDesc"
  95. :value = "i.buNo">
  96. </el-option>
  97. </el-select>
  98. </el-form-item>
  99. </el-form>
  100. <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
  101. <el-form-item prop="workCenterNo">
  102. <span style="cursor: pointer" slot="label" @click="getBaseList(516)"><a herf="#">加工中心编码</a></span>
  103. <el-input v-model="modalData.workCenterNo" @blur="workCenterBlur(516)" style="width: 140px"></el-input>
  104. </el-form-item>
  105. <el-form-item :label="'加工中心名称'" prop="workCenterDesc" :rules="rules.workCenterDesc">
  106. <el-input v-model="modalData.workCenterDesc" disabled style="width: 272px"></el-input>
  107. </el-form-item>
  108. </el-form>
  109. <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
  110. <el-form-item prop="setupLaborClassNo" :rules="rules.setupLaborClassNo">
  111. <span style="cursor: pointer" slot="label" @click="getBaseList(517, 2)"><a herf="#">调机时人员等级编码</a></span>
  112. <el-input v-model="modalData.setupLaborClassNo" @blur="setupLaborClassBlur(517)" @change="changeSetupLaborClassNo()" style="width: 140px"></el-input>
  113. </el-form-item>
  114. <el-form-item :label="'调机时人员等级描述'" prop="setupLaborClassDesc" :rules="rules.setupLaborClassDesc">
  115. <el-input v-model="modalData.setupLaborClassDesc" disabled style="width: 272px"></el-input>
  116. </el-form-item>
  117. <el-form-item :label="'调机过程人数'" prop="setupCrewSize" :rules="rules.setupCrewSize">
  118. <el-input-number :controls="false" :step="0" v-model="modalData.setupCrewSize" @change="changeSetupCrewSize()" style="width: 99px"></el-input-number>
  119. </el-form-item>
  120. </el-form>
  121. <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
  122. <el-form-item prop="laborClassNo" :rules="rules.laborClassNo">
  123. <span style="cursor: pointer" slot="label" @click="getBaseList(517, 1)"><a herf="#">人员等级编码</a></span>
  124. <el-input v-model="modalData.laborClassNo" @blur="laborClassBlur(517)" style="width: 140px"></el-input>
  125. </el-form-item>
  126. <el-form-item :label="'人员等级描述'" prop="laborClassDesc" :rules="rules.laborClassDesc">
  127. <el-input v-model="modalData.laborClassDesc" disabled style="width: 272px"></el-input>
  128. </el-form-item>
  129. <el-form-item :label="'生产过程人数'" prop="crewSize" :rules="rules.crewSize">
  130. <el-input-number :controls="false" :step="0" v-model="modalData.crewSize" style="width: 100px"></el-input-number>
  131. </el-form-item>
  132. </el-form>
  133. <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
  134. <el-form-item :label="'人均日产量'">
  135. <el-input-number :controls="false" :step="0" v-model="modalData.refDailyProduction" style="width: 140px"></el-input-number>
  136. </el-form-item>
  137. <el-form-item :label="'速度'">
  138. <el-input-number :controls="false" :step="0" v-model="modalData.refSpeed" style="width: 129px"></el-input-number>
  139. </el-form-item>
  140. <el-form-item :label="'时间'">
  141. <el-input-number :controls="false" :step="0" v-model="modalData.refTime" style="width: 129px"></el-input-number>
  142. </el-form-item>
  143. <el-form-item :label="'效率%'">
  144. <el-input-number :controls="false" :step="0" v-model="modalData.refEfficiency" style="width: 100px"></el-input-number>
  145. </el-form-item>
  146. </el-form>
  147. <el-footer style="height:30px;margin-top: 20px;text-align:center">
  148. <el-button type="primary" @click="saveData">保存</el-button>
  149. <el-button type="primary" @click="modalFlag = false">关闭</el-button>
  150. </el-footer>
  151. </el-dialog>
  152. <!-- chooseList模态框 -->
  153. <ChooseList ref="baseList" @getBaseData="getBaseData"></ChooseList>
  154. </div>
  155. </template>
  156. <script>
  157. import {
  158. searchStandardRoutingOperationList, // 分类信息列表查询
  159. saveStandardRoutingOperation, // 分类信息新增
  160. updateStandardRoutingOperation, // 分类信息编辑
  161. deleteStandardRoutingOperation // 分类信息删除
  162. } from '@/api/part/standardRoutingOperation.js'
  163. import {getSiteAndBuByUserName} from "@/api/eam/eam.js"
  164. import {getTableDefaultListLanguage, getTableUserListLanguage} from "@/api/table.js"
  165. import {verifyData} from "../../../api/part/partInformation";
  166. import ChooseList from '@/views/modules/common/Chooselist_eam'
  167. export default {
  168. // 组件
  169. components: {
  170. ChooseList
  171. },
  172. watch: {
  173. 'modalData.workCenterNo': function (val) {
  174. this.modalData.workCenterNo = val.toUpperCase()
  175. },
  176. 'modalData.setupLaborClassNo': function (val) {
  177. this.modalData.setupLaborClassNo = val.toUpperCase()
  178. },
  179. 'modalData.laborClassNo': function (val) {
  180. this.modalData.laborClassNo = val.toUpperCase()
  181. },
  182. },
  183. data () {
  184. return {
  185. // 导出
  186. exportData: [],
  187. exportName: '物料分类' + this.dayjs().format('YYYYMMDDHHmmss'),
  188. exportHeader: ['物料分类'],
  189. exportFooter: [],
  190. resultList: [],
  191. userBuList: [],
  192. // ======== 行高 ========
  193. height: 200,
  194. // ======== 分页 ========
  195. pageIndex: 1,
  196. pageSize: 50,
  197. totalPage: 0,
  198. // 条件查询
  199. searchData: {
  200. site: '',
  201. userName: this.$store.state.user.name,
  202. buNo: '',
  203. operationNo: '',
  204. operationName: '',
  205. page: 1,
  206. limit: 10
  207. },
  208. modalData: {
  209. flag: '',
  210. title: '',
  211. bu: '',
  212. site: this.$store.state.user.site,
  213. buNo: '',
  214. operationNo: '',
  215. operationName: '',
  216. workCenterNo: '',
  217. workCenterDesc: '',
  218. laborClassNo: '',
  219. laborClassDesc: '',
  220. setupLaborClassNo: '',
  221. setupLaborClassDesc: '',
  222. setupCrewSize: '',
  223. crewSize: '',
  224. refDailyProduction: '',
  225. refSpeed: '',
  226. refTime: '',
  227. refEfficiency: ''
  228. },
  229. // ======== 数据列表 ========
  230. dataList: [],
  231. // 展示列集
  232. columnList: [
  233. {
  234. userId: this.$store.state.user.name,
  235. functionId: 6010012,
  236. serialNumber: '6010012Table1BuDesc',
  237. tableId: "6010012Table1",
  238. tableName: "标准工序表",
  239. columnProp: 'buDesc',
  240. headerAlign: "center",
  241. align: "center",
  242. columnLabel: 'BU',
  243. columnHidden: false,
  244. columnImage: false,
  245. columnSortable: false,
  246. sortLv: 0,
  247. status: true,
  248. fixed: '',
  249. columnWidth: 100
  250. },
  251. {
  252. userId: this.$store.state.user.name,
  253. functionId: 6010012,
  254. serialNumber: '6010012Table1OperationNo',
  255. tableId: "6010012Table1",
  256. tableName: "标准工序表",
  257. columnProp: 'operationNo',
  258. headerAlign: "center",
  259. align: "left",
  260. columnLabel: '工序号',
  261. columnHidden: false,
  262. columnImage: false,
  263. columnSortable: false,
  264. sortLv: 0,
  265. status: true,
  266. fixed: '',
  267. columnWidth: 120
  268. },
  269. {
  270. userId: this.$store.state.user.name,
  271. functionId: 6010012,
  272. serialNumber: '6010012Table1OperationName',
  273. tableId: "6010012Table1",
  274. tableName: "标准工序表",
  275. columnProp: 'operationName',
  276. headerAlign: "center",
  277. align: "left",
  278. columnLabel: '工序名称',
  279. columnHidden: false,
  280. columnImage: false,
  281. columnSortable: false,
  282. sortLv: 0,
  283. status: true,
  284. fixed: '',
  285. columnWidth: 300
  286. },
  287. {
  288. userId: this.$store.state.user.name,
  289. functionId: 6010012,
  290. serialNumber: '6010012Table2SetupCrewSize',
  291. tableId: '6010012Table2',
  292. tableName: '标准工序表',
  293. columnProp: 'setupCrewSize',
  294. headerAlign: 'center',
  295. align: 'right',
  296. columnLabel: '调机过程人数',
  297. columnHidden: false,
  298. columnImage: false,
  299. columnSortable: false,
  300. sortLv: 0,
  301. status: true,
  302. fixed: '',
  303. columnWidth: 100
  304. },
  305. {
  306. userId: this.$store.state.user.name,
  307. functionId: 6010012,
  308. serialNumber: '6010012Table1SetupLaborClassNo',
  309. tableId: "6010012Table1",
  310. tableName: "标准工序表",
  311. columnProp: 'setupLaborClassNo',
  312. headerAlign: "center",
  313. align: "center",
  314. columnLabel: '调机时人员等级编码',
  315. columnHidden: false,
  316. columnImage: false,
  317. columnSortable: false,
  318. sortLv: 0,
  319. status: true,
  320. fixed: '',
  321. columnWidth: 118
  322. },
  323. {
  324. userId: this.$store.state.user.name,
  325. functionId: 6010012,
  326. serialNumber: '6010012Table1SetupLaborClassDesc',
  327. tableId: "6010012Table1",
  328. tableName: "标准工序表",
  329. columnProp: 'setupLaborClassDesc',
  330. headerAlign: "center",
  331. align: "center",
  332. columnLabel: '调机时人员等级描述',
  333. columnHidden: false,
  334. columnImage: false,
  335. columnSortable: false,
  336. sortLv: 0,
  337. status: true,
  338. fixed: '',
  339. columnWidth: 118
  340. },
  341. {
  342. userId: this.$store.state.user.name,
  343. functionId: 6010012,
  344. serialNumber: '6010012Table2CrewSize',
  345. tableId: '6010012Table2',
  346. tableName: '标准工序表',
  347. columnProp: 'crewSize',
  348. headerAlign: 'center',
  349. align: 'right',
  350. columnLabel: '生产过程人数',
  351. columnHidden: false,
  352. columnImage: false,
  353. columnSortable: false,
  354. sortLv: 0,
  355. status: true,
  356. fixed: '',
  357. columnWidth: 100
  358. },
  359. {
  360. userId: this.$store.state.user.name,
  361. functionId: 6010012,
  362. serialNumber: '6010012Table1LaborClassNo',
  363. tableId: "6010012Table1",
  364. tableName: "标准工序表",
  365. columnProp: 'laborClassNo',
  366. headerAlign: "center",
  367. align: "center",
  368. columnLabel: '人员等级编码',
  369. columnHidden: false,
  370. columnImage: false,
  371. columnSortable: false,
  372. sortLv: 0,
  373. status: true,
  374. fixed: '',
  375. columnWidth: 100
  376. },
  377. {
  378. userId: this.$store.state.user.name,
  379. functionId: 6010012,
  380. serialNumber: '6010012Table1LaborClassDesc',
  381. tableId: "6010012Table1",
  382. tableName: "标准工序表",
  383. columnProp: 'laborClassDesc',
  384. headerAlign: "center",
  385. align: "center",
  386. columnLabel: '人员等级描述',
  387. columnHidden: false,
  388. columnImage: false,
  389. columnSortable: false,
  390. sortLv: 0,
  391. status: true,
  392. fixed: '',
  393. columnWidth: 100
  394. },
  395. {
  396. functionId: 6010012,
  397. serialNumber: '6010012Table1WorkCenterNo',
  398. tableId: '6010012Table1',
  399. tableName: '标准工序表',
  400. columnProp: 'workCenterNo',
  401. headerAlign: 'center',
  402. align: 'center',
  403. columnLabel: '加工中心编码',
  404. columnHidden: false,
  405. columnImage: false,
  406. columnSortable: false,
  407. sortLv: 0,
  408. status: true,
  409. fixed: '',
  410. columnWidth: 100
  411. },
  412. {
  413. functionId: 6010012,
  414. serialNumber: '6010012Table1WorkCenterDesc',
  415. tableId: '6010012Table1',
  416. tableName: '标准工序表',
  417. columnProp: 'workCenterDesc',
  418. headerAlign: 'center',
  419. align: 'center',
  420. columnLabel: '加工中心名称',
  421. columnHidden: false,
  422. columnImage: false,
  423. columnSortable: false,
  424. sortLv: 0,
  425. status: true,
  426. fixed: '',
  427. columnWidth: 200
  428. },
  429. {
  430. userId: this.$store.state.user.name,
  431. functionId: 6010012,
  432. serialNumber: '6010012Table1CreateDate',
  433. tableId: '6010012Table1',
  434. tableName: '标准工序表',
  435. columnProp: 'createDate',
  436. headerAlign: 'center',
  437. align: 'center',
  438. columnLabel: '创建时间',
  439. columnHidden: false,
  440. columnImage: false,
  441. columnSortable: false,
  442. sortLv: 0,
  443. status: true,
  444. fixed: '',
  445. columnWidth: 170
  446. },
  447. {
  448. userId: this.$store.state.user.name,
  449. functionId: 6010012,
  450. serialNumber: '6010012Table1CreateBy',
  451. tableId: "6010012Table1",
  452. tableName: "标准工序表",
  453. columnProp: 'createBy',
  454. headerAlign: "center",
  455. align: "center",
  456. columnLabel: '创建人',
  457. columnHidden: false,
  458. columnImage: false,
  459. columnSortable: false,
  460. sortLv: 0,
  461. status: true,
  462. fixed: '',
  463. columnWidth: 100
  464. },
  465. {
  466. userId: this.$store.state.user.name,
  467. functionId: 6010012,
  468. serialNumber: '6010012Table1UpdateDate',
  469. tableId: "6010012Table1",
  470. tableName: "标准工序表",
  471. columnProp: 'updateDate',
  472. headerAlign: "center",
  473. align: "center",
  474. columnLabel: '更新时间',
  475. columnHidden: false,
  476. columnImage: false,
  477. columnSortable: false,
  478. sortLv: 0,
  479. status: true,
  480. fixed: '',
  481. columnWidth: 170
  482. },
  483. {
  484. userId: this.$store.state.user.name,
  485. functionId: 6010012,
  486. serialNumber: '6010012Table1UpdateBy',
  487. tableId: "6010012Table1",
  488. tableName: "标准工序表",
  489. columnProp: 'updateBy',
  490. headerAlign: "center",
  491. align: "center",
  492. columnLabel: '更新人',
  493. columnHidden: false,
  494. columnImage: false,
  495. columnSortable: false,
  496. sortLv: 0,
  497. status: true,
  498. fixed: '',
  499. columnWidth: 100
  500. },
  501. ],
  502. rules: {
  503. bu: [
  504. {
  505. required: true,
  506. message: ' ',
  507. trigger: ['blur','change']
  508. }
  509. ],
  510. operationNo: [
  511. {
  512. required: true,
  513. message: ' ',
  514. trigger: ['blur','change']
  515. }
  516. ],
  517. operationName: [
  518. {
  519. required: true,
  520. message: ' ',
  521. trigger: ['blur','change']
  522. }
  523. ],
  524. workCenterNo: [
  525. {
  526. required: true,
  527. message: ' ',
  528. trigger: ['blur','change']
  529. }
  530. ],
  531. workCenterDesc: [
  532. {
  533. required: true,
  534. message: ' ',
  535. trigger: ['blur','change']
  536. }
  537. ],
  538. laborClassNo: [
  539. {
  540. required: true,
  541. message: ' ',
  542. trigger: ['blur','change']
  543. }
  544. ],
  545. laborClassDesc: [
  546. {
  547. required: true,
  548. message: ' ',
  549. trigger: ['blur','change']
  550. }
  551. ],
  552. setupLaborClassNo: [
  553. {
  554. required: true,
  555. message: ' ',
  556. trigger: ['blur','change']
  557. }
  558. ],
  559. setupLaborClassDesc: [
  560. {
  561. required: true,
  562. message: ' ',
  563. trigger: ['blur','change']
  564. }
  565. ],
  566. setupCrewSize: [
  567. {
  568. required: true,
  569. message: ' ',
  570. trigger: ['blur','change']
  571. }
  572. ],
  573. crewSize: [
  574. {
  575. required: true,
  576. message: ' ',
  577. trigger: ['blur','change']
  578. }
  579. ],
  580. },
  581. // ======== 模态框开关控制 ========
  582. authSearch: false,
  583. authSave: false,
  584. authUpdate: false,
  585. authDelete: false,
  586. modalFlag: false,
  587. modalDisableFlag: false,
  588. menuId: this.$route.meta.menuId,
  589. }
  590. },
  591. mounted () {
  592. this.$nextTick(() => {
  593. this.height = window.innerHeight - 180
  594. })
  595. },
  596. created () {
  597. // 按钮控制
  598. this.getButtonAuthData()
  599. // 获取用户的 site 和 bu
  600. this.getSiteAndBuByUserName()
  601. // 动态列
  602. this.getTableUserColumn(this.$route.meta.menuId+'table1',1)
  603. if (!this.authSearch) {
  604. // 获取数据列表
  605. this.getDataList()
  606. }
  607. },
  608. methods: {
  609. // 获取用户的bu
  610. getSiteAndBuByUserName () {
  611. let tempData = {
  612. username: this.$store.state.user.name,
  613. }
  614. getSiteAndBuByUserName(tempData).then(({data}) => {
  615. if (data.code === 0) {
  616. this.userBuList = data.rows
  617. }
  618. })
  619. },
  620. // 每页数
  621. sizeChangeHandle (val) {
  622. this.pageSize = val
  623. this.pageIndex = 1
  624. this.getDataList()
  625. },
  626. // 当前页
  627. currentChangeHandle (val) {
  628. this.pageIndex = val
  629. this.getDataList()
  630. },
  631. //导出excel
  632. async createExportData() {
  633. this.searchData.limit = -1
  634. this.searchData.page = 1
  635. await searchStandardRoutingOperationList(this.searchData).then(({data}) => {
  636. this.exportList= data.page.list
  637. })
  638. return this.exportList
  639. },
  640. startDownload() {
  641. },
  642. finishDownload() {
  643. },
  644. fields () {
  645. let json = "{"
  646. this.columnList.forEach((item, index) => {
  647. if (index == this.columnList.length - 1) {
  648. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\""
  649. } else {
  650. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" + ","
  651. }
  652. })
  653. json += "}"
  654. let s = eval("(" + json + ")")
  655. return s
  656. },
  657. // ======== chooseList相关方法 ========
  658. /**
  659. * 获取基础数据列表S
  660. * @param val
  661. * @param type
  662. */
  663. getBaseList (val, type) {
  664. this.tagNo = val
  665. this.tagNo1 = type
  666. this.$nextTick(() => {
  667. let strVal = ''
  668. let conSql = ''
  669. if (this.modalData.bu === null || this.modalData.bu === '') {
  670. this.$message.warning("请选择BU!")
  671. return
  672. }
  673. if (val === 517) {
  674. if(type === 1) {
  675. strVal = this.modalData.laborClassNo?this.modalData.laborClassNo:''
  676. } else if (type === 2) {
  677. strVal = this.modalData.setupLaborClassNo?this.modalData.setupLaborClassNo:''
  678. }
  679. conSql = " and site = '" + this.modalData.bu.split('_')[0] + "'"
  680. }
  681. if (val === 516) {
  682. strVal = this.modalData.workCenterNo?this.modalData.workCenterNo:''
  683. conSql = " and site = '" + this.modalData.bu.split('_')[0] + "'"
  684. }
  685. this.$refs.baseList.init(val, strVal, conSql)
  686. })
  687. },
  688. /**
  689. * 列表方法的回调
  690. * @param val
  691. */
  692. getBaseData (val) {
  693. if (this.tagNo === 517) {
  694. if (this.tagNo1 === 1) {
  695. this.modalData.laborClassNo = val.class_no
  696. this.modalData.laborClassDesc = val.class_desc
  697. } else if (this.tagNo1 === 2) {
  698. this.modalData.setupLaborClassNo = val.class_no
  699. this.modalData.setupLaborClassDesc = val.class_desc
  700. this.modalData.laborClassNo = val.class_no
  701. this.modalData.laborClassDesc = val.class_desc
  702. }
  703. }
  704. if (this.tagNo === 516) {
  705. this.modalData.workCenterNo = val.work_center_no
  706. this.modalData.workCenterDesc = val.work_center_desc
  707. }
  708. },
  709. // 获取数据列表
  710. getDataList () {
  711. this.searchData.limit = this.pageSize
  712. this.searchData.page = this.pageIndex
  713. searchStandardRoutingOperationList(this.searchData).then(({data}) => {
  714. if (data.code === 0) {
  715. this.dataList = data.page.list
  716. this.pageIndex = data.page.currPage
  717. this.pageSize = data.page.pageSize
  718. this.totalPage = data.page.totalCount
  719. }
  720. })
  721. },
  722. addModal () {
  723. this.modalData = {
  724. flag: '1',
  725. title: '标准工序新增',
  726. bu: this.userBuList[0].buNo,
  727. buNo: '',
  728. site: '',
  729. operationNo: '',
  730. operationName: '',
  731. workCenterNo: '',
  732. workCenterDesc: '',
  733. laborClassNo: '',
  734. laborClassDesc: '',
  735. setupLaborClassNo: '',
  736. setupLaborClassDesc: '',
  737. setupCrewSize: 1,
  738. crewSize: 1,
  739. createBy: this.$store.state.user.name,
  740. refDailyProduction: undefined,
  741. refSpeed: undefined,
  742. refTime: undefined,
  743. refEfficiency: undefined
  744. }
  745. this.modalDisableFlag = false
  746. this.modalFlag = true
  747. },
  748. /**
  749. * 分类信息编辑模态框
  750. * @param row
  751. */
  752. updateModal (row) {
  753. this.modalData = {
  754. flag: '2',
  755. title: '标准工序编辑',
  756. site: row.site,
  757. bu: row.site + '_' + row.buNo,
  758. buNo: row.buNo,
  759. id: row.id,
  760. operationNo: row.operationNo,
  761. operationName: row.operationName,
  762. workCenterNo: row.workCenterNo,
  763. workCenterDesc: row.workCenterDesc,
  764. laborClassNo: row.laborClassNo,
  765. laborClassDesc: row.laborClassDesc,
  766. setupLaborClassNo: row.setupLaborClassNo,
  767. setupLaborClassDesc: row.setupLaborClassDesc,
  768. setupCrewSize: row.setupCrewSize,
  769. crewSize: row.crewSize,
  770. updateBy: this.$store.state.user.name,
  771. refDailyProduction: row.refDailyProduction,
  772. refSpeed: row.refSpeed,
  773. refTime: row.refTime,
  774. refEfficiency: row.refEfficiency
  775. }
  776. this.modalDisableFlag = true
  777. this.modalFlag = true
  778. },
  779. changeSetupLaborClassNo () {
  780. if (this.modalData.setupLaborClassNo !== '' && this.modalData.setupLaborClassNo != null) {
  781. this.modalData.laborClassNo = this.modalData.setupLaborClassNo
  782. this.laborClassBlur(517)
  783. }
  784. },
  785. changeSetupCrewSize () {
  786. if (this.modalData.setupCrewSize !== '' && this.modalData.setupCrewSize != null) {
  787. this.modalData.crewSize = this.modalData.setupCrewSize
  788. }
  789. },
  790. // ======== 新增/编辑/删除方法 ========
  791. /**
  792. * 分类信息新增/编辑
  793. */
  794. async saveData () {
  795. await this.workCenterBlur(516)
  796. await this.laborClassBlur(517)
  797. await this.setupLaborClassBlur(517)
  798. if (this.modalData.bu === '' || this.modalData.bu == null) {
  799. this.$message.warning('请选择BU!')
  800. return
  801. }
  802. if (this.modalData.operationNo === '' || this.modalData.operationNo == null) {
  803. this.$message.warning('请填写工序号!')
  804. return
  805. }
  806. if (this.modalData.operationName === '' || this.modalData.operationName == null) {
  807. this.$message.warning('请填写工序名称!')
  808. return
  809. }
  810. if (this.modalData.workCenterNo === '' || this.modalData.workCenterNo == null) {
  811. this.$message.warning('请填写加工中心编码!')
  812. return
  813. }
  814. if (this.modalData.workCenterDesc === '' || this.modalData.workCenterDesc == null) {
  815. this.$alert('该加工中心不存在,请重新输入加工中心编码!', '提示', {
  816. confirmButtonText: '确定'
  817. })
  818. return
  819. }
  820. if (this.modalData.laborClassNo === '' || this.modalData.laborClassNo == null) {
  821. this.$message.warning('请填写人员等级编码!')
  822. return
  823. }
  824. if (this.modalData.laborClassDesc === '' || this.modalData.laborClassDesc == null) {
  825. this.$alert('当前BU下人员等级编码不存在,请重新输入人员等级编码!', '提示', {
  826. confirmButtonText: '确定'
  827. })
  828. return
  829. }
  830. if (this.modalData.setupLaborClassNo === '' || this.modalData.setupLaborClassNo == null) {
  831. this.$message.warning('请填写调机过程中人员等级编码!')
  832. return
  833. }
  834. if (this.modalData.setupLaborClassDesc === '' || this.modalData.setupLaborClassDesc == null) {
  835. this.$alert('当前BU下调机过程中人员等级编码不存在,请重新输入调机过程中人员等级编码!', '提示', {
  836. confirmButtonText: '确定'
  837. })
  838. return
  839. }
  840. if (this.modalData.setupCrewSize === '' || this.modalData.setupCrewSize == null) {
  841. this.$message.warning('请填写调机过程中人数!')
  842. return
  843. }
  844. if (this.modalData.crewSize === '' || this.modalData.crewSize == null) {
  845. this.$message.warning('请填写生产过程中人数!')
  846. return
  847. }
  848. if (this.modalData.flag === '1') {
  849. saveStandardRoutingOperation(this.modalData).then(({data}) => {
  850. if (data && data.code === 0) {
  851. this.getDataList()
  852. this.modalFlag = false
  853. this.$message({
  854. message: '操作成功',
  855. type: 'success',
  856. duration: 1500,
  857. onClose: () => {}
  858. })
  859. } else {
  860. this.$alert(data.msg, '错误', {
  861. confirmButtonText: '确定'
  862. })
  863. }
  864. })
  865. } else {
  866. updateStandardRoutingOperation(this.modalData).then(({data}) => {
  867. if (data && data.code === 0) {
  868. this.getDataList()
  869. this.modalFlag = false
  870. this.$message({
  871. message: '操作成功',
  872. type: 'success',
  873. duration: 1500,
  874. onClose: () => {}
  875. })
  876. } else {
  877. this.$alert(data.msg, '错误', {
  878. confirmButtonText: '确定'
  879. })
  880. }
  881. })
  882. }
  883. },
  884. /**
  885. * 分类信息删除
  886. */
  887. delModal (row) {
  888. this.$confirm(`是否删除这条分类信息?`, '提示', {
  889. confirmButtonText: '确定',
  890. cancelButtonText: '取消',
  891. type: 'warning'
  892. }).then(() => {
  893. deleteStandardRoutingOperation(row).then(({data}) => {
  894. if (data && data.code === 0) {
  895. this.getDataList()
  896. this.partSelections = []
  897. this.$message({
  898. message: '操作成功',
  899. type: 'success',
  900. duration: 1500,
  901. onClose: () => {}
  902. })
  903. } else {
  904. this.$alert(data.msg, '错误', {
  905. confirmButtonText: '确定'
  906. })
  907. }
  908. })
  909. }).catch(() => {
  910. })
  911. },
  912. // 加工中心输入校验
  913. async workCenterBlur (tagNo) {
  914. if (this.modalData.workCenterNo != null && this.modalData.workCenterNo !== '') {
  915. let tempData = {
  916. tagno: tagNo,
  917. conditionSql: " and work_center_no = '" + this.modalData.workCenterNo + "'" + " and site = '" + this.modalData.bu.split('_')[0] + "'"
  918. }
  919. // 返回 Promise
  920. return verifyData(tempData).then(({ data }) => {
  921. if (data && data.code === 0) {
  922. if (data.baseListData.length > 0) {
  923. this.modalData.workCenterDesc = data.baseListData[0].work_center_desc
  924. } else {
  925. this.modalData.workCenterDesc = ''
  926. }
  927. } else {
  928. this.$message.warning(data.msg)
  929. this.modalData.workCenterDesc = ''
  930. }
  931. }).catch(error => {
  932. console.error(error);
  933. this.$message.error('校验失败,请重试');
  934. this.modalData.workCenterDesc = '';
  935. });
  936. } else {
  937. this.modalData.workCenterDesc = ''
  938. return Promise.resolve(); // 如果 itemNo 为空,直接返回 resolved Promise
  939. }
  940. },
  941. // 人员等级描述
  942. async setupLaborClassBlur (tagNo) {
  943. if (this.modalData.setupLaborClassNo != null && this.modalData.setupLaborClassNo !== '') {
  944. let tempData = {
  945. tagno: tagNo,
  946. conditionSql: " and class_no = '" + this.modalData.setupLaborClassNo + "'" + " and site = '" + this.modalData.bu.split('_')[0] + "'"
  947. }
  948. // 返回 Promise
  949. return verifyData(tempData).then(({data}) => {
  950. if (data && data.code === 0) {
  951. if (data.baseListData.length > 0) {
  952. this.modalData.setupLaborClassDesc = data.baseListData[0].class_desc
  953. } else {
  954. this.modalData.setupLaborClassDesc = ''
  955. }
  956. } else {
  957. this.$message.warning(data.msg)
  958. this.modalData.setupLaborClassDesc = ''
  959. }
  960. }).catch(error => {
  961. console.error(error);
  962. this.$message.error('校验失败,请重试');
  963. this.modalData.setupLaborClassDesc = '';
  964. });
  965. } else {
  966. this.modalData.setupLaborClassDesc = ''
  967. return Promise.resolve(); // 如果 itemNo 为空,直接返回 resolved Promise
  968. }
  969. },
  970. // 人员等级描述
  971. async laborClassBlur (tagNo) {
  972. if (this.modalData.laborClassNo != null && this.modalData.laborClassNo !== '') {
  973. let tempData = {
  974. tagno: tagNo,
  975. conditionSql: " and class_no = '" + this.modalData.laborClassNo + "'" + " and site = '" + this.modalData.bu.split('_')[0] + "'"
  976. }
  977. return verifyData(tempData).then(({data}) => {
  978. if (data && data.code === 0) {
  979. if (data.baseListData.length > 0) {
  980. this.modalData.laborClassDesc = data.baseListData[0].class_desc
  981. } else {
  982. this.modalData.laborClassDesc = ''
  983. }
  984. } else {
  985. this.$message.warning(data.msg)
  986. this.modalData.laborClassDesc = ''
  987. }
  988. }).catch(error => {
  989. console.error(error);
  990. this.$message.error('校验失败,请重试');
  991. this.modalData.laborClassDesc = '';
  992. });
  993. }else {
  994. this.modalData.laborClassDesc = ''
  995. return Promise.resolve(); // 如果 itemNo 为空,直接返回 resolved Promise
  996. }
  997. },
  998. // 动态列开始 获取 用户保存的 格式列
  999. async getTableUserColumn(tableId, columnId) {
  1000. let queryTableUser = {
  1001. userId: this.$store.state.user.name,
  1002. functionId: this.$route.meta.menuId,
  1003. tableId: tableId,
  1004. status: true,
  1005. languageCode: this.$i18n.locale
  1006. }
  1007. await getTableUserListLanguage(queryTableUser).then(({data}) => {
  1008. if (data.rows.length > 0) {
  1009. switch (columnId) {
  1010. case 1:
  1011. this.columnList = data.rows
  1012. break;
  1013. }
  1014. } else {
  1015. this.getColumnList(tableId, columnId)
  1016. }
  1017. })
  1018. },
  1019. // 获取 tableDefault 列
  1020. async getColumnList (tableId, columnId) {
  1021. let queryTable= {
  1022. functionId: this.$route.meta.menuId,
  1023. tableId: tableId,
  1024. languageCode: this.$i18n.locale
  1025. }
  1026. await getTableDefaultListLanguage(queryTable).then(({data}) => {
  1027. if (!data.rows.length === 0) {
  1028. switch (columnId) {
  1029. case 1:
  1030. this.columnList = data.rows
  1031. break;
  1032. }
  1033. }
  1034. })
  1035. },
  1036. //获取按钮的权限数据
  1037. getButtonAuthData () {
  1038. let searchFlag = this.isAuth(this.menuId+":search")
  1039. let saveFlag = this.isAuth(this.menuId+":save")
  1040. let updateFlag = this.isAuth(this.menuId+":update")
  1041. let deleteFlag = this.isAuth(this.menuId+":delete")
  1042. //处理页面的权限数据
  1043. this.authSearch = !searchFlag
  1044. this.authSave = !saveFlag
  1045. this.authUpdate = !updateFlag
  1046. this.authDelete = !deleteFlag
  1047. },
  1048. }
  1049. }
  1050. </script>
  1051. <style scoped lang="scss">
  1052. /deep/ .customer-tab .el-tabs__content {
  1053. padding: 0px !important;
  1054. height: 459px;
  1055. }
  1056. </style>