BudgetCostList.vue 14 KB

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