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.

list.vue 14 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432
  1. <template>
  2. <view class="welcome">
  3. <view class="welT">基本信息</view>
  4. <view class="welBox">
  5. <!-- <input type="hidden" name="ID" value="" id="ID" /> -->
  6. <l-input title="学号" placeholder="请填写" :value="StuInfoFreshEntity.StuNo" disabled right />
  7. <l-input title="准考证号" placeholder="请填写" :value="StuInfoFreshEntity.zkzh" disabled right />
  8. <l-input title="考生号" placeholder="请填写" :value="StuInfoFreshEntity.ksh" disabled right />
  9. <l-input title="姓名" placeholder="请填写" :value="StuInfoFreshEntity.StuName" disabled right />
  10. <l-input title="性别" placeholder="请填写" :value="displayListItem(StuInfoFreshEntity, 'GenderNo')" disabled right />
  11. <l-input title="系别" placeholder="请填写" :value="displayListItem(StuInfoFreshEntity, 'DeptNo')" disabled right />
  12. <l-input title="专业" placeholder="请填写" :value="StuInfoFreshEntity.MajorNo" disabled right />
  13. <l-input title="班级" placeholder="请填写" :value="StuInfoFreshEntity.ClassNo" disabled right />
  14. <l-input title="身份证号" placeholder="请填写" :value="StuInfoFreshEntity.IdentityCardNo" disabled right />
  15. <l-input title="出生日期" placeholder="请填写" :value="StuInfoFreshEntity.Birthday" disabled right />
  16. <!-- <l-input title="户口类别" placeholder="请填写" :value="StuInfoFreshEntity.ResidenceNo" disabled right /> -->
  17. <l-select v-model="StuInfoFreshEntity.ResidenceNo" disabled :range="dataSource.ResidenceNo" title="户口类别" placeholder="请选择" />
  18. <l-input title="政治面貌" placeholder="请填写" :value="displayListItem(StuInfoFreshEntity, 'PartyFaceNo')" disabled right />
  19. </view>
  20. <view class="welT" style="padding-top: 10px;">采集照片信息</view>
  21. <l-upload
  22. v-if="uploadVisiable"
  23. ref="upload"
  24. :number="1"
  25. :size="100"
  26. type="image/jpeg,image/jpg"
  27. :value.sync="photo"
  28. />
  29. <view class="passwordDes">
  30. <text>照片要求:1 . 单色背景,正面,免冠近期证件照 2 . 文件格式JPG 3 . 文件大小165320KB以下</text>
  31. </view>
  32. <view class="welLine"></view>
  33. <view class="welT" style="padding-top: 10px;">自然信息</view>
  34. <view class="welLine"></view>
  35. <view class="welBox"><l-input v-model="queryData.RegionNo" title="籍贯" placeholder="请填写" right /></view>
  36. <view class="welT" style="padding-top: 10px;">通讯信息</view>
  37. <view class="welLine"></view>
  38. <view class="welBox">
  39. <l-input v-model="queryData.FamilyAddress" title="家庭住址" placeholder="请填写" right />
  40. <l-input v-model="queryData.telephone" title="联系电话" placeholder="请填写" right />
  41. </view>
  42. <view class="welT" style="padding-top: 10px;">
  43. 家庭成员(直系家属)
  44. <text class="text-xxl cuIcon cuIcon-add" @click="add('StuInfoFreshFamilyEntities')"></text>
  45. </view>
  46. <view class="welBox" id="StuInfoFreshFamily" v-show="queryData.StuInfoFreshFamilyEntities.length != 0">
  47. <view class="welCon" v-for="(item, i) in queryData.StuInfoFreshFamilyEntities" :key='i'>
  48. <l-input v-model="item.Name" title="姓名" placeholder="请填写" right />
  49. <!-- <l-input v-model="item.Relation" title="" placeholder="请填写" right /> -->
  50. <l-select v-model="item.Relation" :range="dataSource.FamilyRelation" title="与本人关系" placeholder="请选择" />
  51. <l-select v-model="item.Sex" :range="dataSource.GenderNo" title="性别" placeholder="请选择" />
  52. <l-input v-model="item.Age" title="年龄" placeholder="请填写" right />
  53. <!-- <l-input v-model="item.Politicy" title="政治面貌" placeholder="请填写" right /> -->
  54. <l-select v-model="item.Politicy" :range="dataSource.PartyFaceNo" title="政治面貌" placeholder="请选择" />
  55. <view class="welDel" @click="del('StuInfoFreshFamilyEntities', i)"><text class="text-xxl cuIcon cuIcon-move"></text></view>
  56. </view>
  57. </view>
  58. <view class="welT" style="padding-top: 10px;">
  59. 紧急联系人
  60. <text class="text-xxl cuIcon cuIcon-add" @click="add('StuInfoFreshEmergePeopleEntities')"></text>
  61. </view>
  62. <view class="welBox" id="StuInfoFreshEmergePeople" v-show="queryData.StuInfoFreshEmergePeopleEntities.length != 0">
  63. <view class="welCon" v-for="(item, i) in queryData.StuInfoFreshEmergePeopleEntities" :key='i'>
  64. <l-input v-model="item.Name" title="姓名" placeholder="请填写" right />
  65. <l-input v-model="item.Relation" title="与本人关系" placeholder="请填写" right />
  66. <l-input v-model="item.Telephone" title="手机号码" placeholder="请填写" right />
  67. <l-input v-model="item.Mobile" title="座机号码" placeholder="请填写" right />
  68. <l-input v-model="item.Address" title="联系地址" placeholder="请填写" right />
  69. <view class="welDel" @click="del('StuInfoFreshEmergePeopleEntities', i)"><text class="text-xxl cuIcon cuIcon-move"></text></view>
  70. </view>
  71. </view>
  72. <!-- <view class="welT" style="padding-top: 10px;">附件上传</view>
  73. <uploadFile v-if="uploadVisiable" :number="10" :folderId="queryData.ID" :value="fileList"></uploadFile> -->
  74. <view class="btn" @click="submit">保存</view>
  75. </view>
  76. </template>
  77. <script>
  78. import moment from 'moment';
  79. import get from 'lodash/get';
  80. import set from 'lodash/set';
  81. import uploadFile from '@/components/upload-file.vue'
  82. export default {
  83. components:{
  84. uploadFile,
  85. },
  86. data() {
  87. return {
  88. photo:[],
  89. // fileList:[],
  90. uploadVisiable:false,
  91. imgSrc: '',
  92. scheme: {
  93. PartyFaceNo: {
  94. type: 'sourceData',
  95. dataSource: '1',
  96. dataSourceId: 'BCdPartyFace,partyface,partyfaceno'
  97. },
  98. GenderNo:{
  99. type: 'dataItem',
  100. dataType: 'dataDictionary'
  101. },
  102. DeptNo:{
  103. type: 'dataItem',
  104. dataType: 'dataDictionary'
  105. },
  106. },
  107. userInfo: {},
  108. dataSource:{
  109. DeptNo:[],
  110. GenderNo: Object.values(this.GET_GLOBAL('dataDictionary').usersex).map(t => ({ value: t.value, text: t.text })),
  111. FamilyRelation: Object.values(this.GET_GLOBAL('dataDictionary').FamilyRelation).map(t => ({ value: t.value, text: t.text })),
  112. PartyFaceNo:[],
  113. ResidenceNo:Object.values(this.GET_GLOBAL('dataDictionary').ResidenceNo).map(t => ({ value: t.value, text: t.text })),
  114. },
  115. StuInfoFreshFamilyEntities:{
  116. Name: '',
  117. Age: '',
  118. Sex: '1',
  119. Politicy: '01',
  120. Relation: '01'
  121. },
  122. StuInfoFreshEmergePeopleEntities:{
  123. Name: '',
  124. Relation: '',
  125. Telephone: '',
  126. Mobile: '',
  127. Address: ''
  128. },
  129. queryData:{
  130. ID: '',
  131. RegionNo: '',
  132. FamilyAddress: '',
  133. telephone: '',
  134. Photo: '',
  135. StuInfoFreshFamilyEntities:[],
  136. StuInfoFreshEmergePeopleEntities: []
  137. },
  138. StuInfoFreshEntity:{}
  139. };
  140. },
  141. methods: {
  142. async init() {
  143. // console.log(this.API)
  144. let _this = this;
  145. Promise.all([
  146. this.FETCH_DATASOURCE('BCdPartyFace').then(data => {
  147. // console.log(data)
  148. this.dataSource.PartyFaceNo = data.data.map(t => ({
  149. text: t.partyface,
  150. value: t.partyfaceno
  151. }));
  152. }),
  153. this.FETCH_DATASOURCE('CdDeptInfo').then(data => {
  154. this.dataSource.DeptNo = data.data.map(t => ({
  155. text: t.deptname,
  156. value: t.deptno
  157. }));
  158. }),
  159. () => {}
  160. ]);
  161. _this.LOADING('加载数据…');
  162. _this.HTTP_GET('StuInfoFresh/stuInfoFreshEntity', _this.userInfo.account, '加载数据时出错').then(async(res)=> {
  163. this.HIDE_LOADING();
  164. _this.StuInfoFreshEntity = _this.COPY(res.StuInfoFreshEntity)||{};
  165. _this.queryData.StuInfoFreshFamilyEntities = _this.COPY(res.StuInfoFreshFamilyList);
  166. _this.queryData.StuInfoFreshEmergePeopleEntities = _this.COPY(res.StuInfoFreshEmergePeopleList);
  167. _this.queryData.ID = res.StuInfoFreshEntity.ID;
  168. _this.queryData.Photo = res.StuInfoFreshEntity.Photo;
  169. let resFile = await this.FETCH_FILEINFO(res.StuInfoFreshEntity.Photo)
  170. let url = ""
  171. if(resFile&&resFile.F_FolderId){
  172. url = this.API + '/learun/adms/annexes/wxdown?' + this.URL_QUERY(resFile.F_FolderId, true)
  173. }
  174. _this.photo = (res.StuInfoFreshEntity.Photo&&url)?[{url,id:res.StuInfoFreshEntity.Photo}]:[];
  175. _this.refreshComponent()
  176. _this.queryData.telephone = res.StuInfoFreshEntity.telephone;
  177. _this.queryData.FamilyAddress = res.StuInfoFreshEntity.FamilyAddress;
  178. _this.queryData.RegionNo = res.StuInfoFreshEntity.RegionNo;
  179. // _this.imgSrc = this.API.slice(0,-1) + res.Url;
  180. });
  181. },
  182. async submit() {
  183. let validateRes = this.validate()
  184. if(validateRes.length>0){
  185. this.CONFIRM('表单验证失败', validateRes.join('\n'))
  186. return
  187. }
  188. this.LOADING('正在提交数据…');
  189. let res = await this.$refs["upload"].uploadImage()
  190. if(res&&res.length){
  191. this.queryData.Photo = res[0]["id"];
  192. }else{
  193. this.queryData.Photo = ""
  194. }
  195. this.HTTP_POST('StuInfoFresh/saveStuInfoFresh', this.queryData).then(res => {
  196. this.HIDE_LOADING();
  197. if (res) {
  198. // this.NAV_TO("/pages/my/newpassword")
  199. setTimeout(()=>{
  200. this.TOAST('保存成功');
  201. },100)
  202. this.NAV_BACK()
  203. }
  204. });
  205. },
  206. add(str) {
  207. let jsons = this.COPY(this[str]);
  208. this.queryData[str].push(jsons)
  209. // console.log(this.queryData[str])
  210. },
  211. del(str, num) {
  212. this.queryData[str].splice(num, 1)
  213. },
  214. validate(){
  215. let array = []
  216. if(!this.photo.length)array.push("[采集照片信息]:不能为空")
  217. // if(!this.queryData.RegionNo)array.push("[籍贯]:不能为空")
  218. // if(!this.queryData.FamilyAddress)array.push("[家庭住址]:不能为空")
  219. if(!this.queryData.telephone||!/^(\+\d{2,3}\-)?\d{11}$/.test(this.queryData.telephone)){
  220. let str = this.queryData.telephone?"格式错误":"不能为空"
  221. array.push("[联系电话]:" + str)
  222. }
  223. if(!this.queryData.StuInfoFreshFamilyEntities.length||
  224. !this.queryData.StuInfoFreshFamilyEntities.every((item)=>{
  225. return item.Name&&(item.Relation||item.Relation===0)&&(item.Sex||item.Sex===0)&&/^[1-9]\d*$/.test(item.Age)&&(item.Politicy||item.Politicy===0)
  226. })
  227. )array.push("[家庭成员]:未完善")
  228. // if(!this.queryData.StuInfoFreshEmergePeopleEntities.length||
  229. // !this.queryData.StuInfoFreshEmergePeopleEntities.every((item)=>{
  230. // return item.Name&&(item.Relation||item.Relation===0)&&item.Telephone&&item.Mobile&&item.Address
  231. // })
  232. // )array.push("[紧急联系人]:未完善")
  233. return array
  234. },
  235. refreshComponent(){
  236. // this.uploadVisiable = false
  237. this.$nextTick(()=>{
  238. this.uploadVisiable = true
  239. })
  240. },
  241. // 显示列表中的标题项
  242. displayListItem(item, field) {
  243. const fieldItem = this.scheme[field];
  244. const value = item[field];
  245. // console.log(Object.values(this.GET_GLOBAL('dataDictionary').usersex));
  246. switch (fieldItem.type) {
  247. case 'currentInfo':
  248. case 'organize':
  249. return fieldItem.dataType === 'time' ? value : get(this.GET_GLOBAL(fieldItem.dataType), `${value}.name`, '');
  250. case 'dataItem':
  251. const sex = this.dataSource[field].find(t => t.value === String(value));
  252. return get(sex, 'text', '');
  253. case 'sourceData':
  254. const BCdPartyFace = this.dataSource[field].find(t => t.value === String(value));
  255. return get(BCdPartyFace, 'text', '');
  256. case 'radio':
  257. case 'select':
  258. const selectItem = this.dataSource[field].find(t => t.value === String(value));
  259. return get(selectItem, 'text', '');
  260. case 'checkbox':
  261. if (!value || value.split(',').length <= 0) {
  262. return '';
  263. }
  264. const checkboxItems = value.split(',');
  265. return this.dataSource[field]
  266. .filter(t => checkboxItems.includes(t.value))
  267. .map(t => t.text)
  268. .join(',');
  269. case 'datetime':
  270. if (!value) {
  271. return '';
  272. }
  273. return moment(value).format(Number(fieldItem.dateformat) === 0 ? 'YYYY年 M月 D日' : 'YYYY-MM-DD HH:mm');
  274. default:
  275. return value === null || value === undefined ? '' : value;
  276. }
  277. }
  278. },
  279. created() {
  280. this.userInfo = this.GET_GLOBAL('loginUser'); //获取登录信息
  281. this.init();
  282. }
  283. };
  284. </script>
  285. <style lang="less" scoped>
  286. /deep/ .cu-form-group {
  287. min-height: 40px;
  288. }
  289. .welcome {
  290. padding: 1px 0px 20px;
  291. background: #fff;
  292. }
  293. .welT {
  294. font-size: 16px;
  295. margin-bottom: 10px;
  296. line-height: 26px;
  297. padding: 0 12px;
  298. }
  299. .welT text {
  300. width: 26px;
  301. height: 26px;
  302. line-height: 24px;
  303. border: 1px solid #efefef;
  304. border-radius: 4px;
  305. float: right;
  306. text-align: center;
  307. color: #999;
  308. }
  309. .welLine {
  310. height: 1px;
  311. background: #efefef;
  312. // margin: 10px -12px;
  313. }
  314. .welInput {
  315. overflow: hidden;
  316. font-size: 14px;
  317. margin-top: 10px;
  318. }
  319. .welInput span {
  320. float: left;
  321. width: 26%;
  322. text-align: right;
  323. line-height: 30px;
  324. }
  325. .welInput input {
  326. display: block;
  327. margin-left: 28%;
  328. width: 72%;
  329. border: 1px solid #efefef;
  330. border-radius: 4px;
  331. height: 30px;
  332. line-height: 28px;
  333. padding: 0 10px;
  334. margin-bottom: 0;
  335. }
  336. .welCon {
  337. padding: 10px;
  338. border: 1px solid #efefef;
  339. margin-top: 18px;
  340. border-radius: 4px;
  341. position: relative;
  342. }
  343. .welDel {
  344. position: absolute;
  345. top: -8px;
  346. left: -8px;
  347. background: #fff;
  348. }
  349. .welDel text {
  350. text-align: center;
  351. width: 26px;
  352. height: 26px;
  353. display: block;
  354. line-height: 24px;
  355. border: 1px solid #efefef;
  356. border-radius: 50%;
  357. }
  358. .welImgAdd {
  359. text-align: center;
  360. line-height: 0;
  361. }
  362. .passwordDes{
  363. color: #606266;
  364. font-size: 14px;
  365. padding: 8px;
  366. text-indent:2em;
  367. }
  368. #files {
  369. opacity: 0;
  370. -webkit-opacity: 0;
  371. z-index: 9;
  372. display: none;
  373. }
  374. #welImgBtn {
  375. display: block;
  376. width: 110px;
  377. height: 30px;
  378. text-align: center;
  379. line-height: 26px;
  380. border: 2px solid #efefef;
  381. border-radius: 4px;
  382. font-size: 14px;
  383. color: #999;
  384. margin: 10px auto;
  385. cursor: pointer;
  386. }
  387. .welImgAdd {
  388. min-height: 110px;
  389. }
  390. #PhotoImg {
  391. width: 110px;
  392. height: 110px;
  393. }
  394. .btnBox {
  395. margin-top: 20px;
  396. text-align: center;
  397. }
  398. #saveBtn {
  399. margin: auto;
  400. margin-top: 25px;
  401. width: 92%;
  402. }
  403. #StuInfoFreshFamily,#StuInfoFreshEmergePeople{
  404. padding: 0 15px;
  405. }
  406. </style>