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.

963 lines
31 KiB

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