CarfareDetailList.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384
  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-divider type="vertical" />
  117. <a-dropdown>
  118. <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
  119. <a-menu slot="overlay">
  120. <a-menu-item>
  121. <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
  122. <a>删除</a>
  123. </a-popconfirm>
  124. </a-menu-item>
  125. </a-menu>
  126. </a-dropdown>
  127. </span>
  128. </a-table>
  129. </div>
  130. <carfareDetail-modal ref="modalForm" @ok="modalFormOk"></carfareDetail-modal>
  131. <carfare-modal ref="multiAddModalForm" @ok="modalFormOk"></carfare-modal>
  132. </a-card>
  133. </template>
  134. <script>
  135. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  136. import CarfareDetailModal from './modules/CarfareDetailModal'
  137. import CarfareModal from './modules/CarfareModal'
  138. import JDate from '@/components/jeecg/JDate'
  139. import JInput from '@/components/jeecg/JInput'
  140. import { getAction } from '@api/manage'
  141. export default {
  142. name: "CarfareDetailList",
  143. mixins:[JeecgListMixin],
  144. components: {
  145. JDate,
  146. JInput,
  147. CarfareDetailModal,
  148. CarfareModal
  149. },
  150. data () {
  151. return {
  152. description: '车辆费用报销管理页面',
  153. // 表头
  154. columns: [
  155. {
  156. title: '#',
  157. dataIndex: '',
  158. key:'rowIndex',
  159. width:60,
  160. align:"center",
  161. // customRender: (value, row, index) => {
  162. // const obj = {
  163. // children: parseInt(index)+1,
  164. // attrs: {},
  165. // };
  166. // obj.attrs.rowSpan = this.myArray[index];
  167. // return obj
  168. // }
  169. customRender:function (t,r,index) {
  170. return parseInt(index)+1;
  171. }
  172. },
  173. {
  174. title:'登记人',
  175. align:"center",
  176. dataIndex: 'registrant',
  177. // customRender: (value, row, index) => {
  178. // const obj = {
  179. // children: value,
  180. // attrs: {},
  181. // };
  182. // obj.attrs.rowSpan = this.myArray[index];
  183. // return obj
  184. // }
  185. },
  186. {
  187. title:'登记部门',
  188. align:"center",
  189. dataIndex: 'registrantDept',
  190. // customRender: (value, row, index) => {
  191. // const obj = {
  192. // children: value,
  193. // attrs: {},
  194. // };
  195. // obj.attrs.rowSpan = this.myArray[index];
  196. // return obj
  197. // }
  198. },
  199. {
  200. title:'财务经办人',
  201. align:"center",
  202. dataIndex: 'financeOperator',
  203. // customRender: (value, row, index) => {
  204. // const obj = {
  205. // children: value,
  206. // attrs: {},
  207. // };
  208. // obj.attrs.rowSpan = this.myArray[index];
  209. // return obj
  210. // }
  211. },
  212. {
  213. title:'报销人',
  214. align:"center",
  215. dataIndex: 'submitter'
  216. },
  217. {
  218. title:'部门',
  219. align:"center",
  220. dataIndex: 'dept'
  221. },
  222. {
  223. title:'报销日期',
  224. align:"center",
  225. dataIndex: 'reimbursementDate'
  226. },
  227. {
  228. title:'金额',
  229. align:"center",
  230. dataIndex: 'amount'
  231. },
  232. {
  233. title:'支付凭证编号',
  234. align:"center",
  235. dataIndex: 'paymentNo'
  236. },
  237. {
  238. title:'车牌号',
  239. align:"center",
  240. dataIndex: 'carNo'
  241. },
  242. {
  243. title: '操作',
  244. dataIndex: 'action',
  245. align:"center",
  246. customRender: (value, row, index) => {
  247. const obj = {
  248. children:
  249. (
  250. <span>
  251. <a id="btn" onClick={() => this.handleEdit(row.cdCarfareId)}>编辑 </a>
  252. <a-divider type="vertical" />
  253. <a onClick={()=>this.print(row)}>打印</a>
  254. <a-divider type="vertical" />
  255. <a-popconfirm title="确定删除吗?" onConfirm={() => this.handleDelete(row.cdCarfareId)} placement="topRight">
  256. <a>删除</a>
  257. </a-popconfirm>
  258. </span> ),
  259. attrs: {},
  260. };
  261. obj.attrs.rowSpan = this.myArray[index];
  262. return obj
  263. }
  264. }
  265. ],
  266. url: {
  267. list: "/oa/carfareDetail/list",
  268. delete: "/oa/carfare/delete",
  269. deleteBatch: "/oa/carfare/deleteBatch",
  270. queryById: "/oa/carfare/queryById",
  271. },
  272. dictOptions:{},
  273. myArray:[],
  274. }
  275. },
  276. computed: {
  277. importExcelUrl: function(){
  278. return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
  279. }
  280. },
  281. methods: {
  282. initDictConfig(){
  283. },
  284. print(record){
  285. var printMouldUrl = 'http://172.18.91.36:8081/jeecg-boot/jmreport/shareView/834582982537072640'+'?id='+record.cdCarfareId
  286. window.open(printMouldUrl)
  287. },
  288. handleMultiAdd: function () {
  289. this.$refs.multiAddModalForm.add();
  290. this.$refs.multiAddModalForm.title = "新增";
  291. this.$refs.multiAddModalForm.disableSubmit = false;
  292. this.$refs.multiAddModalForm.initFinanceManager();
  293. },
  294. loadData(arg) {
  295. if(!this.url.list){
  296. this.$message.error("请设置url.list属性!")
  297. return
  298. }
  299. //加载数据 若传入参数1则加载第一页的内容
  300. if (arg === 1) {
  301. this.ipagination.current = 1;
  302. }
  303. var params = this.getQueryParams();//查询条件
  304. this.loading = true;
  305. getAction(this.url.list, params).then((res) => {
  306. if (res.success) {
  307. this.dataSource = res.result.records;
  308. this.setRowSpan(this.dataSource)
  309. this.ipagination.total = res.result.total;
  310. }
  311. if(res.code===510){
  312. this.$message.warning(res.message)
  313. }
  314. this.loading = false;
  315. })
  316. },
  317. // 设置每一行的rowSpan
  318. setRowSpan(data){
  319. //保存上一个name
  320. var x = "";
  321. //相同name出现的次数
  322. var count = 0;
  323. //该name第一次出现的位置
  324. var startindex=0;
  325. for(var i = 0;i<data.length;i++){
  326. console.log(data[i].cdCarfareId);
  327. //这里是合并name列,根据各自情况大家可以自己完善
  328. var val = data[(i)].cdCarfareId;
  329. if(i==0){
  330. x=val;
  331. count=1;
  332. this.myArray[0]=1
  333. }else{
  334. if(val==x){
  335. count++;
  336. this.myArray[startindex]=count;
  337. this.myArray[i]=0
  338. }else{
  339. count = 1;
  340. x=val;
  341. startindex=i;
  342. this.myArray[i]=1
  343. }
  344. }
  345. }
  346. console.log(this.myArray);
  347. },
  348. handleEdit: function (id) {
  349. getAction(this.url.queryById, {id:id}).then((res) => {
  350. if (res.success) {
  351. let record = res.result;
  352. this.$refs.multiAddModalForm.edit(record);
  353. this.$refs.multiAddModalForm.title = "编辑";
  354. this.$refs.multiAddModalForm.disableSubmit = false;
  355. }
  356. if(res.code===510){
  357. this.$message.warning(res.message)
  358. }
  359. this.loading = false;
  360. })
  361. },
  362. }
  363. }
  364. </script>
  365. <style scoped lang="less">
  366. @import '~@assets/less/common.less';
  367. /deep/ .table-page-search-wrapper .ant-form-inline .ant-form-item>.ant-form-item-label{
  368. width: 26% !important;
  369. }
  370. </style>