CertificateManagement.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340
  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 :md="6" :sm="12">
  8. <a-form-item label="证件名称">
  9. <!--<a-input placeholder="请输入账号查询" v-model="queryParam.username"></a-input>-->
  10. <a-input placeholder="输入证件名称查询" v-model="queryParam.name"></a-input>
  11. </a-form-item>
  12. </a-col>
  13. <a-col :md="6" :sm="12">
  14. <a-form-item label="证件编号">
  15. <a-input placeholder="输入证件编号查询" v-model="queryParam.code"></a-input>
  16. </a-form-item>
  17. </a-col>
  18. <a-col :md="6" :sm="12">
  19. <a-form-item label="创建人">
  20. <!--<a-input placeholder="请输入账号查询" v-model="queryParam.username"></a-input>-->
  21. <!-- <a-input placeholder="输入创建人" v-model="queryParam.createBy"></a-input> -->
  22. <j-search-select-tag v-model="queryParam.createBy" placeholder="请选择用户名称"
  23. dict="sys_user,realname,username" @search="searchName" />
  24. </a-form-item>
  25. </a-col>
  26. <!-- <a-col :md="6" :sm="12">
  27. <a-form-item label="起始日期">
  28. <a-date-picker
  29. style="width: 100%"
  30. placeholder="请选择购买日期"
  31. v-model="beDate"
  32. format="YYYY-MM-DD"
  33. @change="onDateChange"
  34. />
  35. </a-form-item>
  36. </a-col>
  37. <a-col :md="6" :sm="12">
  38. <a-form-item label="到期时间">
  39. <a-date-picker
  40. style="width: 100%"
  41. placeholder="请选择购买日期"
  42. v-model="enDate"
  43. format="YYYY-MM-DD"
  44. @change="onEndDateChange"
  45. />
  46. </a-form-item>
  47. </a-col> -->
  48. <template v-if="toggleSearchStatus">
  49. </template>
  50. <a-col :md="6" :sm="8">
  51. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  52. <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
  53. <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
  54. <a @click="handleToggleSearch" style="margin-left: 8px">
  55. {{ toggleSearchStatus ? '收起' : '展开' }}
  56. <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
  57. </a>
  58. </span>
  59. </a-col>
  60. </a-row>
  61. </a-form>
  62. </div>
  63. <!-- 操作按钮区域 -->
  64. <div class="table-operator" style="border-top: 5px">
  65. <a-button type="primary" icon="download" @click="handleExportXls('证件管理')">导出</a-button>
  66. <a-button @click="handleAdd" type="primary" icon="plus">添加</a-button>
  67. <a-popconfirm title="确定删除吗?" ok-text="是" cancel-text="否" @confirm="handleDelete()">
  68. <a-button type="primary" icon="plus">删除</a-button>
  69. </a-popconfirm>
  70. </div>
  71. <!-- table区域-begin -->
  72. <div>
  73. <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
  74. <i class="anticon anticon-info-circle ant-alert-icon"></i>已选择&nbsp;<a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项&nbsp;&nbsp;
  75. <a style="margin-left: 24px" @click="onClearSelected">清空</a>
  76. </div>
  77. <a-table
  78. ref="table"
  79. bordered
  80. size="middle"
  81. rowKey="id"
  82. :columns="columns"
  83. :dataSource="dataSource"
  84. :pagination="pagination"
  85. :loading="loading"
  86. :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
  87. @change="handleTableChange">
  88. <span slot="operation" slot-scope="text, record">
  89. <a @click="handleEdit(record)">编辑</a>
  90. </span>
  91. </a-table>
  92. </div>
  93. <!-- 新增框 -->
  94. <add-certificate-management ref='AddCertificateManagement' @close="close"></add-certificate-management>
  95. </a-card>
  96. </template>
  97. <script>
  98. import { downFile } from '@/api/manage'
  99. import {JeecgListMixin} from '@/mixins/JeecgListMixin'
  100. import JEllipsis from '@/components/jeecg/JEllipsis'
  101. import AddCertificateManagement from './modules/AddCertificateManagement'
  102. import JSearchSelectTag from '@/components/dict/JSearchSelectTag'
  103. import moment from 'moment'
  104. import {
  105. managementList,
  106. enterpriseEDelete,
  107. managementListId
  108. } from '@api/oa/cd-certificate-management'
  109. export default {
  110. name: "CertificateManagement",
  111. mixins: [JeecgListMixin],
  112. components: {
  113. AddCertificateManagement,
  114. moment,
  115. JEllipsis,
  116. JSearchSelectTag
  117. },
  118. data() {
  119. let ellipsis = (v, l = 10) => <j-ellipsis value={v} length={l} />
  120. return {
  121. queryParam:{ //查询条件
  122. beginDate:'',
  123. endDate:''
  124. },
  125. // 表头
  126. columns:[
  127. {
  128. title: '证件名称',
  129. align: "center",
  130. dataIndex: 'name',
  131. width: 120
  132. },
  133. {
  134. title: '证件所有人',
  135. align: "center",
  136. dataIndex: 'userId',
  137. width: 120
  138. },
  139. {
  140. title: '证件编号',
  141. align: "center",
  142. dataIndex: 'code',
  143. width: 120
  144. },
  145. {
  146. title: '起始日期',
  147. align: "center",
  148. dataIndex: 'beginDate',
  149. width: 120
  150. },
  151. {
  152. title: '到期时间',
  153. align: "center",
  154. dataIndex: 'endDate',
  155. width: 120
  156. },
  157. {
  158. title: '管理人',
  159. align: "center",
  160. dataIndex: 'manageId',
  161. width: 120
  162. },
  163. {
  164. title: '提前通知时间/月',
  165. align: "center",
  166. dataIndex: 'noticeMonth',
  167. width: 120
  168. },
  169. {
  170. title: '备注',
  171. align: "center",
  172. dataIndex: 'remarks',
  173. customRender: (t) => ellipsis(t),
  174. width: 120
  175. },
  176. {
  177. title: '操作',
  178. align: "center",
  179. dataIndex: 'operation',
  180. scopedSlots: { customRender: 'operation' },
  181. width: 120
  182. },
  183. ],
  184. // url: {
  185. // exportXlsUrl: "/oa/syCertificates/exportXls",
  186. // },
  187. dataSource:[],
  188. selectedRowKeys:[],
  189. beDate:'',
  190. enDate:'',
  191. pagination:{ }
  192. }
  193. },
  194. computed: {
  195. },
  196. created(){
  197. this.getData()
  198. },
  199. methods: {
  200. /* 导出 */
  201. handleExportXls(fileName){
  202. if(!fileName || typeof fileName != "string"){
  203. fileName = "导出文件"
  204. }
  205. let param = {...this.queryParam};
  206. if(this.selectedRowKeys && this.selectedRowKeys.length>0){
  207. param['selections'] = this.selectedRowKeys.join(",")
  208. }
  209. console.log("导出参数",param)
  210. downFile('/oa/syCertificates/exportXls',param).then((data)=>{
  211. if (!data) {
  212. this.$message.warning("文件下载失败")
  213. return
  214. }
  215. if (typeof window.navigator.msSaveBlob !== 'undefined') {
  216. window.navigator.msSaveBlob(new Blob([data],{type: 'application/vnd.ms-excel'}), fileName+'.xls')
  217. }else{
  218. let url = window.URL.createObjectURL(new Blob([data],{type: 'application/vnd.ms-excel'}))
  219. let link = document.createElement('a')
  220. link.style.display = 'none'
  221. link.href = url
  222. link.setAttribute('download', fileName+'.xls')
  223. document.body.appendChild(link)
  224. link.click()
  225. document.body.removeChild(link); //下载完成移除元素
  226. window.URL.revokeObjectURL(url); //释放掉blob对象
  227. }
  228. })
  229. },
  230. // 查询
  231. searchQuery(){
  232. this.getData()
  233. },
  234. //重置
  235. searchReset(){
  236. this.queryParam={}
  237. this.beDate = ''
  238. this.enDate = ''
  239. this.getData()
  240. },
  241. // 获取数据
  242. getData(){
  243. this.$nextTick(() => {
  244. managementList(this.queryParam).then(res => {
  245. // console.log('>>>>', this.queryParam)
  246. if (res.success) {
  247. this.dataSource =res.result.records
  248. this.pagination = {
  249. total: res.result.total,
  250. current: res.result.current,
  251. pageSize: res.result.size
  252. }
  253. }else{
  254. this.$message.error(res.message);
  255. }
  256. })
  257. })
  258. },
  259. // 删除
  260. handleDelete(){
  261. var id = this.selectedRowKeys.toString()
  262. enterpriseEDelete({ids:id}).then(res => {
  263. // console.log('>>>>', this.queryParam)
  264. if (res.success) {
  265. this.$message.success('删除成功');
  266. this.getData()
  267. }else{
  268. this.$message.error(res.message);
  269. }
  270. })
  271. },
  272. // 添加
  273. handleAdd(){
  274. this.$refs.AddCertificateManagement.visible = true
  275. },
  276. //编辑
  277. handleEdit(record){
  278. managementListId({id:record.id}).then(res => {
  279. // console.log('>>>>', this.queryParam)
  280. if (res.success) {
  281. this.$refs.AddCertificateManagement.visible = true
  282. this.$refs.AddCertificateManagement.defult = 'edit'
  283. res.result.beginDate =moment (res.result.beginDate)
  284. res.result.endDate = moment (res.result.endDate)
  285. this.$refs.AddCertificateManagement.formState = res.result
  286. if(!res.result.enclosure || res.result.enclosure==''){
  287. this.$refs.AddCertificateManagement.fileList = []
  288. }else{
  289. this.$refs.AddCertificateManagement.fileList.push(res.result.enclosure)
  290. }
  291. }else{
  292. this.$message.error(res.message);
  293. }
  294. })
  295. },
  296. //选中行
  297. onSelectChange(keys,rows){
  298. this.selectedRowKeys = keys;
  299. this.selectedRows = rows;
  300. },
  301. onDateChange(value){
  302. this.queryParam.beginDate =moment(value).format('YYYY-MM-DD');
  303. },
  304. onEndDateChange(value){
  305. this.queryParam.endDate =moment(value).format('YYYY-MM-DD');
  306. },
  307. // 分页变化时触发
  308. handleTableChange(pagination, filters, sorter) {
  309. this.queryParam.pageNo = pagination.current
  310. this.getData()
  311. },
  312. close(){
  313. this.getData()
  314. }
  315. }
  316. }
  317. </script>
  318. <style scoped>
  319. @import '~@assets/less/common.less'
  320. </style>