MuseumDutyList.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  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. <a-input placeholder="请输入申请人" v-model="queryParam.applyPerson"></a-input>
  10. </a-form-item>
  11. </a-col>
  12. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  13. <a-form-item label="申请部门">
  14. <a-input placeholder="请输入申请部门" v-model="queryParam.applyDept"></a-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-date placeholder="请选择申请日期" v-model="queryParam.applyDate"></j-date>
  21. </a-form-item>
  22. </a-col>
  23. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  24. <a-form-item label="值班月">
  25. <a-date-picker
  26. mode="month"
  27. v-model="queryParam.dutyMonth"
  28. placeholder="请选择班月"
  29. format="YYYY-MM"
  30. :open="monthShowOne"
  31. @openChange="openChangeOne"
  32. @panelChange="panelChangeOne"/>
  33. </a-form-item>
  34. </a-col>
  35. </template>
  36. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  37. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  38. <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
  39. <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
  40. <a @click="handleToggleSearch" style="margin-left: 8px">
  41. {{ toggleSearchStatus ? '收起' : '展开' }}
  42. <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
  43. </a>
  44. </span>
  45. </a-col>
  46. </a-row>
  47. </a-form>
  48. </div>
  49. <!-- 查询区域-END -->
  50. <!-- 操作按钮区域 -->
  51. <div class="table-operator">
  52. <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
  53. <a-button type="primary" icon="download" @click="handleExportXls('全馆值班登记')">导出</a-button>
  54. <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
  55. <a-button type="primary" icon="import">导入</a-button>
  56. </a-upload>
  57. <a-dropdown v-if="selectedRowKeys.length > 0">
  58. <a-menu slot="overlay">
  59. <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
  60. </a-menu>
  61. <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
  62. </a-dropdown>
  63. </div>
  64. <!-- table区域-begin -->
  65. <div>
  66. <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
  67. <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
  68. <a style="margin-left: 24px" @click="onClearSelected">清空</a>
  69. </div>
  70. <a-table
  71. ref="table"
  72. size="middle"
  73. bordered
  74. rowKey="id"
  75. :columns="columns"
  76. :dataSource="dataSource"
  77. :pagination="ipagination"
  78. :loading="loading"
  79. :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
  80. @change="handleTableChange">
  81. <template slot="htmlSlot" slot-scope="text">
  82. <div v-html="text"></div>
  83. </template>
  84. <template slot="imgSlot" slot-scope="text">
  85. <span v-if="!text" style="font-size: 12px;font-style: italic;">无此图片</span>
  86. <img v-else :src="getImgView(text)" height="25px" alt="图片不存在" style="max-width:80px;font-size: 12px;font-style: italic;"/>
  87. </template>
  88. <template slot="fileSlot" slot-scope="text">
  89. <span v-if="!text" style="font-size: 12px;font-style: italic;">无此文件</span>
  90. <a-button
  91. v-else
  92. :ghost="true"
  93. type="primary"
  94. icon="download"
  95. size="small"
  96. @click="uploadFile(text)">
  97. 下载
  98. </a-button>
  99. </template>
  100. <span slot="action" slot-scope="text, record">
  101. <a @click="handleEdit(record)">编辑</a>
  102. <a-divider type="vertical" />
  103. <a-dropdown>
  104. <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
  105. <a-menu slot="overlay">
  106. <a-menu-item>
  107. <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
  108. <a>删除</a>
  109. </a-popconfirm>
  110. </a-menu-item>
  111. </a-menu>
  112. </a-dropdown>
  113. </span>
  114. </a-table>
  115. </div>
  116. <museumDuty-modal ref="modalForm" @ok="modalFormOk"></museumDuty-modal>
  117. </a-card>
  118. </template>
  119. <script>
  120. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  121. import MuseumDutyModal from './modules/MuseumDutyModal'
  122. import JDate from '@/components/jeecg/JDate.vue'
  123. import { getAction } from '@api/manage'
  124. export default {
  125. name: "MuseumDutyList",
  126. mixins:[JeecgListMixin],
  127. components: {
  128. JDate,
  129. MuseumDutyModal
  130. },
  131. data () {
  132. return {
  133. description: '全馆值班登记管理页面',
  134. monthShowOne: false,
  135. // 表头
  136. columns: [
  137. {
  138. title: '#',
  139. dataIndex: '',
  140. key:'rowIndex',
  141. width:60,
  142. align:"center",
  143. customRender:function (t,r,index) {
  144. return parseInt(index)+1;
  145. }
  146. },
  147. {
  148. title:'申请人',
  149. align:"center",
  150. dataIndex: 'applyPerson'
  151. },
  152. {
  153. title:'申请部门',
  154. align:"center",
  155. dataIndex: 'applyDept'
  156. },
  157. {
  158. title:'申请日期',
  159. align:"center",
  160. dataIndex: 'applyDate',
  161. customRender:function (text) {
  162. return !text?"":(text.length>10?text.substr(0,10):text)
  163. }
  164. },
  165. {
  166. title:'值班月',
  167. align:"center",
  168. dataIndex: 'dutyMonth',
  169. customRender:function (text) {
  170. return !text?"":(text.length>10?text.substr(0,10):text)
  171. }
  172. },
  173. {
  174. title:'说明',
  175. align:"center",
  176. dataIndex: 'remark'
  177. },
  178. {
  179. title: '操作',
  180. dataIndex: 'action',
  181. align:"center",
  182. scopedSlots: { customRender: 'action' },
  183. }
  184. ],
  185. url: {
  186. list: "/oa/museumDuty/list",
  187. delete: "/oa/museumDuty/delete",
  188. deleteBatch: "/oa/museumDuty/deleteBatch",
  189. exportXlsUrl: "/oa/museumDuty/exportXls",
  190. importExcelUrl: "oa/museumDuty/importExcel",
  191. },
  192. dictOptions:{},
  193. }
  194. },
  195. computed: {
  196. importExcelUrl: function(){
  197. return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
  198. }
  199. },
  200. methods: {
  201. initDictConfig(){
  202. },
  203. // 弹出日历和关闭日历的回调
  204. openChangeOne(status) {
  205. if (status) {
  206. this.monthShowOne = true;
  207. }
  208. },
  209. // 得到年份选择器的值
  210. panelChangeOne(value) {
  211. this.monthShowOne = false;
  212. this.queryParam.dutyMonth = value;
  213. },
  214. loadData(arg) {
  215. if(!this.url.list){
  216. this.$message.error("请设置url.list属性!")
  217. return
  218. }
  219. //加载数据 若传入参数1则加载第一页的内容
  220. if (arg === 1) {
  221. this.ipagination.current = 1;
  222. }
  223. var params = this.getQueryParams();//查询条件
  224. if(params.dutyMonth){
  225. params.dutyMonth = this.queryParam.dutyMonth.format("YYYY-MM");
  226. }
  227. console.log("params",params)
  228. this.loading = true;
  229. getAction(this.url.list, params).then((res) => {
  230. if (res.success) {
  231. this.dataSource = res.result.records;
  232. this.ipagination.total = res.result.total;
  233. }
  234. if(res.code===510){
  235. this.$message.warning(res.message)
  236. }
  237. this.loading = false;
  238. })
  239. },
  240. }
  241. }
  242. </script>
  243. <style scoped>
  244. @import '~@assets/less/common.less';
  245. </style>