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.

1455 lines
43 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 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 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 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 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 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. <div style="width: 1000px">
  4. <el-form label-position="top" :model="searchData" @keyup.enter.native="getDataList()">
  5. <el-row :gutter="10">
  6. <el-col :span="4">
  7. <el-form-item label="工厂编号">
  8. <el-select v-model="searchData.site" style="width: 100%">
  9. <el-option label="全部" value=" "></el-option>
  10. <el-option :label="site.siteid" :value="site.siteid" v-for="(site) in siteList" :key="site.siteid"></el-option>
  11. </el-select>
  12. </el-form-item>
  13. </el-col>
  14. <el-col :span="4">
  15. <el-form-item label="货币">
  16. <el-input v-model="searchData.currency" clearable ></el-input>
  17. </el-form-item>
  18. </el-col>
  19. <el-col :span="5">
  20. <el-form-item label="货币描述">
  21. <el-input v-model="searchData.currencyDesc" clearable ></el-input>
  22. </el-form-item>
  23. </el-col>
  24. <el-col :span="3">
  25. <el-form-item label="状态">
  26. <el-select v-model="searchData.active" style="width: 100%" placeholder="请选择">
  27. <el-option label="全部" value=" "></el-option>
  28. <el-option label="启用" value="Y"></el-option>
  29. <el-option label="禁用" value="N"></el-option>
  30. </el-select>
  31. </el-form-item>
  32. </el-col>
  33. <el-col :span="3">
  34. <el-form-item label=" ">
  35. <el-button v-if="!authSearch" type="primary" @click="getDataList()">查询</el-button>
  36. <el-button v-if="!authSave" type="primary" @click="addModal()">新增</el-button>
  37. </el-form-item>
  38. </el-col>
  39. </el-row>
  40. </el-form>
  41. </div>
  42. <!-- 展示列表 -->
  43. <el-table
  44. :height="height"
  45. :data="dataList"
  46. @row-click="changeData"
  47. border
  48. :row-style="rowStyle"
  49. style="width: 100%;">
  50. <el-table-column
  51. v-for="(item,index) in columnList" :key="index"
  52. :sortable="item.columnSortable"
  53. :prop="item.columnProp"
  54. :header-align="item.headerAlign"
  55. :show-overflow-tooltip="item.showOverflowTooltip"
  56. :align="item.align"
  57. :fixed="item.fixed==''?false:item.fixed"
  58. :min-width="item.columnWidth"
  59. :label="item.columnLabel">
  60. <template slot-scope="scope">
  61. <template v-if="item.columnProp==='active'">
  62. <span > {{ scope.row[item.columnProp] === 'Y'? '启用' : '停用' }}</span>
  63. </template>
  64. <template v-else>
  65. <span v-if="!item.columnHidden"> {{ scope.row[item.columnProp] }}</span>
  66. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  67. </template>
  68. </template>
  69. </el-table-column>
  70. <el-table-column
  71. fixed="right"
  72. header-align="center"
  73. align="center"
  74. min-width="120"
  75. label="操作">
  76. <template slot-scope="scope">
  77. <a type="text" @click="updateModal(scope.row)">修改</a>
  78. <a type="text" @click="deleteModal(scope.row)">删除</a>
  79. </template>
  80. </el-table-column>
  81. </el-table>
  82. <el-pagination
  83. @size-change="sizeChangeHandle"
  84. @current-change="currentChangeHandle"
  85. :current-page="pageIndex"
  86. :page-sizes="[20, 50, 100, 200, 500]"
  87. :page-size="pageSize"
  88. :total="totalPage"
  89. layout="total, sizes, prev, pager, next, jumper">
  90. </el-pagination>
  91. <el-tabs style="font-size: 12px;min-height: 200px" class="customer-tab" v-model="activeName" type="border-card">
  92. <el-tab-pane label="汇率" name="detail" >
  93. <el-row style="display: flex">
  94. <el-card style="width: 50%">
  95. <el-col >
  96. <div>参考货币</div>
  97. <el-button v-if="!authSave" type="primary" @click="addModal1()">新增</el-button>
  98. <el-table
  99. :data="dataList1"
  100. @row-click="changeData2"
  101. :height="height"
  102. border
  103. :row-style="rowStyle2"
  104. style="width: 100%; ">
  105. <el-table-column
  106. v-for="(item,index) in columnList1" :key="index"
  107. :sortable="item.columnSortable"
  108. :prop="item.columnProp"
  109. :header-align="item.headerAlign"
  110. :show-overflow-tooltip="item.showOverflowTooltip"
  111. :align="item.align"
  112. :fixed="item.fixed==''?false:item.fixed"
  113. :min-width="item.columnWidth"
  114. :label="item.columnLabel">
  115. <template slot-scope="scope">
  116. <span v-if="!item.columnHidden"> {{ scope.row[item.columnProp] }}</span>
  117. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
  118. style="width: 100px; height: 80px"/></span>
  119. </template>
  120. </el-table-column>
  121. <el-table-column
  122. fixed="right"
  123. header-align="center"
  124. align="center"
  125. width="160"
  126. label="操作">
  127. <template slot-scope="scope">
  128. <!-- <a type="text" size="small" @click="updateModal1(scope.row)">修改</a>-->
  129. <a type="text" size="small" @click="deleteModal1(scope.row)">删除</a>
  130. </template>
  131. </el-table-column>
  132. </el-table>
  133. </el-col>
  134. </el-card>
  135. <el-card style="width: 50%">
  136. <el-col style="margin-left: 20px">
  137. <el-col>
  138. <span>货币汇率</span>
  139. </el-col>
  140. <el-button v-if="!authSave" type="primary" @click="addModal2()">新增</el-button>
  141. <el-table
  142. :data="dataList2"
  143. :height="height"
  144. border
  145. style="width: 100%; ">
  146. <el-table-column
  147. v-for="(item,index) in columnList2" :key="index"
  148. :sortable="item.columnSortable"
  149. :prop="item.columnProp"
  150. :header-align="item.headerAlign"
  151. :show-overflow-tooltip="item.showOverflowTooltip"
  152. :align="item.align"
  153. :fixed="item.fixed==''?false:item.fixed"
  154. :min-width="item.columnWidth"
  155. :label="item.columnLabel">
  156. <template slot-scope="scope">
  157. <span v-if="!item.columnHidden"> {{ scope.row[item.columnProp] }}</span>
  158. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
  159. style="width: 100px; height: 80px"/></span>
  160. </template>
  161. </el-table-column>
  162. <el-table-column
  163. fixed="right"
  164. header-align="center"
  165. align="center"
  166. width="160"
  167. label="操作">
  168. <template slot-scope="scope">
  169. <!-- <a type="text" size="small" @click="updateModal2(scope.row)">修改</a>-->
  170. <a type="text" size="small" @click="deleteModal2(scope.row)">删除</a>
  171. </template>
  172. </el-table-column>
  173. </el-table>
  174. </el-col>
  175. </el-card>
  176. </el-row>
  177. </el-tab-pane>
  178. </el-tabs>
  179. <!-- 货币新增修改-->
  180. <el-dialog title="货币" :close-on-click-modal="false" v-drag :visible.sync="modalFlag" width="450px">
  181. <el-form label-position="top" :model="modalData" :rules="rules" >
  182. <el-row :gutter="10">
  183. <el-col :span="10">
  184. <el-form-item label="工厂编码" prop="site">
  185. <el-select v-model="modalData.site" :disabled="modalDisableFlag" style="width: 100%">
  186. <el-option :label="site.siteid" :value="site.siteid" v-for="(site) in siteList" :key="site.siteid"></el-option>
  187. </el-select>
  188. </el-form-item>
  189. </el-col>
  190. </el-row>
  191. <el-row :gutter="10">
  192. <el-col :span="10">
  193. <el-form-item label="货币:" prop="currency">
  194. <el-input v-model="modalData.currency" :disabled="modalDisableFlag" ></el-input>
  195. </el-form-item>
  196. </el-col>
  197. <el-col :span="14">
  198. <el-form-item label="货币描述" prop="currencyDesc">
  199. <el-input v-model="modalData.currencyDesc" ></el-input>
  200. </el-form-item>
  201. </el-col>
  202. <el-col :span="10">
  203. <el-form-item label="状态" prop="active">
  204. <el-select v-model="modalData.active" style="width: 100%" placeholder="请选择">
  205. <el-option label="启用" value="Y"></el-option>
  206. <el-option label="停用" value="N"></el-option>
  207. </el-select>
  208. </el-form-item>
  209. </el-col>
  210. <el-col :span="4">
  211. <el-form-item label=" ">
  212. <el-checkbox v-model="modalData.baseCurrencyFlag" false-label="N" true-label="Y">本位币</el-checkbox>
  213. </el-form-item>
  214. </el-col>
  215. </el-row>
  216. </el-form>
  217. <el-footer style="height:30px;line-height:30px;text-align:center">
  218. <el-button type="primary" @click="saveData()">保存</el-button>
  219. <el-button type="primary" @click="modalFlag = false">关闭</el-button>
  220. </el-footer>
  221. </el-dialog>
  222. <!-- 货币参考新增和修改 -->
  223. <el-dialog title="货币参考" :close-on-click-modal="false" v-drag :visible.sync="modalFlag1" width="300px">
  224. <el-form label-position="top" :model="modalData1" :rules="rules" >
  225. <el-row :gutter="10">
  226. <el-col :span="12">
  227. <el-form-item label="参考货币" prop="currency">
  228. <template slot="label">
  229. <a @click="handleClickCurrency">参考货币</a>
  230. </template>
  231. <el-input v-model="modalData1.currency" @blur="handleBlurCurrency"></el-input>
  232. </el-form-item>
  233. </el-col>
  234. <el-col :span="24">
  235. <el-form-item label="参考货币描述" prop="currencyDesc">
  236. <el-input v-model="modalData1.currencyDesc" disabled></el-input>
  237. </el-form-item>
  238. </el-col>
  239. </el-row>
  240. </el-form>
  241. <el-footer style="height:30px;line-height:30px;text-align:center">
  242. <el-button type="primary" @click="saveData1()">保存</el-button>
  243. <el-button type="primary" @click="modalFlag1 = false">关闭</el-button>
  244. </el-footer>
  245. </el-dialog>
  246. <!-- 货币汇率新增和修改 -->
  247. <el-dialog title="货币汇率" top="20vh" :close-on-click-modal="false" v-drag :visible.sync="modalFlag2" width="200px">
  248. <el-form label-position="top" :model="modalData2" :rules="rules">
  249. <el-form-item label="汇率:" prop="exchangeRate">
  250. <el-input-number v-model="modalData2.exchangeRate" style="width: 50%;" :controls="false" :step="0" :precision="4"></el-input-number>
  251. </el-form-item>
  252. <el-form-item label="启用日期" >
  253. <el-date-picker
  254. style="width: 100%"
  255. v-model="modalData2.activationDate"
  256. type="date"
  257. value-format="yyyy-MM-dd"
  258. placeholder="选择日期">
  259. </el-date-picker>
  260. </el-form-item>
  261. </el-form>
  262. <el-footer style="height:30px;line-height:30px;text-align:center">
  263. <el-button type="primary" @click="saveData2()">保存</el-button>
  264. <el-button type="primary" @click="modalFlag2 = false">关闭</el-button>
  265. </el-footer>
  266. </el-dialog>
  267. <el-dialog title="货币信息" top="18vh" :close-on-click-modal="false" v-drag :visible.sync="currencyVisible" width="500px">
  268. <el-form label-position="top" :model="currency">
  269. <el-row :gutter="10">
  270. <el-col :span="6">
  271. <el-form-item label="货币" >
  272. <el-input v-model="currency.currency"></el-input>
  273. </el-form-item>
  274. </el-col>
  275. <el-col :span="8">
  276. <el-form-item label="货币描述" >
  277. <el-input v-model="currency.currencyDesc"></el-input>
  278. </el-form-item>
  279. </el-col>
  280. <el-col :span="4">
  281. <el-form-item label=" " >
  282. <el-button type="primary" @click="queryCurrency">查询</el-button>
  283. </el-form-item>
  284. </el-col>
  285. </el-row>
  286. </el-form>
  287. <el-table
  288. :data="currencyList"
  289. :height="300"
  290. @row-dblclick="handleDblclick"
  291. border>
  292. <el-table-column
  293. prop="currency"
  294. label="货币"
  295. min-width="100">
  296. </el-table-column>
  297. <el-table-column
  298. prop="currencyDesc"
  299. label="货币描述"
  300. min-width="160">
  301. </el-table-column>
  302. <el-table-column
  303. prop="active"
  304. label="状态"
  305. min-width="80">
  306. </el-table-column>
  307. </el-table>
  308. <el-pagination
  309. @size-change="handleSizeChange"
  310. @current-change="handleCurrentChange"
  311. :current-page="no"
  312. :page-sizes="[20, 50, 100, 200, 500]"
  313. :page-size="size"
  314. :total="total"
  315. layout="total, sizes, prev, pager, next, jumper">
  316. </el-pagination>
  317. </el-dialog>
  318. </div>
  319. </template>
  320. <script>
  321. import {
  322. //货币
  323. findCurrency,//查询
  324. addCurrency,//新增
  325. updateCurrency,//修改
  326. deleteCurrency,//删除
  327. //货币参考
  328. findRefCurrency,//查询
  329. addRefCurrency,//新增
  330. updateRefCurrency,//修改
  331. deleteRefCurrency,//删除
  332. //货币汇率
  333. findExchangeCurrency,//查询
  334. addExchangeCurrency,//新增
  335. updateExchangeCurrency,//修改
  336. deleteExchangeCurrency,//删除
  337. queryUserSite
  338. } from '@/api/fanucGroup/currency.js'
  339. export default {
  340. data () {
  341. return {
  342. activeName: 'detail',
  343. currentRow: '',
  344. headerData: '',
  345. currentRow2: '',
  346. headerData2: '',
  347. // 是否收藏
  348. favorite: false,
  349. // 导出 start
  350. exportData: [],
  351. exportName: '检验方法' + this.dayjs().format('YYYYMMDDHHmmss'),
  352. exportHeader: ['检验方法'],
  353. exportFooter: [],
  354. exportList: [],
  355. // 导出 end
  356. searchData: {
  357. site: this.$store.state.user.site,
  358. id: '',
  359. currency: '',
  360. currencyDesc: '',
  361. active: 'Y',
  362. baseCurrencyFlag: '',
  363. createDate: '',
  364. createBy: '',
  365. updateDate: '',
  366. updateBy: '',
  367. page: 1,
  368. limit: 10,
  369. },
  370. pageIndex: 1,
  371. pageSize: 20,
  372. totalPage: 0,
  373. height: 200,
  374. dataList: [],
  375. dataList1: [],
  376. dataList2: [],
  377. dataListLoading: false,
  378. modalFlag: false,
  379. modalFlag1: false,
  380. modalFlag2: false,
  381. modalDisableFlag: false,
  382. modalDisableFlag1: false,
  383. modalDisableFlag2: false,
  384. modalData: {
  385. site: this.$store.state.user.site,
  386. id: '',
  387. currency: '',
  388. currencyDesc: '',
  389. active: 'Y',
  390. baseCurrencyFlag: '',
  391. createDate: '',
  392. createBy: '',
  393. updateDate: '',
  394. updateBy: '',
  395. },
  396. //货币参考
  397. modalData1: {
  398. site: this.$store.state.user.site,
  399. id: '',
  400. currencyId: '',
  401. currency: '',
  402. currencyDesc: '',
  403. refCurrency: '',
  404. createDate: '',
  405. },
  406. //货币汇率
  407. modalData2: {
  408. site: this.$store.state.user.site,
  409. id: '',
  410. currency: '',
  411. exchangeRate: '',
  412. activationDate: '',
  413. createDate: '',
  414. createBy: '',
  415. updateDate: '',
  416. updateBy: '',
  417. },
  418. // 标头展示
  419. columnList: [
  420. {
  421. userId: this.$store.state.user.name,
  422. functionId: 501004,
  423. serialNumber: '501004TableSite',
  424. tableId: '501004Table',
  425. tableName: '工厂编码',
  426. columnWidth: 100,
  427. columnProp: 'site',
  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. },
  438. {
  439. userId: this.$store.state.user.name,
  440. functionId: 501004,
  441. serialNumber: '501004TableCurrency',
  442. tableId: '501004Table',
  443. tableName: '货币',
  444. columnWidth: 120,
  445. columnProp: 'currency',
  446. headerAlign: 'center',
  447. align: 'left',
  448. columnLabel: '货币',
  449. columnHidden: false,
  450. columnImage: false,
  451. columnSortable: false,
  452. sortLv: 0,
  453. status: true,
  454. fixed: '',
  455. },
  456. {
  457. userId: this.$store.state.user.name,
  458. functionId: 501004,
  459. serialNumber: '501004TableCurrencyDesc',
  460. tableId: '501004Table',
  461. tableName: '货币描述',
  462. columnWidth: 180,
  463. columnProp: 'currencyDesc',
  464. headerAlign: 'center',
  465. align: 'left',
  466. columnLabel: '货币描述',
  467. columnHidden: false,
  468. columnImage: false,
  469. columnSortable: false,
  470. sortLv: 0,
  471. status: true,
  472. fixed: '',
  473. },
  474. {
  475. userId: this.$store.state.user.name,
  476. functionId: 501004,
  477. serialNumber: '501004TableBaseCurrencyFlag',
  478. tableId: '501004Table',
  479. tableName: '本位币',
  480. columnWidth: 120,
  481. columnProp: 'baseCurrencyFlag',
  482. headerAlign: 'center',
  483. align: 'center',
  484. columnLabel: '本位币',
  485. columnHidden: false,
  486. columnImage: false,
  487. columnSortable: false,
  488. sortLv: 0,
  489. status: true,
  490. fixed: '',
  491. },
  492. {
  493. userId: this.$store.state.user.name,
  494. functionId: 501004,
  495. serialNumber: '501004TableActive',
  496. tableId: '501004Table',
  497. tableName: '状态',
  498. columnWidth: 100,
  499. columnProp: 'active',
  500. headerAlign: 'center',
  501. align: 'center',
  502. columnLabel: '状态',
  503. columnHidden: false,
  504. columnImage: false,
  505. columnSortable: false,
  506. sortLv: 0,
  507. status: true,
  508. fixed: '',
  509. },
  510. {
  511. userId: this.$store.state.user.name,
  512. functionId: 501004,
  513. serialNumber: '501004TableCreateDate',
  514. tableId: '501004Table',
  515. tableName: '录入时间',
  516. columnWidth: 160,
  517. columnProp: 'createDate',
  518. headerAlign: 'center',
  519. align: 'center',
  520. columnLabel: '录入时间',
  521. columnHidden: false,
  522. columnImage: false,
  523. columnSortable: false,
  524. sortLv: 0,
  525. status: true,
  526. fixed: '',
  527. },
  528. {
  529. userId: this.$store.state.user.name,
  530. functionId: 501004,
  531. serialNumber: '501004TableCreateBy',
  532. tableId: '501004Table',
  533. tableName: '录入人',
  534. columnWidth: 160,
  535. columnProp: 'createBy',
  536. headerAlign: 'center',
  537. align: 'left',
  538. columnLabel: '录入人',
  539. columnHidden: false,
  540. columnImage: false,
  541. columnSortable: false,
  542. sortLv: 0,
  543. status: true,
  544. fixed: '',
  545. },
  546. {
  547. userId: this.$store.state.user.name,
  548. functionId: 501004,
  549. serialNumber: '501004TableUpdateDate',
  550. tableId: '501004Table',
  551. tableName: '修改时间',
  552. columnWidth: 160,
  553. columnProp: 'updateDate',
  554. headerAlign: 'center',
  555. align: 'center',
  556. columnLabel: '修改时间',
  557. columnHidden: false,
  558. columnImage: false,
  559. columnSortable: false,
  560. sortLv: 0,
  561. status: true,
  562. fixed: '',
  563. },
  564. {
  565. userId: this.$store.state.user.name,
  566. functionId: 501004,
  567. serialNumber: '501004TableUpdateBy',
  568. tableId: '501004Table',
  569. tableName: '修改人',
  570. columnWidth: 160,
  571. columnProp: 'updateBy',
  572. headerAlign: 'center',
  573. align: 'left',
  574. columnLabel: '修改人',
  575. columnHidden: false,
  576. columnImage: false,
  577. columnSortable: false,
  578. sortLv: 0,
  579. status: true,
  580. fixed: '',
  581. },
  582. ],
  583. columnList1: [
  584. {
  585. userId: this.$store.state.user.name,
  586. functionId: 501004,
  587. serialNumber: '501004TableCurrency',
  588. tableId: '501004Table',
  589. tableName: '货币',
  590. columnWidth: 100,
  591. columnProp: 'currency',
  592. headerAlign: 'center',
  593. align: 'left',
  594. columnLabel: '参考货币',
  595. columnHidden: false,
  596. columnImage: false,
  597. columnSortable: false,
  598. sortLv: 0,
  599. status: true,
  600. fixed: '',
  601. },
  602. {
  603. userId: this.$store.state.user.name,
  604. functionId: 501004,
  605. serialNumber: '501004TableCurrencyDesc',
  606. tableId: '501004Table',
  607. tableName: '货币描述',
  608. columnWidth: 160,
  609. columnProp: 'currencyDesc',
  610. headerAlign: 'center',
  611. align: 'left',
  612. columnLabel: '参考货币描述',
  613. columnHidden: false,
  614. columnImage: false,
  615. columnSortable: false,
  616. sortLv: 0,
  617. status: true,
  618. fixed: '',
  619. },
  620. {
  621. userId: this.$store.state.user.name,
  622. functionId: 501004,
  623. serialNumber: '501004TableCreatDate',
  624. tableId: '501004Table',
  625. tableName: '最近汇率日期',
  626. columnWidth: 120,
  627. columnProp: 'createDate',
  628. headerAlign: 'center',
  629. align: 'center',
  630. columnLabel: '最近汇率日期',
  631. columnHidden: false,
  632. columnImage: false,
  633. columnSortable: false,
  634. sortLv: 0,
  635. status: true,
  636. fixed: '',
  637. },
  638. ],
  639. columnList2: [
  640. {
  641. userId: this.$store.state.user.name,
  642. functionId: 501004,
  643. serialNumber: '501004TableExchangeRate',
  644. tableId: '501004Table',
  645. tableName: '汇率',
  646. columnWidth: 110,
  647. columnProp: 'exchangeRate',
  648. headerAlign: 'center',
  649. align: 'right',
  650. columnLabel: '汇率',
  651. columnHidden: false,
  652. columnImage: false,
  653. columnSortable: false,
  654. sortLv: 0,
  655. status: true,
  656. fixed: '',
  657. },
  658. {
  659. userId: this.$store.state.user.name,
  660. functionId: 501004,
  661. serialNumber: '501004TableActivationDate',
  662. tableId: '501004Table',
  663. tableName: '启用日期',
  664. columnWidth: 100,
  665. columnProp: 'activationDate',
  666. headerAlign: 'center',
  667. align: 'center',
  668. columnLabel: '启用日期',
  669. columnHidden: false,
  670. columnImage: false,
  671. columnSortable: false,
  672. sortLv: 0,
  673. status: true,
  674. fixed: '',
  675. },
  676. {
  677. userId: this.$store.state.user.name,
  678. functionId: 501004,
  679. serialNumber: '501004TableCreateDate',
  680. tableId: '501004Table',
  681. tableName: '录入时间',
  682. columnWidth: 140,
  683. columnProp: 'createDate',
  684. headerAlign: 'center',
  685. align: 'center',
  686. columnLabel: '录入时间',
  687. columnHidden: false,
  688. columnImage: false,
  689. columnSortable: false,
  690. sortLv: 0,
  691. status: true,
  692. fixed: '',
  693. },
  694. {
  695. userId: this.$store.state.user.name,
  696. functionId: 501004,
  697. serialNumber: '501004TableCreateBy',
  698. tableId: '501004Table',
  699. tableName: '录入人',
  700. columnWidth: 110,
  701. columnProp: 'createBy',
  702. headerAlign: 'center',
  703. align: 'center',
  704. columnLabel: '录入人',
  705. columnHidden: false,
  706. columnImage: false,
  707. columnSortable: false,
  708. sortLv: 0,
  709. status: true,
  710. fixed: '',
  711. },
  712. ],
  713. rules: {
  714. currency: [
  715. {
  716. required: true,
  717. message: ' ',
  718. trigger: ['blur', 'change']
  719. }
  720. ],
  721. site: [
  722. {
  723. required: true,
  724. message: ' ',
  725. trigger: ['blur', 'change']
  726. }
  727. ],
  728. bu: [
  729. {
  730. required: true,
  731. message: ' ',
  732. trigger: ['blur', 'change']
  733. }
  734. ],
  735. },
  736. options: [],
  737. userBuList: [],
  738. authSearch: false,
  739. authSave: false,
  740. authUpdate: false,
  741. authDelete: false,
  742. menuId: this.$route.meta.menuId,
  743. siteList:[],
  744. currencyVisible:false,
  745. currency:{
  746. site: '',
  747. currency: '',
  748. currencyDesc: '',
  749. },
  750. currencyList:[],
  751. no: 1,
  752. size: 20,
  753. total: 0,
  754. }
  755. },
  756. mounted () {
  757. this.$nextTick(() => {
  758. this.height = (window.innerHeight - 260) / 2
  759. })
  760. },
  761. //货币自动转化成大写
  762. watch: {
  763. modalData: {
  764. deep: true,
  765. handler: function (newV, oldV) {
  766. this.modalData.currency = this.modalData.currency.toUpperCase()
  767. this.$nextTick(() => {
  768. this.modalData1.currency = this.modalData1.currency.toUpperCase();
  769. });
  770. }
  771. },
  772. 'modalData1.currency'(newVal,oldVal){
  773. this.modalData1.currency = newVal.toUpperCase();
  774. }
  775. },
  776. created () {
  777. this.handleQuerySite()
  778. //页面在加载的时候就调用查询方法
  779. this.getDataList()
  780. // 获取用户的 site 和 bu
  781. // this.getSiteAndBuByUserName()
  782. },
  783. methods: {
  784. formatDate(date) {
  785. const year = date.getFullYear();
  786. const month = (date.getMonth() + 1).toString().padStart(2, '0');
  787. const day = date.getDate().toString().padStart(2, '0');
  788. // const hours = date.getHours().toString().padStart(2, '0');
  789. // const minutes = date.getMinutes().toString().padStart(2, '0');
  790. // const seconds = date.getSeconds().toString().padStart(2, '0');
  791. // return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
  792. return `${year}-${month}-${day}`;
  793. },
  794. // 查询获取数据列表
  795. getDataList () {
  796. this.searchData.limit = this.pageSize
  797. this.searchData.page = this.pageIndex
  798. findCurrency(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. })
  806. },
  807. // 每页数
  808. sizeChangeHandle (val) {
  809. this.pageSize = val
  810. this.pageIndex = 1
  811. this.getDataList()
  812. },
  813. // 当前页
  814. currentChangeHandle (val) {
  815. this.pageIndex = val
  816. this.getDataList()
  817. },
  818. //货币参考
  819. changeData (row) {
  820. this.currentRow = JSON.parse(JSON.stringify(row))
  821. this.headerData = row
  822. this.refreshCurrentTabTable()
  823. },
  824. refreshCurrentTabTable () {
  825. findRefCurrency(this.currentRow).then(({data}) => {
  826. //区分请求成功和失败的状况
  827. if (data && data.code === 0) {
  828. this.dataList1 = data.rows
  829. } else {
  830. this.dataList1 = []
  831. }
  832. })
  833. },
  834. //货币汇率
  835. changeData2 (row) {
  836. this.currentRow2 = JSON.parse(JSON.stringify(row))
  837. this.headerData2 = row
  838. this.refreshCurrentTabTable2()
  839. },
  840. refreshCurrentTabTable2 () {
  841. findExchangeCurrency(this.currentRow2).then(({data}) => {
  842. //区分请求成功和失败的状况
  843. if (data && data.code == 0) {
  844. this.dataList2 = data.rows
  845. } else {
  846. this.dataList2 = []
  847. }
  848. })
  849. },
  850. //货币
  851. // 新增按钮
  852. addModal () {
  853. this.handleQuerySite();
  854. this.modalData = {
  855. flag: '1',
  856. site: this.$store.state.user.site,
  857. id: '',
  858. currency: '',
  859. currencyDesc: '',
  860. active: 'Y',
  861. baseCurrencyFlag: '',
  862. createDate: '',
  863. createBy: '',
  864. updateDate: '',
  865. updateBy: '',
  866. }
  867. this.modalDisableFlag = false
  868. this.modalFlag = true
  869. },
  870. // 修改按钮
  871. updateModal (row) {
  872. this.modalData = {
  873. flag: '2',
  874. id: row.id,
  875. site: this.$store.state.user.site,
  876. currency: row.currency,
  877. currencyDesc: row.currencyDesc,
  878. active: row.active,
  879. baseCurrencyFlag: row.baseCurrencyFlag === 'Y',
  880. createDate: row.createDate,
  881. createBy: row.createBy,
  882. updateDate: row.updateDate,
  883. updateBy: row.updateBy,
  884. }
  885. this.modalDisableFlag = true
  886. this.modalFlag = true
  887. },
  888. saveData () {
  889. if (this.modalData.baseCurrencyFlag) {
  890. this.modalData.baseCurrencyFlag = 'Y'
  891. } else {
  892. this.modalData.baseCurrencyFlag = 'N'
  893. }
  894. if (this.modalData.flag === '1') { // 新增
  895. addCurrency(this.modalData).then(({data}) => {
  896. if (data && data.code === 0) {
  897. this.getDataList()
  898. this.modalFlag = false
  899. this.$message({
  900. message: '操作成功',
  901. type: 'success',
  902. duration: 1500,
  903. onClose: () => {
  904. }
  905. })
  906. } else {
  907. this.$alert(data.msg, '错误', {
  908. confirmButtonText: '确定'
  909. })
  910. }
  911. })
  912. } else { // 修改
  913. updateCurrency(this.modalData).then(({data}) => {
  914. if (data && data.code === 0) {
  915. this.getDataList()
  916. this.modalFlag = false
  917. this.$message({
  918. message: '操作成功',
  919. type: 'success',
  920. duration: 1500,
  921. onClose: () => {
  922. }
  923. })
  924. } else {
  925. this.$alert(data.msg, '错误', {
  926. confirmButtonText: '确定'
  927. })
  928. }
  929. })
  930. }
  931. },
  932. deleteModal (row) {
  933. this.$confirm(`是否删除此数据?`, '提示', {
  934. confirmButtonText: '确定',
  935. cancelButtonText: '取消',
  936. type: 'warning'
  937. }).then(() => {
  938. deleteCurrency(row).then(({data}) => {
  939. if (data && data.code === 0) {
  940. this.getDataList()
  941. this.$message({
  942. message: '操作成功',
  943. type: 'success',
  944. duration: 1500,
  945. onClose: () => {
  946. }
  947. })
  948. } else {
  949. this.$alert(data.msg, '错误', {
  950. confirmButtonText: '确定'
  951. })
  952. }
  953. })
  954. }).catch(() => {
  955. })
  956. },
  957. //货币参考
  958. // 新增按钮
  959. addModal1 () {
  960. if (!this.currentRow){
  961. this.$message.warning('请选择货币记录!')
  962. return
  963. }
  964. this.modalData1 = {
  965. flag1: '1',
  966. id: '',
  967. site: this.$store.state.user.site,
  968. currency: '',
  969. currencyDesc: '',
  970. refCurrency: '',
  971. createDate: '',
  972. currencyId: this.currentRow.id,
  973. }
  974. this.modalDisableFlag1 = false
  975. this.modalFlag1 = true
  976. },
  977. // 修改按钮
  978. updateModal1 (row) {
  979. this.modalData1 = {
  980. flag1: '2',
  981. id: row.id,
  982. site: this.$store.state.user.site,
  983. currency: row.currency,
  984. currencyDesc: row.currencyDesc,
  985. refCurrency: row.refCurrency,
  986. createDate: row.createDate,
  987. }
  988. this.modalDisableFlag1 = true
  989. this.modalFlag1 = true
  990. },
  991. // 删除方法
  992. deleteModal1 (row) {
  993. this.$confirm(`是否删除此数据?`, '提示', {
  994. confirmButtonText: '确定',
  995. cancelButtonText: '取消',
  996. type: 'warning'
  997. }).then(() => {
  998. deleteRefCurrency(row).then(({data}) => {
  999. if (data && data.code === 0) {
  1000. this.refreshCurrentTabTable ()
  1001. this.$message({
  1002. message: '操作成功',
  1003. type: 'success',
  1004. duration: 1500,
  1005. onClose: () => {
  1006. }
  1007. })
  1008. } else {
  1009. this.$alert(data.msg, '错误', {
  1010. confirmButtonText: '确定'
  1011. })
  1012. }
  1013. })
  1014. }).catch(() => {
  1015. })
  1016. },
  1017. // 新增/修改方法
  1018. saveData1 () {
  1019. if (this.modalData1.flag1 === '1') { // 新增
  1020. if (this.modalData1.currencyId == null || this.modalData1.currencyId === '') {
  1021. this.$message.warning('请选择一条货币数据!')
  1022. return
  1023. }
  1024. addRefCurrency(this.modalData1).then(({data}) => {
  1025. if (data && data.code === 0) {
  1026. this.getDataList()
  1027. this.refreshCurrentTabTable ()
  1028. this.modalFlag1 = false
  1029. this.$message({
  1030. message: '操作成功',
  1031. type: 'success',
  1032. duration: 1500,
  1033. onClose: () => {
  1034. }
  1035. })
  1036. } else {
  1037. this.$alert(data.msg, '错误', {
  1038. confirmButtonText: '确定'
  1039. })
  1040. }
  1041. })
  1042. } else { // 修改
  1043. updateRefCurrency(this.modalData1).then(({data}) => {
  1044. if (data && data.code === 0) {
  1045. this.getDataList()
  1046. this.refreshCurrentTabTable ()
  1047. this.modalFlag1 = false
  1048. this.$message({
  1049. message: '操作成功',
  1050. type: 'success',
  1051. duration: 1500,
  1052. onClose: () => {
  1053. }
  1054. })
  1055. } else {
  1056. this.$alert(data.msg, '错误', {
  1057. confirmButtonText: '确定'
  1058. })
  1059. }
  1060. })
  1061. }
  1062. },
  1063. //货币汇率
  1064. // 新增按钮
  1065. addModal2 () {
  1066. if (!this.currentRow2){
  1067. this.$message.warning('请选择参考货币记录!')
  1068. return
  1069. }
  1070. this.modalData2 = {
  1071. flag: '1',
  1072. id: '',
  1073. currency: this.currentRow2.currency,
  1074. activationDate: this.formatDate(new Date()),
  1075. exchangeRate: '',
  1076. createDate: '',
  1077. createBy: '',
  1078. updateDate: '',
  1079. updateBy: '',
  1080. currencyRateRefcurrencyId: this.currentRow2.id,
  1081. }
  1082. this.modalDisableFlag2 = false
  1083. this.modalFlag2 = true
  1084. },
  1085. // 修改按钮
  1086. updateModal2 (row) {
  1087. this.modalData2 = {
  1088. flag: '2',
  1089. id: row.id,
  1090. exchangeRate: row.exchangeRate,
  1091. activationDate: row.activationDate,
  1092. }
  1093. this.modalDisableFlag2 = true
  1094. this.modalFlag2 = true
  1095. },
  1096. saveData2 () {
  1097. if (this.modalData2.flag === '1') { // 新增
  1098. if (this.modalData2.currency==null || this.modalData2.currency==='') {
  1099. this.$message.warning('请选择一条货币参考数据!')
  1100. return
  1101. }
  1102. addExchangeCurrency(this.modalData2).then(({data}) => {
  1103. if (data && data.code === 0) {
  1104. this.getDataList()
  1105. this.refreshCurrentTabTable()
  1106. this.refreshCurrentTabTable2()
  1107. this.modalFlag2 = false
  1108. this.$message({
  1109. message: '操作成功',
  1110. type: 'success',
  1111. duration: 1500,
  1112. onClose: () => {
  1113. }
  1114. })
  1115. } else {
  1116. this.$alert(data.msg, '错误', {
  1117. confirmButtonText: '确定'
  1118. })
  1119. }
  1120. })
  1121. } else { // 修改
  1122. updateExchangeCurrency(this.modalData2).then(({data}) => {
  1123. if (data && data.code === 0) {
  1124. this.getDataList()
  1125. this.refreshCurrentTabTable2()
  1126. this.modalFlag2 = false
  1127. this.$message({
  1128. message: '操作成功',
  1129. type: 'success',
  1130. duration: 1500,
  1131. onClose: () => {
  1132. }
  1133. })
  1134. } else {
  1135. this.$alert(data.msg, '错误', {
  1136. confirmButtonText: '确定'
  1137. })
  1138. }
  1139. })
  1140. }
  1141. },
  1142. deleteModal2 (row) {
  1143. this.$confirm(`是否删除此数据?`, '提示', {
  1144. confirmButtonText: '确定',
  1145. cancelButtonText: '取消',
  1146. type: 'warning'
  1147. }).then(() => {
  1148. deleteExchangeCurrency(row).then(({data}) => {
  1149. if (data && data.code === 0) {
  1150. this.refreshCurrentTabTable2()
  1151. this.$message({
  1152. message: '操作成功',
  1153. type: 'success',
  1154. duration: 1500,
  1155. onClose: () => {
  1156. }
  1157. })
  1158. } else {
  1159. this.$alert(data.msg, '错误', {
  1160. confirmButtonText: '确定'
  1161. })
  1162. }
  1163. })
  1164. }).catch(() => {
  1165. })
  1166. },
  1167. // 查询检验类型
  1168. inspectionTypeSearch () {
  1169. let tempData = {
  1170. site: this.$store.state.user.site
  1171. }
  1172. inspectionTypeSearch(tempData).then(({data}) => {
  1173. if (data.code === 0) {
  1174. this.options = data.rows
  1175. }
  1176. })
  1177. },
  1178. // 校验用户是否收藏
  1179. favoriteIsOk () {
  1180. let userFavorite = {
  1181. userId: this.$store.state.user.id,
  1182. languageCode: this.$i18n.locale
  1183. }
  1184. userFavoriteList(userFavorite).then(({data}) => {
  1185. for (let i = 0; i < data.list.length; i++) {
  1186. if (this.$route.meta.menuId === data.list[i].menuId) {
  1187. this.favorite = true
  1188. }
  1189. }
  1190. })
  1191. },
  1192. // 收藏 OR 取消收藏
  1193. favoriteFunction () {
  1194. let userFavorite = {
  1195. userId: this.$store.state.user.id,
  1196. functionId: this.$route.meta.menuId,
  1197. }
  1198. if (this.favorite) {
  1199. removeUserFavorite(userFavorite).then(({data}) => {
  1200. this.$message.success(data.msg)
  1201. this.favorite = false
  1202. })
  1203. } else {
  1204. // 收藏
  1205. saveUserFavorite(userFavorite).then(({data}) => {
  1206. this.$message.success(data.msg)
  1207. this.favorite = true
  1208. })
  1209. }
  1210. },
  1211. //导出excel
  1212. async createExportData () {
  1213. this.searchData.limit = -1
  1214. this.searchData.page = 1
  1215. await findAll1(this.searchData).then(({data}) => {
  1216. this.exportList = data.rows
  1217. })
  1218. return this.exportList
  1219. },
  1220. startDownload () {
  1221. },
  1222. finishDownload () {
  1223. },
  1224. fields () {
  1225. let json = '{'
  1226. this.columnList.forEach((item, index) => {
  1227. if (index == this.columnList.length - 1) {
  1228. json += '"' + item.columnLabel + '"' + ':' + '"' + item.columnProp + '"'
  1229. } else {
  1230. json += '"' + item.columnLabel + '"' + ':' + '"' + item.columnProp + '"' + ','
  1231. }
  1232. })
  1233. json += '}'
  1234. let s = eval('(' + json + ')')
  1235. return s
  1236. },
  1237. // 动态列开始 获取 用户保存的 格式列
  1238. async getTableUserColumn (tableId, columnId) {
  1239. let queryTableUser = {
  1240. userId: this.$store.state.user.name,
  1241. functionId: this.$route.meta.menuId,
  1242. tableId: tableId,
  1243. status: true,
  1244. languageCode: this.$i18n.locale
  1245. }
  1246. await getTableUserListLanguage(queryTableUser).then(({data}) => {
  1247. if (data.rows.length > 0) {
  1248. //this.columnList1 = []
  1249. switch (columnId) {
  1250. case 1:
  1251. this.columnList = data.rows
  1252. break
  1253. // case 2:
  1254. // this.columnDetailList = data.rows
  1255. // break;
  1256. // case 3:
  1257. // this.columnList2 = data.rows
  1258. // break;
  1259. // case 4:
  1260. // this.columnList3 = data.rows
  1261. // break;
  1262. }
  1263. } else {
  1264. this.getColumnList(tableId, columnId)
  1265. }
  1266. })
  1267. },
  1268. // 获取 tableDefault 列
  1269. async getColumnList (tableId, columnId) {
  1270. let queryTable = {
  1271. functionId: this.$route.meta.menuId,
  1272. tableId: tableId,
  1273. languageCode: this.$i18n.locale
  1274. }
  1275. await getTableDefaultListLanguage(queryTable).then(({data}) => {
  1276. if (!data.rows.length == 0) {
  1277. switch (columnId) {
  1278. case 1:
  1279. this.columnList = data.rows
  1280. break
  1281. // case 2:
  1282. // this.columnDetailList = data.rows
  1283. // break;
  1284. // case 3:
  1285. // this.columnList2 = data.rows
  1286. // break;
  1287. // case 4:
  1288. // this.columnList3 = data.rows
  1289. // break;
  1290. }
  1291. } else {
  1292. // this.showDefault = true.
  1293. }
  1294. })
  1295. },
  1296. //获取按钮的权限数据
  1297. getButtonAuthData () {
  1298. let searchFlag = this.isAuth(this.menuId + ':search')
  1299. let saveFlag = this.isAuth(this.menuId + ':save')
  1300. let updateFlag = this.isAuth(this.menuId + ':update')
  1301. let deleteFlag = this.isAuth(this.menuId + ':delete')
  1302. //处理页面的权限数据
  1303. this.authSearch = !searchFlag
  1304. this.authSave = !saveFlag
  1305. this.authUpdate = !updateFlag
  1306. this.authDelete = !deleteFlag
  1307. },
  1308. handleQuerySite(){
  1309. let params = {
  1310. username: this.$store.state.user.name,
  1311. }
  1312. queryUserSite(params).then(({data})=>{
  1313. if (data && data.code === 0){
  1314. this.siteList = data.row2
  1315. }else {
  1316. this.$message.warning(data.msg)
  1317. }
  1318. }).catch((error)=>{
  1319. this.$message.error(error)
  1320. })
  1321. },
  1322. rowStyle({row}){
  1323. if (this.currentRow.site === row.site && this.currentRow.currency === row.currency) {
  1324. return { 'background-color': '#E8F7F6', cursor: 'pointer' };
  1325. }
  1326. },
  1327. rowStyle2({row}){
  1328. if (this.currentRow2.id === row.id) {
  1329. return { 'background-color': '#E8F7F6', cursor: 'pointer' };
  1330. }
  1331. },
  1332. handleBlurCurrency(){
  1333. let params = {
  1334. site: this.modalData1.site,
  1335. currency: this.modalData1.currency,
  1336. page: 1,
  1337. limit: this.searchData.limit,
  1338. }
  1339. findCurrency(params).then(({data}) => {
  1340. if ( data && data.code === 0) {
  1341. if (data.page.list.length === 1){
  1342. this.modalData1.currency = this.dataList[0].currency
  1343. this.modalData1.currencyDesc = this.dataList[0].currencyDesc
  1344. }else {
  1345. this.modalData1.currencyDesc = ''
  1346. }
  1347. }else {
  1348. this.$message.warning(data.msg)
  1349. }
  1350. }).catch((error)=>{
  1351. this.$message.error(error)
  1352. })
  1353. },
  1354. handleClickCurrency(){
  1355. this.currency.site = this.modalData1.site
  1356. this.currency.currency = this.modalData1.currency
  1357. this.queryCurrency();
  1358. this.currencyVisible = true
  1359. },
  1360. queryCurrency(){
  1361. let params = {
  1362. ...this.currency,
  1363. page: this.no,
  1364. limit: this.size,
  1365. }
  1366. findCurrency(params).then(({data}) => {
  1367. if ( data && data.code === 0) {
  1368. this.currencyList = data.page.list
  1369. this.total = data.page.totalCount
  1370. }else {
  1371. this.$message.warning(data.msg)
  1372. }
  1373. }).catch((error)=>{
  1374. this.$message.error(error)
  1375. })
  1376. },
  1377. handleSizeChange(val){
  1378. this.size = val
  1379. this.queryCurrency()
  1380. },
  1381. handleCurrentChange(val){
  1382. this.no = val
  1383. this.queryCurrency()
  1384. },
  1385. handleDblclick(row){
  1386. this.modalData1.currency = row.currency
  1387. this.modalData1.currencyDesc = row.currencyDesc
  1388. this.currencyVisible = false
  1389. }
  1390. }
  1391. }
  1392. </script>
  1393. <style scoped>
  1394. .numInput /deep/ .el-input__inner{
  1395. text-align: right;
  1396. }
  1397. /deep/ .inlineNumber input::-webkit-outer-spin-button,
  1398. /deep/ .inlineNumber input::-webkit-inner-spin-button {
  1399. -webkit-appearance: none;
  1400. }
  1401. /deep/ .inlineNumber input[type="number"]{
  1402. -moz-appearance: textfield;
  1403. padding-right: 5px !important;
  1404. }
  1405. </style>