You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

312 lines
8.0 KiB

8 months ago
  1. <template>
  2. <view class="pageBgImg">
  3. <topNavbar title="排课计划"></topNavbar>
  4. <view class="pad">
  5. <view class="card">
  6. <view class="row">
  7. <view class="lab">计划开始日期</view>
  8. <view class="rightCon" @click="showClick('classBeginDate')">
  9. <view class="inputBox">
  10. <input type="text" v-model="form.classBeginDate" placeholder="请选择" disabled style="pointer-events: none;">
  11. </view>
  12. <view class="icon">
  13. <u-icon name="arrow-right" :size="12" :color="'#696B72'"></u-icon>
  14. </view>
  15. </view>
  16. </view>
  17. <view class="row">
  18. <view class="lab">计划结束日期</view>
  19. <view class="rightCon" @click="showClick('classEndDate')">
  20. <view class="inputBox">
  21. <input type="text" v-model="form.classEndDate" placeholder="请选择" disabled style="pointer-events: none;">
  22. </view>
  23. <view class="icon">
  24. <u-icon name="arrow-right" :size="12" :color="'#696B72'"></u-icon>
  25. </view>
  26. </view>
  27. </view>
  28. <view class="row">
  29. <view class="lab">选择训练场地</view>
  30. <view class="rightCon" @click="showSite=true">
  31. <view class="inputBox">
  32. <input type="text" v-model="form.siteName" placeholder="请选择" disabled style="pointer-events: none;">
  33. </view>
  34. <view class="icon">
  35. <u-icon name="arrow-right" :size="12" :color="'#696B72'"></u-icon>
  36. </view>
  37. </view>
  38. </view>
  39. <view class="row">
  40. <view class="lab">选择开课时间段</view>
  41. <view class="rightCon" @click="$goPage('/pages/recordEntry/operate/mySchedule/mould/mould')">
  42. <view class="inputBox">
  43. <input type="text" v-model="currentMould.templateName" placeholder="请选择" disabled style="pointer-events: none;">
  44. </view>
  45. <view class="icon">
  46. <u-icon name="arrow-right" :size="12" :color="'#696B72'"></u-icon>
  47. </view>
  48. </view>
  49. </view>
  50. <view class="blueBg">
  51. <view class="time_row hui">
  52. <text>时间段</text> <text>最多人数</text>
  53. </view>
  54. <view class="time_row" v-for="(item,index) in currentMould.detailVO" :key="index">
  55. <text>{{item.startTime}} <text>-</text> {{item.endTime}}</text> <text>{{item.personCount}}</text>
  56. </view>
  57. </view>
  58. <view class="row">
  59. <view class="lab">训练科目</view>
  60. <view class="rightCon">
  61. <myRadio @changeRadio="changeRadioSubject" :radioData="radiolist1" :radioVal="{value: form.subject}"></myRadio>
  62. </view>
  63. </view>
  64. <view class="row">
  65. <view class="lab">选择教练车</view>
  66. <view class="rightCon" @click="showCar=true">
  67. <view class="inputBox">
  68. <input type="text" v-model="form.carNumber" placeholder="请选择" disabled style="pointer-events: none;">
  69. </view>
  70. <view class="icon">
  71. <u-icon name="arrow-right" :size="12" :color="'#696B72'"></u-icon>
  72. </view>
  73. </view>
  74. </view>
  75. <view class="row">
  76. <view class="lab">开放范围</view>
  77. <view class="rightCon">
  78. <myRadio @changeRadio="changeRadioOpenRange" :radioData="radiolist3" :radioVal="{value: form.openRange}"></myRadio>
  79. </view>
  80. </view>
  81. </view>
  82. <view class="btnBg" @click="scheduleClassCreateFn">确认发布</view>
  83. </view>
  84. <u-datetime-picker
  85. :show="show"
  86. :minDate="minDate"
  87. :maxDate="maxDate"
  88. mode="date"
  89. @confirm="changeDate"
  90. @cancel="show=false"
  91. ></u-datetime-picker>
  92. <u-picker :show="showSite" :columns="siteColumns" keyName="name" @confirm="changeSite" @cancel="showSite=false" ></u-picker>
  93. <u-picker :show="showCar" :columns="carColumns" keyName="licnum" @confirm="changeCarNumber" @cancel="showCar=false" ></u-picker>
  94. </view>
  95. </template>
  96. <script>
  97. import { scheduleClassCreate, getClassDateLimit, trainingSiteList, carPage} from '@/config/api.js'
  98. export default {
  99. data() {
  100. return {
  101. tmpDateName:'',//选择日期临时变量
  102. minDate: null,
  103. maxDate: null,
  104. show: false,
  105. showSite: false,
  106. showCar: false,
  107. form: {
  108. classDate: '',
  109. carNumber: '',
  110. subject: 0, //科目类别:0:不限;2:科目二;3:科目三
  111. openRange: '1', //开放范围:0:自己的学员;1:绑定的驾校的学员
  112. siteName: '',
  113. siteId: ''
  114. },
  115. formToast: {
  116. classBeginDate: '请选择开始时间',
  117. classEndDate: '请选择结束时间',
  118. siteId: '请选择场地',
  119. carNumber: '请选择车辆',
  120. },
  121. currentMould: {},
  122. siteColumns: [],
  123. carColumns: [],
  124. radiolist1: [{
  125. name: '不限制',
  126. id: 0,
  127. disabled: false
  128. },
  129. {
  130. name: '科目二',
  131. id: 2,
  132. disabled: false
  133. },
  134. {
  135. name: '科目三',
  136. id: 3,
  137. disabled: false
  138. },
  139. ],
  140. radiolist3: [{
  141. name: '我的学员',
  142. id: 0,
  143. disabled: false
  144. },
  145. {
  146. name: '所有学员',
  147. id: 1,
  148. disabled: false
  149. },
  150. ] //开放范围:0:自己的学员;1:绑定的驾校的学员
  151. }
  152. },
  153. onLoad() {
  154. this.form.deptId = this.vuex_deptId
  155. this.form.coachId = this.vuex_coachId
  156. this.getClassDateLimitFn()
  157. this.trainingSiteListFn()
  158. this.carPageFn()
  159. uni.$on('chooseMould',(item)=>{
  160. this.form.templateId = item.id
  161. this.currentMould = item
  162. console.log(item)
  163. })
  164. },
  165. methods: {
  166. // 点击显示选择日期组件
  167. showClick(name) {
  168. this.show = true
  169. this.tmpDateName = name
  170. },
  171. // 选择车牌号
  172. changeCarNumber(val) {
  173. const item = val.value[0]
  174. this.showCar = false
  175. this.form.carNumber = item.licnum
  176. // console.log()
  177. },
  178. // 发布排课计划
  179. async scheduleClassCreateFn() {
  180. for(let k in this.formToast) {
  181. if(!this.form[k])
  182. return this.$u.toast(this.formToast[k])
  183. }
  184. console.log(this.form)
  185. const res = await scheduleClassCreate(this.form)
  186. if(res.code==0) {
  187. this.$goPage('/pages/recordEntry/operate/mySchedule/mySchedule')
  188. }
  189. console.log(res)
  190. },
  191. // 选择训练场地
  192. changeSite(val) {
  193. let item = val.value[0]
  194. this.form.address = item.address
  195. this.form.seq = item.seq
  196. this.form.area = item.area
  197. this.form.siteName = item.name
  198. this.form.siteId = item.id
  199. this.showSite = false
  200. },
  201. // 获取训练场地
  202. async trainingSiteListFn() {
  203. let obj = {
  204. pageNo: 1,
  205. pageSize: 100,
  206. schoolId: this.vuex_userInfo.user.schoolId
  207. }
  208. const {data: res} = await trainingSiteList(obj)
  209. this.siteColumns = [ res ]
  210. console.log(res)
  211. },
  212. changeRadio(val) {
  213. console.log(val)
  214. },
  215. changeRadioOpenRange(val) {
  216. this.form.openRange = val
  217. },
  218. // 选择科目
  219. changeRadioSubject(val) {
  220. this.form.subject = val
  221. console.log(this.form.subject)
  222. },
  223. // 选择日期
  224. changeDate(val) {
  225. this.form[this.tmpDateName] = this.$u.date(val.value, 'yyyy-mm-dd')
  226. this.show = false
  227. console.log(val)
  228. },
  229. // 获取排课日期范围
  230. async getClassDateLimitFn() {
  231. let obj = {
  232. coachId: this.vuex_coachId
  233. }
  234. const {data: res} = await getClassDateLimit(obj)
  235. this.minDate = new Date(res.beginDateLimit)*1 + 86400000
  236. this.maxDate = new Date(res.endDateLimit)*1
  237. },
  238. async carPageFn() {
  239. let obj = {
  240. pageNo: 1,
  241. pageSize: 40,
  242. schoolId: this.vuex_schoolId,
  243. coachId: this.vuex_coachId
  244. }
  245. const {data: res} = await carPage(obj)
  246. this.carColumns = [res.list]
  247. },
  248. }
  249. }
  250. </script>
  251. <style lang="scss" scoped>
  252. .card {
  253. padding: 10rpx 28rpx;
  254. .row {
  255. display: flex;
  256. justify-content: space-between;
  257. padding: 26rpx 0;
  258. .lab {
  259. font-weight: 500;
  260. }
  261. }
  262. }
  263. .btnBg {
  264. width: 396rpx;
  265. margin: 120rpx auto 0 auto;
  266. }
  267. .rightCon {
  268. display: flex;
  269. align-items: center;
  270. .icon {
  271. margin-left: 10rpx;
  272. }
  273. .inputBox {
  274. flex: 1;
  275. input {
  276. text-align: right;
  277. font-size: 28rpx;
  278. color: #333;
  279. }
  280. }
  281. }
  282. .blueBg {
  283. background-color: #E8F3FE;
  284. padding: 12rpx 32rpx;
  285. border-radius: 16rpx;
  286. text-align: center;
  287. .time_row {
  288. display: flex;
  289. justify-content: space-between;
  290. padding: 12rpx 0;
  291. &.hui {
  292. color: #ADADAD;
  293. }
  294. text {
  295. width: 170rpx;
  296. }
  297. }
  298. }
  299. </style>