CarfareDetailList.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376
  1. <template>
  2. <a-card :bordered="false">
  3. <!-- 查询区域 -->
  4. <div class="table-page-search-wrapper">
  5. <a-form layout="inline" @keyup.enter.native="searchQuery">
  6. <a-row :gutter="24">
  7. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  8. <a-form-item label="报销日期">
  9. <j-date placeholder="请选择报销日期" v-model="queryParam.reimbursementDate" style="width: 100%;"></j-date>
  10. </a-form-item>
  11. </a-col>
  12. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  13. <a-form-item label="支付凭证编号">
  14. <j-input placeholder="请输入支付凭证编号" v-model="queryParam.paymentNo"></j-input>
  15. </a-form-item>
  16. </a-col>
  17. <template v-if="toggleSearchStatus">
  18. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  19. <a-form-item label="车牌号">
  20. <j-input placeholder="请输入车牌号" v-model="queryParam.carNo"></j-input>
  21. </a-form-item>
  22. </a-col>
  23. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  24. <a-form-item label="报销人">
  25. <j-input placeholder="请输入报销人" v-model="queryParam.submitter"></j-input>
  26. </a-form-item>
  27. </a-col>
  28. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  29. <a-form-item label="部门">
  30. <j-input placeholder="请输入部门" v-model="queryParam.dept"></j-input>
  31. </a-form-item>
  32. </a-col>
  33. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  34. <a-form-item label="登记人">
  35. <j-input placeholder="请输入登记人" v-model="queryParam.registrant"></j-input>
  36. </a-form-item>
  37. </a-col>
  38. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  39. <a-form-item label="登记部门">
  40. <j-input placeholder="请输入登记部门" v-model="queryParam.registrantDept"></j-input>
  41. </a-form-item>
  42. </a-col>
  43. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  44. <a-form-item label="财务经办人">
  45. <j-input placeholder="请输入财务经办人" v-model="queryParam.financeOperator"></j-input>
  46. </a-form-item>
  47. </a-col>
  48. </template>
  49. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  50. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  51. <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
  52. <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
  53. <a @click="handleToggleSearch" style="margin-left: 8px">
  54. {{ toggleSearchStatus ? '收起' : '展开' }}
  55. <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
  56. </a>
  57. </span>
  58. </a-col>
  59. </a-row>
  60. </a-form>
  61. </div>
  62. <!-- 查询区域-END -->
  63. <!-- 操作按钮区域 -->
  64. <div class="table-operator">
  65. <a-button @click="handleMultiAdd" type="primary" icon="plus">新增</a-button>
  66. <!-- <a-button type="primary" icon="download" @click="handleExportXls('车辆费用报销明细')">导出</a-button>
  67. <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
  68. <a-button type="primary" icon="import">导入</a-button>
  69. </a-upload> -->
  70. <a-dropdown v-if="selectedRowKeys.length > 0">
  71. <a-menu slot="overlay">
  72. <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
  73. </a-menu>
  74. <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
  75. </a-dropdown>
  76. </div>
  77. <!-- table区域-begin -->
  78. <div>
  79. <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
  80. <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
  81. <a style="margin-left: 24px" @click="onClearSelected">清空</a>
  82. </div>
  83. <a-table
  84. ref="table"
  85. size="middle"
  86. bordered
  87. rowKey="cdCarfareId"
  88. :columns="columns"
  89. :dataSource="dataSource"
  90. :pagination="ipagination"
  91. :loading="loading"
  92. :rowSelection="{fixed:true,selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
  93. @change="handleTableChange">
  94. <template slot="htmlSlot" slot-scope="text">
  95. <div v-html="text"></div>
  96. </template>
  97. <template slot="imgSlot" slot-scope="text">
  98. <span v-if="!text" style="font-size: 12px;font-style: italic;">无此图片</span>
  99. <img v-else :src="getImgView(text)" height="25px" alt="图片不存在" style="max-width:80px;font-size: 12px;font-style: italic;"/>
  100. </template>
  101. <template slot="fileSlot" slot-scope="text">
  102. <span v-if="!text" style="font-size: 12px;font-style: italic;">无此文件</span>
  103. <a-button
  104. v-else
  105. :ghost="true"
  106. type="primary"
  107. icon="download"
  108. size="small"
  109. @click="uploadFile(text)">
  110. 下载
  111. </a-button>
  112. </template>
  113. <span slot="action" slot-scope="text, record">
  114. <a @click="handleEdit(record)">编辑</a>
  115. <a-divider type="vertical" />
  116. <a-dropdown>
  117. <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
  118. <a-menu slot="overlay">
  119. <a-menu-item>
  120. <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
  121. <a>删除</a>
  122. </a-popconfirm>
  123. </a-menu-item>
  124. </a-menu>
  125. </a-dropdown>
  126. </span>
  127. </a-table>
  128. </div>
  129. <carfareDetail-modal ref="modalForm" @ok="modalFormOk"></carfareDetail-modal>
  130. <carfare-modal ref="multiAddModalForm" @ok="modalFormOk"></carfare-modal>
  131. </a-card>
  132. </template>
  133. <script>
  134. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  135. import CarfareDetailModal from './modules/CarfareDetailModal'
  136. import CarfareModal from './modules/CarfareModal'
  137. import JDate from '@/components/jeecg/JDate'
  138. import JInput from '@/components/jeecg/JInput'
  139. import { getAction } from '@api/manage'
  140. export default {
  141. name: "CarfareDetailList",
  142. mixins:[JeecgListMixin],
  143. components: {
  144. JDate,
  145. JInput,
  146. CarfareDetailModal,
  147. CarfareModal
  148. },
  149. data () {
  150. return {
  151. description: '车辆费用报销管理页面',
  152. // 表头
  153. columns: [
  154. {
  155. title: '#',
  156. dataIndex: '',
  157. key:'rowIndex',
  158. width:60,
  159. align:"center",
  160. // customRender: (value, row, index) => {
  161. // const obj = {
  162. // children: parseInt(index)+1,
  163. // attrs: {},
  164. // };
  165. // obj.attrs.rowSpan = this.myArray[index];
  166. // return obj
  167. // }
  168. customRender:function (t,r,index) {
  169. return parseInt(index)+1;
  170. }
  171. },
  172. {
  173. title:'登记人',
  174. align:"center",
  175. dataIndex: 'registrant',
  176. // customRender: (value, row, index) => {
  177. // const obj = {
  178. // children: value,
  179. // attrs: {},
  180. // };
  181. // obj.attrs.rowSpan = this.myArray[index];
  182. // return obj
  183. // }
  184. },
  185. {
  186. title:'登记部门',
  187. align:"center",
  188. dataIndex: 'registrantDept',
  189. // customRender: (value, row, index) => {
  190. // const obj = {
  191. // children: value,
  192. // attrs: {},
  193. // };
  194. // obj.attrs.rowSpan = this.myArray[index];
  195. // return obj
  196. // }
  197. },
  198. {
  199. title:'财务经办人',
  200. align:"center",
  201. dataIndex: 'financeOperator',
  202. // customRender: (value, row, index) => {
  203. // const obj = {
  204. // children: value,
  205. // attrs: {},
  206. // };
  207. // obj.attrs.rowSpan = this.myArray[index];
  208. // return obj
  209. // }
  210. },
  211. {
  212. title:'报销人',
  213. align:"center",
  214. dataIndex: 'submitter'
  215. },
  216. {
  217. title:'部门',
  218. align:"center",
  219. dataIndex: 'dept'
  220. },
  221. {
  222. title:'报销日期',
  223. align:"center",
  224. dataIndex: 'reimbursementDate'
  225. },
  226. {
  227. title:'金额',
  228. align:"center",
  229. dataIndex: 'amount'
  230. },
  231. {
  232. title:'支付凭证编号',
  233. align:"center",
  234. dataIndex: 'paymentNo'
  235. },
  236. {
  237. title:'车牌号',
  238. align:"center",
  239. dataIndex: 'carNo'
  240. },
  241. {
  242. title: '操作',
  243. dataIndex: 'action',
  244. align:"center",
  245. customRender: (value, row, index) => {
  246. const obj = {
  247. children:
  248. (
  249. <span>
  250. <a id="btn" onClick={() => this.handleEdit(row.cdCarfareId)}>编辑 </a>
  251. <a-divider type="vertical" />
  252. <a-popconfirm title="确定删除吗?" onConfirm={() => this.handleDelete(row.cdCarfareId)} placement="topRight">
  253. <a>删除</a>
  254. </a-popconfirm>
  255. </span> ),
  256. attrs: {},
  257. };
  258. obj.attrs.rowSpan = this.myArray[index];
  259. return obj
  260. }
  261. }
  262. ],
  263. url: {
  264. list: "/oa/carfareDetail/list",
  265. delete: "/oa/carfare/delete",
  266. deleteBatch: "/oa/carfare/deleteBatch",
  267. queryById: "/oa/carfare/queryById",
  268. },
  269. dictOptions:{},
  270. myArray:[],
  271. }
  272. },
  273. computed: {
  274. importExcelUrl: function(){
  275. return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
  276. }
  277. },
  278. methods: {
  279. initDictConfig(){
  280. },
  281. handleMultiAdd: function () {
  282. this.$refs.multiAddModalForm.add();
  283. this.$refs.multiAddModalForm.title = "新增";
  284. this.$refs.multiAddModalForm.disableSubmit = false;
  285. this.$refs.multiAddModalForm.initFinanceManager();
  286. },
  287. loadData(arg) {
  288. if(!this.url.list){
  289. this.$message.error("请设置url.list属性!")
  290. return
  291. }
  292. //加载数据 若传入参数1则加载第一页的内容
  293. if (arg === 1) {
  294. this.ipagination.current = 1;
  295. }
  296. var params = this.getQueryParams();//查询条件
  297. this.loading = true;
  298. getAction(this.url.list, params).then((res) => {
  299. if (res.success) {
  300. this.dataSource = res.result.records;
  301. this.setRowSpan(this.dataSource)
  302. this.ipagination.total = res.result.total;
  303. }
  304. if(res.code===510){
  305. this.$message.warning(res.message)
  306. }
  307. this.loading = false;
  308. })
  309. },
  310. // 设置每一行的rowSpan
  311. setRowSpan(data){
  312. //保存上一个name
  313. var x = "";
  314. //相同name出现的次数
  315. var count = 0;
  316. //该name第一次出现的位置
  317. var startindex=0;
  318. for(var i = 0;i<data.length;i++){
  319. console.log(data[i].cdCarfareId);
  320. //这里是合并name列,根据各自情况大家可以自己完善
  321. var val = data[(i)].cdCarfareId;
  322. if(i==0){
  323. x=val;
  324. count=1;
  325. this.myArray[0]=1
  326. }else{
  327. if(val==x){
  328. count++;
  329. this.myArray[startindex]=count;
  330. this.myArray[i]=0
  331. }else{
  332. count = 1;
  333. x=val;
  334. startindex=i;
  335. this.myArray[i]=1
  336. }
  337. }
  338. }
  339. console.log(this.myArray);
  340. },
  341. handleEdit: function (id) {
  342. getAction(this.url.queryById, {id:id}).then((res) => {
  343. if (res.success) {
  344. let record = res.result;
  345. this.$refs.multiAddModalForm.edit(record);
  346. this.$refs.multiAddModalForm.title = "编辑";
  347. this.$refs.multiAddModalForm.disableSubmit = false;
  348. }
  349. if(res.code===510){
  350. this.$message.warning(res.message)
  351. }
  352. this.loading = false;
  353. })
  354. },
  355. }
  356. }
  357. </script>
  358. <style scoped lang="less">
  359. @import '~@assets/less/common.less';
  360. /deep/ .table-page-search-wrapper .ant-form-inline .ant-form-item>.ant-form-item-label{
  361. width: 26% !important;
  362. }
  363. </style>