SealArchivesList.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371
  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-input placeholder="请输入印章类别" v-model="queryParam.sealType"></j-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. <j-input placeholder="请输入印章名称" v-model="queryParam.sealName"></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.sealMaterial"></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.sealSize"></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.                 <a-select placeholder="请选择印章状态" v-model="queryParam.sealStatus" >
  31.                   <a-select-option value="正在使用">正在使用</a-select-option>
  32.                   <a-select-option value="已销毁">已销毁</a-select-option>
  33.                 </a-select>
  34. </a-form-item>
  35. </a-col>
  36. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  37. <a-form-item label="印章保管人">
  38. <j-input placeholder="请输入印章保管人" v-model="queryParam.sealCustodian"></j-input>
  39. </a-form-item>
  40. </a-col>
  41. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  42. <a-form-item label="保管部门">
  43. <j-input placeholder="请输入保管部门" v-model="queryParam.custodianDept"></j-input>
  44. </a-form-item>
  45. </a-col>
  46. </template>
  47. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  48. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  49. <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
  50. <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
  51. <a @click="handleToggleSearch" style="margin-left: 8px">
  52. {{ toggleSearchStatus ? '收起' : '展开' }}
  53. <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
  54. </a>
  55. </span>
  56. </a-col>
  57. </a-row>
  58. </a-form>
  59. </div>
  60. <!-- 查询区域-END -->
  61. <!-- 操作按钮区域 -->
  62. <div class="table-operator">
  63. <!-- <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>-->
  64. <!-- <a-button type="primary" icon="download" @click="handleExportXls('印章档案')">导出</a-button>-->
  65. <!-- <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">-->
  66. <!-- <a-button type="primary" icon="import">导入</a-button>-->
  67. <!-- </a-upload>-->
  68. <!-- <a-dropdown v-if="selectedRowKeys.length > 0">-->
  69. <!-- <a-menu slot="overlay">-->
  70. <!-- <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>-->
  71. <!-- </a-menu>-->
  72. <!-- <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>-->
  73. <!-- </a-dropdown>-->
  74. </div>
  75. <!-- table区域-begin -->
  76. <div>
  77. <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
  78. <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
  79. <a style="margin-left: 24px" @click="onClearSelected">清空</a>
  80. </div>
  81. <a-table
  82. ref="table"
  83. size="middle"
  84. bordered
  85. rowKey="id"
  86. :columns="columns"
  87. :dataSource="dataSource"
  88. :pagination="ipagination"
  89. :loading="loading"
  90. :rowSelection="{fixed:true,selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
  91. @change="handleTableChange">
  92. <template slot="htmlSlot" slot-scope="text">
  93. <div v-html="text"></div>
  94. </template>
  95. <template slot="imgSlot" slot-scope="text">
  96. <span v-if="!text" style="font-size: 12px;font-style: italic;">无此图片</span>
  97. <img v-else :src="getImgView(text)" height="25px" alt="图片不存在" style="max-width:80px;font-size: 12px;font-style: italic;"/>
  98. </template>
  99. <template slot="fileSlot" slot-scope="text">
  100. <span v-if="!text" style="font-size: 12px;font-style: italic;">无此文件</span>
  101. <a-button
  102. v-else
  103. :ghost="true"
  104. type="primary"
  105. icon="download"
  106. size="small"
  107. @click="uploadFile(text)">
  108. 下载
  109. </a-button>
  110. </template>
  111. <span slot="action" slot-scope="text, record">
  112. <a @click="handleEdit(record)">编辑</a>
  113. <a-divider type="vertical" />
  114. <a-dropdown>
  115. <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
  116. <a-menu slot="overlay">
  117. <a-menu-item>
  118. <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
  119. <a>删除</a>
  120. </a-popconfirm>
  121. </a-menu-item>
  122. </a-menu>
  123. </a-dropdown>
  124. </span>
  125. <span slot="status" slot-scope="text, record">
  126. <a @click="changeStatus(record)">{{record.sealStatus}}</a>
  127. </span>
  128. </a-table>
  129. </div>
  130. <a-modal
  131. :visible='visible'
  132. :width="100"
  133. cancelText='关闭'
  134. title='更改状态'
  135. @ok="ok"
  136. @cancel="cancel">
  137. <a-form :form="form">
  138. <a-form-item label="印章状态" :labelCol="labelCol" :wrapperCol="wrapperCol">
  139. <a-select placeholder="请选择印章状态" v-decorator="[ 'sealStatus']" >
  140. <a-select-option value="正在使用">正在使用</a-select-option>
  141. <a-select-option value="已销毁">已销毁</a-select-option>
  142. </a-select>
  143. </a-form-item>
  144. </a-form>
  145. </a-modal>
  146. <sealArchives-modal ref="modalForm" @ok="modalFormOk"></sealArchives-modal>
  147. </a-card>
  148. </template>
  149. <script>
  150. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  151. import SealArchivesModal from './modules/SealArchivesModal'
  152. import JDictSelectTag from '@/components/dict/JDictSelectTag.vue'
  153. import { httpAction } from '@api/manage'
  154. import pick from 'lodash.pick'
  155. import JInput from '@/components/jeecg/JInput.vue'
  156. export default {
  157. name: "SealArchivesList",
  158. mixins:[JeecgListMixin],
  159. components: {
  160. JDictSelectTag,
  161. JInput,
  162. SealArchivesModal
  163. },
  164. data () {
  165. return {
  166. form: this.$form.createForm(this),
  167. visible: false,
  168. description: '印章档案管理页面',
  169. labelCol: {
  170. xs: { span: 24 },
  171. sm: { span: 5 },
  172. },
  173. wrapperCol: {
  174. xs: { span: 24 },
  175. sm: { span: 16 },
  176. },
  177. // 表头
  178. columns: [
  179. {
  180. title: '#',
  181. dataIndex: '',
  182. key:'rowIndex',
  183. width:60,
  184. align:"center",
  185. customRender:function (t,r,index) {
  186. return parseInt(index)+1;
  187. }
  188. },
  189. {
  190. title:'印章类别',
  191. align:"center",
  192. dataIndex: 'sealType'
  193. },
  194. {
  195. title:'印章名称',
  196. align:"center",
  197. dataIndex: 'sealName'
  198. },
  199. {
  200. title:'印章材质',
  201. align:"center",
  202. dataIndex: 'sealMaterial'
  203. },
  204. {
  205. title:'印章尺寸',
  206. align:"center",
  207. dataIndex: 'sealSize'
  208. },
  209. {
  210. title:'印章状态',
  211. align:"center",
  212. scopedSlots: { customRender: 'status' },
  213. dataIndex: 'sealStatus'
  214. },
  215. {
  216. title:'印章保管人',
  217. align:"center",
  218. dataIndex: 'sealCustodian'
  219. },
  220. {
  221. title:'保管部门',
  222. align:"center",
  223. dataIndex: 'custodianDept',
  224. customRender: (text, record, index) => {
  225. if(text!==''&&text&&text!=='null'){
  226. return text
  227. }else{
  228. var cc=''
  229. return cc
  230. }
  231. }, },
  232. {
  233. title:'刻章日期',
  234. align:"center",
  235. dataIndex: 'engravingDate'
  236. },
  237. {
  238. title:'销毁日期',
  239. align:"center",
  240. dataIndex: 'destroyDate',
  241. customRender:function (text) {
  242. return !text?"":(text.length>10?text.substr(0,10):text)
  243. }
  244. },
  245. {
  246. title:'上缴日期',
  247. align:"center",
  248. dataIndex: 'turnDate',
  249. customRender:function (text) {
  250. return !text?"":(text.length>10?text.substr(0,10):text)
  251. }
  252. },
  253. {
  254. title:'附件',
  255. align:"center",
  256. dataIndex: 'file',
  257. scopedSlots: {customRender: 'fileSlot'},
  258. },
  259. // {
  260. // title: '操作',
  261. // dataIndex: 'action',
  262. // align:"center",
  263. // scopedSlots: { customRender: 'action' }
  264. // }
  265. ],
  266. url: {
  267. list: "/sealArchives/sealArchives/list",
  268. delete: "/sealArchives/sealArchives/delete",
  269. deleteBatch: "/sealArchives/sealArchives/deleteBatch",
  270. exportXlsUrl: "/sealArchives/sealArchives/exportXls",
  271. importExcelUrl: "sealArchives/sealArchives/importExcel",
  272. edit: "/sealArchives/sealArchives/edit",
  273. },
  274. dictOptions:{},
  275. }
  276. },
  277. computed: {
  278. importExcelUrl: function(){
  279. return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
  280. }
  281. },
  282. methods: {
  283. initDictConfig(){
  284. },
  285. changeStatus(record){
  286. console.log(record);
  287. this.form.resetFields();
  288. this.visible = true;
  289. this.model = Object.assign({}, record);
  290. this.$nextTick(() => {
  291. this.form.setFieldsValue(pick(this.model,'sealStatus'))
  292. })
  293. },
  294. ok(){
  295. const that = this;
  296. // 触发表单验证
  297. this.form.validateFields((err, values) => {
  298. if (!err) {
  299. that.confirmLoading = true;
  300. let httpurl = '';
  301. let method = '';
  302. httpurl+=this.url.edit;
  303. method = 'put';
  304. let formData = Object.assign(this.model, values);
  305. console.log("表单提交数据",formData)
  306. httpAction(httpurl,formData,method).then((res)=>{
  307. if(res.success){
  308. that.$message.success(res.message);
  309. that.$emit('ok');
  310. }else{
  311. that.$message.warning(res.message);
  312. }
  313. }).finally(() => {
  314. this.visible = false;
  315. this.loadData()
  316. })
  317. }
  318. })
  319. },
  320. cancel(){
  321. this.visible = false;
  322. },
  323. /* 文件下载 */
  324. uploadFile(text){
  325. console.log(text)
  326. if(!text){
  327. this.$message.warning("未知的文件")
  328. return;
  329. }
  330. var strArr = text;
  331. if(text.indexOf(",")>0){
  332. strArr = text.split(',');
  333. console.log("strArr",strArr)
  334. text = text.substring(0,text.indexOf(","))
  335. var count=0;
  336. for(var i =0;i<strArr.length;i++){
  337. console.log(strArr[i])
  338. var hiddenIFrameID = 'hiddenDownloader' + count++;
  339. var iframe = document.createElement('iframe');
  340. iframe.id = hiddenIFrameID;
  341. iframe.style.display = 'none';
  342. document.body.appendChild(iframe);
  343. iframe.src = strArr[i];//直接下载,不会弹出新的页面
  344. }
  345. }else {
  346. window.open(window._CONFIG['staticDomainURL']+ "/"+text);
  347. }
  348. },
  349. }
  350. }
  351. </script>
  352. <style scoped lang="less">
  353. @import '~@assets/less/common.less';
  354. /deep/ .table-page-search-wrapper .ant-form-inline .ant-form-item>.ant-form-item-label{
  355. width: 26% ;
  356. }
  357. </style>