EnrollmentList.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437
  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.operator"></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.operatorDept"></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-date placeholder="请选择登记日期" v-model="queryParam.operateDate" style="width: 100%;"></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. <j-input placeholder="请输入姓名" v-model="queryParam.realname"></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. <j-input placeholder="请输入用户账号" v-model="queryParam.username"></j-input>
  31. </a-form-item>
  32. </a-col>
  33. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  34. <a-form-item label="性别">
  35. <a-select v-model="queryParam.gender" placeholder="请选择性别">
  36. <a-select-option :value="1">男</a-select-option>
  37. <a-select-option :value="2">女</a-select-option>
  38. </a-select>
  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-select-position placeholder="请选择职务" :multiple="false" v-model="queryParam.post" />
  44. </a-form-item>
  45. </a-col>
  46. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  47. <a-form-item label="职级">
  48. <j-input placeholder="请输入职级" v-model="queryParam.postLevel"></j-input>
  49. </a-form-item>
  50. </a-col>
  51. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  52. <a-form-item label="岗位类型">
  53. <a-select v-model="queryParam.positionType" placeholder="请选择岗位类型">
  54. <a-select-option value="管理类">管理类</a-select-option>
  55. <a-select-option value="专技类">专技类</a-select-option>
  56. </a-select>
  57. </a-form-item>
  58. </a-col>
  59. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  60. <a-form-item label="部门">
  61. <j-select-depart v-model="queryParam.departIds" :trigger-change="true"/>
  62. </a-form-item>
  63. </a-col>
  64. </template>
  65. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  66. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  67. <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
  68. <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
  69. <a @click="handleToggleSearch" style="margin-left: 8px">
  70. {{ toggleSearchStatus ? '收起' : '展开' }}
  71. <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
  72. </a>
  73. </span>
  74. </a-col>
  75. </a-row>
  76. </a-form>
  77. </div>
  78. <!-- 查询区域-END -->
  79. <!-- 操作按钮区域 -->
  80. <div class="table-operator">
  81. <a-button @click="showUserSelection" type="primary" icon="plus">添加员工</a-button>
  82. <!-- <a-button type="primary" icon="download" @click="handleExportXls('入职登记')">导出</a-button>
  83. <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
  84. <a-button type="primary" icon="import">导入</a-button>
  85. </a-upload> -->
  86. <!-- <a-dropdown v-if="selectedRowKeys.length > 0">
  87. <a-menu slot="overlay">
  88. <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
  89. </a-menu>
  90. <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
  91. </a-dropdown> -->
  92. </div>
  93. <!-- table区域-begin -->
  94. <div>
  95. <!-- <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
  96. <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
  97. <a style="margin-left: 24px" @click="onClearSelected">清空</a>
  98. </div>
  99. :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" -->
  100. <a-table
  101. ref="table"
  102. size="middle"
  103. :scroll="{x:1800}"
  104. bordered
  105. rowKey="id"
  106. :columns="columns"
  107. :dataSource="dataSource"
  108. :pagination="ipagination"
  109. :loading="loading"
  110. @change="handleTableChange">
  111. <template slot="htmlSlot" slot-scope="text">
  112. <div v-html="text"></div>
  113. </template>
  114. <template slot="imgSlot" slot-scope="text">
  115. <span v-if="!text" style="font-size: 12px;font-style: italic;">无此图片</span>
  116. <img v-else :src="getImgView(text)" height="25px" alt="图片不存在" style="max-width:80px;font-size: 12px;font-style: italic;"/>
  117. </template>
  118. <template slot="fileSlot" slot-scope="text">
  119. <span v-if="!text" style="font-size: 12px;font-style: italic;">无此文件</span>
  120. <a-button
  121. v-else
  122. :ghost="true"
  123. type="primary"
  124. icon="download"
  125. size="small"
  126. @click="uploadFile(text)">
  127. 下载
  128. </a-button>
  129. </template>
  130. <span slot="action" slot-scope="text, record">
  131. <a @click="handleEdit(record)" v-if="record.status==1" >编辑</a>
  132. <a-divider type="vertical" v-if="record.status==2" />
  133. <a href="javascript:;" v-if="record.status==2" @click="handleDetail(record,'detail')">详情</a>
  134. <a-divider type="vertical" v-if="record.status==1" />
  135. <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)" v-if="record.status==1">
  136. <a v-if="record.status==1">删除</a>
  137. </a-popconfirm>
  138. <a-divider type="vertical" v-if="record.status==1" />
  139. <a-popconfirm title="确定提交吗?" @confirm="() => handleSubmit(record.id)" v-if="record.status==1">
  140. <a v-if="record.status==1">提交</a>
  141. </a-popconfirm>
  142. <!-- <a-divider type="vertical" /> -->
  143. <!-- <a-dropdown v-if="record.status==1" >
  144. <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
  145. <a-menu slot="overlay">
  146. <a-menu-item>
  147. <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
  148. <a>删除</a>
  149. </a-popconfirm>
  150. </a-menu-item>
  151. <a-menu-item>
  152. <a-popconfirm title="确定提交吗?" @confirm="() => handleSubmit(record.id)">
  153. <a>提交</a>
  154. </a-popconfirm>
  155. </a-menu-item>
  156. </a-menu>
  157. </a-dropdown> -->
  158. </span>
  159. </a-table>
  160. </div>
  161. <enrollment-modal ref="modalForm" @ok="modalFormOk"></enrollment-modal>
  162. <a-modal title="新增员工选择" :width="450" :visible="newUserVisible" :closable="false" :maskClosable="false">
  163. <template slot="footer">
  164. <a-button type="primary" @click="handleAddUser">确认</a-button>
  165. <a-button type="primary" @click="newUserVisible = false">取消</a-button>
  166. </template>
  167. <a-form>
  168. <a-form-item
  169. :labelCol="{ span: 4 }"
  170. :wrapperCol="{ span: 20 }"
  171. style="margin-bottom:10px"
  172. >
  173. <!-- <a-tooltip placement="topLeft">
  174. <template slot="title">
  175. <span>请选择最新添加的用户</span>
  176. </template>
  177. <a-avatar style="backgroundColor:#87d068" icon="gold" />
  178. </a-tooltip> -->
  179. <a-select
  180. @change="selectUser"
  181. placeholder="请选择需要添加的员工"
  182. style="margin-left:10px;width: 80%"
  183. >
  184. <a-icon slot="suffixIcon" type="gold" />
  185. <a-select-option v-for="d in newUserList" :key="d.user_id" :value="d.user_id">
  186. {{ d.user_cn_name }} -- {{ d.dept_cn_name }}
  187. </a-select-option>
  188. </a-select>
  189. </a-form-item>
  190. </a-form>
  191. </a-modal>
  192. </a-card>
  193. </template>
  194. <script>
  195. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  196. import {putAction,getFileAccessHttpUrl,getAction} from '@/api/manage';
  197. import EnrollmentModal from './modules/EnrollmentModal'
  198. import JDate from '@/components/jeecg/JDate.vue'
  199. import JSelectDepart from '@/components/jeecgbiz/JSelectDepart'
  200. import JDictSelectTag from "@/components/dict/JDictSelectTag"
  201. import JSelectPosition from '@/components/jeecgbiz/JSelectPosition'
  202. import JInput from '@/components/jeecg/JInput'
  203. export default {
  204. name: "EnrollmentList",
  205. mixins:[JeecgListMixin],
  206. components: {
  207. JDate,
  208. JInput,
  209. EnrollmentModal,
  210. JSelectDepart,
  211. JDictSelectTag,
  212. JSelectPosition
  213. },
  214. data () {
  215. return {
  216. description: '入职登记管理页面',
  217. newUserVisible: false,
  218. newUserList: [],
  219. userSelected:{},
  220. // 表头
  221. columns: [
  222. {
  223. title: '#',
  224. dataIndex: '',
  225. key:'rowIndex',
  226. width:60,
  227. align:"center",
  228. customRender:function (t,r,index) {
  229. return parseInt(index)+1;
  230. }
  231. },
  232. {
  233. title:'部门',
  234. align:"center",
  235. dataIndex: 'departIds_dictText'
  236. },
  237. {
  238. title:'姓名',
  239. align:"center",
  240. dataIndex: 'realname'
  241. },
  242. {
  243. title:'用户账号',
  244. align:"center",
  245. dataIndex: 'username'
  246. },
  247. {
  248. title:'入职日期',
  249. align:"center",
  250. dataIndex: 'joinDate',
  251. customRender:function (text) {
  252. return !text?"":(text.length>10?text.substr(0,10):text)
  253. }
  254. },
  255. {
  256. title:'职务',
  257. align:"center",
  258. dataIndex: 'post'
  259. },
  260. {
  261. title:'职级',
  262. align:"center",
  263. dataIndex: 'postLevel'
  264. },
  265. {
  266. title:'岗位类型',
  267. align:"center",
  268. dataIndex: 'positionType'
  269. },
  270. {
  271. title:'手机号码',
  272. align:"center",
  273. dataIndex: 'mobile'
  274. },
  275. {
  276. title:'座机',
  277. align:"center",
  278. dataIndex: 'phone'
  279. },
  280. {
  281. title:'联系地址',
  282. align:"center",
  283. dataIndex: 'address'
  284. },
  285. {
  286. title:'合同起始日期',
  287. align:"center",
  288. dataIndex: 'contractStart',
  289. customRender:function (text) {
  290. return !text?"":(text.length>10?text.substr(0,10):text)
  291. }
  292. },
  293. {
  294. title:'合同终止日期',
  295. align:"center",
  296. dataIndex: 'contractEnd',
  297. customRender:function (text) {
  298. return !text?"":(text.length>10?text.substr(0,10):text)
  299. }
  300. },
  301. {
  302. title:'登记人 ',
  303. align:"center",
  304. dataIndex: 'operator'
  305. },
  306. {
  307. title:'登记部门',
  308. align:"center",
  309. dataIndex: 'operatorDept'
  310. },
  311. {
  312. title:'登记日期',
  313. align:"center",
  314. dataIndex: 'operateDate',
  315. customRender:function (text) {
  316. return !text?"":(text.length>10?text.substr(0,10):text)
  317. }
  318. },
  319. {
  320. title: '操作',
  321. dataIndex: 'action',
  322. align:"center",
  323. fixed:"right",
  324. width:150,
  325. scopedSlots: { customRender: 'action' },
  326. }
  327. ],
  328. url: {
  329. list: "/oa/enrollment/list",
  330. delete: "/oa/enrollment/delete",
  331. submit: "/oa/enrollment/submit",
  332. deleteBatch: "/oa/enrollment/deleteBatch",
  333. exportXlsUrl: "/oa/enrollment/exportXls",
  334. importExcelUrl: "oa/enrollment/importExcel",
  335. },
  336. dictOptions:{},
  337. }
  338. },
  339. computed: {
  340. importExcelUrl: function(){
  341. return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
  342. }
  343. },
  344. methods: {
  345. initDictConfig(){
  346. },
  347. showUserSelection(){
  348. getAction(`/sys/user/recently/added`)
  349. .then(res => {
  350. if (res.success) {
  351. this.newUserList = res.result
  352. // this.newUserList = [
  353. // {
  354. // "user_id": "zhangds5",
  355. // "user_cn_name": "张大山",
  356. // "active_state": "1",
  357. // "update_time": "2022-12-22 10:35:55",
  358. // "dept_code": "c01",
  359. // "dept_cn_name": "办公室",
  360. // "contact": "",
  361. // "email": "",
  362. // "registry_date": "2022-12-19 10:35:55"
  363. // }
  364. // ]
  365. this.newUserVisible = true;
  366. } else {
  367. this.$message.error(res.message)
  368. this.newUserVisible = false;
  369. }
  370. })
  371. .catch(() => {
  372. this.newUserVisible = false;
  373. })
  374. },
  375. selectUser (value) {
  376. this.newUserList.forEach(u=>{
  377. if(u.user_id == value)
  378. this.userSelected = u;
  379. })
  380. },
  381. handleAddUser(){
  382. console.log(this.userSelected);
  383. if(this.userSelected.user_id){
  384. let u = this.userSelected;
  385. let user = {
  386. username : u.user_id,
  387. realname: u.user_cn_name,
  388. }
  389. this.handleEdit(user,'新增');
  390. this.newUserVisible = false;
  391. }else{
  392. this.$message.warning('请先选择员工')
  393. }
  394. },
  395. handleSubmit(id){
  396. let that = this;
  397. putAction(this.url.submit,{"id":id}).then((res) => {
  398. if (res.success) {
  399. that.$message.success(res.message);
  400. that.loadData();
  401. that.onClearSelected();
  402. } else {
  403. console.log(res.message);
  404. that.$message.warning("提交失败");
  405. }
  406. }).error((err)=>{
  407. console.log(res.message);
  408. that.$message.error("提交失败");
  409. })
  410. }
  411. }
  412. }
  413. </script>
  414. <style scoped lang="less">
  415. @import '~@assets/less/common.less';
  416. /deep/ .table-page-search-wrapper .ant-form-inline .ant-form-item>.ant-form-item-label{
  417. width: 26% ;
  418. }
  419. </style>