liu_manage.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443
  1. <template>
  2. <view class="content">
  3. <!-- 提交记录 -->
  4. <view style="min-height: 100vh;">
  5. <view class="select_submit">
  6. <view style="width: 100px;margin-left: 9rpx;position: absolute;">
  7. <uni-data-select
  8. v-model="value3"
  9. :localdata="shenfen"
  10. @change="changeShen"
  11. ></uni-data-select>
  12. </view>
  13. <view style="width: 80px;margin-left: 196rpx;position: absolute;">
  14. <uni-data-select
  15. v-model="value"
  16. :localdata="zhuangtai"
  17. @change="changezhuang"
  18. ></uni-data-select>
  19. </view>
  20. <view style="width: 80px;margin-left: 396rpx;">
  21. <uni-data-select
  22. v-model="value2"
  23. :localdata="TimeRanges"
  24. @change="changetime"
  25. ></uni-data-select>
  26. </view>
  27. <!-- 不同状态的记录 -->
  28. <view :class="item.department=='4'?'submit-list2':'submit-list'" v-for="(item,index) in submit" :key="index" v-if="item.department=='4'">
  29. <text @click="clickDetail(item.id,item.department)">
  30. <text class="submit-title" v-if="item.department=='4'">临时人员</text>
  31. <!-- <text class="submit-title" v-if="item.department=='4'">教师换课</text> -->
  32. <text class="submit-time">{{item.submissionTime}}</text>
  33. <view class="submit-line"></view>
  34. <view class="submit-start" style="color: rgba(0, 0, 0, 1);">附件:</view>
  35. <view class="submit-start" style="color: rgba(0, 0, 0, 1);">
  36. <!-- {{item.imageUrl!=null&&item.imageUrl!=''}}3{{(item.imageUrl).split(',')}} -->
  37. <text v-if="item.imageUrl!=null&&item.imageUrl!=''">
  38. <image @click.stop="clickImg2(item2)" style="color: rgba(0, 97, 255, 1);width: 200rpx;height: 200rpx;margin-left: 20rpx;" :src="item2" v-for="(item2,index2) in (item.imageUrl).split(',')" :key="index2">
  39. </image>
  40. </text>
  41. </view>
  42. <view class="submit-start">开始时间:{{item.startTime}}</view>
  43. <view class="submit-end">结束时间:{{item.endTime}}</view>
  44. <view class="submit-teacher" v-if="item.department=='4'">换课老师:{{item.changeUsersName}}</view>
  45. <view class="submit-remark">
  46. 部门:{{item.orgName}}
  47. <!-- <template v-if="item.orgName=='0'">其他</template>
  48. <template v-if="item.orgName=='1'">学生</template>
  49. <template v-if="item.orgName=='4'">教职工</template>
  50. <template v-if="item.orgName=='5'">校友</template>
  51. <template v-if="item.orgName=='6'">访客</template>
  52. <template v-if="item.orgName=='7'">临时人员</template> -->
  53. </view>
  54. <view class="submit-remark">提交人:{{item.usersName}}</view>
  55. <view class="submit-remark">房间数量:{{item.houseCount}}</view>
  56. <view class="submit-remark">申请原因:{{item.reasonApplication}}</view>
  57. <view class="submit-type1" v-if="item.status==0">已拒绝</view>
  58. <view class="submit-type1" v-if="item.status==1">待审批</view>
  59. <view class="submit-type2" v-if="item.status==2">处理中</view>
  60. <view class="submit-type" v-if="item.status==3">已同意</view>
  61. </text>
  62. <template v-if="approverType=='1'">
  63. <template v-if="dengji==0">
  64. <view class="submit-disagree" v-if="item.status==1 || item.status==2" @click="disagree(item.id)">驳回</view>
  65. <view class="submit-agree" v-if="item.status==1 || item.status==2" @click="agree(item.id)">同意</view>
  66. </template>
  67. <template v-else>
  68. </template>
  69. </template>
  70. <template v-if="approverType=='2'">
  71. <template v-if="dengji==0">
  72. <view class="submit-disagree" v-if="item.status==2" @click="disagree(item.id)">驳回</view>
  73. <view class="submit-agree" v-if="item.status==2" @click="agree(item.id)">同意</view>
  74. </template>
  75. <template v-else>
  76. <view class="submit-disagree" v-if="item.status==1" @click="disagree(item.id)">驳回</view>
  77. <view class="submit-agree" v-if="item.status==1" @click="agree(item.id)">同意</view>
  78. </template>
  79. </template>
  80. <view style="height: 20px;"></view>
  81. </view>
  82. </view>
  83. </view>
  84. </view>
  85. </template>
  86. <script>
  87. import {
  88. shenpiguiju,
  89. getManaLinlist,
  90. getManaTealist,
  91. shenpiLinshi,
  92. shenpiTeacher
  93. } from '../../utils/api_hotel.js'
  94. export default {
  95. data() {
  96. return {
  97. // 提交记录
  98. value3: 0,
  99. shenfen: [
  100. { value: 0, text: "临时人员" },
  101. // { value: 1, text: "教师换课" },
  102. ],
  103. value: '',
  104. zhuangtai: [
  105. { value: 0, text: "已拒绝" },
  106. { value: 1, text: "待审批" },
  107. { value: 2, text: "处理中" },
  108. { value: 3, text: "已同意" },
  109. { value: '', text: "全部" },
  110. ],
  111. value2: 2,
  112. TimeRanges: [
  113. { value: 0, text: "近一周" },
  114. { value: 1, text: "本月" },
  115. { value: 2, text: "全部" },
  116. ],
  117. submit:[],
  118. page:1,
  119. size:10,
  120. startTime:'',
  121. endTime:'',
  122. nowTime: new Date().toISOString().slice(0, 10),//当前日期2024-07-23
  123. totalCount:0,
  124. agreestatu:'',//1:同意 0:拒绝
  125. dengji:localStorage.getItem('parentId'),//当前人等级,0最上级
  126. approverType:'',//审批规则,1最上级审,2批次审
  127. }
  128. },
  129. onLoad() {
  130. this.shenpiGui()
  131. },
  132. mounted() {
  133. },
  134. methods: {
  135. //点击放大图片
  136. clickImg2(item2) {
  137. // console.log(item.srcUrl)
  138. uni.previewImage({
  139. urls: [item2], //需要预览的图片http链接列表,多张的时候,url直接写在后面就行了
  140. current: '', // 当前显示图片的http链接,默认是第一个
  141. success: function(res) {},
  142. fail: function(res) {},
  143. complete: function(res) {},
  144. })
  145. },
  146. //审批规则
  147. shenpiGui(){
  148. let _self = this
  149. shenpiguiju().then((res) => {
  150. if (res.success) {
  151. _self.approverType=res.data.approverType
  152. _self.getManageLin()
  153. } else {
  154. uni.showToast({
  155. title: res.message
  156. })
  157. }
  158. }).catch((err) => {
  159. uni.showToast({
  160. title: err.message
  161. })
  162. });
  163. },
  164. //管理员查看临时人员记录
  165. getManageLin(){
  166. let _self = this
  167. // adminMenuId身份类型,localStorage.getItem('manager'),//1管理员,0不是管理员
  168. // 状态,0:已拒绝,1:待审批,2:处理中,3:已同意
  169. var data="?adminMenuId="+localStorage.getItem('adminMenuId')+"&startTime="+this.startTime+"&endTime="+this.endTime+"&status="+this.value
  170. +"&page="+this.page+"&size="+this.size+'&OrgIds='+localStorage.getItem('OrgIds')
  171. getManaLinlist(data).then((res) => {
  172. if (res.success) {
  173. _self.totalCount=res.data.totalCount
  174. if (_self.page == 1) {
  175. _self.submit = res.data.list
  176. } else {
  177. _self.submit = [..._self.submit, ...res.data.list]
  178. }
  179. uni.stopPullDownRefresh();
  180. uni.hideLoading()
  181. } else {
  182. uni.showToast({
  183. title: res.message
  184. })
  185. }
  186. }).catch((err) => {
  187. uni.showToast({
  188. title: err.message
  189. })
  190. });
  191. },
  192. //管理员查看换课教师记录
  193. getManageTeacher(){
  194. let _self = this
  195. // adminMenuId身份类型,localStorage.getItem('manager'),//1管理员,0不是管理员
  196. // 状态,0:已拒绝,1:待审批,2:处理中,3:已同意
  197. var data="?adminMenuId="+localStorage.getItem('adminMenuId')+"&startTime="+this.startTime+"&endTime="+this.endTime+"&status="+this.value+"&page="+this.page+"&size="+this.size
  198. getManaTealist(data).then((res) => {
  199. if (res.success) {
  200. _self.totalCount=res.data.totalCount
  201. if (_self.page == 1) {
  202. _self.submit = res.data.list
  203. } else {
  204. _self.submit = [..._self.submit, ...res.data.list]
  205. }
  206. uni.stopPullDownRefresh();
  207. uni.hideLoading()
  208. } else {
  209. uni.showToast({
  210. title: res.message
  211. })
  212. }
  213. }).catch((err) => {
  214. uni.showToast({
  215. title: err.message
  216. })
  217. });
  218. },
  219. //驳回
  220. disagree(id){
  221. this.agreestatu='0'
  222. var id=id
  223. if(this.value3==0){
  224. this.shenpiLinshi(id)
  225. }else if(this.value3==1){
  226. this.shenpiTeacher(id)
  227. }
  228. },
  229. //同意
  230. agree(id){
  231. this.agreestatu='1'
  232. var id=id
  233. if(this.value3==0){
  234. this.shenpiLinshi(id)
  235. }else if(this.value3==1){
  236. this.shenpiTeacher(id)
  237. }
  238. },
  239. // 审批临时人员
  240. shenpiLinshi(id){
  241. let _self = this
  242. this.$axios.defaults.headers.common['token'] = localStorage.getItem('token');
  243. this.$axios.defaults.headers.common['request_token'] = this.submitToken;
  244. this.$axios.defaults.headers.common['Content-Type'] ='application/json'
  245. var data={
  246. "id": id, //审批表id
  247. "adminMenuId": localStorage.getItem('adminMenuId'),//1管理员,0不是管理员
  248. "status": _self.agreestatu, //审批状态 1:同意 0:拒绝
  249. "adminId": localStorage.getItem('adminId'),//管理端id
  250. "remark": "" ,//审批备注
  251. }
  252. shenpiLinshi(data).then((res) => {
  253. if (res.success) {
  254. uni.showToast({
  255. title: '审批成功',
  256. icon: 'success',
  257. duration: 1500
  258. })
  259. setTimeout(function(){
  260. if(_self.value3==1){
  261. _self.page=1
  262. _self.getManageTeacher()
  263. }else if(_self.value3==0){
  264. _self.page=1
  265. _self.getManageLin()
  266. }
  267. },1500);
  268. } else {
  269. uni.showToast({
  270. title: res.message,
  271. duration: 1500
  272. })
  273. }
  274. }).catch((err) => {
  275. uni.showToast({
  276. title: err.message
  277. })
  278. });
  279. },
  280. // 审批教师换课
  281. shenpiTeacher(id){
  282. let _self = this
  283. this.$axios.defaults.headers.common['token'] = localStorage.getItem('token');
  284. this.$axios.defaults.headers.common['request_token'] = this.submitToken;
  285. this.$axios.defaults.headers.common['Content-Type'] ='application/json'
  286. var data={
  287. "id": id, //审批表id
  288. "adminMenuId": localStorage.getItem('adminMenuId'),//1管理员,0不是管理员
  289. "status": _self.agreestatu, //审批状态 1:同意 0:拒绝
  290. "adminId": localStorage.getItem('adminId'),//管理端id
  291. "remark": "" ,//审批备注
  292. }
  293. shenpiTeacher(data).then((res) => {
  294. if (res.success) {
  295. uni.showToast({
  296. title: '审批成功',
  297. icon: 'success',
  298. duration: 1500
  299. })
  300. setTimeout(function(){
  301. if(_self.value3==1){
  302. _self.page=1
  303. _self.getManageTeacher()
  304. }else if(_self.value3==0){
  305. _self.page=1
  306. _self.getManageLin()
  307. }
  308. },1500);
  309. } else {
  310. uni.showToast({
  311. title: res.message,
  312. duration: 1500
  313. })
  314. }
  315. }).catch((err) => {
  316. uni.showToast({
  317. title: err.message
  318. })
  319. });
  320. },
  321. // 提交记录
  322. //选择审批类型身份
  323. changeShen(e){
  324. this.value3=e
  325. if(this.value3==1){
  326. this.getManageTeacher()
  327. }else if(this.value3==0){
  328. this.getManageLin()
  329. }
  330. },
  331. // 选择审批状态
  332. changezhuang(e) {
  333. this.value=e
  334. if(this.value3==1){
  335. this.getManageTeacher()
  336. }else if(this.value3==0){
  337. this.getManageLin()
  338. }
  339. },
  340. //获得本周的开始时间:
  341. getStartDayOfWeek(time) {
  342. let now = new Date(time); // 当前日期
  343. let nowDayOfWeek = now.getDay(); // 今天本周的第几天
  344. let day = nowDayOfWeek || 7;
  345. let nowDay = now.getDate(); // 当前日
  346. let nowMonth = now.getMonth(); // 当前月
  347. return this.formatDate(new Date(now.getFullYear(), nowMonth, nowDay + 1 - day));
  348. },
  349. //获得本周的结束时间:
  350. getEndDayOfWeek(time) {
  351. let now = new Date(time); // 当前日期
  352. let nowDayOfWeek = now.getDay(); // 今天本周的第几天
  353. let day = nowDayOfWeek || 7;
  354. let nowDay = now.getDate(); // 当前日
  355. let nowMonth = now.getMonth(); // 当前月
  356. return this.formatDate(new Date(now.getFullYear(), nowMonth, nowDay + 7 - day));
  357. },
  358. //获得本月的开始时间:
  359. getStartDayOfMonth(time) {
  360. let now = new Date(time); // 当前日期
  361. let nowDay = now.getDate(); // 当前日
  362. let nowMonth = now.getMonth(); // 当前月
  363. return this.formatDate(new Date(now.getFullYear(), nowMonth, 1));
  364. },
  365. // 日期格式化
  366. formatDate(date) {
  367. let myyear = date.getFullYear();
  368. let mymonth = date.getMonth() + 1;
  369. let myweekday = date.getDate();
  370. if (mymonth < 10) {
  371. mymonth = '0' + mymonth;
  372. }
  373. if (myweekday < 10) {
  374. myweekday = '0' + myweekday;
  375. }
  376. return (myyear + '-' + mymonth + '-' + myweekday);
  377. },
  378. // 选择时间
  379. changetime(e) {
  380. this.value2=e
  381. if(this.value2==0){
  382. this.startTime=this.getStartDayOfWeek(this.nowTime).slice(0, 10)+' 00:00:00'
  383. this.endTime=this.getEndDayOfWeek(this.nowTime).slice(0, 10)+' 23:59:59'
  384. }else if(this.value2==1){
  385. this.startTime=this.getStartDayOfMonth(this.nowTime).slice(0, 10)+' 00:00:00'
  386. this.endTime=this.nowTime+' 23:59:59'
  387. }else if(this.value2==2){
  388. this.startTime=''
  389. this.endTime=''
  390. }
  391. if(this.value3==1){
  392. this.getManageTeacher()
  393. }else if(this.value3==0){
  394. this.getManageLin()
  395. }
  396. },
  397. // 跳转到详情页面
  398. clickDetail(id,department){
  399. uni.navigateTo({
  400. url: "../liuchengManger/detail/teach_detail?id="+id+"&department="+department
  401. })
  402. },
  403. onReachBottom: function() {
  404. if (this.submit.length < this.totalCount) {
  405. wx.showLoading({
  406. title: '加载中...',
  407. })
  408. this.page = this.page + 1;
  409. if(this.value3==1){
  410. this.getManageTeacher()
  411. }else if(this.value3==0){
  412. this.getManageLin()
  413. }
  414. } else {
  415. uni.showToast({
  416. title: '已经到底了',
  417. icon: 'none'
  418. })
  419. }
  420. },
  421. onPullDownRefresh: function() {
  422. this.page = 1;
  423. if(this.value3==1){
  424. this.getManageTeacher()
  425. }else if(this.value3==0){
  426. this.getManageLin()
  427. }
  428. },
  429. }
  430. }
  431. </script>
  432. <style>
  433. @import url("./css/liu_manage.css");
  434. </style>