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.

1028 lines
33 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.bu" 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.partNo" clearable style="width: 120px"></el-input>
  16. </el-form-item>
  17. <el-form-item :label="'物料名称'">
  18. <el-input v-model="searchData.partDesc" clearable style="width: 120px"></el-input>
  19. </el-form-item>
  20. <el-form-item :label="' '">
  21. <el-button type="primary" @click="getDataList">查询</el-button>
  22. </el-form-item>
  23. </el-form>
  24. <el-table
  25. :height="height"
  26. :data="dataList"
  27. ref="mainTable"
  28. border
  29. style="width: 100%;">
  30. <el-table-column
  31. v-for="(item,index) in columnList" :key="index"
  32. :sortable="item.columnSortable"
  33. :prop="item.columnProp"
  34. :header-align="item.headerAlign"
  35. :show-overflow-tooltip="item.showOverflowTooltip"
  36. :align="item.align"
  37. :fixed="item.fixed==''?false:item.fixed"
  38. :min-width="item.columnWidth"
  39. :label="item.columnLabel">
  40. <template slot-scope="scope">
  41. <span v-if="!item.columnHidden">{{ scope.row[item.columnProp] }}</span>
  42. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  43. </template>
  44. </el-table-column>
  45. <el-table-column
  46. fixed="right"
  47. header-align="center"
  48. align="center"
  49. width="100"
  50. label="操作">
  51. <template slot-scope="scope">
  52. <el-link v-if="!authUpdate" style="cursor: pointer" @click="updateModal(scope.row)">修改</el-link>
  53. <el-link style="cursor: pointer" @click="costHistorySearch(scope.row)">成本历史</el-link>
  54. </template>
  55. </el-table-column>
  56. </el-table>
  57. <!-- 分页栏 -->
  58. <el-pagination
  59. @size-change="sizeChangeHandle"
  60. @current-change="currentChangeHandle"
  61. :current-page="pageIndex"
  62. :page-sizes="[20, 50, 100, 200, 500]"
  63. :page-size="pageSize"
  64. :total="totalPage"
  65. layout="total, sizes, prev, pager, next, jumper">
  66. </el-pagination>
  67. <!-- 编辑模态框 -->
  68. <el-dialog title="物料成本信息 - 修改" @close="closeDialog" :close-on-click-modal="false" v-drag :visible.sync="modalFlag" width="596px">
  69. <el-form :inline="true" label-position="top" :model="modalData" style="margin-top: -5px;">
  70. <el-form :inline="true" label-position="top" :model="modalData">
  71. <el-form-item label="物料编码" prop="partNo">
  72. <el-input v-model="modalData.partNo" disabled style="width: 128px"></el-input>
  73. </el-form-item>
  74. <el-form-item label="物料描述" prop="partDesc">
  75. <el-input v-model="modalData.partDesc" disabled style="width: 330px"></el-input>
  76. </el-form-item>
  77. <el-form-item label="BU">
  78. <el-input v-model="modalData.buDesc" disabled style="width: 80px"></el-input>
  79. </el-form-item>
  80. </el-form>
  81. <el-form :inline="true" label-position="top" :model="modalData" style="margin-top: -5px;">
  82. <el-form-item label="物料分类编码" prop="familyID">
  83. <el-input v-model="modalData.familyID" disabled style="width: 128px"></el-input>
  84. </el-form-item>
  85. <el-form-item label="物料分类描述" prop="familyName">
  86. <el-input v-model="modalData.familyName" disabled style="width: 330px"></el-input>
  87. </el-form-item>
  88. <el-form-item label="计量单位">
  89. <el-input v-model="modalData.umId2" disabled style="width: 80px"></el-input>
  90. </el-form-item>
  91. </el-form>
  92. <el-form :inline="true" label-position="top" :model="modalData" style="margin-top: -5px;">
  93. <el-form-item label="商品组1编码" prop="otherGroup1">
  94. <el-input v-model="modalData.otherGroup1" disabled style="width: 128px"></el-input>
  95. </el-form-item>
  96. <el-form-item label="商品组1描述" prop="otherGroupName1">
  97. <el-input v-model="modalData.otherGroupName1" disabled style="width: 330px"></el-input>
  98. </el-form-item>
  99. </el-form>
  100. <el-form :inline="true" label-position="top" :model="modalData" style="margin-top: -5px;">
  101. <el-form-item label="单位标准成本" prop="standardCost">
  102. <el-input v-model="modalData.standardCost" @change="standardCostChange()" placeholder="最多6位小数" class="inlineNumber numInput" style="width: 107px"></el-input>
  103. </el-form-item>
  104. <el-form-item label="标准成本货币" prop="standardCostCurrency" :show-message="false">
  105. <span slot="label">
  106. <a @click="getBaseList(512)">标准成本货币</a>
  107. </span>
  108. <el-input v-model="modalData.standardCostCurrency" disabled @change="standardCostCurrencyChange()" style="width: 108px"></el-input>
  109. </el-form-item>
  110. <el-form-item label="单位报价成本" prop="actualCost">
  111. <el-input v-model="modalData.actualCost" placeholder="最多6位小数" class="inlineNumber numInput" style="width: 107px"></el-input>
  112. </el-form-item>
  113. <el-form-item label="报价成本货币" prop="actualCostCurrency" :show-message="false">
  114. <span slot="label">
  115. <a @click="getBaseList(513)">报价成本货币</a>
  116. </span>
  117. <el-input v-model="modalData.actualCostCurrency" disabled style="width: 108px"></el-input>
  118. </el-form-item>
  119. </el-form>
  120. <el-form :inline="true" label-position="top" :model="modalData" style="margin-top: 0px;">
  121. <el-form-item label="备注" style="height: 80px">
  122. <el-input v-model="modalData.costRemark" style="width: 565px"></el-input>
  123. </el-form-item>
  124. </el-form>
  125. </el-form>
  126. <el-footer style="height:35px;margin-top: -25px;text-align:center">
  127. <el-button type="primary" @click="saveData">保存</el-button>
  128. <el-button type="primary" @click="closeDialog">关闭</el-button>
  129. </el-footer>
  130. </el-dialog>
  131. <!-- 成本历史模态框 -->
  132. <el-dialog title="物料成本信息 - 成本历史" @close="closeCostHistoryDialog" :close-on-click-modal="false" v-drag :visible.sync="costHistoryFlag" width="680px">
  133. <el-table
  134. :height="height - 300"
  135. :data="costHistoryList"
  136. border
  137. style="width: 100%;">
  138. <el-table-column
  139. v-for="(item,index) in columnCostHistoryList" :key="index"
  140. :sortable="item.columnSortable"
  141. :prop="item.columnProp"
  142. :header-align="item.headerAlign"
  143. :show-overflow-tooltip="item.showOverflowTooltip"
  144. :align="item.align"
  145. :fixed="item.fixed==''?false:item.fixed"
  146. :min-width="item.columnWidth"
  147. :label="item.columnLabel">
  148. <template slot-scope="scope">
  149. <span v-if="!item.columnHidden">{{ scope.row[item.columnProp] }}</span>
  150. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  151. </template>
  152. </el-table-column>
  153. </el-table>
  154. <span slot="footer" class="dialog-footer">
  155. <el-button type="primary" @click="closeCostHistoryDialog">关闭</el-button>
  156. </span>
  157. </el-dialog>
  158. <choose-list-eam ref="baseList" @getBaseData="getBaseData"></choose-list-eam>
  159. </div>
  160. </template>
  161. <script>
  162. import {partInformationSearch,partCostInformationEdit} from "@/api/part/partInformation";
  163. import Chooselist from "../common/Chooselist.vue";
  164. import {getSiteAndBuByUserName} from "../../../api/qc/qc";
  165. import ChooseListEam from "../common/Chooselist_eam.vue";
  166. import {costHistorySearch, verifyData} from "../../../api/part/partInformation";
  167. import {getTableDefaultListLanguage, getTableUserListLanguage} from "../../../api/table";
  168. export default {
  169. components: {
  170. ChooseListEam,
  171. Chooselist
  172. },
  173. data() {
  174. return {
  175. // ======== 行高 ========
  176. height: 200,
  177. // ======== 分页 ========
  178. pageIndex: 1,
  179. pageSize: 50,
  180. totalPage: 0,
  181. userBuList: [],
  182. // 条件查询
  183. searchData: {
  184. site: '',
  185. userName: this.$store.state.user.name,
  186. bu: '',
  187. buNo: '',
  188. partNo: '',
  189. partDesc: '',
  190. page: 1,
  191. limit: 10
  192. },
  193. modalData: {
  194. id: null,
  195. partId: null,
  196. bu: '',
  197. site: '',
  198. buNo: '',
  199. sourceBu: '',
  200. partNo: '',
  201. partDesc: '',
  202. umId2: '',
  203. umName: '',
  204. familyId: '',
  205. familyName: '',
  206. otherGroup1: '',
  207. otherGroupName1: '',
  208. standardCost: '',
  209. standardCostCurrency: '',
  210. actualCost: '',
  211. actualCostCurrency: '',
  212. costRemark: '',
  213. createBy: '',
  214. createDate: '',
  215. updateBy: '',
  216. updateDate: ''
  217. },
  218. originalData: {},
  219. // ======== 数据列表 ========
  220. dataList: [],
  221. costHistoryList: [],
  222. // 展示列集
  223. columnList: [
  224. {
  225. userId: this.$store.state.user.name,
  226. functionId: 6010011,
  227. serialNumber: '6010011Table1BuDesc',
  228. tableId: '6010011Table1',
  229. tableName: '物料成本表',
  230. columnProp: 'buDesc',
  231. headerAlign: 'center',
  232. align: 'center',
  233. columnLabel: 'BU',
  234. columnHidden: false,
  235. columnImage: false,
  236. columnSortable: false,
  237. sortLv: 0,
  238. status: true,
  239. fixed: '',
  240. columnWidth: 100
  241. },
  242. {
  243. userId: this.$store.state.user.name,
  244. functionId: 6010011,
  245. serialNumber: '6010011Table1PartNo',
  246. tableId: '6010011Table1',
  247. tableName: '物料成本表',
  248. columnProp: 'partNo',
  249. headerAlign: 'center',
  250. align: 'center',
  251. columnLabel: '物料编码',
  252. columnHidden: false,
  253. columnImage: false,
  254. columnSortable: false,
  255. sortLv: 0,
  256. status: true,
  257. fixed: '',
  258. columnWidth: 120
  259. },
  260. {
  261. userId: this.$store.state.user.name,
  262. functionId: 6010011,
  263. serialNumber: '6010011Table1PartDesc',
  264. tableId: '6010011Table1',
  265. tableName: '物料成本表',
  266. columnProp: 'partDesc',
  267. headerAlign: 'center',
  268. align: 'left',
  269. columnLabel: '物料描述',
  270. columnHidden: false,
  271. columnImage: false,
  272. columnSortable: false,
  273. sortLv: 0,
  274. status: true,
  275. fixed: '',
  276. columnWidth: 300
  277. },
  278. {
  279. userId: this.$store.state.user.name,
  280. functionId: 6010011,
  281. serialNumber: '6010011Table1UmId2',
  282. tableId: '6010011Table1',
  283. tableName: '物料成本表',
  284. columnProp: 'umId2',
  285. headerAlign: 'center',
  286. align: 'center',
  287. columnLabel: '计量单位编码',
  288. columnHidden: false,
  289. columnImage: false,
  290. columnSortable: false,
  291. sortLv: 0,
  292. status: true,
  293. fixed: '',
  294. columnWidth: 100
  295. },
  296. {
  297. userId: this.$store.state.user.name,
  298. functionId: 6010011,
  299. serialNumber: '6010011Table1UmName',
  300. tableId: '6010011Table1',
  301. tableName: '物料成本表',
  302. columnProp: 'umName',
  303. headerAlign: 'center',
  304. align: 'left',
  305. columnLabel: '计量单位名称',
  306. columnHidden: false,
  307. columnImage: false,
  308. columnSortable: false,
  309. sortLv: 0,
  310. status: true,
  311. fixed: '',
  312. columnWidth: 150
  313. },
  314. {
  315. userId: this.$store.state.user.name,
  316. functionId: 6010011,
  317. serialNumber: '6010011Table1PartType2Desc',
  318. tableId: '6010011Table1',
  319. tableName: '物料成本表',
  320. columnProp: 'partType2Desc',
  321. headerAlign: 'center',
  322. align: 'center',
  323. columnLabel: '零件类型',
  324. columnHidden: false,
  325. columnImage: false,
  326. columnSortable: false,
  327. sortLv: 0,
  328. status: true,
  329. fixed: '',
  330. columnWidth: 100
  331. },
  332. {
  333. userId: this.$store.state.user.name,
  334. functionId: 6010011,
  335. serialNumber: '6010011Table1FamilyId',
  336. tableId: '6010011Table1',
  337. tableName: '物料成本表',
  338. columnProp: 'familyId',
  339. headerAlign: 'center',
  340. align: 'center',
  341. columnLabel: '物料分类编码',
  342. columnHidden: false,
  343. columnImage: false,
  344. columnSortable: false,
  345. sortLv: 0,
  346. status: true,
  347. fixed: '',
  348. columnWidth: 120
  349. },
  350. {
  351. userId: this.$store.state.user.name,
  352. functionId: 6010011,
  353. serialNumber: '6010011Table1FamilyName',
  354. tableId: '6010011Table1',
  355. tableName: '物料成本表',
  356. columnProp: 'familyName',
  357. headerAlign: 'center',
  358. align: 'center',
  359. columnLabel: '物料分类描述',
  360. columnHidden: false,
  361. columnImage: false,
  362. columnSortable: false,
  363. sortLv: 0,
  364. status: true,
  365. fixed: '',
  366. columnWidth: 120
  367. },
  368. {
  369. userId: this.$store.state.user.name,
  370. functionId: 6010011,
  371. serialNumber: '6010011Table1ProductGroupId1',
  372. tableId: '6010011Table1',
  373. tableName: '物料成本表',
  374. columnProp: 'productGroupId1',
  375. headerAlign: 'center',
  376. align: 'center',
  377. columnLabel: '商品组1编码',
  378. columnHidden: false,
  379. columnImage: false,
  380. columnSortable: false,
  381. sortLv: 0,
  382. status: true,
  383. fixed: '',
  384. columnWidth: 100
  385. },
  386. {
  387. userId: this.$store.state.user.name,
  388. functionId: 6010011,
  389. serialNumber: '6010011Table1ProductGroupName1',
  390. tableId: '6010011Table1',
  391. tableName: '物料成本表',
  392. columnProp: 'productGroupName1',
  393. headerAlign: 'center',
  394. align: 'left',
  395. columnLabel: '商品组1名称',
  396. columnHidden: false,
  397. columnImage: false,
  398. columnSortable: false,
  399. sortLv: 0,
  400. status: true,
  401. fixed: '',
  402. columnWidth: 150
  403. },
  404. {
  405. userId: this.$store.state.user.name,
  406. functionId: 6010011,
  407. serialNumber: '6010011Table1StandardCost',
  408. tableId: '6010011Table1',
  409. tableName: '物料成本表',
  410. columnProp: 'standardCost',
  411. headerAlign: 'center',
  412. align: 'right',
  413. columnLabel: '单位标准成本',
  414. columnHidden: false,
  415. columnImage: false,
  416. columnSortable: false,
  417. sortLv: 0,
  418. status: true,
  419. fixed: '',
  420. columnWidth: 100
  421. },
  422. {
  423. userId: this.$store.state.user.name,
  424. functionId: 6010011,
  425. serialNumber: '6010011Table1StandardCostCurrency',
  426. tableId: '6010011Table1',
  427. tableName: '物料成本表',
  428. columnProp: 'standardCostCurrency',
  429. headerAlign: 'center',
  430. align: 'center',
  431. columnLabel: '标准成本货币',
  432. columnHidden: false,
  433. columnImage: false,
  434. columnSortable: false,
  435. sortLv: 0,
  436. status: true,
  437. fixed: '',
  438. columnWidth: 100
  439. },
  440. {
  441. userId: this.$store.state.user.name,
  442. functionId: 6010011,
  443. serialNumber: '6010011Table1ActualCost',
  444. tableId: '6010011Table1',
  445. tableName: '物料成本表',
  446. columnProp: 'actualCost',
  447. headerAlign: 'center',
  448. align: 'right',
  449. columnLabel: '单位报价成本',
  450. columnHidden: false,
  451. columnImage: false,
  452. columnSortable: false,
  453. sortLv: 0,
  454. status: true,
  455. fixed: '',
  456. columnWidth: 100
  457. },
  458. {
  459. userId: this.$store.state.user.name,
  460. functionId: 6010011,
  461. serialNumber: '6010011Table1ActualCostCurrency',
  462. tableId: '6010011Table1',
  463. tableName: '物料成本表',
  464. columnProp: 'actualCostCurrency',
  465. headerAlign: 'center',
  466. align: 'center',
  467. columnLabel: '报价成本货币',
  468. columnHidden: false,
  469. columnImage: false,
  470. columnSortable: false,
  471. sortLv: 0,
  472. status: true,
  473. fixed: '',
  474. columnWidth: 100
  475. },
  476. {
  477. userId: this.$store.state.user.name,
  478. functionId: 6010011,
  479. serialNumber: '6010011Table1CostRemark',
  480. tableId: '6010011Table1',
  481. tableName: '物料成本表',
  482. columnProp: 'costRemark',
  483. headerAlign: 'center',
  484. align: 'left',
  485. columnLabel: '备注',
  486. columnHidden: false,
  487. columnImage: false,
  488. columnSortable: false,
  489. sortLv: 0,
  490. status: true,
  491. fixed: '',
  492. columnWidth: 200
  493. },
  494. {
  495. userId: this.$store.state.user.name,
  496. functionId: 6010011,
  497. serialNumber: '6010011Table1CreateDate',
  498. tableId: '6010011Table1',
  499. tableName: '物料成本表',
  500. columnProp: 'createDate',
  501. headerAlign: 'center',
  502. align: 'center',
  503. columnLabel: '创建时间',
  504. columnHidden: false,
  505. columnImage: false,
  506. columnSortable: false,
  507. sortLv: 0,
  508. status: true,
  509. fixed: '',
  510. columnWidth: 160
  511. },
  512. {
  513. userId: this.$store.state.user.name,
  514. functionId: 6010011,
  515. serialNumber: '6010011Table1CreateBy',
  516. tableId: '6010011Table1',
  517. tableName: '物料成本表',
  518. columnProp: 'createBy',
  519. headerAlign: 'center',
  520. align: 'center',
  521. columnLabel: '创建人',
  522. columnHidden: false,
  523. columnImage: false,
  524. columnSortable: false,
  525. sortLv: 0,
  526. status: true,
  527. fixed: '',
  528. columnWidth: 80
  529. },
  530. {
  531. userId: this.$store.state.user.name,
  532. functionId: 6010011,
  533. serialNumber: '6010011Table1UpdateDate',
  534. tableId: '6010011Table1',
  535. tableName: '物料成本表',
  536. columnProp: 'updateDate',
  537. headerAlign: 'center',
  538. align: 'center',
  539. columnLabel: '更新时间',
  540. columnHidden: false,
  541. columnImage: false,
  542. columnSortable: false,
  543. sortLv: 0,
  544. status: true,
  545. fixed: '',
  546. columnWidth: 160
  547. },
  548. {
  549. userId: this.$store.state.user.name,
  550. functionId: 6010011,
  551. serialNumber: '6010011Table1UpdateBy',
  552. tableId: '6010011Table1',
  553. tableName: '物料成本表',
  554. columnProp: 'updateBy',
  555. headerAlign: 'center',
  556. align: 'center',
  557. columnLabel: '更新人',
  558. columnHidden: false,
  559. columnImage: false,
  560. columnSortable: false,
  561. sortLv: 0,
  562. status: true,
  563. fixed: '',
  564. columnWidth: 80
  565. }
  566. ],
  567. columnCostHistoryList: [
  568. {
  569. userId: this.$store.state.user.name,
  570. functionId: 6010011,
  571. serialNumber: '6010011Table2FieldCaption',
  572. tableId: '6010011Table2',
  573. tableName: '物料成本表',
  574. columnProp: 'fieldcaption',
  575. headerAlign: 'center',
  576. align: 'center',
  577. columnLabel: '名称',
  578. columnHidden: false,
  579. columnImage: false,
  580. columnSortable: false,
  581. sortLv: 0,
  582. status: true,
  583. fixed: '',
  584. columnWidth: 100
  585. },
  586. {
  587. userId: this.$store.state.user.name,
  588. functionId: 6010011,
  589. serialNumber: '6010011Table2FieldName',
  590. tableId: '6010011Table2',
  591. tableName: '物料成本表',
  592. columnProp: 'fieldname',
  593. headerAlign: 'center',
  594. align: 'center',
  595. columnLabel: '字段',
  596. columnHidden: false,
  597. columnImage: false,
  598. columnSortable: false,
  599. sortLv: 0,
  600. status: true,
  601. fixed: '',
  602. columnWidth: 100
  603. },
  604. {
  605. userId: this.$store.state.user.name,
  606. functionId: 6010011,
  607. serialNumber: '6010011Table2OldValue',
  608. tableId: '6010011Table2',
  609. tableName: '物料成本表',
  610. columnProp: 'oldvalue',
  611. headerAlign: 'center',
  612. align: 'center',
  613. columnLabel: 'Old Value',
  614. columnHidden: false,
  615. columnImage: false,
  616. columnSortable: false,
  617. sortLv: 0,
  618. status: true,
  619. fixed: '',
  620. columnWidth: 100
  621. },
  622. {
  623. userId: this.$store.state.user.name,
  624. functionId: 6010011,
  625. serialNumber: '6010011Table2NewValue',
  626. tableId: '6010011Table2',
  627. tableName: '物料成本表',
  628. columnProp: 'newvalue',
  629. headerAlign: 'center',
  630. align: 'center',
  631. columnLabel: 'New Value',
  632. columnHidden: false,
  633. columnImage: false,
  634. columnSortable: false,
  635. sortLv: 0,
  636. status: true,
  637. fixed: '',
  638. columnWidth: 100
  639. },
  640. {
  641. userId: this.$store.state.user.name,
  642. functionId: 6010011,
  643. serialNumber: '6010011Table2Recordtype',
  644. tableId: '6010011Table2',
  645. tableName: '物料成本表',
  646. columnProp: 'recordtype',
  647. headerAlign: 'center',
  648. align: 'center',
  649. columnLabel: '变更类型',
  650. columnHidden: false,
  651. columnImage: false,
  652. columnSortable: false,
  653. sortLv: 0,
  654. status: true,
  655. fixed: '',
  656. columnWidth: 100
  657. },
  658. {
  659. userId: this.$store.state.user.name,
  660. functionId: 6010011,
  661. serialNumber: '6010011Table2UserId',
  662. tableId: '6010011Table2',
  663. tableName: '物料成本表',
  664. columnProp: 'userid',
  665. headerAlign: 'center',
  666. align: 'center',
  667. columnLabel: '更新人',
  668. columnHidden: false,
  669. columnImage: false,
  670. columnSortable: false,
  671. sortLv: 0,
  672. status: true,
  673. fixed: '',
  674. columnWidth: 100
  675. },
  676. {
  677. userId: this.$store.state.user.name,
  678. functionId: 6010011,
  679. serialNumber: '6010011Table2CreateDate',
  680. tableId: '6010011Table2',
  681. tableName: '物料成本表',
  682. columnProp: 'createdate',
  683. headerAlign: 'center',
  684. align: 'center',
  685. columnLabel: '更新时间',
  686. columnHidden: false,
  687. columnImage: false,
  688. columnSortable: false,
  689. sortLv: 0,
  690. status: true,
  691. fixed: '',
  692. columnWidth: 100
  693. }
  694. ],
  695. // ======== 模态框开关控制 ========
  696. authSearch: false,
  697. authSave: false,
  698. authUpdate: false,
  699. authDelete: false,
  700. modalFlag: false,
  701. modalDisableFlag: false,
  702. costHistoryFlag: false,
  703. menuId: this.$route.meta.menuId,
  704. tagNo:undefined,
  705. }
  706. },
  707. mounted () {
  708. this.$nextTick(() => {
  709. this.height = window.innerHeight - 180
  710. })
  711. },
  712. created () {
  713. // 按钮控制
  714. this.getButtonAuthData()
  715. // 获取用户的 site 和 bu
  716. this.getSiteAndBuByUserName()
  717. // 动态列
  718. this.getTableUserColumn(this.$route.meta.menuId+'table1',1)
  719. if (!this.authSearch) {
  720. // 获取数据列表
  721. this.getDataList()
  722. }
  723. },
  724. methods: {
  725. getBaseList(val){
  726. this.tagNo = val
  727. this.$nextTick(()=>{
  728. let strVal = ''
  729. let conSql = ''
  730. if (val === 512) {
  731. strVal = this.modalData.standardCostCurrency ? this.modalData.standardCostCurrency : ''
  732. }
  733. if (val === 513) {
  734. strVal = this.modalData.actualCostCurrency ? this.modalData.actualCostCurrency : ''
  735. }
  736. if (this.modalData.bu === null || this.modalData.bu === '') {
  737. this.$message.warning("请选择BU!")
  738. return
  739. } else {
  740. conSql = " and site = '" + this.modalData.bu.split('-')[0] + "'"
  741. }
  742. this.$refs.baseList.init(val, strVal, conSql)
  743. })
  744. },
  745. getBaseData(val){
  746. if (this.tagNo === 512){
  747. this.modalData.standardCostCurrency = val.Currency
  748. if (this.modalData.actualCostCurrency === '' || this.modalData.actualCostCurrency == null){
  749. this.modalData.actualCostCurrency = val.Currency
  750. }
  751. }
  752. if (this.tagNo === 513){
  753. this.modalData.actualCostCurrency = val.Currency
  754. }
  755. },
  756. // 获取用户的bu
  757. getSiteAndBuByUserName () {
  758. let tempData = {
  759. username: this.$store.state.user.name,
  760. }
  761. getSiteAndBuByUserName(tempData).then(({data}) => {
  762. if (data.code === 0) {
  763. this.userBuList = data.rows
  764. }
  765. })
  766. },
  767. // 每页数
  768. sizeChangeHandle (val) {
  769. this.pageSize = val
  770. this.pageIndex = 1
  771. this.getDataList()
  772. },
  773. // 当前页
  774. currentChangeHandle (val) {
  775. this.pageIndex = val
  776. this.getDataList()
  777. },
  778. //获取按钮的权限数据
  779. getButtonAuthData () {
  780. let searchFlag = this.isAuth(this.menuId+":search")
  781. let saveFlag = this.isAuth(this.menuId+":save")
  782. let updateFlag = this.isAuth(this.menuId+":update")
  783. let deleteFlag = this.isAuth(this.menuId+":delete")
  784. //处理页面的权限数据
  785. this.authSearch = !searchFlag
  786. this.authSave = !saveFlag
  787. this.authUpdate = !updateFlag
  788. this.authDelete = !deleteFlag
  789. },
  790. // ======== 列表数据刷新方法 ========
  791. /**
  792. * 获取数据列表
  793. */
  794. getDataList () {
  795. this.searchData.limit = this.pageSize
  796. this.searchData.page = this.pageIndex
  797. this.searchData.buNo = this.searchData.bu.split('_')[1]
  798. partInformationSearch(this.searchData).then(({data}) => {
  799. if (data.code === 0) {
  800. this.dataList = data.page.list
  801. this.pageIndex = data.page.currPage
  802. this.pageSize = data.page.pageSize
  803. this.totalPage = data.page.totalCount
  804. // 判断是否全部存在数据
  805. if (this.totalPage > 0) {
  806. // 设置选中行
  807. this.$refs.mainTable.setCurrentRow(this.dataList[0])
  808. }
  809. }
  810. })
  811. },
  812. updateModal (row) {
  813. this.modalData = {
  814. id: row.id,
  815. partId: row.partId,
  816. bu: row.site + '-' + row.sourceBu,
  817. site: row.site,
  818. buNo: row.sourceBu,
  819. buDesc: row.buDesc,
  820. partNo: row.partNo,
  821. partDesc: row.partDesc,
  822. umId2: row.umId2,
  823. umName: row.umName,
  824. familyId: row.familyId,
  825. familyName: row.familyName,
  826. otherGroup1: row.otherGroup1,
  827. otherGroupName1: row.otherGroupName1,
  828. standardCost: row.standardCost,
  829. standardCostCurrency: row.standardCostCurrency,
  830. actualCost: row.actualCost,
  831. actualCostCurrency: row.actualCostCurrency,
  832. costRemark: row.costRemark,
  833. createBy: row.createBy,
  834. createDate: row.createDate,
  835. }
  836. if (this.modalData.standardCost === null || this.modalData.standardCost === ''){
  837. this.modalData.standardCost = 0
  838. }
  839. if (this.modalData.standardCostCurrency === null || this.modalData.standardCostCurrency === ''){
  840. this.modalData.standardCostCurrency = 'CNY'
  841. }
  842. if (this.modalData.actualCost === null || this.modalData.actualCost === ''){
  843. this.modalData.actualCost = 0
  844. }
  845. if (this.modalData.actualCostCurrency === null || this.modalData.actualCostCurrency === ''){
  846. this.modalData.actualCostCurrency = 'CNY'
  847. }
  848. this.originalData = JSON.parse(JSON.stringify(this.modalData))
  849. this.modalFlag = true
  850. },
  851. saveData () {
  852. if (JSON.stringify(this.modalData) === JSON.stringify(this.originalData)) {
  853. this.closeDialog()
  854. return
  855. }
  856. // 单位标准成本 和单位报价成本只能为正整数的数字,提示2500ms
  857. let reg = /^[0-9]+.?[0-9]*/
  858. if (!reg.test(this.modalData.standardCost) || !reg.test(this.modalData.actualCost)) {
  859. this.$alert('单位标准成本和单位报价成本只能为正整数的数字!', '提示', {
  860. confirmButtonText: '确定',
  861. callback: action => {
  862. }
  863. })
  864. return
  865. }
  866. let inData = {
  867. id: this.modalData.id,
  868. partId: this.modalData.partId,
  869. bu: this.modalData.bu,
  870. site: this.modalData.site,
  871. buNo: this.modalData.buNo,
  872. standardCost: this.modalData.standardCost,
  873. standardCostCurrency: this.modalData.standardCostCurrency,
  874. actualCost: this.modalData.actualCost,
  875. actualCostCurrency: this.modalData.actualCostCurrency,
  876. costRemark: this.modalData.costRemark,
  877. updateBy: this.$store.state.user.name,
  878. updateDate:''
  879. }
  880. this.$confirm('确定保存吗?', '提示', {
  881. confirmButtonText: '确定',
  882. cancelButtonText: '取消',
  883. type: 'warning'
  884. }).then(() => {
  885. partCostInformationEdit(inData).then(({data}) => {
  886. if (data.code === 0) {
  887. this.$message({
  888. message: '保存成功',
  889. type: 'success'
  890. })
  891. this.getDataList()
  892. this.closeDialog()
  893. } else {
  894. this.$message.error(data.msg)
  895. }
  896. })
  897. }).catch(() => {
  898. this.$message({
  899. type: 'info',
  900. message: '已取消保存'
  901. })
  902. })
  903. },
  904. closeDialog () {
  905. this.modalData = {
  906. flag: '',
  907. title: '',
  908. bu: '',
  909. site: this.$store.state.user.site,
  910. buNo: '',
  911. partNo: '',
  912. partDesc: '',
  913. umId2: '',
  914. umName: '',
  915. familyId: '',
  916. familyName: '',
  917. otherGroup1: '',
  918. otherGroupName1: '',
  919. standardCost: '',
  920. standardCostCurrency: '',
  921. actualCost: '',
  922. actualCostCurrency: '',
  923. costRemark: '',
  924. }
  925. this.modalFlag = false
  926. },
  927. standardCostChange(){
  928. if (this.modalData.actualCost === '' || this.modalData.actualCost === null){
  929. this.modalData.actualCost = this.modalData.standardCost
  930. }
  931. },
  932. costHistorySearch(row) {
  933. let inData = {
  934. site: row.site,
  935. partno: row.partNo
  936. }
  937. costHistorySearch(inData).then(({data}) => {
  938. if (data.code === 0) {
  939. this.costHistoryList = data.rows
  940. this.costHistoryFlag = true
  941. } else {
  942. this.$message.error(data.msg)
  943. }
  944. })
  945. },
  946. closeCostHistoryDialog () {
  947. this.costHistoryFlag = false
  948. this.costHistoryList = []
  949. },
  950. // 动态列开始 获取 用户保存的 格式列
  951. async getTableUserColumn(tableId, columnId) {
  952. let queryTableUser = {
  953. userId: this.$store.state.user.name,
  954. functionId: this.$route.meta.menuId,
  955. tableId: tableId,
  956. status: true,
  957. languageCode: this.$i18n.locale
  958. }
  959. await getTableUserListLanguage(queryTableUser).then(({data}) => {
  960. if (data.rows.length > 0) {
  961. switch (columnId) {
  962. case 1:
  963. this.columnList = data.rows
  964. break;
  965. }
  966. } else {
  967. this.getColumnList(tableId, columnId)
  968. }
  969. })
  970. },
  971. // 获取 tableDefault 列
  972. async getColumnList (tableId, columnId) {
  973. let queryTable= {
  974. functionId: this.$route.meta.menuId,
  975. tableId: tableId,
  976. languageCode: this.$i18n.locale
  977. }
  978. await getTableDefaultListLanguage(queryTable).then(({data}) => {
  979. if (!data.rows.length === 0) {
  980. switch (columnId) {
  981. case 1:
  982. this.columnList = data.rows
  983. break;
  984. }
  985. }
  986. })
  987. },
  988. }
  989. }
  990. </script>
  991. <style scoped>
  992. .numInput /deep/ .el-input__inner{
  993. text-align: right;
  994. }
  995. /deep/ .inlineNumber input::-webkit-outer-spin-button,
  996. /deep/ .inlineNumber input::-webkit-inner-spin-button {
  997. -webkit-appearance: none;
  998. }
  999. /deep/ .inlineNumber input[type="number"]{
  1000. -moz-appearance: textfield;
  1001. padding-right: 5px !important;
  1002. }
  1003. </style>
  1004. ```