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 11 KiB

4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358
  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="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-input title="政治面貌" placeholder="请填写" :value="displayListItem(StuInfoFreshEntity, 'PartyFaceNo')" disabled right />
  18. </view>
  19. <!-- {{ StuInfoFreshEntity.GenderNo }} -->
  20. <!-- <view class="welLine"></view> -->
  21. <view class="welT" style="padding-top: 10px;">采集照片信息</view>
  22. <view class="welBox">
  23. <input type="hidden" id="Photo" value="" />
  24. <input id="files" type="file" accept="image/*" />
  25. <view class="welImgAdd">
  26. <!--<view id="welImgBtn">上传照片</view>-->
  27. <img id="PhotoImg" :src="imgSrc" alt="" />
  28. </view>
  29. <!--<view class="welText">说明:近期两寸免冠正面彩色照小于100K</view>-->
  30. </view>
  31. <view class="welLine"></view>
  32. <view class="welT" style="padding-top: 10px;">自然信息</view>
  33. <view class="welLine"></view>
  34. <view class="welBox"><l-input v-model="queryData.RegionNo" title="籍贯" placeholder="请填写" right /></view>
  35. <view class="welT" style="padding-top: 10px;">通讯信息</view>
  36. <view class="welLine"></view>
  37. <view class="welBox">
  38. <l-input v-model="queryData.FamilyAddress" title="家庭住址" placeholder="请填写" right />
  39. <l-input v-model="queryData.telephone" title="联系电话" placeholder="请填写" right />
  40. </view>
  41. <view class="welT" style="padding-top: 10px;">
  42. 家庭成员(直系家属)
  43. <text class="text-xxl cuIcon cuIcon-add" @click="add('StuInfoFreshFamilyEntities')"></text>
  44. </view>
  45. <view class="welBox" id="StuInfoFreshFamily" v-show="queryData.StuInfoFreshFamilyEntities.length != 0">
  46. <view class="welCon" v-for="(item, i) in queryData.StuInfoFreshFamilyEntities" :key='i'>
  47. <l-input v-model="item.Name" title="姓名" placeholder="请填写" right />
  48. <!-- <l-input v-model="item.Relation" title="" placeholder="请填写" right /> -->
  49. <l-select v-model="item.Relation" :range="dataSource.FamilyRelation" title="与本人关系" placeholder="请选择" />
  50. <l-select v-model="item.Sex" :range="dataSource.GenderNo" title="性别" placeholder="请选择" />
  51. <l-input v-model="item.Age" title="年龄" placeholder="请填写" right />
  52. <!-- <l-input v-model="item.Politicy" title="政治面貌" placeholder="请填写" right /> -->
  53. <l-select v-model="item.Politicy" :range="dataSource.PartyFaceNo" title="政治面貌" placeholder="请选择" />
  54. <view class="welDel" @click="del('StuInfoFreshFamilyEntities', i)"><text class="text-xxl cuIcon cuIcon-move"></text></view>
  55. </view>
  56. </view>
  57. <view class="welT" style="padding-top: 10px;">
  58. 紧急联系人
  59. <text class="text-xxl cuIcon cuIcon-add" @click="add('StuInfoFreshEmergePeopleEntities')"></text>
  60. </view>
  61. <view class="welBox" id="StuInfoFreshEmergePeople" v-show="queryData.StuInfoFreshEmergePeopleEntities.length != 0">
  62. <view class="welCon" v-for="(item, i) in queryData.StuInfoFreshEmergePeopleEntities" :key='i'>
  63. <l-input v-model="item.Name" title="姓名" placeholder="请填写" right />
  64. <l-input v-model="item.Relation" title="与本人关系" placeholder="请填写" right />
  65. <l-input v-model="item.Telephone" title="手机号码" placeholder="请填写" right />
  66. <l-input v-model="item.Mobile" title="座机号码" placeholder="请填写" right />
  67. <l-input v-model="item.Address" title="联系地址" placeholder="请填写" right />
  68. <view class="welDel" @click="del('StuInfoFreshEmergePeopleEntities', i)"><text class="text-xxl cuIcon cuIcon-move"></text></view>
  69. </view>
  70. </view>
  71. <view class="btn" @click="tapBtn">保存</view>
  72. </view>
  73. </template>
  74. <script>
  75. import moment from 'moment';
  76. import get from 'lodash/get';
  77. import set from 'lodash/set';
  78. export default {
  79. data() {
  80. return {
  81. imgSrc: '',
  82. scheme: {
  83. PartyFaceNo: {
  84. type: 'sourceData',
  85. dataSource: '1',
  86. dataSourceId: 'BCdPartyFace,partyface,partyfaceno'
  87. },
  88. GenderNo:{
  89. type: 'dataItem',
  90. dataType: 'dataDictionary'
  91. }
  92. },
  93. userInfo: {},
  94. dataSource:{
  95. GenderNo: Object.values(this.GET_GLOBAL('dataDictionary').usersex).map(t => ({ value: t.value, text: t.text })),
  96. FamilyRelation: Object.values(this.GET_GLOBAL('dataDictionary').FamilyRelation).map(t => ({ value: t.value, text: t.text })),
  97. PartyFaceNo:[]
  98. },
  99. StuInfoFreshFamilyEntities:{
  100. Name: '',
  101. Age: '',
  102. Sex: '1',
  103. Politicy: '01',
  104. Relation: '01'
  105. },
  106. StuInfoFreshEmergePeopleEntities:{
  107. Name: '',
  108. Relation: '',
  109. Telephone: '',
  110. Mobile: '',
  111. Address: ''
  112. },
  113. queryData:{
  114. ID: '',
  115. RegionNo: '',
  116. FamilyAddress: '',
  117. telephone: '',
  118. Photo: '',
  119. StuInfoFreshFamilyEntities:[],
  120. StuInfoFreshEmergePeopleEntities: []
  121. },
  122. StuInfoFreshEntity:{
  123. }
  124. };
  125. },
  126. methods: {
  127. init() {
  128. // console.log(this.API)
  129. let _this = this;
  130. Promise.all([
  131. this.FETCH_DATASOURCE('BCdPartyFace').then(data => {
  132. // console.log(data)
  133. this.dataSource.PartyFaceNo = data.data.map(t => ({
  134. text: t.partyface,
  135. value: t.partyfaceno
  136. }));
  137. }),
  138. () => {}
  139. ]);
  140. _this.LOADING('加载数据…');
  141. _this.HTTP_GET('StuInfoFresh/stuInfoFreshEntity', _this.userInfo.account, '加载数据时出错').then(res => {
  142. this.HIDE_LOADING();
  143. // console.log(res);
  144. _this.StuInfoFreshEntity = _this.COPY(res.StuInfoFreshEntity);
  145. _this.queryData.StuInfoFreshFamilyEntities = _this.COPY(res.StuInfoFreshFamilyList);
  146. _this.queryData.StuInfoFreshEmergePeopleEntities = _this.COPY(res.StuInfoFreshEmergePeopleList);
  147. _this.queryData.ID = res.StuInfoFreshEntity.ID;
  148. _this.queryData.Photo = res.StuInfoFreshEntity.Photo;
  149. _this.queryData.telephone = res.StuInfoFreshEntity.telephone;
  150. _this.queryData.FamilyAddress = res.StuInfoFreshEntity.FamilyAddress;
  151. _this.queryData.RegionNo = res.StuInfoFreshEntity.RegionNo;
  152. _this.imgSrc = this.API.slice(0,-1) + res.Url;
  153. });
  154. },
  155. tapBtn() {
  156. console.log(this.queryData)
  157. this.LOADING('正在提交数据…');
  158. this.HTTP_GET('StuInfoFresh/saveStuInfoFresh', this.queryData, '加载数据时出错').then(res => {
  159. this.HIDE_LOADING();
  160. // console.log(res);
  161. if (res) {
  162. this.TOAST('保存成功');
  163. }
  164. });
  165. },
  166. add(str) {
  167. let jsons = this.COPY(this[str]);
  168. this.queryData[str].push(jsons)
  169. // console.log(this.queryData[str])
  170. },
  171. del(str, num) {
  172. this.queryData[str].splice(num, 1)
  173. },
  174. // 显示列表中的标题项
  175. displayListItem(item, field) {
  176. const fieldItem = this.scheme[field];
  177. const value = item[field];
  178. // console.log(Object.values(this.GET_GLOBAL('dataDictionary').usersex));
  179. switch (fieldItem.type) {
  180. case 'currentInfo':
  181. case 'organize':
  182. return fieldItem.dataType === 'time' ? value : get(this.GET_GLOBAL(fieldItem.dataType), `${value}.name`, '');
  183. case 'dataItem':
  184. const sex = this.dataSource[field].find(t => t.value === String(value));
  185. return get(sex, 'text', '');
  186. case 'sourceData':
  187. const BCdPartyFace = this.dataSource[field].find(t => t.value === String(value));
  188. return get(BCdPartyFace, 'text', '');
  189. case 'radio':
  190. case 'select':
  191. const selectItem = this.dataSource[field].find(t => t.value === String(value));
  192. return get(selectItem, 'text', '');
  193. case 'checkbox':
  194. if (!value || value.split(',').length <= 0) {
  195. return '';
  196. }
  197. const checkboxItems = value.split(',');
  198. return this.dataSource[field]
  199. .filter(t => checkboxItems.includes(t.value))
  200. .map(t => t.text)
  201. .join(',');
  202. case 'datetime':
  203. if (!value) {
  204. return '';
  205. }
  206. return moment(value).format(Number(fieldItem.dateformat) === 0 ? 'YYYY年 M月 D日' : 'YYYY-MM-DD HH:mm');
  207. default:
  208. return value === null || value === undefined ? '' : value;
  209. }
  210. }
  211. },
  212. created() {
  213. this.userInfo = this.GET_GLOBAL('loginUser'); //获取登录信息
  214. this.init();
  215. }
  216. };
  217. </script>
  218. <style lang="less" scoped>
  219. /deep/ .cu-form-group {
  220. min-height: 40px;
  221. }
  222. .welcome {
  223. padding: 1px 0px 20px;
  224. background: #fff;
  225. }
  226. .welT {
  227. font-size: 16px;
  228. margin-bottom: 10px;
  229. line-height: 26px;
  230. padding: 0 12px;
  231. }
  232. .welT text {
  233. width: 26px;
  234. height: 26px;
  235. line-height: 24px;
  236. border: 1px solid #efefef;
  237. border-radius: 4px;
  238. float: right;
  239. text-align: center;
  240. color: #999;
  241. }
  242. .welLine {
  243. height: 1px;
  244. background: #efefef;
  245. // margin: 10px -12px;
  246. }
  247. .welInput {
  248. overflow: hidden;
  249. font-size: 14px;
  250. margin-top: 10px;
  251. }
  252. .welInput span {
  253. float: left;
  254. width: 26%;
  255. text-align: right;
  256. line-height: 30px;
  257. }
  258. .welInput input {
  259. display: block;
  260. margin-left: 28%;
  261. width: 72%;
  262. border: 1px solid #efefef;
  263. border-radius: 4px;
  264. height: 30px;
  265. line-height: 28px;
  266. padding: 0 10px;
  267. margin-bottom: 0;
  268. }
  269. .welCon {
  270. padding: 10px;
  271. border: 1px solid #efefef;
  272. margin-top: 18px;
  273. border-radius: 4px;
  274. position: relative;
  275. }
  276. .welDel {
  277. position: absolute;
  278. top: -8px;
  279. left: -8px;
  280. background: #fff;
  281. }
  282. .welDel text {
  283. text-align: center;
  284. width: 26px;
  285. height: 26px;
  286. display: block;
  287. line-height: 24px;
  288. border: 1px solid #efefef;
  289. border-radius: 50%;
  290. }
  291. .welImgAdd {
  292. text-align: center;
  293. line-height: 0;
  294. }
  295. #files {
  296. opacity: 0;
  297. -webkit-opacity: 0;
  298. z-index: 9;
  299. display: none;
  300. }
  301. #welImgBtn {
  302. display: block;
  303. width: 110px;
  304. height: 30px;
  305. text-align: center;
  306. line-height: 26px;
  307. border: 2px solid #efefef;
  308. border-radius: 4px;
  309. font-size: 14px;
  310. color: #999;
  311. margin: 10px auto;
  312. cursor: pointer;
  313. }
  314. .welImgAdd {
  315. min-height: 110px;
  316. }
  317. #PhotoImg {
  318. width: 110px;
  319. height: 110px;
  320. }
  321. .btnBox {
  322. margin-top: 20px;
  323. text-align: center;
  324. }
  325. #saveBtn {
  326. margin: auto;
  327. margin-top: 25px;
  328. width: 92%;
  329. }
  330. #StuInfoFreshFamily,#StuInfoFreshEmergePeople{
  331. padding: 0 15px;
  332. }
  333. </style>