GwCirculationCard2List.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436
  1. <template>
  2. <div class="page">
  3. <el-form
  4. :inline="true"
  5. v-if="searchVisible"
  6. class="query-form m-b-10"
  7. ref="searchForm"
  8. :model="searchForm"
  9. @keyup.enter="refreshList()"
  10. @submit.prevent
  11. >
  12. <!-- 搜索框-->
  13. <!-- <el-form-item prop="yearNum" label="年度:">
  14. <el-input v-model="searchForm.yearNum" placeholder="请输入年度" clearable></el-input>
  15. </el-form-item>
  16. <el-form-item prop="cardNum" label="卡号:">
  17. <el-input v-model="searchForm.cardNum" placeholder="请输入卡号" clearable></el-input>
  18. </el-form-item> -->
  19. <el-form-item prop="sendingAgency" label="来文机关:">
  20. <el-input v-model="searchForm.sendingAgency" placeholder="请输入来文机关" clearable></el-input>
  21. </el-form-item>
  22. <!-- <el-form-item prop="docFontSize" label="来文字号:">
  23. <el-input v-model="searchForm.docFontSize" placeholder="请输入来文字号" clearable></el-input>
  24. </el-form-item>
  25. <el-form-item prop="fileSource" label="文件来源:">
  26. <el-input v-model="searchForm.fileSource" placeholder="请输入文件来源" clearable></el-input>
  27. </el-form-item> -->
  28. <el-form-item prop="writtenTime" label="成文时间:">
  29. <el-date-picker
  30. v-model="searchForm.writtenTime"
  31. type="datetime"
  32. value-format="YYYY-MM-DD HH:mm:ss"
  33. placeholder="请选择成文时间">
  34. </el-date-picker>
  35. </el-form-item>
  36. <el-form-item prop="receivingTime" label="收文时间:">
  37. <el-date-picker
  38. v-model="searchForm.receivingTime"
  39. type="datetime"
  40. value-format="YYYY-MM-DD HH:mm:ss"
  41. placeholder="请选择收文时间">
  42. </el-date-picker>
  43. </el-form-item>
  44. <el-form-item prop="contentSummary" label="内容摘要:">
  45. <el-input v-model="searchForm.contentSummary" placeholder="请输入内容摘要" clearable></el-input>
  46. </el-form-item>
  47. <el-form-item prop="state" label="状态:">
  48. <el-select v-model="searchForm.state" placeholder="请选择状态">
  49. <el-option
  50. v-for="item in $dictUtils.getDictList('gw_state')"
  51. :key="item.value"
  52. :label="item.label"
  53. :value="item.value">
  54. </el-option>
  55. </el-select>
  56. </el-form-item>
  57. <el-form-item>
  58. <el-button type="primary" @click="refreshList()" icon="search">查询</el-button>
  59. <el-button type="default" @click="resetSearch()" icon="refresh-right">重置</el-button>
  60. </el-form-item>
  61. </el-form>
  62. <div class="jp-table" style="height: calc(100% - 120px);">
  63. <vxe-toolbar ref="gwCirculationCard2Toolbar" :refresh="{query: refreshList}" import export print custom>
  64. <template #buttons>
  65. <el-button v-if="hasPermission('circulation2:gwCirculationCard2:add')" type="primary" icon="plus" @click="add()">新建</el-button>
  66. <el-button v-if="hasPermission('circulation2:gwCirculationCard2:edit')" type="warning" icon="edit-filled" @click="edit()" v-show="$refs.gwCirculationCard2Table && $refs.gwCirculationCard2Table.getCheckboxRecords().length === 1" plain>修改</el-button>
  67. <el-button v-if="hasPermission('circulation2:gwCirculationCard2:del')" type="danger" icon="del-filled" @click="del()" v-show="$refs.gwCirculationCard2Table && $refs.gwCirculationCard2Table.getCheckboxRecords().length > 0" plain>删除</el-button>
  68. </template>
  69. <template #tools>
  70. <vxe-button
  71. type="text"
  72. :title="
  73. searchVisible ? '收起检索' : '展开检索'
  74. "
  75. icon="vxe-icon-search"
  76. class="tool-btn"
  77. @click="searchVisible = !searchVisible"
  78. ></vxe-button>
  79. <vxe-button
  80. type="text"
  81. title="下载导入模板"
  82. v-if="hasPermission('circulation2:gwCirculationCard2:import')"
  83. icon="iconfont icon-xiazaimoban1"
  84. class="tool-btn m-l-0"
  85. @click="downloadTpl()"
  86. >
  87. </vxe-button>
  88. </template>
  89. </vxe-toolbar>
  90. <div class="jp-table-body">
  91. <vxe-table
  92. border="inner"
  93. auto-resize
  94. resizable
  95. height="auto"
  96. :loading="loading"
  97. size="small"
  98. ref="gwCirculationCard2Table"
  99. show-header-overflow
  100. show-overflow
  101. highlight-hover-row
  102. :menu-config="{}"
  103. :print-config="{}"
  104. :import-config="{
  105. importMethod: importMethod,
  106. types: ['csv', 'xls', 'xlsx'],
  107. remote: true,
  108. }"
  109. :export-config="{
  110. remote: true,
  111. filename: `公文流转数据${moment(new Date()).format(
  112. 'YYYY-MM-DD'
  113. )}`,
  114. sheetName: '公文流转数据',
  115. exportMethod: exportMethod,
  116. types: ['xlsx'],
  117. modes: ['current', 'selected', 'all'],
  118. }"
  119. @sort-change="sortChangeHandle"
  120. :sort-config="{remote:true}"
  121. :data="dataList"
  122. :checkbox-config="{}">
  123. <vxe-column type="seq" width="40"></vxe-column>
  124. <vxe-column type="checkbox" width="40px"></vxe-column>
  125. <vxe-column
  126. field="yearNum"
  127. sortable
  128. title="年度">
  129. <template #default="{ row }">
  130. <el-link type="primary" :underline="false" v-if="hasPermission('circulation2:gwCirculationCard2:edit')" @click="edit(row.id)">{{row.yearNum}}</el-link>
  131. <el-link type="primary" :underline="false" v-else-if="hasPermission('circulation2:gwCirculationCard2:view')" @click="view(row.id)">{{row.yearNum}}</el-link>
  132. <span v-else>{{row.yearNum}}</span>
  133. </template>
  134. </vxe-column>
  135. <vxe-column
  136. field="cardNum"
  137. sortable
  138. title="卡号">
  139. </vxe-column>
  140. <vxe-column
  141. field="sendingAgency"
  142. sortable
  143. title="来文机关">
  144. </vxe-column>
  145. <vxe-column
  146. field="docFontSize"
  147. sortable
  148. title="来文字号">
  149. </vxe-column>
  150. <vxe-column
  151. field="fileSource"
  152. sortable
  153. title="文件来源">
  154. </vxe-column>
  155. <vxe-column
  156. field="writtenTime"
  157. sortable
  158. title="成文时间">
  159. </vxe-column>
  160. <vxe-column
  161. field="receivingTime"
  162. sortable
  163. title="收文时间">
  164. </vxe-column>
  165. <vxe-column
  166. field="contentSummary"
  167. sortable
  168. title="内容摘要">
  169. </vxe-column>
  170. <vxe-column
  171. field="attachedDocumentId"
  172. sortable
  173. title="来文附件">
  174. <template #default="{ row }">
  175. <template v-if="row.attachedDocumentId">
  176. <el-image
  177. style="height: 50px;width:50px;margin-right:10px;"
  178. :src="src" v-for="(src, index) in row.attachedDocumentId.split(',')" :key="index"
  179. :preview-src-list="row.attachedDocumentId.split(',')">
  180. </el-image>
  181. </template>
  182. </template>
  183. </vxe-column>
  184. <vxe-column
  185. field="state"
  186. sortable
  187. title="状态">
  188. <template #default="{ row }">
  189. {{ $dictUtils.getDictLabel("gw_state", row.state, '-') }}
  190. </template>
  191. </vxe-column>
  192. <vxe-column
  193. fixed="right"
  194. align="center"
  195. width="200"
  196. title="操作">
  197. <template #default="{ row }">
  198. <el-button v-if="hasPermission('circulation2:gwCirculationCard2:view')" type="primary" text icon="view-filled" @click="view(row.id)">查看</el-button>
  199. <el-button v-if="daiban" type="primary" text icon="view-filled" @click="view2(row.id)">阅办</el-button>
  200. <!-- <el-button v-if="hasPermission('circulation2:gwCirculationCard2:edit')" type="primary" text icon="edit-filled" @click="edit(row.id)">修改</el-button> -->
  201. <el-button v-if="hasPermission('circulation2:gwCirculationCard2:del')" type="danger" text icon="del-filled" @click="del(row.id)">删除</el-button>
  202. </template>
  203. </vxe-column>
  204. </vxe-table>
  205. <vxe-pager
  206. background
  207. size="small"
  208. :current-page="tablePage.currentPage"
  209. :page-size="tablePage.pageSize"
  210. :total="tablePage.total"
  211. :page-sizes="[10, 20, 100, 1000, {label: '全量数据', value: 1000000}]"
  212. :layouts="['PrevPage', 'JumpNumber', 'NextPage', 'FullJump', 'Sizes', 'Total']"
  213. @page-change="currentChangeHandle">
  214. </vxe-pager>
  215. </div>
  216. </div>
  217. <!-- 弹窗, 新增 / 修改 -->
  218. <GwCirculationCard2Form ref="gwCirculationCard2Form" @refreshDataList="refreshList"></GwCirculationCard2Form>
  219. <GwCirculationCard2Form2 ref="gwCirculationCard2Form2" @refreshDataList="refreshList"></GwCirculationCard2Form2>
  220. <GwCirculationCard2FormYb ref="GwCirculationCard2FormYb" @refreshDataList="refreshList"></GwCirculationCard2FormYb>
  221. <!-- <fileInfo ref="fileInfo" @refreshDataList="refreshList"></fileInfo> -->
  222. </div>
  223. </template>
  224. <script>
  225. import GwCirculationCard2Form from './GwCirculationCard2Form'
  226. import GwCirculationCard2Form2 from './GwCirculationCard2Form2'
  227. import GwCirculationCard2FormYb from './GwCirculationCard2FormYb'
  228. //import fileInfo from './fileInfo'
  229. import gwCirculationCard2Service from '@/api/circulation2/gwCirculationCard2Service'
  230. export default {
  231. data () {
  232. return {
  233. searchVisible: true,
  234. daiban:false,
  235. searchForm: {
  236. yearNum: '',
  237. cardNum: '',
  238. sendingAgency: '',
  239. docFontSize: '',
  240. fileSource: '',
  241. writtenTime: '',
  242. receivingTime: '',
  243. contentSummary: '',
  244. state: '1'
  245. },
  246. dataList: [],
  247. tablePage: {
  248. total: 0,
  249. currentPage: 1,
  250. pageSize: 10,
  251. orders: [{ column: "a.create_time", asc: false }],
  252. },
  253. loading: false
  254. }
  255. },
  256. components: {
  257. GwCirculationCard2Form,
  258. GwCirculationCard2Form2,
  259. GwCirculationCard2FormYb
  260. },
  261. created () {
  262. },
  263. mounted () {
  264. this.$nextTick(() => {
  265. // 将表格和工具栏进行关联
  266. const $table = this.$refs.gwCirculationCard2Table
  267. const $toolbar = this.$refs.gwCirculationCard2Toolbar
  268. $table.connect($toolbar)
  269. })
  270. },
  271. activated () {
  272. this.refreshList()
  273. },
  274. methods: {
  275. // 获取数据列表
  276. refreshList () {
  277. this.loading = true
  278. gwCirculationCard2Service.list({
  279. 'current': this.tablePage.currentPage,
  280. 'size': this.tablePage.pageSize,
  281. 'orders': this.tablePage.orders,
  282. ...this.searchForm
  283. }).then((data) => {
  284. this.dataList = data.records
  285. this.tablePage.total = data.total
  286. this.loading = false
  287. //选择待办的时候
  288. if(this.searchForm.state=='1'){
  289. this.daiban=true;
  290. }else{
  291. this.daiban=false;
  292. }
  293. })
  294. },
  295. // 当前页
  296. currentChangeHandle ({ currentPage, pageSize }) {
  297. this.tablePage.currentPage = currentPage
  298. this.tablePage.pageSize = pageSize
  299. this.refreshList()
  300. },
  301. // 排序
  302. sortChangeHandle(obj) {
  303. this.tablePage.orders = [];
  304. if (obj.order != null) {
  305. this.tablePage.orders = [{ column: obj.column.sortBy || this.$utils.toLine(obj.property), asc: obj.order === "asc" }];
  306. } else {
  307. this.tablePage.orders = [{ column: "create_time", asc: false }];
  308. }
  309. this.refreshList();
  310. },
  311. // 新增
  312. add () {
  313. this.$refs.gwCirculationCard2Form.init('add', '')
  314. },
  315. // 修改
  316. edit (id) {
  317. id = id || this.$refs.gwCirculationCard2Table.getCheckboxRecords().map(item => {
  318. return item.id
  319. })[0]
  320. this.$refs.gwCirculationCard2Form.init('edit', id)
  321. },
  322. // 查看
  323. view (id) {
  324. //this.$refs.gwCirculationCard2Form.init('view', id)
  325. // this.$refs.fileInfo.init('view', id)
  326. //this.$refs.gwCirculationCard2Form2.init('view', id)
  327. this.$refs.GwCirculationCard2FormYb.init('view', id)
  328. },
  329. // 查看
  330. view2 (id) {
  331. this.$refs.GwCirculationCard2FormYb.init('edit', id)
  332. },
  333. // 删除
  334. del (id) {
  335. let ids = id || this.$refs.gwCirculationCard2Table.getCheckboxRecords().map(item => {
  336. return item.id
  337. }).join(',')
  338. this.$confirm(`确定删除所选项吗?`, '提示', {
  339. confirmButtonText: '确定',
  340. cancelButtonText: '取消',
  341. type: 'warning'
  342. }).then(() => {
  343. this.loading = true
  344. gwCirculationCard2Service.delete(ids).then((data) => {
  345. this.$message.success(data)
  346. this.refreshList()
  347. this.loading = false
  348. })
  349. })
  350. },
  351. // 下载模板
  352. downloadTpl() {
  353. this.loading = true
  354. gwCirculationCard2Service
  355. .exportTemplate()
  356. .then((data) => {
  357. // 将二进制流文件写入excel表,以下为重要步骤
  358. this.$utils.downloadExcel(data, "公文流转导入模板");
  359. this.loading = false
  360. })
  361. .catch(function (err) {
  362. this.loading = false
  363. if (err.response) {
  364. console.log(err.response);
  365. }
  366. });
  367. },
  368. // 自定义服务端导入
  369. importMethod({ file }) {
  370. // 处理表单
  371. const formBody = new FormData();
  372. formBody.append("file", file);
  373. this.loading = true
  374. gwCirculationCard2Service.importExcel(formBody).then((result) => {
  375. this.$message.success({
  376. dangerouslyUseHTMLString: true,
  377. message: result,
  378. });
  379. this.refreshList();
  380. });
  381. },
  382. // 自定义服务端导出
  383. exportMethod({ options }) {
  384. // 传给服务端的参数
  385. const params = {
  386. current: this.tablePage.currentPage,
  387. size: this.tablePage.pageSize,
  388. orders: this.tablePage.orders,
  389. ...this.searchForm,
  390. filename: options.filename,
  391. sheetName: options.sheetName,
  392. isHeader: options.isHeader,
  393. original: options.original,
  394. mode: options.mode,
  395. selectIds:
  396. options.mode === "selected"
  397. ? options.data.map((item) => item.id)
  398. : [],
  399. exportFields: options.columns.map(
  400. (column) => column.property && column.property.split(".")[0]
  401. ),
  402. };
  403. this.loading = true;
  404. return gwCirculationCard2Service
  405. .exportExcel(params)
  406. .then((data) => {
  407. // 将二进制流文件写入excel表,以下为重要步骤
  408. this.$utils.downloadExcel(data, options.filename);
  409. this.loading = false;
  410. })
  411. .catch(function (err) {
  412. if (err.response) {
  413. console.log(err.response);
  414. }
  415. });
  416. },
  417. resetSearch () {
  418. this.$refs.searchForm.resetFields()
  419. this.refreshList()
  420. }
  421. }
  422. }
  423. </script>