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.

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