User.vue 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939
  1. <template>
  2. <div>
  3. <div class="communal-list userlist">
  4. <div class="communal-title">
  5. <div>员工列表</div>
  6. <div class="communal-box">
  7. <el-input @input="Inquireclick()" placeholder="公司/部门/岗位/姓名" v-model="input" clearable>
  8. </el-input>
  9. <el-button @click="Inquireclick()" type="primary"><i class="iconfont icon-sousuo"></i></el-button>
  10. </div>
  11. </div>
  12. <template>
  13. <el-table :data="tableDatas.slice((currentPage - 1) * pageSize, currentPage * pageSize)" border
  14. style="width: 100%">
  15. <el-table-column prop="num" label="序 号" width="55">
  16. <template slot-scope="scope">
  17. {{ (currentPage - 1) * pageSize + scope.$index + 1 }}
  18. </template>
  19. </el-table-column>
  20. <el-table-column prop="number" label="工号" width="80">
  21. </el-table-column>
  22. <el-table-column prop="cnName" label="姓名" width="200">
  23. </el-table-column>
  24. <el-table-column prop="companyName" label="公司名称" width="250">
  25. </el-table-column>
  26. <el-table-column prop="depName" label="部门名称" width="100">
  27. </el-table-column>
  28. <el-table-column prop="jobName" label="职位" width="140">
  29. </el-table-column>
  30. <el-table-column prop="ext" label="分机号" width="80">
  31. </el-table-column>
  32. <el-table-column prop="phone" label="手机号" width="180">
  33. </el-table-column>
  34. <el-table-column label="人事审核" prop="hrAudit">
  35. <template slot-scope="hrAudit">
  36. <span v-if="hrAudit.row.hrAudit == 1">审核通过</span>
  37. <span v-else-if="hrAudit.row.hrAudit == 2">审核未通过</span>
  38. <span v-else>
  39. <a v-if="examine" style="color: cornflowerblue;" @click="hrAuditBtn(hrAudit.row.id, 1)">通过</a>
  40. <a v-if="examine" style="color: red;" @click="hrAuditBtn(hrAudit.row.id, 2)">拒绝</a>
  41. <span v-else>未审核</span>
  42. </span>
  43. </template>
  44. </el-table-column>
  45. <el-table-column label="操作" width="180">
  46. <template slot-scope="scope">
  47. <el-button v-if="examine" size="mini" @click="upDate(scope.$index, scope.row)">编辑</el-button>
  48. <el-button size="mini" type="danger" @click="del(scope.$index, scope.row)">删除</el-button>
  49. </template>
  50. </el-table-column>
  51. </el-table>
  52. </template>
  53. <div class="block">
  54. <el-pagination align='center' @size-change="handleSizeChange" @current-change="handleCurrentChange"
  55. :current-page="currentPage" :page-sizes="[10, 15, 20]" :page-size="pageSize"
  56. layout="total, sizes, prev, pager, next" :total="tableDatas.length">
  57. </el-pagination>
  58. </div>
  59. </div>
  60. <el-dialog top="1vh" style="z-index:2013" title="修改员工信息" :visible.sync="upUserVisible" width="900px" :before-close="handleClose">
  61. <div>
  62. <el-form
  63. :model="ruleForm"
  64. :rules="rules"
  65. ref="ruleForm"
  66. label-width="100px"
  67. class="demo-ruleForm"
  68. >
  69. <div class="form-lis">
  70. <el-form-item label="中文名称" prop="mandarinName">
  71. <el-input @blur="emailpj" v-model="ruleForm.mandarinName" placeholder="与企业微信名称一致"></el-input>
  72. </el-form-item>
  73. <el-form-item label="英文名称" prop="eflName">
  74. <el-input @blur="emailpj" v-model="ruleForm.eflName" placeholder="请输入英文名称"></el-input>
  75. </el-form-item>
  76. </div>
  77. <div class="form-lis">
  78. <el-form-item label="邮箱" prop="email">
  79. <el-input v-model="ruleForm.email" placeholder="会自动识别">
  80. <template slot="append">@pan-american-intl.com</template>
  81. </el-input>
  82. </el-form-item>
  83. <el-form-item label="性别" prop="sex">
  84. <el-radio-group v-model="ruleForm.sex">
  85. <el-radio label="男"></el-radio>
  86. <el-radio label="女"></el-radio>
  87. </el-radio-group>
  88. </el-form-item>
  89. <el-form-item label="工号" prop="number">
  90. <el-input v-model="ruleForm.number" placeholder="请填写工号"></el-input>
  91. </el-form-item>
  92. <el-form-item label="手机号" prop="phone">
  93. <el-input v-model="ruleForm.phone" placeholder="与企业微信注册的手机号一致"></el-input>
  94. </el-form-item>
  95. <el-form-item label="紧急电话" prop="urgentphone">
  96. <el-input v-model="ruleForm.urgentphone" placeholder="不能与使用的手机号相同"></el-input>
  97. </el-form-item>
  98. <el-form-item label="密码" prop="pass">
  99. <el-input v-model="ruleForm.pass" show-password placeholder="输入密码"></el-input>
  100. </el-form-item>
  101. <el-form-item label="确认密码" prop="checkPass">
  102. <el-input v-model="ruleForm.checkPass" show-password placeholder="确认密码"></el-input>
  103. </el-form-item>
  104. <el-form-item label="身份证号" prop="IDnumber">
  105. <el-input v-model="ruleForm.IDnumber" placeholder="输入身份证号"></el-input>
  106. </el-form-item>
  107. <el-form-item label="入职时间" prop="datebirth">
  108. <el-date-picker type="date" placeholder="选择日期" v-model="ruleForm.datebirth" style="width: 100%;"></el-date-picker>
  109. <!-- <el-input v-model="ruleForm.datebirth"></el-input> -->
  110. </el-form-item>
  111. <el-form-item label="学历" prop="educated">
  112. <el-select v-model="ruleForm.educated" placeholder="请选择学历">
  113. <el-option
  114. v-for="item in educatedarr"
  115. :key="item.value"
  116. :label="item.label"
  117. :value="item.value">
  118. </el-option>
  119. </el-select>
  120. </el-form-item>
  121. <el-form-item label="专业" prop="specialized">
  122. <el-input v-model="ruleForm.specialized" placeholder="输入专业"></el-input>
  123. </el-form-item>
  124. <el-form-item label="毕业院校" prop="school">
  125. <el-input v-model="ruleForm.school" placeholder="输入毕业院校"></el-input>
  126. </el-form-item>
  127. <el-form-item label="教育类型" prop="recruitment">
  128. <el-select v-model="ruleForm.recruitment" placeholder="请选择教育类型">
  129. <el-option
  130. v-for="item in recruitmentarr"
  131. :key="item.value"
  132. :label="item.label"
  133. :value="item.value">
  134. </el-option>
  135. </el-select>
  136. </el-form-item>
  137. <el-form-item label="婚姻状况" prop="maritalstatus">
  138. <el-input v-model="ruleForm.maritalstatus" placeholder="输入婚姻状况"></el-input>
  139. </el-form-item>
  140. <el-form-item label="居住住址" prop="address">
  141. <el-input v-model="ruleForm.address" placeholder="输入居住住址"></el-input>
  142. </el-form-item>
  143. <el-form-item label="家庭地址" prop="homeAddress">
  144. <el-input v-model="ruleForm.homeAddress" placeholder="输入家庭地址"></el-input>
  145. </el-form-item>
  146. <el-form-item label="所属公司" prop="corporation">
  147. <el-select v-model="ruleForm.corporation" value-key="id" @change="changeCorporation" placeholder="请选择所属公司">
  148. <el-option
  149. v-for="item in CorporationOption"
  150. :key="item.companyId"
  151. :label="item.companyName"
  152. :value="item.companyId">
  153. </el-option>
  154. </el-select>
  155. </el-form-item>
  156. <el-form-item label="所属部门" prop="division">
  157. <el-select v-model="ruleForm.division" value-key="id" @change="changeDivision" placeholder="请选择所属部门">
  158. <el-option
  159. v-for="item in DivisionOption"
  160. :key="item.depId"
  161. :label="item.depName"
  162. :value="item.depId">
  163. </el-option>
  164. </el-select>
  165. </el-form-item>
  166. <el-form-item label="职位" prop="posts">
  167. <el-select v-model="ruleForm.posts" placeholder="请选择职位">
  168. <el-option
  169. v-for="item in PostsOption"
  170. :key="item.jobId"
  171. :label="item.jobName"
  172. :value="item.jobId">
  173. </el-option>
  174. </el-select>
  175. </el-form-item>
  176. </div>
  177. <el-form-item label="工作经历">
  178. <el-input type="textarea" v-model="ruleForm.desc"></el-input>
  179. </el-form-item>
  180. <!-- <div class="enroll-btn">
  181. <el-button type="primary" @click="submitForm('ruleForm')">立即注册</el-button>
  182. <el-button @click="resetForm('ruleForm')">重置</el-button>
  183. <el-button @click="houtui()">返回</el-button>
  184. </div> -->
  185. </el-form>
  186. </div>
  187. <span slot="footer" class="dialog-footer">
  188. <el-button @click="upUserVisible = false">取 消</el-button>
  189. <el-button type="primary" @click="confirmbtn('ruleForm')">确 定</el-button>
  190. </span>
  191. </el-dialog>
  192. </div>
  193. </template>
  194. <script>
  195. import { co, el } from '@fullcalendar/core/internal-common';
  196. import { del } from 'vue';
  197. export default {
  198. data() {
  199. var validatePass = (rule, value, callback) => {
  200. if (value === "") {
  201. callback(new Error("请输入密码"));
  202. } else {
  203. if (this.ruleForm.checkPass !== "") {
  204. this.$refs.ruleForm.validateField("checkPass");
  205. }
  206. callback();
  207. }
  208. };
  209. var validatePass2 = (rule, value, callback) => {
  210. if (value === "") {
  211. callback(new Error("请再次输入密码"));
  212. } else if (value !== this.ruleForm.pass) {
  213. callback(new Error("两次输入密码不一致!"));
  214. } else {
  215. callback();
  216. }
  217. };
  218. var phonePass = (rule, value, callback) => {
  219. console.log(value)
  220. console.log(this.ruleForm.phone)
  221. if (value === "") {
  222. callback(new Error("请输入紧急电话"));
  223. }else if (value === this.ruleForm.phone) {
  224. callback(new Error("紧急电话与联系电话不能一致!"));
  225. }else {
  226. callback();
  227. }
  228. };
  229. return {
  230. // rules: {
  231. // Number: [
  232. // { required: true, message: '请输入工号', trigger: 'blur' },
  233. // ],
  234. // CompanyId: [
  235. // { required: true, message: '请选择所属公司', trigger: 'blur' },
  236. // ],
  237. // DepId: [
  238. // { required: true, message: '请选择所属部门', trigger: 'change' }
  239. // ],
  240. // JobPostId: [
  241. // { required: true, message: '请选择所属职位', trigger: 'change' }
  242. // ],
  243. // },
  244. tableDatas: [],
  245. tableData: [],
  246. companyData: [],
  247. depData: [],
  248. JobData: [],
  249. currentPage: 1, // 当前页码
  250. pageSize: 15,// 每页的数据条数
  251. input: '',
  252. token: '',
  253. userId: 0,
  254. ID:0,
  255. upUserVisible: false,
  256. upData: {
  257. Id: 0,
  258. Number: '',
  259. CompanyId: 0,
  260. DepId: 0,
  261. JobPostId: 0,
  262. Ext: '',
  263. UsePeriod: '',
  264. HrAudit: 0,
  265. currUserId:0
  266. },
  267. HrAuditSelect: [{
  268. value: 0,
  269. label: '未审核'
  270. },
  271. {
  272. value: 1,
  273. label: '已通过'
  274. },
  275. {
  276. value: 2,
  277. label: '已拒绝'
  278. },],
  279. Permissions:[],
  280. examine:false,
  281. CorporationOption:[],//公司
  282. DivisionOption:[],//部门
  283. PostsOption:[],//职位
  284. ruleForm: {
  285. mandarinName: "",//中文名称
  286. eflName: "",//英文名称
  287. sex: "",//性别
  288. number:"",//工号
  289. email: "",//邮箱
  290. phone: "",//手机号
  291. urgentphone: "",//紧急电话
  292. pass: "",//密码
  293. checkPass: "",//确认密码
  294. IDnumber: "",//身份证号
  295. educated: "",//学历
  296. specialized: "",//专业
  297. school: "",//毕业院校
  298. recruitment: "",//统招/成教
  299. datebirth: "",//入职时间
  300. homeAddress:"",//家庭地址
  301. maritalstatus: "",//婚姻状况
  302. address: "",//现在居住住址
  303. corporation: "",//所属公司
  304. division: "",//所属部门
  305. posts:"",//职位
  306. desc: "",//工作经历
  307. },
  308. educatedarr:[
  309. {
  310. label:'未设置',
  311. value:0
  312. },
  313. {
  314. label:'小学',
  315. value:1
  316. },{
  317. label:'初中',
  318. value:2
  319. },{
  320. label:'高中',
  321. value:3
  322. },{
  323. label:'专科',
  324. value:4
  325. },{
  326. label:'本科',
  327. value:5
  328. },{
  329. label:'研究生',
  330. value:6
  331. }
  332. ],
  333. recruitmentarr:[
  334. {
  335. label:'未设置',
  336. value:0
  337. },
  338. {
  339. label:'统招',
  340. value:1
  341. }, {
  342. label:'成教',
  343. value:2
  344. },{
  345. label:'留学',
  346. value:3
  347. },
  348. ],
  349. rules: {
  350. mandarinName: [
  351. { required: true, message: "中文名称", trigger: "blur" },
  352. { min: 2, max: 6, message: "长度在 3 到 5 个字符", trigger: "blur" },
  353. ],
  354. eflName: [
  355. { required: true, message: "英文名称", trigger: "blur" },
  356. { min: 0, max: 10, message: "长度在 0 到 10 个字符", trigger: "blur" },
  357. ],
  358. sex: [{ required: true, message: "请选择性别", trigger: "change" }],
  359. email: [
  360. { required: true, message: "请输入邮箱地址", trigger: "blur" },
  361. // {
  362. // type: "email",
  363. // message: "请输入正确的邮箱地址",
  364. // trigger: ["blur", "change"],
  365. // },
  366. ],
  367. phone: [
  368. { required: true, message: "手机号必填", trigger: "blur" },
  369. {
  370. pattern: /^1[3456789]\d{9}$/,
  371. message: "手机号码格式不正确",
  372. trigger: "blur",
  373. },
  374. ],
  375. urgentphone: [
  376. { required: true,validator: phonePass, trigger: "blur" },
  377. {
  378. pattern: /^1[3456789]\d{9}$/,
  379. message: "紧急号码格式不正确",
  380. trigger: "blur",
  381. },
  382. ],
  383. pass: [
  384. { required: true, validator: validatePass, trigger: "blur" },
  385. {
  386. min: 6,
  387. max: 18,
  388. message: "长度在 6 到 18 个字符",
  389. trigger: "blur",
  390. },
  391. ],
  392. checkPass: [
  393. { required: true, validator: validatePass2, trigger: "blur" },
  394. {
  395. min: 6,
  396. max: 18,
  397. message: "长度在 6 到 18 个字符",
  398. trigger: "blur",
  399. },
  400. ],
  401. IDnumber: [
  402. { required: true, message: "请填写证件号码", trigger: "blur" },
  403. {
  404. pattern:
  405. /(^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$)|(^[1-9]\d{5}\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{2}$)/,
  406. message: "证件号码格式有误!",
  407. trigger: "blur",
  408. },
  409. ],
  410. datebirth: [
  411. {
  412. required: true,
  413. message: "请选择入职日期",
  414. trigger: "change",
  415. },
  416. ],
  417. educated: [{ required: true, message: "请选择学历", trigger: "change" }],
  418. specialized: [
  419. { required: true, message: "请填写专业", trigger: "blur" },
  420. ],
  421. school: [
  422. { required: true, message: "请填写毕业院校", trigger: "blur" },
  423. ],
  424. recruitment: [
  425. { required: true, message: "请填写统招/成教", trigger: "blur" },
  426. ],
  427. maritalstatus: [
  428. { required: true, message: "请填写婚姻状况", trigger: "blur" },
  429. ],
  430. address: [
  431. { required: true, message: "请填写现在居住住址", trigger: "blur" },
  432. ],
  433. homeAddress: [
  434. { required: true, message: "请填写家庭地址", trigger: "blur" },
  435. ],
  436. corporation: [
  437. { required: true, message: "请选择所属公司", trigger: "change" },
  438. ],
  439. division: [
  440. { required: true, message: "请选择所属部门", trigger: "blur" },
  441. ],
  442. posts: [
  443. { required: true, message: "请选择职位", trigger: "blur" },
  444. ],
  445. desc: [{ required: true, message: "请填写工作经历", trigger: "blur" }],
  446. number: [{ required: true, message: "请填写工号", trigger: "blur" }],
  447. },
  448. }
  449. },
  450. methods: {
  451. //每页条数改变时触发 选择一页显示多少行
  452. handleSizeChange(val) {
  453. this.currentPage = 1;
  454. this.pageSize = val;
  455. },
  456. //当前页改变时触发 跳转其他页
  457. handleCurrentChange(val) {
  458. this.currentPage = val;
  459. },
  460. //获取公司
  461. daraSource(){
  462. var url = "/api/register/daraSource"
  463. var that = this
  464. this.$axios({
  465. method: 'post',
  466. url: url,
  467. headers: {
  468. Authorization: 'Bearer ' + this.token
  469. }
  470. }).then(function (res) {
  471. if(res.data.code==200){
  472. console.log(res)
  473. that.CorporationOption=res.data.data;
  474. }else{
  475. that.$message({
  476. message: res.data.msg,
  477. type: 'warning'
  478. });
  479. }
  480. })
  481. },
  482. //切换公司
  483. changeCorporation(item){
  484. this.ruleForm.division='';
  485. this.ruleForm.posts='';
  486. for(let i=0;i<this.CorporationOption.length;i++){
  487. if(this.CorporationOption[i].companyId==item){
  488. this.DivisionOption=this.CorporationOption[i].subDep
  489. }
  490. }
  491. },
  492. //切换部门
  493. changeDivision(item){
  494. this.ruleForm.posts='';
  495. for(let j=0;j<this.DivisionOption.length;j++){
  496. if(this.DivisionOption[j].depId==item){
  497. this.PostsOption=this.DivisionOption[j].subJob
  498. }
  499. }
  500. },
  501. //邮箱拼接
  502. emailpj(){
  503. let emailall;
  504. let surname=pinyin(this.ruleForm.mandarinName[0], {toneType: 'none'})
  505. this.ruleForm.email=this.ruleForm.eflName+'.'+surname
  506. emailall=this.ruleForm.eflName+'.'+surname+'@pan-american-intl.com'
  507. },
  508. //确定
  509. confirmbtn(ruleForm){
  510. this.$refs[ruleForm].validate((valid) => {
  511. if (valid) {
  512. this.EditUserInfo()
  513. } else {
  514. this.$message.error('请完善信息在保存!');
  515. return false;
  516. }
  517. });
  518. },
  519. //修改
  520. EditUserInfo() {
  521. var url = "/api/System/EditUserInfo"
  522. var that = this
  523. that.depData = [];
  524. that.$axios({
  525. method: 'post',
  526. url: url,
  527. headers: {
  528. Authorization: 'Bearer '
  529. },
  530. data: {
  531. currUserId:that.userId,
  532. id: that.ID,
  533. cnName: that.ruleForm.mandarinName,//中文姓名
  534. enName: that.ruleForm.eflName,//英文姓名
  535. number: that.ruleForm.number,//工号
  536. companyId: that.ruleForm.corporation,//公司Id
  537. depId: that.ruleForm.division,//部门Id
  538. jobPostId: that.ruleForm.posts,//岗位Id
  539. password: that.ruleForm.pass,//密码
  540. comfirmPassword: that.ruleForm.checkPass,//确认密码
  541. sex: that.ruleForm.sex=='男'?0:1,//性别0 男 1 女 2 未设置
  542. ext: '',//分机号
  543. phone: that.ruleForm.phone,//手机号
  544. urgentPhone:that.ruleForm.urgentphone,//紧急联系人 手机号
  545. email: that.ruleForm.email+'@pan-american-intl.com',//邮箱
  546. address: that.ruleForm.address,//住址
  547. edate: that.ruleForm.datebirth,//入职时间
  548. birthday: '',//生日
  549. idCard: that.ruleForm.IDnumber,//身份证号码
  550. startWorkDate: '',//开始工作时
  551. graduateInstitutions: that.ruleForm.school,//毕业学校
  552. professional: that.ruleForm.specialized,//专业
  553. education: that.ruleForm.educated,//学历 0 未设置 1 小学、2 初中、3 高中、4 专科、5 本科、6 研究生
  554. theOrAdultEducation: that.ruleForm.recruitment,//学历类型 0 未设置 1 成教 2 统招 3 留学
  555. maritalStatus: that.ruleForm.maritalstatus,//婚姻状态
  556. homeAddress: that.ruleForm.homeAddress,//家庭地址
  557. usePeriod: '',//试用期
  558. workExperience: that.ruleForm.desc,//工作经历
  559. certificate: '',//证书上传
  560. qiyeChatUserId: '',//企微Id
  561. remark: '',//备注
  562. }
  563. }).then(function (res) {
  564. if (res.data.code == 200) {
  565. that.$message({
  566. type: 'success',
  567. message: res.data.msg,
  568. });
  569. that.upUserVisible=false;
  570. that.user();
  571. }else{
  572. that.$message({
  573. message: res.data.msg,
  574. type: 'warning'
  575. });
  576. }
  577. })
  578. },
  579. //部门数据查询
  580. Department(companyId) {
  581. var url = "/api/System/QueryDepartmentList"
  582. var that = this
  583. that.depData = [];
  584. that.$axios({
  585. method: 'post',
  586. url: url,
  587. headers: {
  588. Authorization: 'Bearer ' + this.token
  589. },
  590. data: {
  591. portType: 1,
  592. CompanyId: companyId
  593. }
  594. }).then(function (res) {
  595. if (res.data.code == 200) {
  596. that.depData = res.data.data;
  597. }
  598. })
  599. },
  600. //公司数据查询
  601. company() {
  602. var url = "/api/System/getCompanyList"
  603. var that = this
  604. that.$axios({
  605. method: 'post',
  606. url: url,
  607. headers: {
  608. Authorization: 'Bearer ' + this.token
  609. },
  610. data: {
  611. portType: 1,
  612. }
  613. }).then(function (res) {
  614. if (res.data.code == 200) {
  615. that.companyData = res.data.data;
  616. }
  617. })
  618. },
  619. companyChange(event) {
  620. this.upData.DepId = null;
  621. this.upData.JobPostId = null;
  622. this.Department(event)
  623. this.Job(event, 0)
  624. },
  625. depChange(event) {
  626. this.upData.JobPostId = null;
  627. this.Job(this.upData.CompanyId, event)
  628. },
  629. //职位数据查询
  630. Job(companyId, depId) {
  631. var url = "/api/System/QueryJobPost"
  632. var that = this
  633. that.JobData = [];
  634. that.$axios({
  635. method: 'post',
  636. url: url,
  637. headers: {
  638. Authorization: 'Bearer ' + this.token
  639. },
  640. data: {
  641. portType: 1,
  642. CompanyId: companyId,
  643. DepId: depId
  644. }
  645. }).then(function (res) {
  646. if (res.data.code == 200) {
  647. that.JobData = res.data.data;
  648. }
  649. })
  650. },
  651. user() {
  652. var url = "/api/System/QueryUserList"
  653. var that = this
  654. this.$axios({
  655. method: 'post',
  656. url: url,
  657. headers: {
  658. Authorization: 'Bearer ' + this.token
  659. },
  660. data: {
  661. portType: 1,
  662. }
  663. }).then(function (res) {
  664. if (res.data.code == 200) {
  665. that.tableDatas = res.data.data;
  666. that.tableData = that.tableDatas
  667. if (that.tableDatas.slice((that.currentPage - 1) * that.pageSize, that.currentPage * that.pageSize).length == 0) {
  668. if (that.currentPage > 1) {
  669. that.currentPage = that.currentPage - 1;
  670. }
  671. }
  672. }
  673. })
  674. },
  675. Inquireclick() {
  676. var newarr = [];
  677. if (this.input == "") {
  678. newarr = this.tableData;
  679. } else {
  680. for (var i = 0; i < this.tableData.length; i++) {
  681. if (this.tableData[i].cnName.indexOf(this.input) != -1) {
  682. newarr.push(this.tableData[i]);
  683. } else if (this.tableData[i].companyName.indexOf(this.input) != -1) {
  684. newarr.push(this.tableData[i]);
  685. } else if (this.tableData[i].depName.indexOf(this.input) != -1) {
  686. newarr.push(this.tableData[i]);
  687. } else if (this.tableData[i].jobName.indexOf(this.input) != -1) {
  688. newarr.push(this.tableData[i]);
  689. }
  690. }
  691. }
  692. this.tableDatas = newarr;
  693. this.currentPage = 1;
  694. },
  695. //#region 修改操作
  696. upDate(index, row) {
  697. this.ruleForm= {
  698. mandarinName: "",//中文名称
  699. eflName: "",//英文名称
  700. sex: "",//性别
  701. number:"",//工号
  702. email: "",//邮箱
  703. phone: "",//手机号
  704. urgentphone: "",//紧急电话
  705. pass: "",//密码
  706. checkPass: "",//确认密码
  707. IDnumber: "",//身份证号
  708. educated: "",//学历
  709. specialized: "",//专业
  710. school: "",//毕业院校
  711. recruitment: "",//统招/成教
  712. datebirth: "",//入职时间
  713. homeAddress:"",//家庭地址
  714. maritalstatus: "",//婚姻状况
  715. address: "",//现在居住住址
  716. corporation: "",//所属公司
  717. division: "",//所属部门
  718. posts:"",//职位
  719. desc: "",//工作经历
  720. }
  721. this.ID=row.id;
  722. this.upUserVisible = true;
  723. this.getuserinfo(row.id);
  724. },
  725. //获取详细信息
  726. getuserinfo(val){
  727. var url = "/api/System/UserInfo"
  728. var that = this
  729. this.$axios({
  730. method: 'post',
  731. url: url,
  732. headers: {
  733. Authorization: 'Bearer '
  734. },
  735. data: {
  736. portType:1,
  737. id: val,
  738. }
  739. }).then(function (res) {
  740. if (res.data.code == 200) {
  741. var datainfo=res.data.data;
  742. that.ruleForm.mandarinName=datainfo.cnName;
  743. that.ruleForm.eflName=datainfo.enName;
  744. that.ruleForm.number=datainfo.number;
  745. that.ruleForm.email=datainfo.email.split('@')[0];
  746. that.ruleForm.sex=datainfo.sex==0?'男':'女';
  747. that.ruleForm.phone=datainfo.phone;
  748. that.ruleForm.urgentphone=datainfo.urgentPhone;
  749. that.ruleForm.pass=datainfo.password;
  750. that.ruleForm.checkPass=datainfo.password;
  751. that.ruleForm.IDnumber=datainfo.idCard;
  752. that.ruleForm.educated=datainfo.education;
  753. that.ruleForm.specialized=datainfo.professional;
  754. that.ruleForm.school=datainfo.graduateInstitutions;
  755. that.ruleForm.recruitment=datainfo.theOrAdultEducation;
  756. that.ruleForm.datebirth=datainfo.edate;
  757. that.ruleForm.homeAddress=datainfo.homeAddress;
  758. that.ruleForm.maritalstatus=datainfo.maritalStatus;
  759. that.ruleForm.address=datainfo.address;
  760. that.ruleForm.corporation=datainfo.companyId;
  761. that.ruleForm.division=datainfo.depId;
  762. that.ruleForm.posts=datainfo.jobPostId;
  763. that.ruleForm.desc=datainfo.workExperience;
  764. for(let i=0;i<that.CorporationOption.length;i++){
  765. if(that.CorporationOption[i].companyId==that.ruleForm.corporation){
  766. that.DivisionOption=that.CorporationOption[i].subDep
  767. }
  768. }
  769. for(let j=0;j<that.DivisionOption.length;j++){
  770. if(that.DivisionOption[j].depId==that.ruleForm.division){
  771. that.PostsOption=that.DivisionOption[j].subJob
  772. }
  773. }
  774. } else {
  775. that.$message.error(res.data.msg);
  776. }
  777. })
  778. },
  779. upBtn() {
  780. this.$refs.upData.validate((valid) => {
  781. if (valid) {
  782. } else {
  783. this.$message.error('请完善信息在保存!');
  784. return false;
  785. }
  786. })
  787. },
  788. //关闭修改框
  789. handleClose(done) {
  790. done();
  791. },
  792. //#endregion
  793. del(index, row) {
  794. this.$confirm('此操作将删除该员工, 是否继续?', '提示', {
  795. confirmButtonText: '确定',
  796. cancelButtonText: '取消',
  797. type: 'warning'
  798. }).then(() => {
  799. var url = "/api/System/PostUserDelById"
  800. var that = this
  801. this.$axios({
  802. method: 'post',
  803. url: url,
  804. headers: {
  805. Authorization: 'Bearer ' + this.token
  806. },
  807. data: {
  808. Id: row.id,
  809. }
  810. }).then(function (res) {
  811. console.log(res)
  812. if (res.data.code == 200) {
  813. that.$message({
  814. type: 'success',
  815. message: '删除成功!'
  816. });
  817. that.user();
  818. } else {
  819. that.$message.error(res.data.msg);
  820. }
  821. })
  822. }).catch(() => {
  823. this.$message({
  824. type: 'info',
  825. message: '操作已取消!'
  826. });
  827. });
  828. },
  829. hrAuditBtn(id, HrAudit) {
  830. debugger
  831. this.$confirm('是否进行此操作?', '提示', {
  832. confirmButtonText: '确定',
  833. cancelButtonText: '取消',
  834. type: 'warning'
  835. }).then(() => {
  836. var url = "/api/System/PersonnelAudit"
  837. var that = this
  838. this.$axios({
  839. method: 'post',
  840. url: url,
  841. headers: {
  842. Authorization: 'Bearer ' + this.token
  843. },
  844. data: {
  845. userId:that.userId,
  846. Id: id,
  847. isAudit: HrAudit
  848. }
  849. }).then(function (res) {
  850. console.log(res)
  851. if (res.data.code == 200) {
  852. that.$message({
  853. type: 'success',
  854. message: '操作成功!'
  855. });
  856. that.user();
  857. } else {
  858. that.$message.error(res.data.msg);
  859. }
  860. })
  861. }).catch(() => {
  862. debugger
  863. this.$message({
  864. type: 'info',
  865. message: '操作已取消!'
  866. });
  867. });
  868. }
  869. //#endregion
  870. },
  871. mounted() {
  872. this.token = JSON.parse(localStorage.getItem('userinif')).token;
  873. this.userId = JSON.parse(localStorage.getItem('userinif')).userInfo.userId;
  874. this.upData.currUserId=this.userId;
  875. this.Permissions = JSON.parse(localStorage.getItem('Permissions'));
  876. console.log(this.Permissions)
  877. for(let k=0;k<this.Permissions.length;k++){
  878. if(this.Permissions[k].funid==12){
  879. this.examine=true;
  880. }
  881. }
  882. this.daraSource()
  883. this.Department(0);
  884. this.company();
  885. this.user();
  886. }
  887. }
  888. </script>
  889. <style>
  890. .communal-list {
  891. background-color: #fff;
  892. padding: 10px;
  893. box-shadow: 0 0 5px #0005;
  894. border-radius: 10px;
  895. }
  896. .communal-title {
  897. display: flex;
  898. font-size: 17px;
  899. font-weight: 600;
  900. color: #555;
  901. margin-top: 8px;
  902. margin-bottom: 2px;
  903. justify-content: space-between;
  904. align-items: center;
  905. }
  906. .communal-box {
  907. display: flex;
  908. }
  909. .communal-box>button {
  910. margin-left: 10px;
  911. padding: 8px 20px;
  912. }
  913. .form-lis {
  914. display: flex;
  915. flex-wrap: wrap;
  916. }
  917. .form-lis > div {
  918. width: 50%;
  919. }
  920. .form-lis .el-select{
  921. width: 100%;
  922. }
  923. </style>