index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388
  1. <template>
  2. <div>
  3. <basic-container v-show="isShow">
  4. <avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page" :search.sync="query"
  5. v-model="form" id="out-table" :header-cell-class-name="headerClassName" ref="crud" @row-del="rowDel"
  6. @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange"
  7. @current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange"
  8. @resetColumn="resetColumn('crud', 'option', 'optionBack', 530)"
  9. @saveColumn="saveColumn('crud', 'option', 'optionBack', 530)" @on-load="onLoad">
  10. <template slot="menuLeft">
  11. <el-button type="primary" size="small" icon="el-icon-plus" @click="addButton">创建单据
  12. </el-button>
  13. <el-button type="success" size="small" :disabled="selectionList.length != 1" @click="copyButton">复制单据
  14. </el-button>
  15. <el-button type="warning" size="small" disabled @click="outExport">导 出
  16. </el-button>
  17. <el-tabs v-model="query.status" type="card" @tab-click="handleClick">
  18. <el-tab-pane label="录入" name="0"></el-tab-pane>
  19. <el-tab-pane label="提交" name="1"></el-tab-pane>
  20. <el-tab-pane label="审核中" name="2"></el-tab-pane>
  21. <el-tab-pane label="审核通过" name="3"></el-tab-pane>
  22. <el-tab-pane label="驳回" name="4"></el-tab-pane>
  23. </el-tabs>
  24. </template>
  25. <template slot="menu" slot-scope="{ row, index }">
  26. <el-button size="small" icon="el-icon-edit" type="text" @click="rowEdit(row)">编辑</el-button>
  27. <el-button size="small" icon="el-icon-delete" type="text" @click="rowDel(row, index)"
  28. :disabled="!(row.status == 0||row.status == 4)">删 除</el-button>
  29. </template>
  30. <template slot="sysNo" slot-scope="{ row }">
  31. <span style="color: #1e9fff;cursor: pointer;" @click="rowEdit(row)">{{ row.sysNo }}</span>
  32. </template>
  33. <template slot="purchaseCompanyName" slot-scope="{ row }">
  34. <span style="color: #1e9fff;cursor: pointer;" @click="rowEdit(row)">{{ row.purchaseCompanyName }}</span>
  35. </template>
  36. <template slot="contractNo" slot-scope="{ row }">
  37. <span style="color: #1e9fff;cursor: pointer;" @click="rowEdit(row)">{{ row.contractNo }}</span>
  38. </template>
  39. </avue-crud>
  40. </basic-container>
  41. <detailsPage ref="detailsPage" v-if="!isShow" :detailData="detailData" @goBack="goBack"></detailsPage>
  42. </div>
  43. </template>
  44. <script>
  45. import { getList, remove } from "@/api/iosBasicData/reimbursement.js";
  46. import { getWorkDicts } from "@/api/system/dictbiz";
  47. import detailsPage from "./detailsPage";
  48. import { getToken } from "@/util/auth";
  49. import _ from "lodash";
  50. export default {
  51. data() {
  52. return {
  53. isShow: true,
  54. form: {},
  55. query: {
  56. type: "XGFY",
  57. status:'0',
  58. },
  59. loading: false,
  60. page: {
  61. pageSize: 10,
  62. currentPage: 1,
  63. total: 0
  64. },
  65. selectionList: [],
  66. option: {},
  67. optionBack: {
  68. height: 'auto',
  69. calcHeight: 30,
  70. menuWidth: 140,
  71. tip: false,
  72. searchShow: true,
  73. searchMenuSpan: 24,
  74. border: true,
  75. index: true,
  76. addBtn: false,
  77. viewBtn: false,
  78. editBtn: false,
  79. delBtn: false,
  80. selection: true,
  81. searchIcon: true,
  82. align: 'center',
  83. searchIndex: 3,
  84. column: [
  85. {
  86. label: "所属公司 ",
  87. prop: 'branchName',
  88. search: true,
  89. type: "select",
  90. filterable: true,
  91. dicUrl: "/api/blade-system/dept/lazy-list",
  92. props: {
  93. label: "deptName",
  94. value: "deptName",
  95. },
  96. overHidden: true,
  97. },
  98. {
  99. label: '申请人',
  100. prop: 'applicantName',
  101. search: true,
  102. type: 'select',
  103. filterable: true,
  104. remote: true,
  105. dicUrl: "/api/blade-user/page?current=1&size=5&realName={{key}}",
  106. props: {
  107. label: 'realName',
  108. value: 'realName',
  109. res: 'data.records'
  110. },
  111. overHidden: true,
  112. },
  113. {
  114. label: '申请日期',
  115. prop: 'applicantDate',
  116. search: true,
  117. searchProp: 'applicantDateList',
  118. overHidden: true,
  119. type: "date",
  120. searchRange: true,
  121. searchDefaultTime: ["00:00:00", "23:59:59"],
  122. format: "yyyy-MM-dd",
  123. valueFormat: "yyyy-MM-dd HH:mm:ss"
  124. },
  125. {
  126. label: '金额',
  127. prop: 'amount',
  128. overHidden: true,
  129. },
  130. {
  131. label: '打印时间',
  132. prop: 'printDate',
  133. overHidden: true,
  134. },
  135. {
  136. label: '打印次数',
  137. prop: 'printFrequency',
  138. overHidden: true,
  139. },
  140. {
  141. label: '开户行',
  142. prop: 'bankOfDeposit',
  143. overHidden: true,
  144. },
  145. {
  146. label: '银行户头',
  147. prop: 'bankAccount',
  148. overHidden: true,
  149. },
  150. {
  151. label: '账号',
  152. prop: 'account',
  153. overHidden: true,
  154. },
  155. {
  156. label: "制单人",
  157. prop: "createUserName",
  158. overHidden: true,
  159. width: 80,
  160. }, {
  161. label: "制单日期",
  162. prop: "createTime",
  163. type: "date",
  164. overHidden: true,
  165. width: 100,
  166. format: "yyyy-MM-dd",
  167. valueFormat: "yyyy-MM-dd HH:mm:ss"
  168. }, {
  169. label: "修改人",
  170. prop: "updateUserName",
  171. overHidden: true,
  172. width: 80,
  173. }, {
  174. label: "修改日期",
  175. prop: "updateTime",
  176. type: "date",
  177. overHidden: true,
  178. width: 100,
  179. format: "yyyy-MM-dd",
  180. valueFormat: "yyyy-MM-dd HH:mm:ss"
  181. },
  182. {
  183. label: '备注',
  184. prop: 'remarks',
  185. overHidden: true,
  186. search:true,
  187. }
  188. ]
  189. },
  190. data: [],
  191. };
  192. },
  193. components: {
  194. detailsPage
  195. },
  196. async created() {
  197. this.option = await this.getColumnData(this.getColumnName(530), this.optionBack);
  198. },
  199. activated() {
  200. setTimeout(() => {
  201. if (this.$route.query.home) {
  202. this.addButton();
  203. }
  204. }, 100);
  205. },
  206. methods: {
  207. addButton() {
  208. this.isShow = false
  209. this.detailData = {
  210. type: 'new'
  211. };
  212. },
  213. copyButton() {
  214. this.isShow = false
  215. this.detailData = {
  216. copyId: this.selectionList[0].id
  217. };
  218. },
  219. rowEdit(row) {
  220. this.detailData = {
  221. id: row.id
  222. };
  223. this.isShow = false
  224. },
  225. // 删除
  226. rowDel(row, index) {
  227. if (row.item == 1) {
  228. return this.$message.error("存在明细不允许删除");
  229. }
  230. this.$confirm("确定将选择数据删除?", {
  231. confirmButtonText: "确定",
  232. cancelButtonText: "取消",
  233. type: "warning"
  234. }).then(() => {
  235. remove({ ids: row.id }).then(res => {
  236. this.onLoad(this.page, this.query);
  237. this.$message.success("成功删除");
  238. })
  239. })
  240. },
  241. searchReset() {
  242. this.query = this.$options.data().query;
  243. this.onLoad(this.page);
  244. },
  245. // 搜索按钮点击
  246. searchChange(params, done) {
  247. this.page.currentPage = 1;
  248. this.onLoad(this.page, this.query);
  249. done();
  250. },
  251. selectionChange(list) {
  252. this.selectionList = list;
  253. },
  254. currentChange(currentPage) {
  255. this.page.currentPage = currentPage;
  256. },
  257. sizeChange(pageSize) {
  258. this.page.pageSize = pageSize;
  259. },
  260. refreshChange() {
  261. this.onLoad(this.page, this.query);
  262. },
  263. handleClick(){
  264. this.refreshChange()
  265. },
  266. onLoad(page, params = {}) {
  267. let obj = {}
  268. obj = {
  269. ...Object.assign(params, this.query),
  270. }
  271. this.loading = true;
  272. getList(page.currentPage, page.pageSize, obj).then(res => {
  273. this.data = res.data.data.records;
  274. this.page.total = res.data.data.total;
  275. this.$nextTick(() => {
  276. this.$refs.crud.doLayout();
  277. this.$refs.crud.dicInit();
  278. });
  279. }).finally(() => {
  280. this.loading = false;
  281. })
  282. },
  283. // 详情的返回列表
  284. goBack() {
  285. // 初始化数据
  286. if (JSON.stringify(this.$route.query) != "{}") {
  287. this.$router.$avueRouter.closeTag();
  288. this.$router.push({
  289. path: "/boxManagement/boxCost/index"
  290. });
  291. }
  292. this.detailData = {}
  293. this.isShow = true;
  294. this.onLoad(this.page, this.query);
  295. },
  296. outExport() {
  297. let config = { params: { ...this.query } }
  298. if (config.params) {
  299. for (const propName of Object.keys(config.params)) {
  300. const value = config.params[propName];
  301. if (value !== null && typeof (value) !== "undefined") {
  302. if (value instanceof Array) {
  303. for (const key of Object.keys(value)) {
  304. let params = propName + '[' + key + ']';
  305. config.params[params] = value[key]
  306. }
  307. delete config.params[propName]
  308. }
  309. }
  310. }
  311. }
  312. const routeData = this.$router.resolve({
  313. path: '/api/blade-los/routecost/exportRouteCost', //跳转目标窗口的地址
  314. query: {
  315. ...config.params, //括号内是要传递给新窗口的参数
  316. identification: this.url
  317. }
  318. })
  319. window.open(routeData.href.slice(1, routeData.href.length) + '&' + `${this.website.tokenHeader}=${getToken()}`);
  320. },
  321. //自定义列保存
  322. async saveColumn(ref, option, optionBack, code) {
  323. /**
  324. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  325. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  326. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  327. */
  328. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  329. if (inSave) {
  330. this.$message.success("保存成功");
  331. //关闭窗口
  332. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  333. this.selectionList = []
  334. this.searchReset()
  335. }
  336. },
  337. //自定义列重置
  338. async resetColumn(ref, option, optionBack, code) {
  339. this[option] = this[optionBack];
  340. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  341. if (inSave) {
  342. this.$message.success("重置成功");
  343. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  344. this.selectionList = []
  345. this.searchReset()
  346. }
  347. },
  348. // 更改表格颜色
  349. headerClassName(tab) {
  350. //颜色间隔
  351. let back = ""
  352. if (tab.columnIndex >= 0 && tab.column.level === 1) {
  353. if (tab.columnIndex % 2 === 0) {
  354. back = "back-one"
  355. } else if (tab.columnIndex % 2 === 1) {
  356. back = "back-two"
  357. }
  358. }
  359. return back;
  360. },
  361. }
  362. }
  363. </script>
  364. <style lang="scss" scoped>
  365. ::v-deep #out-table .back-one {
  366. background: #ecf5ff !important;
  367. text-align: center;
  368. }
  369. ::v-deep #out-table .back-two {
  370. background: #ecf5ff !important;
  371. text-align: center;
  372. }
  373. .pointerClick {
  374. cursor: pointer;
  375. color: #1e9fff;
  376. }
  377. ::v-deep .el-col-md-8 {
  378. width: 24.33333%;
  379. }
  380. </style>