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.

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