Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 
 
 
 

355 Zeilen
12 KiB

  1. <template>
  2. <view class="page">
  3. <view v-if="ready">
  4. <l-select
  5. @input="setValue('Acc_StuDayRoutine.DeptNo', $event)"
  6. :value="getValue('Acc_StuDayRoutine.DeptNo')"
  7. :disabled="!edit"
  8. :range="dataSource.Acc_StuDayRoutine.DeptNo"
  9. @change="DeptNoChange"
  10. title="专业部"
  11. required
  12. />
  13. <l-select
  14. @input="setValue('Acc_StuDayRoutine.MajorNo', $event)"
  15. :value="getValue('Acc_StuDayRoutine.MajorNo')"
  16. :disabled="!edit"
  17. :range="dataSource.Acc_StuDayRoutine.MajorNo"
  18. @change="MajorNoChange"
  19. title="专业"
  20. required
  21. />
  22. <l-select
  23. @input="setValue('Acc_StuDayRoutine.ClassNo', $event)"
  24. :value="getValue('Acc_StuDayRoutine.ClassNo')"
  25. :disabled="!edit"
  26. :range="dataSource.Acc_StuDayRoutine.ClassNo"
  27. @change="ClassNoChange"
  28. title="班级"
  29. required
  30. />
  31. <l-select
  32. @input="setValue('Acc_StuDayRoutine.StuNo', $event)"
  33. :value="getValue('Acc_StuDayRoutine.StuNo')"
  34. :disabled="!edit"
  35. :range="dataSource.Acc_StuDayRoutine.StuNo"
  36. title="学生"
  37. required
  38. />
  39. <l-date-picker
  40. @input="setValue('Acc_StuDayRoutine.Date', $event)"
  41. :value="getValue('Acc_StuDayRoutine.Date')"
  42. :disabled="!edit"
  43. title="日期"
  44. required
  45. />
  46. <l-input
  47. @input="setValue('Acc_StuDayRoutine.AddScore', $event)"
  48. :value="getValue('Acc_StuDayRoutine.AddScore')"
  49. :disabled="!edit"
  50. title="奖分"
  51. />
  52. <l-input
  53. @input="setValue('Acc_StuDayRoutine.MinusScore', $event)"
  54. :value="getValue('Acc_StuDayRoutine.MinusScore')"
  55. :disabled="!edit"
  56. title="扣分"
  57. />
  58. <l-textarea
  59. @input="setValue('Acc_StuDayRoutine.Reason', $event)"
  60. :value="getValue('Acc_StuDayRoutine.Reason')"
  61. :readonly="!edit"
  62. title="奖扣分原因"
  63. required
  64. />
  65. <!-- 附件上传 -->
  66. <l-input
  67. @input="setValue('Acc_StuDayRoutine.Files', $event)"
  68. :value="getValue('Acc_StuDayRoutine.Files')"
  69. disabled="disabled"
  70. v-show="false"
  71. title="附件值"
  72. />
  73. <uploadFile :number="5" :folderId="folderId" :value="fileList" :readonly="!edit" :title="fileTitle" :required="false"></uploadFile>
  74. </view>
  75. <view v-if="ready" class="bg-white margin-tb padding" style="padding-top: 0; overflow: hidden;">
  76. <l-button v-if="edit" @click="action('save')" size="lg" color="green" class="block margin-top" block>
  77. 提交保存
  78. </l-button>
  79. <l-button v-if="edit && mode !== 'create'" @click="action('reset')" size="lg" line="red" class="block margin-top" block>
  80. 取消编辑
  81. </l-button>
  82. </view>
  83. </view>
  84. </template>
  85. <script>
  86. /*
  87. * 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架(http://www.learun.cn)
  88. * Copyright (c) 2013-2020 上海力软信息技术有限公司
  89. * 创建人:超级管理员
  90. * 日 期:2022-09-16 09:37
  91. * 描 述:学生日常规管理
  92. */
  93. /**
  94. * 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用
  95. * 请在移动端 /pages.json 中的 pages 字段中添加一条记录:
  96. * { "path": "pages/LogisticsManagement/Acc_StuDayRoutine/single", "style": { "navigationBarTitleText": "表单详情页" } }
  97. *
  98. * (navigationBarTitleText 字段为本页面的标题文本,可以修改)
  99. * (必须自行操作该步骤,力软代码生成器不会自动帮您修改 /pages.json 文件)
  100. */
  101. import get from 'lodash/get'
  102. import set from 'lodash/set'
  103. import moment from 'moment'
  104. import customPageMixins from '@/common/custompage.js'
  105. import uploadFile from '@/components/upload-file2.vue'
  106. export default {
  107. mixins: [customPageMixins],
  108. components:{
  109. uploadFile,
  110. },
  111. data() {
  112. return {
  113. // 页面相关参数
  114. id: null,
  115. mode: null,
  116. edit: null,
  117. ready: false,
  118. fileList:[],//附件列表
  119. folderId:null,//附件随机文件夹id
  120. fileTitle:'附件上传',//附件label值
  121. // 表单数据
  122. current: {},
  123. origin: {},
  124. // 表单项数据结构
  125. scheme: {
  126. Acc_StuDayRoutine: {
  127. DeptNo: { type: 'select', title: '专业部', dataSource: '1', dataSourceId: 'CdDeptInfo,deptname,deptno', verify: 'NotNull' },
  128. MajorNo: { type: 'select', title: '专业', dataSource: '1', dataSourceId: 'CdMajorInfo,majorname,majorno', verify: 'NotNull' },
  129. ClassNo: { type: 'select', title: '班级', dataSource: '1', dataSourceId: 'bjsj,classname,classno', verify: 'NotNull' },
  130. StuNo: { type: 'select', title: '学生', dataSource: '1', dataSourceId: 'StuInfoBasic,stuname,stuno', verify: 'NotNull' },
  131. Date: { type: 'datetime', title: '日期', dateformat: '0' , verify: 'NotNull'},
  132. AddScore: { type: 'text', title: '奖分' },
  133. MinusScore: { type: 'text', title: '扣分' },
  134. Reason: { type: 'textarea', title: '奖扣分原因' , verify: 'NotNull'},
  135. Files: { type: "text", title: "附件上传" },
  136. },
  137. },
  138. // 数据源
  139. dataSource: {
  140. Acc_StuDayRoutine: {
  141. DeptNo: [],
  142. MajorNo: [],
  143. ClassNo: [],
  144. StuNo:[],
  145. },
  146. } ,
  147. StuNoAll:[],
  148. }
  149. },
  150. async onLoad({ type, id }) {
  151. await this.init(type, id)
  152. },
  153. methods: {
  154. // 页面初始化
  155. async init(type, id) {
  156. this.folderId=this.GUID();
  157. // console.log('附件随机文件夹id:'+this.folderId);
  158. this.LOADING('加载数据中...')
  159. this.id = id
  160. this.mode = type
  161. this.edit = ['create', 'edit'].includes(this.mode)
  162. // 拉取表单数据,同时拉取所有来自数据源的选单数据
  163. await Promise.all([
  164. this.FETCH_DATASOURCE('CdDeptInfo').then(result => {
  165. this.dataSource.Acc_StuDayRoutine.DeptNo = result.data.sort((a,b)=>{return a.deptsort-b.deptsort}).map(t => ({ text: t.deptname, value: t.deptno }))
  166. }),
  167. this.FETCH_DATASOURCE('CdMajorInfo').then(result => {
  168. this.dataSource.Acc_StuDayRoutine.MajorNo = result.data.sort((a,b)=>{return a.majorno-b.majorno}).map(t => ({ text: t.majorname, value: t.majorno }))
  169. }),
  170. this.FETCH_DATASOURCE('bjsj').then(result => {
  171. this.dataSource.Acc_StuDayRoutine.ClassNo = result.data.sort((a,b)=>{return b.classno-a.classno}).map(t => ({ text: t.classname, value: t.classno }))
  172. }),
  173. this.FETCH_DATASOURCE('StuInfoBasic').then(result => {
  174. this.dataSource.Acc_StuDayRoutine.StuNo = result.data.map(t => ({ text: t.stuname, value: t.stuno,classno:t.classno }))
  175. this.StuNoAll = JSON.parse(JSON.stringify(this.dataSource.Acc_StuDayRoutine.StuNo))
  176. }),
  177. () => {}
  178. ])
  179. await this.fetchForm()
  180. this.ready = true
  181. this.HIDE_LOADING()
  182. },
  183. // 加载表单数据
  184. async fetchForm() {
  185. if (this.mode === 'create') {
  186. this.origin = await this.getDefaultForm()
  187. } else {
  188. const result = await this.HTTP_GET('learun/adms/LogisticsManagement/Acc_StuDayRoutine/form', this.id)
  189. this.origin = await this.formatFormData(result)
  190. }
  191. this.current = this.COPY(this.origin)
  192. //加载附件值数据
  193. // console.log('附件值赋值前:'+this.getValue('Acc_StuDayRoutine.Files'));
  194. if (this.getValue('Acc_StuDayRoutine.Files') == ""||this.getValue('Acc_StuDayRoutine.Files') == undefined ||this.getValue('Acc_StuDayRoutine.Files') == null) {
  195. this.setValue('Acc_StuDayRoutine.Files',this.folderId);
  196. // console.log('附件值赋值后:'+this.getValue('Acc_StuDayRoutine.Files'));
  197. }else{
  198. this.folderId=this.getValue('Acc_StuDayRoutine.Files');
  199. // console.log('文件夹id赋值后:'+this.folderId);
  200. //请求‘获取附件列表’接口
  201. this.fileList = await this.FETCH_FILEList(this.getValue('Acc_StuDayRoutine.Files'));
  202. }
  203. // console.log('origin:'+JSON.stringify(this.origin) )
  204. // console.log('current:'+JSON.stringify(this.current))
  205. },
  206. // 点击 「编辑」、「重置」、「保存」、「删除」 按钮
  207. async action(type) {
  208. switch (type) {
  209. case 'edit':
  210. this.edit = true
  211. break
  212. case 'reset':
  213. this.current = this.COPY(this.origin)
  214. this.edit = false
  215. break
  216. case 'save':
  217. const verifyResult = this.verifyForm()
  218. if (verifyResult.length > 0) {
  219. this.CONFIRM('表单验证失败', verifyResult.join('\n'))
  220. return
  221. }
  222. if (!(await this.CONFIRM('提交确认', '确定要提交本页表单内容吗?', true))) {
  223. return
  224. }
  225. this.LOADING('正在提交...')
  226. const postData = await this.getPostData(this.id)
  227. // console.log('页面提交数据:'+JSON.stringify(postData));
  228. this.HTTP_POST('learun/adms/LogisticsManagement/Acc_StuDayRoutine/save', postData, '表单提交保存失败').then(success => {
  229. this.HIDE_LOADING()
  230. if (!success) {
  231. return
  232. }
  233. this.EMIT('LogisticsManagementAcc_StuDayRoutine-list-change')
  234. this.NAV_BACK()
  235. this.TOAST('提交保存成功')
  236. })
  237. break
  238. case 'delete':
  239. if (!(await this.CONFIRM('删除项目', '确定要删除本项吗?', true))) {
  240. return
  241. }
  242. this.LOADING('提交删除中...')
  243. this.HTTP_POST('learun/adms/LogisticsManagement/Acc_StuDayRoutine/delete', this.id, '删除失败').then(success => {
  244. this.HIDE_LOADING()
  245. if (!success) {
  246. return
  247. }
  248. this.EMIT('LogisticsManagementAcc_StuDayRoutine-list-change')
  249. this.NAV_BACK()
  250. this.this.TOAST('删除成功', 'success')
  251. })
  252. break
  253. default: break
  254. }
  255. },
  256. // 获取表单值
  257. getValue(path) {
  258. return get(this.current, path)
  259. },
  260. // 设置表单值
  261. setValue(path, val) {
  262. set(this.current, path, val)
  263. },
  264. //多条件查询:专业部改变事件
  265. async DeptNoChange(){
  266. if (this.getValue('Acc_StuDayRoutine.DeptNo') != null && this.getValue('Acc_StuDayRoutine.DeptNo')!=undefined && this.getValue('Acc_StuDayRoutine.DeptNo') != "") {
  267. this.FETCH_DATASOURCE('CdMajorInfo').then(result => {
  268. this.dataSource.Acc_StuDayRoutine.MajorNo = result.data.sort((a,b)=>{return a.majorno-b.majorno}).filter(t=>t.deptno===this.getValue('Acc_StuDayRoutine.DeptNo')).map(t => ({ text: t.majorname, value: t.majorno }))
  269. })
  270. }else{
  271. this.FETCH_DATASOURCE('CdMajorInfo').then(result => {
  272. this.dataSource.Acc_StuDayRoutine.MajorNo = result.data.sort((a,b)=>{return a.majorno-b.majorno}).map(t => ({ text: t.majorname, value: t.majorno }))
  273. })
  274. }
  275. this.setValue('Acc_StuDayRoutine.MajorNo','');
  276. this.setValue('Acc_StuDayRoutine.ClassNo','');
  277. this.setValue('Acc_StuDayRoutine.StuNo','');
  278. },
  279. //多条件查询:专业改变事件
  280. async MajorNoChange(){
  281. if (this.getValue('Acc_StuDayRoutine.MajorNo') != null && this.getValue('Acc_StuDayRoutine.MajorNo')!=undefined && this.getValue('Acc_StuDayRoutine.MajorNo') != "") {
  282. this.FETCH_DATASOURCE('bjsj').then(result => {
  283. this.dataSource.Acc_StuDayRoutine.ClassNo = result.data.sort((a,b)=>{return b.classno-a.classno}).filter(t=>t.majorno===this.getValue('Acc_StuDayRoutine.MajorNo')).map(t => ({ text: t.classname, value: t.classno }))
  284. })
  285. }else{
  286. this.FETCH_DATASOURCE('bjsj').then(result => {
  287. this.dataSource.Acc_StuDayRoutine.ClassNo = result.data.sort((a,b)=>{return b.classno-a.classno}).map(t => ({ text: t.classname, value: t.classno }))
  288. })
  289. }
  290. this.setValue('Acc_StuDayRoutine.ClassNo','');
  291. this.setValue('Acc_StuDayRoutine.StuNo','');
  292. },
  293. //多条件查询:班级改变事件
  294. async ClassNoChange(){
  295. if (!this.getValue('Acc_StuDayRoutine.ClassNo')) {
  296. // this.FETCH_DATASOURCE('StuInfoBasic').then(result => {
  297. // this.dataSource.Acc_StuDayRoutine.StuNo = result.data.filter(t=>t.classno===this.getValue('Acc_StuDayRoutine.ClassNo')).map(t => ({ text: t.stuname, value: t.stuno }))
  298. // })
  299. this.dataSource.Acc_StuDayRoutine.StuNo = this.StuNoAll
  300. }else{
  301. // this.FETCH_DATASOURCE('StuInfoBasic').then(result => {
  302. // this.dataSource.Acc_StuDayRoutine.StuNo = result.data.map(t => ({ text: t.stuname, value: t.stuno }))
  303. // })
  304. this.dataSource.Acc_StuDayRoutine.StuNo = this.StuNoAll.filter(t=>t.classno == this.getValue('Acc_StuDayRoutine.ClassNo'))
  305. }
  306. this.setValue('Acc_StuDayRoutine.StuNo','');
  307. },
  308. }
  309. }
  310. </script>