index.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786
  1. <template>
  2. <div>
  3. <el-row>
  4. <el-col :span="4">
  5. <div class="box">
  6. <el-scrollbar>
  7. <basic-container>
  8. <avue-tree :option="treeOption" :data="feesTypeData" @node-click="nodeClick">
  9. <template slot="addBtn">
  10. <el-tooltip class="item" effect="dark" content="新建分类" placement="top">
  11. <i class="el-icon-setting" style="font-size:18px;line-height: 30px;width: 20px;padding: 0 10px;"
  12. @click="corpTypeVisible = true"></i>
  13. </el-tooltip>
  14. </template>
  15. </avue-tree>
  16. </basic-container>
  17. </el-scrollbar>
  18. </div>
  19. </el-col>
  20. <el-col :span="20">
  21. <basic-container>
  22. <avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page" :permission="permissionList"
  23. id="out-table" :header-cell-class-name="headerClassName" :before-open="beforeOpen" :search.sync="search"
  24. v-model="form" ref="crud" @row-update="rowUpdate" @row-save="rowSave" @row-del="rowDel"
  25. @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange"
  26. @current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange"
  27. @resetColumn="resetColumnTwo('crud', 'option', 'optionBack', 302)"
  28. @saveColumn="saveColumnTwo('crud', 'option', 'optionBack', 302)" @on-load="onLoad">
  29. <template slot="menuLeft">
  30. <el-button type="danger" size="small" icon="el-icon-delete" plain @click="handleDelete">删 除
  31. </el-button>
  32. <el-button type="warning" size="small" icon="el-icon-printer" @click="excelBox = true">导入
  33. </el-button>
  34. <el-button type="success" size="small" @click="handleExport" icon="el-icon-printer">导出</el-button>
  35. </template>
  36. <template slot-scope="scope" slot="menu">
  37. <el-button v-if="scope.row.status == 1" type="text" icon="el-icon-turn-off" style="color: #85e967" size="small"
  38. @click.stop="statusfun(scope.row.id,0)">
  39. 启用
  40. </el-button>
  41. <el-button v-if="scope.row.status == 0" type="text" icon="el-icon-turn-off" style="color: #e83c3a" size="small"
  42. @click.stop="statusfun(scope.row.id,1)">
  43. 停用
  44. </el-button>
  45. </template>
  46. <template slot="unitNoForm">
  47. <search-query ref="SearchQuery" :disabled="searchDisabled" :selectValue="form.unitNo" :datalist="unitNoData" title="计量单位" :filterable="true" :clearable="true"
  48. :remote="true" :forParameter="{ key: 'id', label: 'cnName', value: 'cnName' }"
  49. @remoteMethod="getBunitsListfun" @corpChange="unitNoCorpChange">
  50. <bunits></bunits>
  51. </search-query>
  52. </template>
  53. <template slot="curNoForm">
  54. <search-query ref="SearchQuery" :disabled="searchDisabled" :selectValue="form.curNo" :datalist="curNoData" title="币别" :filterable="true" :clearable="true"
  55. :remote="true" :forParameter="{ key: 'id', label: 'cnName', value: 'cnName' }"
  56. @remoteMethod="getRateListfun" @corpChange="curNoCorpChange">
  57. <rateManagement></rateManagement>
  58. </search-query>
  59. </template>
  60. <template slot="feesTypeNameForm">
  61. <search-query ref="SearchQuery" :disabled="searchDisabled" :selectValue="form.feesTypeName" :datalist="feesTypeData" title="费用类别"
  62. :filterable="true" :clearable="true"
  63. :remote="true" :forParameter="{ key: 'id', label: 'cnName', value: 'cnName' }"
  64. @remoteMethod="bfeesdefineListfun" @corpChange="feesTypeCorpChange">
  65. <bfeesdetype></bfeesdetype>
  66. </search-query>
  67. </template>
  68. <template slot="code" slot-scope="scope">
  69. <avue-text-ellipsis :text="scope.row.code" :height="30" use-tooltip placement="top">
  70. <small slot="more">...</small>
  71. </avue-text-ellipsis>
  72. </template>
  73. <template slot="cnName" slot-scope="scope">
  74. <avue-text-ellipsis :text="scope.row.cnName" :height="30" use-tooltip placement="top">
  75. <small slot="more">...</small>
  76. </avue-text-ellipsis>
  77. </template>
  78. <template slot="enName" slot-scope="scope">
  79. <avue-text-ellipsis :text="scope.row.enName" :height="30" use-tooltip placement="top">
  80. <small slot="more">...</small>
  81. </avue-text-ellipsis>
  82. </template>
  83. <template slot="remarks" slot-scope="scope">
  84. <avue-text-ellipsis :text="scope.row.remarks" :height="30" use-tooltip placement="top">
  85. <small slot="more">...</small>
  86. </avue-text-ellipsis>
  87. </template>
  88. </avue-crud>
  89. </basic-container>
  90. </el-col>
  91. </el-row>
  92. <!--类别弹窗-->
  93. <el-dialog title="类别" :visible.sync="corpTypeVisible" append-to-body width="60%" :before-close="corpTypeClose">
  94. <div>
  95. <bfeesdetype></bfeesdetype>
  96. </div>
  97. <span slot="footer" class="dialog-footer">
  98. <el-button @click="corpTypeVisible = false">取 消</el-button>
  99. <el-button type="primary" @click="corpTypeVisible = false">确 定</el-button>
  100. </span>
  101. </el-dialog>
  102. <el-dialog title="导入往来单位" append-to-body :visible.sync="excelBox" width="555px" :close-on-click-modal="false"
  103. v-dialog-drag>
  104. <avue-form :option="excelOption" v-model="excelForm" :table-loading="excelLoading" :upload-before="uploadBefore"
  105. :upload-after="onSuccess">
  106. <template slot="excelTemplate">
  107. <el-button type="primary" @click="handleGet">
  108. 点击下载<i class="el-icon-download el-icon--right"></i>
  109. </el-button>
  110. </template>
  111. </avue-form>
  112. <p style="text-align: center;color: #DC0505">
  113. 温馨提示 第一次导入时请先下载模板
  114. </p>
  115. </el-dialog>
  116. </div>
  117. </template>
  118. <script>
  119. import { bfeesList, bfeesDetail, bfeesSubmit, bfeesRemove } from "@/api/iosBasicData/bfees";
  120. import { mapGetters } from "vuex";
  121. import { bfeesdefineList } from "@/api/iosBasicData/bfeesdefine";
  122. import { getBunitsList } from "@/api/iosBasicData/bunits";
  123. import { getRateList } from "@/api/iosBasicData/rateManagement";
  124. import SearchQuery from "@/components/iosbasic-data/searchquery.vue";
  125. import bunits from "@/views/iosBasicData/bunits/index.vue";
  126. import bfeesdetype from "@/views/iosBasicData/bfeesdefine/bfeesdetype.vue";
  127. import rateManagement from '@/views/iosBasicData/rateManagement/index.vue'
  128. import { getToken } from "@/util/auth";
  129. export default {
  130. components: { bunits, bfeesdetype, rateManagement, SearchQuery },
  131. data() {
  132. return {
  133. // 是否禁用
  134. searchDisabled:false,
  135. // 类别弹窗的开启
  136. corpTypeVisible: false,
  137. // 费用类别数据
  138. feesTypeData: [],
  139. // 计量单位数据
  140. unitNoData: [],
  141. // 币别数据
  142. curNoData: [],
  143. treeOption: {
  144. nodeKey: "id",
  145. // lazy: true,
  146. // treeLoad: function(node, resolve) {
  147. // const parentId = node.level === 0 ? 0 : node.data.id;
  148. // },
  149. addBtn: false,
  150. menu: false,
  151. size: "small",
  152. props: {
  153. labelText: "标题",
  154. label: "cnName",
  155. value: "value",
  156. children: "children"
  157. }
  158. },
  159. form: {},
  160. query: {},
  161. loading: true,
  162. excelBox: false,
  163. search: {},
  164. excelForm: {},
  165. excelLoading: false,
  166. excelOption: {
  167. submitBtn: false,
  168. emptyBtn: false,
  169. column: [
  170. {
  171. label: "模板下载",
  172. prop: "excelTemplate",
  173. formslot: true,
  174. span: 24
  175. },
  176. {
  177. label: "模板上传",
  178. prop: "excelFile",
  179. type: "upload",
  180. drag: true,
  181. loadText: "模板上传中,请稍等",
  182. span: 24,
  183. propsHttp: {
  184. res: "data"
  185. },
  186. tip: "请上传 .xls,.xlsx 标准格式文件",
  187. action: "/api/blade-los/bfees/importBFees"
  188. }
  189. ]
  190. },
  191. page: {
  192. pageSize: 10,
  193. currentPage: 1,
  194. total: 0,
  195. ageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
  196. },
  197. selectionList: [],
  198. option: {
  199. dialogDrag: true,
  200. },
  201. optionBack: {
  202. dialogDrag: true,
  203. addBtnText: '新建费用信息',
  204. addTitle: '新建费用信息',
  205. editBtnText: '编辑',
  206. editTitle: '编辑费用信息',
  207. viewBtnText: '查看',
  208. viewTitle: '查看费用信息',
  209. height: 'auto',
  210. calcHeight: 30,
  211. tip: false,
  212. searchShow: true,
  213. searchMenuSpan: 6,
  214. border: true,
  215. index: true,
  216. viewBtn: true,
  217. selection: true,
  218. dialogClickModal: false,
  219. menuWidth:260,
  220. column: [
  221. // {
  222. // label: "凭证",
  223. // prop: "code",
  224. // search: true,
  225. // rules: [{
  226. // required: true,
  227. // message: "请输入费用编码",
  228. // trigger: "blur"
  229. // }]
  230. // },
  231. {
  232. label: "编码",
  233. prop: "code",
  234. width: "180",
  235. search: true,
  236. rules: [{
  237. required: true,
  238. message: "请输入费用编码",
  239. trigger: "blur"
  240. }]
  241. },
  242. {
  243. label: "中文名称",
  244. prop: "cnName",
  245. width: "180",
  246. search: true,
  247. rules: [{
  248. required: true,
  249. message: "请输入中文名称",
  250. trigger: "blur"
  251. }]
  252. },
  253. {
  254. label: "英文名称",
  255. prop: "enName",
  256. width: "180",
  257. search: true,
  258. rules: [{
  259. required: true,
  260. message: "请输入英文名称",
  261. trigger: "blur"
  262. }]
  263. },
  264. {
  265. label: "费用类别",
  266. prop: "feesTypeName",
  267. formslot: true,
  268. // rules: [{
  269. // required: true,
  270. // message: "请选择费用类别",
  271. // trigger: "blur"
  272. // }]
  273. },
  274. {
  275. label: "计量单位",
  276. prop: "unitNo",
  277. formslot: true,
  278. // rules: [{
  279. // required: true,
  280. // message: "请输入计量单位",
  281. // trigger: "blur"
  282. // }]
  283. },
  284. {
  285. label: "币别",
  286. prop: "curNo",
  287. formslot: true,
  288. // rules: [{
  289. // required: true,
  290. // message: "请输入币别",
  291. // trigger: "blur"
  292. // }]
  293. },
  294. {
  295. label: "核算ID",
  296. prop: "accElementId",
  297. // rules: [{
  298. // required: true,
  299. // message: "请输入核算要素ID",
  300. // trigger: "blur"
  301. // }]
  302. },
  303. {
  304. label: "核算名称",
  305. prop: "accElementName",
  306. // rules: [{
  307. // required: true,
  308. // message: "请输入财务核算要素名称",
  309. // trigger: "blur"
  310. // }]
  311. },
  312. {
  313. label: "科目 Id",
  314. prop: "accId",
  315. // rules: [{
  316. // required: true,
  317. // message: "请输入科目 Id",
  318. // trigger: "blur"
  319. // }]
  320. },
  321. {
  322. label: "科目编号",
  323. prop: "accNo",
  324. // rules: [{
  325. // required: true,
  326. // message: "请输入科目编号",
  327. // trigger: "blur"
  328. // }]
  329. },
  330. {
  331. label: "科目全称",
  332. prop: "accFullName",
  333. // rules: [{
  334. // required: true,
  335. // message: "请输入科目全称",
  336. // trigger: "blur"
  337. // }]
  338. },
  339. {
  340. label: "版本",
  341. prop: "version",
  342. hide: true,
  343. display: false,
  344. },
  345. {
  346. label: "收付",
  347. prop: "dc",
  348. type: 'select',
  349. dicData: [{
  350. label: '收',
  351. value: 'D'
  352. }, {
  353. label: '付',
  354. value: 'C'
  355. }],
  356. },
  357. {
  358. label: "状态",
  359. prop: "status",
  360. type: 'select',
  361. dicData: [{
  362. label: '启用',
  363. value: 0
  364. }, {
  365. label: '停用',
  366. value: 1
  367. }],
  368. value: 0
  369. // rules: [{
  370. // required: true,
  371. // message: "请输入状态",
  372. // trigger: "blur"
  373. // }]
  374. },
  375. {
  376. label: "主键",
  377. prop: "id",
  378. hide: true,
  379. display: false,
  380. },
  381. {
  382. label: "创建人 Id",
  383. prop: "createUser",
  384. hide: true,
  385. display: false,
  386. },
  387. {
  388. label: "创建人",
  389. prop: "createUserName",
  390. display: false,
  391. },
  392. {
  393. label: "创建部门 Id",
  394. prop: "createDept",
  395. hide: true,
  396. display: false,
  397. },
  398. {
  399. label: "创建部门",
  400. prop: "createDeptName",
  401. display: false,
  402. },
  403. {
  404. label: "创建时间",
  405. prop: "createTime",
  406. width: 160,
  407. display: false,
  408. },
  409. {
  410. label: "修改人 Id",
  411. prop: "updateUser",
  412. hide: true,
  413. display: false,
  414. },
  415. {
  416. label: "修改人",
  417. prop: "updateUserName",
  418. display: false,
  419. },
  420. {
  421. label: "修改时间",
  422. prop: "updateTime",
  423. width: 160,
  424. display: false,
  425. },
  426. {
  427. label: "是否已删除(0 否 1是)",
  428. prop: "isDeleted",
  429. hide: true,
  430. display: false,
  431. },
  432. {
  433. label: "备注",
  434. prop: "remarks",
  435. span: 24,
  436. type: 'textarea',
  437. width: "180",
  438. slot: true,
  439. minRows: 3,
  440. },
  441. ]
  442. },
  443. data: []
  444. };
  445. },
  446. computed: {
  447. ...mapGetters(["permission"]),
  448. permissionList() {
  449. return {
  450. // addBtn: this.vaildData(this.permission.bfees_add, false),
  451. // viewBtn: this.vaildData(this.permission.bfees_view, false),
  452. // delBtn: this.vaildData(this.permission.bfees_delete, false),
  453. // editBtn: this.vaildData(this.permission.bfees_edit, false)
  454. };
  455. },
  456. ids() {
  457. let ids = [];
  458. this.selectionList.forEach(ele => {
  459. ids.push(ele.id);
  460. });
  461. return ids.join(",");
  462. }
  463. },
  464. async created() {
  465. this.option = await this.getColumnData(this.getColumnName(302), this.optionBack);
  466. this.bfeesdefineListfun()
  467. this.getBunitsListfun()
  468. this.getRateListfun()
  469. },
  470. methods: {
  471. // 禁用启用按钮
  472. statusfun(id,status){
  473. this.$confirm("确定将选择数据更改状态?", {
  474. confirmButtonText: "确定",
  475. cancelButtonText: "取消",
  476. type: "warning"
  477. }).then(()=>{
  478. bfeesDetail(id).then(res=>{
  479. let obj = res.data.data;
  480. obj.status = status
  481. bfeesSubmit(obj).then(()=>{
  482. this.onLoad(this.page);
  483. this.$message({
  484. type: "success",
  485. message: "操作成功!"
  486. });
  487. })
  488. })
  489. })
  490. },
  491. // 导出
  492. handleExport() {
  493. var condition = ''
  494. for (const key in this.search) {
  495. var value = this.search[key]
  496. if (value) {
  497. condition += `&${key}=${this.search[key]}`
  498. }
  499. }
  500. this.$confirm('是否导出费用信息?', '提示', {
  501. confirmButtonText: '确定',
  502. cancelButtonText: '取消',
  503. type: 'warning'
  504. }).then(() => {
  505. window.open(
  506. `/api/blade-los/bfees/exportBFees?${this.website.tokenHeader
  507. }=${getToken()}${condition}`
  508. );
  509. }).catch(() => {
  510. this.$message({
  511. type: 'info',
  512. message: '已取消' //
  513. });
  514. })
  515. },
  516. uploadBefore(file, done, loading) {
  517. done();
  518. loading = true;
  519. },
  520. // 上传成功
  521. onSuccess(res, done, loading, column) {
  522. this.excelBox = false;
  523. this.$message.success("导入成功!");
  524. loading = false;
  525. this.onLoad(this.page);
  526. done();
  527. },
  528. // 下载模板
  529. handleGet() {
  530. window.open(
  531. `/api/blade-los/bfees/exportBFees/template?${this.website.tokenHeader
  532. }=${getToken()}`
  533. );
  534. },
  535. // 获取费用类别数据
  536. bfeesdefineListfun() {
  537. bfeesdefineList(1, 10).then(res => {
  538. this.feesTypeData = res.data.data.records
  539. })
  540. },
  541. // 获取计算单位数据
  542. getBunitsListfun(cnName) {
  543. getBunitsList(1, 10, { cnName }).then(res => {
  544. this.unitNoData = res.data.data.records
  545. })
  546. },
  547. // 获取币别数据
  548. getRateListfun(cnName) {
  549. getRateList({
  550. current: 1,
  551. size: 10,
  552. cnName
  553. }).then(res => {
  554. this.curNoData = res.data.data.records
  555. })
  556. },
  557. // 费用信息选中回调
  558. feesTypeCorpChange(value) {
  559. this.feesTypeData.map(item => {
  560. if (item.cnName == value) {
  561. this.form.feesTypeId = item.id
  562. this.form.feesTypeName = item.cnName
  563. }
  564. })
  565. },
  566. // 计量单位选中的回调
  567. unitNoCorpChange(value) {
  568. this.form.unitNo = value
  569. },
  570. // 币别选中回调
  571. curNoCorpChange(value) {
  572. this.form.curNo = value
  573. },
  574. nodeClick(data) {
  575. console.log(data, 331)
  576. // this.feesTypeId = data.id;
  577. // this.page.currentPage = 1;
  578. // this.onLoad(this.page);
  579. },
  580. rowSave(row, done, loading) {
  581. row.accElementId = Number(row.accElementId)
  582. row.accId = Number(row.accId)
  583. bfeesSubmit(row).then(() => {
  584. this.onLoad(this.page);
  585. this.$message({
  586. type: "success",
  587. message: "操作成功!"
  588. });
  589. done();
  590. }, error => {
  591. loading();
  592. window.console.log(error);
  593. });
  594. },
  595. rowUpdate(row, index, done, loading) {
  596. row.accElementId = Number(row.accElementId)
  597. row.accId = Number(row.accId)
  598. bfeesSubmit(row).then(() => {
  599. this.onLoad(this.page);
  600. this.$message({
  601. type: "success",
  602. message: "操作成功!"
  603. });
  604. done();
  605. }, error => {
  606. loading();
  607. console.log(error);
  608. });
  609. },
  610. rowDel(row) {
  611. if (row.status === 1) {
  612. this.$confirm("确定将选择数据删除?", {
  613. confirmButtonText: "确定",
  614. cancelButtonText: "取消",
  615. type: "warning"
  616. })
  617. .then(() => {
  618. return bfeesRemove(row.id);
  619. })
  620. .then(() => {
  621. this.onLoad(this.page);
  622. this.$message({
  623. type: "success",
  624. message: "操作成功!"
  625. });
  626. });
  627. } else {
  628. this.$message({
  629. message: '非禁用状态无法删除',
  630. type: 'warning'
  631. });
  632. }
  633. },
  634. handleDelete() {
  635. if (this.selectionList.length === 0) {
  636. this.$message.warning("请选择至少一条数据");
  637. return;
  638. }
  639. for (const selection of this.selectionList) {
  640. if (selection.status == 0) {
  641. this.$message.warning("选中的数据中有启用数据,启用数据不可删除!");
  642. return;
  643. }
  644. }
  645. this.$confirm("确定将选择数据删除?", {
  646. confirmButtonText: "确定",
  647. cancelButtonText: "取消",
  648. type: "warning"
  649. })
  650. .then(() => {
  651. return bfeesRemove(this.ids);
  652. })
  653. .then(() => {
  654. this.onLoad(this.page);
  655. this.$message({
  656. type: "success",
  657. message: "操作成功!"
  658. });
  659. this.$refs.crud.toggleSelection();
  660. });
  661. },
  662. beforeOpen(done, type) {
  663. if (["edit", "add"].includes(type)) {
  664. this.searchDisabled = false
  665. } else {
  666. this.searchDisabled = true
  667. }
  668. if (["edit", "view"].includes(type)) {
  669. bfeesDetail(this.form.id).then(res => {
  670. this.form = res.data.data;
  671. });
  672. }
  673. done();
  674. },
  675. searchReset() {
  676. this.query = {};
  677. this.onLoad(this.page);
  678. },
  679. searchChange(params, done) {
  680. this.query = params;
  681. this.page.currentPage = 1;
  682. this.onLoad(this.page, params);
  683. done();
  684. },
  685. selectionChange(list) {
  686. this.selectionList = list;
  687. },
  688. selectionClear() {
  689. this.selectionList = [];
  690. this.$refs.crud.toggleSelection();
  691. },
  692. currentChange(currentPage) {
  693. this.page.currentPage = currentPage;
  694. },
  695. sizeChange(pageSize) {
  696. this.page.pageSize = pageSize;
  697. },
  698. refreshChange() {
  699. this.onLoad(this.page, this.query);
  700. },
  701. onLoad(page, params = {}) {
  702. this.loading = true;
  703. bfeesList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
  704. const data = res.data.data;
  705. this.page.total = data.total;
  706. this.data = data.records;
  707. this.loading = false;
  708. this.selectionClear();
  709. });
  710. },
  711. // 类别弹窗关闭
  712. corpTypeClose(done) {
  713. this.$confirm('确认关闭?')
  714. .then(_ => {
  715. done();
  716. })
  717. .catch(_ => { });
  718. },
  719. //自定义列保存
  720. async saveColumnTwo(ref, option, optionBack, code) {
  721. /**
  722. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  723. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  724. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  725. */
  726. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  727. if (inSave) {
  728. this.$message.success("保存成功");
  729. //关闭窗口
  730. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  731. }
  732. },
  733. //自定义列重置
  734. async resetColumnTwo(ref, option, optionBack, code) {
  735. this[option] = this[optionBack];
  736. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  737. if (inSave) {
  738. this.$message.success("重置成功");
  739. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  740. }
  741. },
  742. // 更改表格颜色
  743. headerClassName(tab) {
  744. //颜色间隔
  745. let back = ""
  746. if (tab.columnIndex >= 0 && tab.column.level === 1) {
  747. if (tab.columnIndex % 2 === 0) {
  748. back = "back-one"
  749. } else if (tab.columnIndex % 2 === 1) {
  750. back = "back-two"
  751. }
  752. }
  753. return back;
  754. },
  755. }
  756. };
  757. </script>
  758. <style scoped>
  759. ::v-deep#out-table .back-one {
  760. background: #ecf5ff !important;
  761. }
  762. ::v-deep#out-table .back-two {
  763. background: #ecf5ff !important;
  764. }
  765. ::v-deep .el-input-group__append {
  766. padding: 0 0px !important;
  767. }
  768. </style>