shenqing.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537
  1. <template>
  2. <view style="background-color: #fff;" v-if="content != null">
  3. <view style="height: 100%;overflow: auto;">
  4. <u--form labelPosition="left" labelAlign="center" :model="content" ref="uForm" :rules="rules"
  5. errorType="toast" :labelStyle="{fontSize:'32rpx'}" labelWidth="120">
  6. <view v-if="fkFlow == '006'">
  7. <u-form-item label="出差处室:" borderBottom prop="outWorkDept">
  8. <u--input v-model="content.outWorkDept" border="none" readonly></u--input>
  9. </u-form-item>
  10. <u-form-item label="出差人:" borderBottom prop="userName">
  11. <u--input v-model="content.userName" border="none" readonly></u--input>
  12. </u-form-item>
  13. <u-form-item label="目的地:" borderBottom prop="destination">
  14. <view>
  15. <view>
  16. <u-radio-group v-model="content.provinceType" @change="groupChange">
  17. <u-radio :customStyle="{marginRight: '40rpx'}" key="0" label="省内" name="0">
  18. </u-radio>
  19. <u-radio key="1" label="省外" name="1"> </u-radio>
  20. </u-radio-group>
  21. </view>
  22. <view style="margin-top: 20rpx;">
  23. <u--input v-model="content.destination" border="none" placeholder="请填写目的地"></u--input>
  24. </view>
  25. </view>
  26. </u-form-item>
  27. <u-form-item label="起止日期:" borderBottom prop="startTime" @click="show = true">
  28. <view :style="{color:content.startTime==null?'rgb(192, 196, 204)':''}">
  29. {{content.startTime == null?'请选择起止日期':content.startTime+' 至 '+content.endTime}}
  30. </view>
  31. </u-form-item>
  32. <u-form-item label="出差事由:" borderBottom prop="reason">
  33. <u--textarea v-model="content.reason" placeholder="请填写出差事由" border="none"
  34. height="100"></u--textarea>
  35. </u-form-item>
  36. <u-form-item label="接收人:" borderBottom prop="toEmpsName" @click="peoShow = true">
  37. <view :style="{color:content.toEmpsName==null?'rgb(192, 196, 204)':''}">
  38. {{content.params.toEmps == null?'请选择接收人':content.toEmpsName}}
  39. </view>
  40. </u-form-item>
  41. </view>
  42. <view v-if="fkFlow == '007'">
  43. <u-form-item label="申请人:" borderBottom prop="userName">
  44. <u--input v-model="content.userName" border="none" readonly></u--input>
  45. </u-form-item>
  46. <u-form-item label="邀请单位:" borderBottom prop="inviteUnit">
  47. <u--input v-model="content.inviteUnit" border="none" placeholder="请填写邀请单位"></u--input>
  48. </u-form-item>
  49. <u-form-item label="培训名称:" borderBottom prop="trainName">
  50. <u--input v-model="content.trainName" border="none" placeholder="请填写培训名称"></u--input>
  51. </u-form-item>
  52. <u-form-item label="目的地:" borderBottom prop="destination">
  53. <u--input v-model="content.destination" border="none" placeholder="请填写目的地"></u--input>
  54. </u-form-item>
  55. <u-form-item label="起止日期:" borderBottom prop="startTime" @click="show = true">
  56. <view :style="{color:content.startTime==null?'rgb(192, 196, 204)':''}">
  57. {{content.startTime == null?'请选择起止日期':content.startTime+' 至 '+content.endTime}}
  58. </view>
  59. </u-form-item>
  60. <u-form-item label="授课题目:" borderBottom prop="teacherTitle">
  61. <u--input v-model="content.teacherTitle" border="none" placeholder="请填写授课题目"></u--input>
  62. </u-form-item>
  63. <u-form-item label="参加人数:" borderBottom prop="numberOfParticipants">
  64. <u--input v-model="content.numberOfParticipants" border="none" placeholder="请填写参加人数"></u--input>
  65. </u-form-item>
  66. </view>
  67. <view v-if="fkFlow == '009'">
  68. <u-form-item label="姓名:" borderBottom ref="item1">
  69. <u--input v-model="content.name" border="none" readonly></u--input>
  70. </u-form-item>
  71. <u-form-item label="请(休)假类别:" borderBottom prop="leaveTpye">
  72. <uni-data-select v-model="content.leaveTpye" :clear="false" placeholder="请选择请假类别"
  73. :localdata="statusList"></uni-data-select>
  74. </u-form-item>
  75. <u-form-item label="起止日期:" borderBottom prop="leaveStartTime" @click="show = true">
  76. <view :style="{color:content.leaveStartTime==null?'rgb(192, 196, 204)':''}">
  77. {{content.leaveStartTime == null?'请选择起止日期':content.leaveStartTime+' 至 '+content.leaveEndTime}}
  78. </view>
  79. </u-form-item>
  80. <u-form-item label="请(休)假天数:" borderBottom ref="item1">
  81. <u--input v-model="content.leaveNumber" border="none" readonly
  82. placeholder="请填写请(休)假天数"></u--input>
  83. </u-form-item>
  84. <u-form-item label="请(休)假事由:" borderBottom prop="leaveReason">
  85. <u--textarea v-model="content.leaveReason" placeholder="请填写请(休)假事由" border="none"
  86. height="100"></u--textarea>
  87. </u-form-item>
  88. <u-form-item label="接收人:" borderBottom prop="toEmpsName" v-if="fzr == true" @click="peoShow = true">
  89. <view :style="{color:content.toEmpsName==null?'rgb(192, 196, 204)':''}">
  90. {{content.params.toEmps == null?'请选择接收人':content.toEmpsName}}
  91. </view>
  92. </u-form-item>
  93. </view>
  94. <view style="padding: 0 20rpx;">
  95. <u-button type="primary" text="提交" @click="submit" style="margin-top: 40rpx;"></u-button>
  96. </view>
  97. </u--form>
  98. </view>
  99. <u-calendar :show="show" mode="range" allowSameDay @confirm="confirm" @close="show = false"></u-calendar>
  100. <u-modal :show="peoShow" title="选择接收人" showCancelButton @cancel="cancel" @confirm="queren">
  101. <view style="width: 100%;height: 40vh;overflow: auto;" v-if="peoShow == true">
  102. <u-radio-group
  103. v-model="value" @change="radioChange"
  104. iconPlacement="right">
  105. <u-collapse accordion style="width: 100%;">
  106. <u-collapse-item :title="v.Name" :name="v.No" :key="v.No" v-for="v in deptList" style="width: 100%;">
  107. <view style="font-size: 32rpx; padding: 20rpx 0; border-bottom: 1px solid #eaeaea;" v-for=" i in userList" :key="i.NO" v-if="i.FK_Dept == v.No">
  108. <u-radio :label="i.Name" :name="i"></u-radio>
  109. </view>
  110. </u-collapse-item>
  111. </u-collapse>
  112. </u-radio-group>
  113. </view>
  114. </u-modal>
  115. </view>
  116. </template>
  117. <script>
  118. import { handleTree } from '../../utils/wjw'
  119. // import uButton from "../../uni_modules/uview-ui/components/u-button/u-button.vue"
  120. export default {
  121. data() {
  122. return {
  123. workid: null,
  124. flowNo: null,
  125. id: null,
  126. content: null,
  127. statusList: [],
  128. //上个页面传过来的参数
  129. parameter: null,
  130. fkFlow: null, // 006 中层出差 007 外出授课备案 009请假
  131. show: false, //日历
  132. fzr:false,//判断是否是负责人
  133. peoShow:false,
  134. deptList:[],//部门列表
  135. userList:[],//人员列表
  136. value:null,
  137. rules: {},
  138. rules1: {
  139. destination: {
  140. type: 'string',
  141. required: true,
  142. message: '请填写目的地',
  143. trigger: ['blur', 'change']
  144. },
  145. startTime: {
  146. type: 'string',
  147. required: true,
  148. message: '请选择起止日期',
  149. trigger: ['blur', 'change']
  150. },
  151. reason: {
  152. type: 'string',
  153. required: true,
  154. message: '请填写出差事由',
  155. trigger: ['blur', 'change']
  156. },
  157. toEmpsName:{
  158. type: 'string',
  159. required: true,
  160. message: '请选择接收人',
  161. trigger: ['blur', 'change']
  162. },
  163. },
  164. rules2: {
  165. inviteUnit: {
  166. type: 'string',
  167. required: true,
  168. message: '请填写邀请单位',
  169. trigger: ['blur', 'change']
  170. },
  171. trainName: {
  172. type: 'string',
  173. required: true,
  174. message: '请填写培训名称',
  175. trigger: ['blur', 'change']
  176. },
  177. destination: {
  178. type: 'string',
  179. required: true,
  180. message: '请填写目的地',
  181. trigger: ['blur', 'change']
  182. },
  183. startTime: {
  184. type: 'string',
  185. required: true,
  186. message: '请选择起止时间',
  187. trigger: ['blur', 'change']
  188. },
  189. teacherTitle: {
  190. type: 'string',
  191. required: true,
  192. message: '请填写授课题目',
  193. trigger: ['blur', 'change']
  194. },
  195. numberOfParticipants: {
  196. type: 'number',
  197. required: true,
  198. message: '请填写参加人数',
  199. trigger: ['blur', 'change']
  200. },
  201. },
  202. rules3: {
  203. leaveReason: null,
  204. leaveTpye: {
  205. type: 'string',
  206. required: true,
  207. message: '请填写请假类别',
  208. trigger: ['blur', 'change']
  209. },
  210. leaveStartTime: {
  211. type: 'string',
  212. required: true,
  213. message: '请选择起止时间',
  214. trigger: ['blur', 'change']
  215. },
  216. leaveReason: {
  217. type: 'string',
  218. required: true,
  219. message: '请填写请假事由',
  220. trigger: ['blur', 'change']
  221. },
  222. toEmpsName:{
  223. type: 'string',
  224. required: true,
  225. message: '请选择接收人',
  226. trigger: ['blur', 'change']
  227. },
  228. },
  229. }
  230. },
  231. onLoad(options) {
  232. let that = this
  233. let roles = uni.getStorageSync('userInfo').roles
  234. if(options.fkFlow=='006'){
  235. this.getPeoList(options.fkFlow)
  236. }
  237. for(let i in roles){
  238. if(roles[i].roleKey == 'chushifzr' && options.fkFlow=='009'){
  239. this.fzr = true
  240. this.getPeoList(options.fkFlow)
  241. break
  242. }
  243. }
  244. that.parameter = options
  245. that.fkFlow = options.fkFlow
  246. that.type = options.type
  247. that.workid = options.workid
  248. that.flowNo = options.flowNo
  249. uni.setNavigationBarTitle({
  250. title: options.title
  251. })
  252. if (options.fkFlow == '009') {
  253. this.getDicts()
  254. }
  255. this.getContent(options.fkFlow)
  256. this.getRules(options.fkFlow)
  257. },
  258. methods: {
  259. // 查询请假类型
  260. getDicts() {
  261. uni.$u.http.get('/system/dict/data/type/leave_type').then(res => {
  262. this.statusList = res.data.map((item, index) => {
  263. let obj = {
  264. value: item.dictValue,
  265. id: item.dictValue,
  266. text: item.dictLabel
  267. }
  268. return obj
  269. })
  270. })
  271. },
  272. //提交待办
  273. submit() {
  274. this.$refs.uForm.validate().then(res => {
  275. uni.showLoading({
  276. title:"请稍等...",
  277. mask:true
  278. })
  279. switch (this.fkFlow) {
  280. case '006':
  281. uni.$u.http.post("/system/work/startOutWork", this.content).then(res => {
  282. if (res.data.VarAcceptersName != "" && res.data.VarAcceptersName != "结束") {
  283. uni.showToast({
  284. title: "已发送到" + res.data.VarToNodeName + "节点,接收人:" + res
  285. .data.VarAcceptersName,
  286. icon: "none",
  287. mask: true,
  288. duration: 3000
  289. })
  290. } else if (res.data.VarAcceptersName == "结束") {
  291. uni.showToast({
  292. title: res.data.Message,
  293. icon: "none",
  294. mask: true,
  295. duration: 3000
  296. })
  297. } else {
  298. uni.showToast({
  299. title: res.data.Message.replace(/[@]/g, ""),
  300. icon: "none",
  301. mask: true,
  302. duration: 3000
  303. })
  304. }
  305. uni.$emit('query', {
  306. a: 'back'
  307. })
  308. setTimeout(() => {
  309. uni.navigateBack()
  310. }, 2000)
  311. }).catch(res => {
  312. uni.hideLoading()
  313. uni.showToast({
  314. title: "请稍后重试",
  315. icon: "none"
  316. })
  317. })
  318. break
  319. case '007':
  320. uni.$u.http.post("/system/registration/startTeacherOut", this.content).then(res => {
  321. if (res.data.VarAcceptersName != "" && res.data.VarAcceptersName != "结束") {
  322. uni.showToast({
  323. title: "已发送到" + res.data.VarToNodeName + "节点,接收人:" + res
  324. .data.VarAcceptersName,
  325. icon: "none",
  326. mask: true,
  327. duration: 3000
  328. })
  329. } else if (res.data.VarAcceptersName == "结束") {
  330. uni.showToast({
  331. title: res.data.Message,
  332. icon: "none",
  333. mask: true,
  334. duration: 3000
  335. })
  336. } else {
  337. uni.showToast({
  338. title: res.data.Message.replace(/[@]/g, ""),
  339. icon: "none",
  340. mask: true,
  341. duration: 3000
  342. })
  343. }
  344. uni.$emit('query', {
  345. a: 'back'
  346. })
  347. setTimeout(() => {
  348. uni.navigateBack()
  349. }, 2000)
  350. }).catch(res => {
  351. uni.hideLoading()
  352. uni.showToast({
  353. title: "请稍后重试",
  354. icon: "none"
  355. })
  356. })
  357. break
  358. case '009':
  359. uni.$u.http.post("/oa/leave/startLeave", this.content).then(res => {
  360. if (res.data.VarAcceptersName != "" && res.data.VarAcceptersName != "结束") {
  361. uni.showToast({
  362. title: "已发送到" + res.data.VarToNodeName + "节点,接收人:" + res
  363. .data.VarAcceptersName,
  364. icon: "none",
  365. mask: true,
  366. duration: 3000
  367. })
  368. } else if (res.data.VarAcceptersName == "结束") {
  369. uni.showToast({
  370. title: res.data.Message,
  371. icon: "none",
  372. mask: true,
  373. duration: 3000
  374. })
  375. } else {
  376. uni.showToast({
  377. title: res.data.Message.replace(/[@]/g, ""),
  378. icon: "none",
  379. mask: true,
  380. duration: 3000
  381. })
  382. }
  383. uni.$emit('query', {
  384. a: 'back'
  385. })
  386. setTimeout(() => {
  387. uni.navigateBack()
  388. }, 2000)
  389. }).catch(res => {
  390. uni.hideLoading()
  391. uni.showToast({
  392. title: "请稍后重试",
  393. icon: "none"
  394. })
  395. })
  396. break
  397. }
  398. }).catch(errors => {
  399. console.log(errors)
  400. })
  401. },
  402. //日历选择
  403. confirm(e) {
  404. switch (this.fkFlow) {
  405. case '006':
  406. this.content.startTime = e[0]
  407. this.content.endTime = e[e.length - 1]
  408. break
  409. case '007':
  410. this.content.startTime = e[0]
  411. this.content.endTime = e[e.length - 1]
  412. break
  413. case '009':
  414. this.content.leaveStartTime = e[0]
  415. this.content.leaveEndTime = e[e.length - 1]
  416. if(e[0]==e[e.length - 1]){
  417. this.content.leaveNumber = 1
  418. }else{
  419. this.content.leaveNumber = e.length
  420. }
  421. break
  422. }
  423. this.show = false
  424. },
  425. groupChange(e) {
  426. this.content.provinceType = e
  427. },
  428. radioChange(e){
  429. console.log(e)
  430. this.content.params.toEmps = e.NO
  431. this.content.toEmpsName = e.Name
  432. },
  433. cancel(){
  434. this.peoShow = false
  435. this.content.params.toEmps = null
  436. this.content.toEmpsName = null
  437. this.value = null
  438. },
  439. queren(){
  440. this.peoShow = false
  441. },
  442. getContent(v) {
  443. switch (v) {
  444. case '006':
  445. this.content = {
  446. outWorkDept: uni.getStorageSync('userInfo').dept.deptName,
  447. userName: uni.getStorageSync('userInfo').nickName,
  448. destination: null,
  449. provinceType: '0',
  450. startTime: null,
  451. endTime: null,
  452. reason: null,
  453. toEmpsName:null,
  454. params:{
  455. toEmps:null
  456. }
  457. }
  458. break
  459. case '007':
  460. this.content = {
  461. userName: uni.getStorageSync('userInfo').nickName,
  462. leaveTpye: null,
  463. trainName: null,
  464. destination: null,
  465. startTime: null,
  466. endTime: null,
  467. teacherTitle: null,
  468. numberOfParticipants: null
  469. }
  470. break
  471. case '009':
  472. this.content = {
  473. name: uni.getStorageSync('userInfo').nickName,
  474. deptId:uni.getStorageSync('userInfo').dept.deptId,
  475. inviteUnit: null,
  476. leaveStartTime: null,
  477. leaveEndTime: null,
  478. leaveNumber: null,
  479. leaveReason: null,
  480. params:{}
  481. }
  482. if(this.fzr == true){
  483. this.content.params.toEmps = null
  484. this.content.toEmpsName = null
  485. }
  486. break
  487. }
  488. },
  489. getRules(v) {
  490. switch (v) {
  491. case '006':
  492. this.rules = this.rules1
  493. break
  494. case '007':
  495. this.rules = this.rules2
  496. break
  497. case '009':
  498. this.rules = this.rules3
  499. break
  500. }
  501. },
  502. //获取接收人信息
  503. getPeoList(v){
  504. uni.$u.http.get(`/jflow/restful/GenerNextStepNodeEmpsNoWorkId?flowNo=${v}&toNodeID=602`).then(res=>{
  505. this.deptList = res.Depts
  506. this.userList = res.Emps
  507. })
  508. }
  509. },
  510. onReady() {
  511. //如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则。
  512. this.$refs.uForm.setRules(this.rules)
  513. },
  514. }
  515. </script>
  516. <style lang="scss" scoped>
  517. .content {
  518. font-size: 32rpx;
  519. }
  520. .tab {
  521. width: 48%;
  522. height: 100%;
  523. box-sizing: border-box;
  524. display: flex;
  525. align-items: center;
  526. justify-content: center;
  527. }
  528. .active {
  529. color: #2979ff
  530. }
  531. </style>