dimission.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. <template>
  2. <view>
  3. <view style="padding:5rpx 20rpx 45rpx 20rpx;">
  4. <view class="desc">
  5. <uni-row>
  6. <uni-col :span="5">
  7. <view class="desc" style="font-size: 25rpx;">
  8. 姓名
  9. </view>
  10. </uni-col>
  11. <uni-col :span="19">
  12. <view>
  13. <uni-easyinput primaryColor="#37babd" v-model="data.userName" disabled>
  14. </uni-easyinput>
  15. </view>
  16. </uni-col>
  17. </uni-row>
  18. </view>
  19. <view class="desc">
  20. <uni-row>
  21. <uni-col :span="5">
  22. <view class="desc" style="font-size: 25rpx;">
  23. 所属部门
  24. </view>
  25. </uni-col>
  26. <uni-col :span="19">
  27. <view>
  28. <uni-easyinput primaryColor="#37babd" v-model="data.department" disabled>
  29. </uni-easyinput>
  30. </view>
  31. </uni-col>
  32. </uni-row>
  33. </view>
  34. <view class="desc">
  35. <uni-row>
  36. <uni-col :span="5">
  37. <view class="desc" style="font-size: 25rpx;">
  38. 入职时间
  39. </view>
  40. </uni-col>
  41. <uni-col :span="19">
  42. <view>
  43. <uni-datetime-picker type="date" :clear-icon="false" v-model="data.hiredate"
  44. @maskClick="maskClick" @change="onchange()" disabled />
  45. </view>
  46. </uni-col>
  47. </uni-row>
  48. </view>
  49. <view class="desc">
  50. <uni-row>
  51. <uni-col :span="5">
  52. <view class="desc" style="font-size: 25rpx;">
  53. 离职时间
  54. </view>
  55. </uni-col>
  56. <uni-col :span="19">
  57. <view>
  58. <uni-datetime-picker type="date" :clear-icon="false" v-model="form.applyTime"
  59. @maskClick="maskClick" @change="onchange()" />
  60. </view>
  61. </uni-col>
  62. </uni-row>
  63. </view>
  64. <view class="desc">
  65. <uni-row>
  66. <uni-col :span="5">
  67. <view class="desc" style="font-size: 25rpx;">
  68. 离职原因
  69. </view>
  70. </uni-col>
  71. <uni-col :span="19">
  72. <view class="pickerView">
  73. <picker @change="bindPickerChange" :value="dimissionType.index" :range="dimissionType.data"
  74. range-key="dictLabel">
  75. <view class="pickerText"
  76. v-if="dimissionType.data && dimissionType.data.length>0 && dimissionType.index !== undefined">
  77. {{ dimissionType.data[dimissionType.index].dictLabel }}
  78. </view>
  79. <view class="pickerText" v-else>
  80. 待 选 择
  81. </view>
  82. </picker>
  83. </view>
  84. </uni-col>
  85. </uni-row>
  86. </view>
  87. <view class="desc">
  88. <view class="desc" style="font-size: 25rpx;">
  89. 详细说明:
  90. </view>
  91. <view>
  92. <uni-easyinput type="textarea" primaryColor="#37babd" v-model="form.remark">
  93. </uni-easyinput>
  94. </view>
  95. </view>
  96. </view>
  97. <u-gap height="70" bgColor="#ffffff"></u-gap>
  98. <view class="bottim_view">
  99. <view>
  100. <u-row>
  101. <u-col span="11">
  102. <u-button :disabled="isDisabled" class="btnDoPay" shape="circle" @click="submit"
  103. color="rgb(55,186,189)" text="提交"></u-button>
  104. </u-col>
  105. </u-row>
  106. </view>
  107. </view>
  108. <!-- 下一步选择人员弹窗 -->
  109. <uni-popup ref="popup" background-color="#fff">
  110. <view style="height: 800rpx;">
  111. <view class="desc">
  112. <uni-row>
  113. <uni-col :span="10">
  114. <view style="font-size: 40rpx;color: rgb(145, 145, 145);">
  115. </view>
  116. </uni-col>
  117. <uni-col :span="11">
  118. <view style="font-size: 40rpx;color: rgb(98, 98, 98);">
  119. 下一步
  120. </view>
  121. </uni-col>
  122. <uni-col :span="3">
  123. <view @click="submitPass" style="font-size: 40rpx;color: rgb(55,186,189);">
  124. 确认
  125. </view>
  126. </uni-col>
  127. </uni-row>
  128. </view>
  129. <view>
  130. <!-- -->
  131. <uni-row>
  132. <uni-col>
  133. <view style="padding: 15rpx 20rpx;">
  134. <uni-data-picker ref="picker" placeholder="请选择" :popup-title="selectTitle"
  135. :localdata="dataTree" v-model="hxForm.candidate" @change="nextApprovalChange">
  136. </uni-data-picker>
  137. </view>
  138. </uni-col>
  139. </uni-row>
  140. </view>
  141. </view>
  142. </uni-popup>
  143. </view>
  144. </template>
  145. <script>
  146. export default {
  147. data() {
  148. return {
  149. isDisabled: false,
  150. data: {},
  151. selectTitle: '',
  152. hxForm: {},
  153. dataTree: [],
  154. form: {},
  155. dimissionType: {
  156. data: [],
  157. index: undefined
  158. }
  159. }
  160. },
  161. onLoad() {
  162. //写入基本信息
  163. this.dimissionType.data = uni.getStorageSync('dimission_type')
  164. this.data = uni.getStorageSync('files')
  165. this.form.applyUserName = this.data.userName
  166. //翻译部门
  167. this.data.department = this.$dictTranslation(this.data.department, 'deptData', 'dept')
  168. },
  169. methods: {
  170. async submit() {
  171. this.isDisabled = true
  172. if (!this.form.applyTime) {
  173. this.isDisabled = false
  174. uni.showModal({
  175. content: '请选择离职时间',
  176. title: '提交失败',
  177. showCancel: false
  178. })
  179. return
  180. }
  181. if (!this.form.dimissionType) {
  182. this.isDisabled = false
  183. uni.showModal({
  184. content: '请选择离职原因',
  185. title: '提交失败',
  186. showCancel: false
  187. })
  188. return
  189. }
  190. setTimeout(() => {
  191. this.isDisabled = false
  192. }, 1000)
  193. //统一写入参数
  194. this.form.personnelId = this.data.id
  195. this.form.hireOrDimission = '2'
  196. const {
  197. data: res
  198. } = await this.$httpRequest({
  199. url: '/app/submitApply/personnelDimission',
  200. method: 'post',
  201. data: this.form
  202. });
  203. if (res.code === 200) {
  204. this.dataTree = res.data.tree
  205. this.hxForm.taskId = res.data.taskId
  206. this.$refs.popup.open('bottom')
  207. this.selectTitle = "请选择" + this.dataTree[0].text
  208. this.isDisabled = false
  209. } else {
  210. this.$showModal(res.msg)
  211. }
  212. this.isDisabled = false
  213. },
  214. nextApprovalChange(e) {
  215. // console.log('onchange:', e.detail.value[1].text);
  216. this.hxForm.applyUserName = e.detail.value[1].text
  217. this.hxForm.candidate = e.detail.value[1].value
  218. },
  219. async submitPass() {
  220. if (!this.hxForm.candidate) {
  221. uni.showModal({
  222. content: '请选择' + this.dataTree[0].text,
  223. title: '提交失败',
  224. showCancel: false,
  225. })
  226. }
  227. const {
  228. data: res
  229. } = await this.$httpRequest({
  230. url: '/app/task/submit/candidate?taskId=' + this.hxForm.taskId +
  231. '&candidate=' + this.hxForm.candidate + '&applyUserName=' + this.hxForm.applyUserName,
  232. method: 'get',
  233. });
  234. if (res.code === 200) {
  235. uni.showModal({
  236. content: '已提交给审批人员',
  237. title: '提交成功',
  238. showCancel: false,
  239. success() {
  240. uni.navigateBack()
  241. }
  242. })
  243. } else {
  244. uni.showModal({
  245. content: res.msg,
  246. title: '提交失败',
  247. showCancel: false,
  248. success() {
  249. uni.navigateBack()
  250. }
  251. })
  252. }
  253. },
  254. onchange(e) {
  255. setTimeout(() => {
  256. }, 200)
  257. },
  258. maskClick(e) {},
  259. bindPickerChange: function(e) {
  260. this.dimissionType.index = e.detail.value
  261. this.form.dimissionType = this.dimissionType.data[this.dimissionType.index].dictValue
  262. },
  263. }
  264. }
  265. </script>
  266. <style lang="scss" scoped>
  267. .desc {
  268. padding: 10rpx 5rpx;
  269. color: #818181;
  270. font-size: 20rpx;
  271. }
  272. .pickerView {
  273. // align-items: flex-end;
  274. padding: 10rpx 20rpx;
  275. border: 1rpx #eeeeee solid;
  276. }
  277. .pickerText {
  278. font-size: 26rpx;
  279. color: #b1b1b1;
  280. }
  281. .bottim_view {
  282. padding: 5px 20px 30px;
  283. position: fixed;
  284. left: 0px;
  285. bottom: 0px;
  286. width: 100%;
  287. height: 40px;
  288. background-color: #ffffff;
  289. }
  290. </style>