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.
 
 
 
 
 
 

516 lines
18 KiB

  1. <template>
  2. <view class="page">
  3. <l-select :disabled="disabled" v-model="queryData.Creater" :range="dataSource.Creater" title="填报人员" :placeholder="title.Creater" />
  4. <l-date-picker v-model="queryData.CreateTime" title="填报时间" placeholder="" :end="todayTime" />
  5. <l-select v-model="queryData.Type" :range="dataSource.Type" title="类别" placeholder="请选择" />
  6. <l-select v-if="!DepartFlag" v-model="queryData.Department" :range="dataSource.Department" title="所在部门" placeholder="请选择" />
  7. <l-input v-if="DepartFlag" v-model="queryData.StudentSource" title="所在班级" placeholder="请填写所在班级" right />
  8. <l-select v-model="queryData.HealthSituation" :range="dataSource.HealthSituation" title="健康状况" placeholder="请选择" />
  9. <l-select v-model="queryData.Gender" :range="dataSource.Gender" title="性别" placeholder="请选择" />
  10. <l-input v-model="queryData.HomeAddress" title="家庭住址" placeholder="请填写家庭住址" right />
  11. <l-input v-model="queryData.Mobile" title="联系方式" placeholder="请填写联系方式" right />
  12. <l-input v-model="queryData.Objective" title="当前地址" placeholder="请填写当前地址" right />
  13. <l-select v-model="queryData.IsOut" :range="dataSource.YesOrNoInt" title="*是否外出" placeholder="请选择" @change="change('PassPlaces')" />
  14. <view class="checkInBox" v-show="queryData.IsOut == 1">
  15. <view class="checkInCon" v-for="(item, i) in queryData.PassPlaces" :key="item.Time">
  16. <view class="checkInT">
  17. 经过地点记录({{ i + 1 }})
  18. <text @click="remove('PassPlaces', i)" class="remove" v-show="queryData.PassPlaces.length > 1">删除</text>
  19. </view>
  20. <l-select v-model="item.PassType" :range="dataSource.EpiPassType" title="类别" placeholder="请选择" />
  21. <location-picker v-model="item.ProvinceArea" :code="item.ProvinceArea"></location-picker>
  22. <l-input v-model="item.Address" title="详细住址" placeholder="请填写详细住址" right />
  23. <l-datetime-picker v-model="item.Time" title="隔离时间" />
  24. <l-select v-model="item.Vehicle" :range="dataSource.Vehicle" title="交通工具" placeholder="请选择交通工具" />
  25. <l-input v-model="item.VehicleNo" title="班次号" placeholder="请填写班次号" right />
  26. </view>
  27. <view class="checkInBtn" @click="add('PassPlaces')">
  28. <text class="text-xxl cuIcon cuIcon-add"></text>
  29. 增加经过地点记录
  30. </view>
  31. </view>
  32. <l-select v-model="queryData.HasFamily" :range="dataSource.YesOrNoInt" title="*家人异常" placeholder="请选择" @change="change('ContactsDetails')" />
  33. <view class="checkInBox" v-show="queryData.HasFamily == 1">
  34. <view class="checkInCon" v-for="(item, i) in queryData.ContactsDetails" :key="item.QTTime">
  35. <view class="checkInT">
  36. 接触家人({{ i + 1 }})
  37. <text @click="remove('ContactsDetails', i)" class="remove" v-show="queryData.ContactsDetails.length > 1">删除</text>
  38. </view>
  39. <l-input v-model="item.Name" title="名字" placeholder="请填写名字" right />
  40. <l-select v-model="item.Gender" :range="dataSource.Gender" title="性别" placeholder="请选择性别" />
  41. <l-input v-model="item.Mobile" title="联系方式" placeholder="请填写联系方式" right />
  42. <l-select v-model="item.QTType" :range="dataSource.QTType" title="隔离方式" placeholder="请选择隔离方式" />
  43. <location-picker v-model="item.ProvinceArea" :code="item.ProvinceArea"></location-picker>
  44. <l-input v-model="item.QTAddress" title="隔离地点" placeholder="请填写隔离地点" right />
  45. <l-datetime-picker v-model="item.QTTime" title="隔离时间" />
  46. <l-datetime-picker v-model="item.QTContactTime" title="接触隔离时间" />
  47. <l-select v-model="item.Fever" :range="dataSource.HealthSituation" title="健康状况" placeholder="请选择健康状况" />
  48. </view>
  49. <view class="checkInBtn" @click="add('ContactsDetails')">
  50. <text class="text-xxl cuIcon cuIcon-add"></text>
  51. 增加接触家人
  52. </view>
  53. </view>
  54. <l-select v-model="queryData.HasPeople" :range="dataSource.YesOrNoInt" title="*疫区人异常" placeholder="请选择" @change="change('PeopleDetails')" />
  55. <view class="checkInBox" v-show="queryData.HasPeople == 1">
  56. <view class="checkInCon" v-for="(item, i) in queryData.PeopleDetails" :key="item.QTTime">
  57. <view class="checkInT">
  58. 接触人({{ i + 1 }})
  59. <text @click="remove('PeopleDetails', i)" class="remove" v-show="queryData.PeopleDetails.length > 1">删除</text>
  60. </view>
  61. <l-input v-model="item.Name" title="名字" placeholder="请填写名字" right />
  62. <l-select v-model="item.Gender" :range="dataSource.Gender" title="性别" placeholder="请选择性别" />
  63. <l-input v-model="item.Mobile" title="联系方式" placeholder="请填写联系方式" right />
  64. <l-select v-model="item.QTType" :range="dataSource.QTType" title="隔离方式" placeholder="请选择隔离方式" />
  65. <location-picker v-model="item.ProvinceArea" :code="item.ProvinceArea"></location-picker>
  66. <l-input v-model="item.QTAddress" title="隔离地点" placeholder="请填写隔离地点" right />
  67. <l-datetime-picker v-model="item.QTTime" title="隔离时间" />
  68. <l-datetime-picker v-model="item.QTContactTime" title="接触隔离时间" />
  69. <l-select v-model="item.Fever" :range="dataSource.HealthSituation" title="健康状况" placeholder="请选择健康状况" />
  70. </view>
  71. <view class="checkInBtn" @click="add('PeopleDetails')">
  72. <text class="text-xxl cuIcon cuIcon-add"></text>
  73. 增加接触人
  74. </view>
  75. </view>
  76. <view class="btn" @click="submit">{{ submitTxt}}</view>
  77. </view>
  78. </template>
  79. <script>
  80. import moment from 'moment';
  81. import get from 'lodash/get';
  82. import set from 'lodash/set';
  83. import todayTime from '@/common/js/todayTime.js';
  84. import locationPicker from '@/components/location/location.vue';
  85. export default {
  86. components: {
  87. locationPicker
  88. },
  89. data() {
  90. return {
  91. scheme: {
  92. Creater: {
  93. type: 'select',
  94. dataSource: '1',
  95. dataSourceId: 'BaseUser,f_realname,f_userid'
  96. }
  97. },
  98. title:{
  99. Creater: '请选择...',
  100. },
  101. disabled: false,
  102. submitTxt: '',
  103. select3: '0',
  104. pageInfo: null,
  105. userInfo: null,
  106. todayTime: todayTime.fmtDate().ymd,
  107. DepartFlag: true,
  108. //下拉
  109. dataSource: {
  110. Creater: [],
  111. Type: [],
  112. HealthSituation: [],
  113. Gender: [],
  114. YesOrNoInt: [],
  115. Department: [],
  116. EpiPassType: [],
  117. Vehicle: [],
  118. QTType: [],
  119. PassPlaces: {
  120. EpiPassType: '',
  121. ProvinceArea: '',
  122. Address: '',
  123. Time: '',
  124. Vehicle: '',
  125. VehicleNo: ''
  126. },
  127. ContactsDetails: {
  128. Name: '',
  129. Gender: '',
  130. Mobile: '',
  131. QTType: '',
  132. ProvinceArea: '',
  133. QTAddress: '',
  134. QTTime: '',
  135. QTContactTime: '',
  136. Fever: ''
  137. },
  138. PeopleDetails: {
  139. Name: '',
  140. Gender: '',
  141. Mobile: '',
  142. QTType: '',
  143. ProvinceArea: '',
  144. QTAddress: '',
  145. QTTime: '',
  146. QTContactTime: '',
  147. Fever: ''
  148. }
  149. },
  150. queryData: {
  151. keyValue: '',
  152. Creater: '',
  153. Type: '',
  154. Department: '',
  155. CreateTime: todayTime.fmtDate().ymd,
  156. StudentSource: '',
  157. HealthSituation: '',
  158. Gender: '',
  159. HomeAddress: '',
  160. Mobile: '',
  161. Objective: '',
  162. IsOut: '',
  163. PassPlaces: [
  164. {
  165. PassType: '',
  166. ProvinceArea: '',
  167. Address: '',
  168. Time: '',
  169. Vehicle: '',
  170. VehicleNo: ''
  171. }
  172. ],
  173. HasFamily: '',
  174. ContactsDetails: [
  175. {
  176. Name: '',
  177. Gender: '',
  178. Mobile: '',
  179. QTType: '',
  180. ProvinceArea: '',
  181. QTAddress: '',
  182. QTTime: '',
  183. QTContactTime: '',
  184. Fever: ''
  185. }
  186. ],
  187. HasPeople: '',
  188. PeopleDetails: [
  189. {
  190. Name: '',
  191. Gender: '',
  192. Mobile: '',
  193. QTType: '',
  194. ProvinceArea: '',
  195. QTAddress: '',
  196. QTTime: '',
  197. QTContactTime: '',
  198. Fever: ''
  199. }
  200. ]
  201. }
  202. };
  203. },
  204. methods: {
  205. async init() {
  206. let _this = this;
  207. // 拉取加载列表和数据源
  208. await Promise.all([
  209. this.FETCH_DATASOURCE('classdata').then(data => {
  210. //console.log(data)
  211. this.dataSource.Department = data.data.map(t => ({
  212. text: t.f_fullname,
  213. value: t.f_parentid
  214. }));
  215. }),
  216. this.FETCH_DATASOURCE('BaseUser').then(data => {
  217. // console.log(data)
  218. this.dataSource.Creater = data.data.map(t => ({
  219. text: t.f_realname,
  220. value: t.f_userid
  221. }));
  222. }),
  223. () => {}
  224. ]);
  225. let dataDictionary = this.GET_GLOBAL('dataDictionary');
  226. this.dataSource.Type = Object.values(dataDictionary.EUserType).map(t => ({ value: t.value, text: t.text }));
  227. this.dataSource.HealthSituation = Object.values(dataDictionary.EpiHealth).map(t => ({ value: t.value, text: t.text }));
  228. this.dataSource.Gender = Object.values(dataDictionary.usersex).map(t => ({ value: t.value, text: t.text }));
  229. this.dataSource.YesOrNoInt = Object.values(dataDictionary.YesOrNoInt).map(t => ({ value: t.value, text: t.text }));
  230. this.dataSource.EpiPassType = Object.values(dataDictionary.EpiPassType).map(t => ({ value: t.value, text: t.text }));
  231. this.dataSource.Vehicle = Object.values(dataDictionary.Vehicle).map(t => ({ value: t.value, text: t.text }));
  232. this.dataSource.QTType = Object.values(dataDictionary.QuarantineType).map(t => ({ value: t.value, text: t.text }));
  233. // console.log(this.dataSource.YesOrNoInt);
  234. // 拉取加载列表和数据源
  235. _this.pageInfo = _this.GET_PARAM(); //获取页面传递参数
  236. // console.log(_this.pageInfo);
  237. _this.queryData.keyValue = _this.pageInfo.keyValue;
  238. _this.userInfo = _this.GET_GLOBAL('loginUser');
  239. // console.log(_this.userInfo);
  240. //新建时获取登陆人信息
  241. if (_this.pageInfo.type == 'add') {
  242. _this.submitTxt = '提交';
  243. _this.dataSource.Creater = [
  244. {
  245. text: _this.userInfo.realName,
  246. value: _this.userInfo.userId
  247. }
  248. ];
  249. _this.queryData.Creater = _this.userInfo.userId;
  250. _this.queryData.Department = _this.userInfo.departmentId;
  251. _this.queryData.Gender = JSON.stringify(_this.userInfo.gender);
  252. _this.queryData.Mobile = _this.userInfo.mobile;
  253. _this.queryData.IsOut = '0';
  254. _this.queryData.HasFamily = '0';
  255. _this.queryData.HasPeople = '0';
  256. _this.queryData.HealthSituation = '0';
  257. //定位
  258. // $page.find('#Objective').val(returnCitySN.cname)
  259. if (_this.userInfo.Description == '学生') {
  260. _this.queryData.Type = '5';
  261. _this.LOADING('加载数据中…');
  262. _this.HTTP_GET('learun/PersonnelManagement/EpidemicSituationCopy/getStuSource', _this.userInfo.account, '加载数据时出错').then(data => {
  263. this.HIDE_LOADING();
  264. if (data) {
  265. _this.queryData.HomeAddress = data.Address;
  266. _this.queryData.StudentSource = data.res;
  267. }
  268. });
  269. } else {
  270. _this.LOADING('加载数据中…');
  271. _this.HTTP_GET('learun/PersonnelManagement/EpidemicSituationCopy/getUserSource', _this.userInfo.userId, '加载数据时出错').then(data => {
  272. this.HIDE_LOADING();
  273. if (data) {
  274. _this.queryData.HomeAddress = data.Address;
  275. }
  276. });
  277. }
  278. if (_this.userInfo.Description != '学生') {
  279. _this.DepartFlag = false;
  280. }
  281. }else{
  282. _this.LOADING('加载数据中…');
  283. _this.HTTP_GET('learun/PersonnelManagement/EpidemicSituationCopy/form', _this.pageInfo.keyValue, '加载数据时出错').then(data => {
  284. this.HIDE_LOADING();
  285. if (data) {
  286. console.log(data)
  287. // data.EpidemicSituation.forEach((n, i) => {
  288. // console.log(i)
  289. // })
  290. _this.disabled = 'disabled';
  291. for(let j in data.EpidemicSituation){
  292. // console.log(j)
  293. let txt = data.EpidemicSituation[j];
  294. _this.queryData[j] = txt;
  295. }
  296. if(data.EpidemicSituation.IsOut == 1){
  297. _this.queryData.PassPlaces.length = 0;
  298. _this.queryData.PassPlaces = this.COPY(data.PassPlaces);
  299. _this.queryData.PassPlaces.forEach((n,i)=>{
  300. n.ProvinceArea = n.Province + ',' + n.City + ',' + n.Area;
  301. for(let j in n){
  302. if(typeof n[j] == 'number'){
  303. n[j] = JSON.stringify(n[j]);
  304. }
  305. }
  306. })
  307. }
  308. if(data.EpidemicSituation.HasPeople == 1){
  309. _this.queryData.PeopleDetails.length = 0;
  310. _this.queryData.PeopleDetails = this.COPY(data.PeopleDetails);
  311. _this.queryData.PeopleDetails.forEach((n,i)=>{
  312. n.ProvinceArea = n.Province + ',' + n.City + ',' + n.Area;
  313. for(let j in n){
  314. if(typeof n[j] == 'number'){
  315. n[j] = JSON.stringify(n[j]);
  316. }
  317. }
  318. })
  319. }
  320. if(data.EpidemicSituation.HasFamily == 1){
  321. _this.queryData.ContactsDetails.length = 0;
  322. _this.queryData.ContactsDetails = this.COPY(data.ContactsDetails);
  323. _this.queryData.ContactsDetails.forEach((n,i)=>{
  324. n.ProvinceArea = n.Province + ',' + n.City + ',' + n.Area;
  325. for(let j in n){
  326. if(typeof n[j] == 'number'){
  327. n[j] = JSON.stringify(n[j]);
  328. }
  329. }
  330. })
  331. }
  332. _this.queryData.Department = JSON.stringify(_this.queryData.Department);
  333. _this.queryData.Gender = JSON.stringify(_this.userInfo.gender);
  334. _this.queryData.IsOut = JSON.stringify(_this.queryData.IsOut);
  335. _this.queryData.HasFamily = JSON.stringify(_this.queryData.HasFamily);
  336. _this.queryData.HasPeople = JSON.stringify(_this.queryData.HasPeople);
  337. _this.queryData.Type = JSON.stringify(_this.queryData.Type);
  338. _this.title.Creater = _this.displayListItem({Creater: _this.queryData.Creater}, 'Creater');
  339. console.log(_this.queryData)
  340. }
  341. });
  342. _this.submitTxt = '修改';
  343. }
  344. },
  345. change(e) {
  346. //console.log(e);
  347. },
  348. submit() {
  349. console.log(this.queryData);
  350. let _postData = {};
  351. _postData.keyValue = this.pageInfo.keyValue;
  352. let pageForm = {
  353. Creater: this.queryData.Creater,
  354. CreateTime: this.queryData.CreateTime,
  355. Type: this.queryData.Type,
  356. Department: this.queryData.Department,
  357. StudentSource: this.queryData.StudentSource,
  358. HealthSituation: this.queryData.HealthSituation,
  359. Gender: this.queryData.Gender,
  360. HomeAddress: this.queryData.HomeAddress,
  361. Mobile: this.queryData.Mobile,
  362. Objective: this.queryData.Objective,
  363. IsOut: this.queryData.IsOut,
  364. HasFamily: this.queryData.HasFamily,
  365. HasPeople: this.queryData.HasPeople,
  366. Provice: this.queryData.Provice,
  367. OutArea: this.queryData.OutArea,
  368. City: this.queryData.City
  369. };
  370. if (this.queryData.IsOut == 1) {
  371. console.log(this.queryData.PeopleDetails)
  372. pageForm.Provice = '';
  373. pageForm.OutArea = '';
  374. pageForm.City = '';
  375. this.queryData.PassPlaces.forEach((n, i) => {
  376. let areaInfo = n.ProvinceArea.split(',');
  377. n.Province = areaInfo[0];
  378. n.City = areaInfo[1];
  379. n.Area = areaInfo[2];
  380. });
  381. _postData.strpassPlaceList = JSON.stringify(this.queryData.PassPlaces);
  382. } else {
  383. _postData.strpassPlaceList = '[]';
  384. }
  385. if (this.queryData.HasPeople == 1) {
  386. console.log(this.queryData.PeopleDetails)
  387. this.queryData.PeopleDetails.forEach((n, i) => {
  388. let areaInfo = n.ProvinceArea.split(',');
  389. n.Province = areaInfo[0];
  390. n.City = areaInfo[1];
  391. n.Area = areaInfo[2];
  392. });
  393. _postData.strpeopleDetailsList = JSON.stringify(this.queryData.PeopleDetails);
  394. } else {
  395. _postData.strpeopleDetailsList = '[]';
  396. }
  397. if (this.queryData.HasFamily == 1) {
  398. console.log(this.queryData.ContactsDetails)
  399. this.queryData.ContactsDetails.forEach((n, i) => {
  400. let areaInfo = n.ProvinceArea.split(',');
  401. n.Province = areaInfo[0];
  402. n.City = areaInfo[1];
  403. n.Area = areaInfo[2];
  404. });
  405. _postData.strcontactsDetailsList = JSON.stringify(this.queryData.ContactsDetails);
  406. } else {
  407. _postData.strcontactsDetailsList = '[]';
  408. }
  409. _postData.strEntity = JSON.stringify(pageForm);
  410. // console.log(this.queryData);
  411. // console.log(_postData);
  412. var _this = this;
  413. this.LOADING('正在提交数据…');
  414. this.HTTP_POST('learun/PersonnelManagement/EpidemicSituationCopy/save', _postData, '加载数据时出错').then(data => {
  415. this.HIDE_LOADING();
  416. if (data) {
  417. // _this.$parent.refreshList();
  418. // console.log(data)
  419. this.EMIT('EpidemicSituationCopy')
  420. this.NAV_BACK()
  421. this.TOAST('提交保存成功', 'success')
  422. }
  423. });
  424. },
  425. add(str) {
  426. let json = this.COPY(this.dataSource[str]);
  427. this.queryData[str].push(json);
  428. },
  429. remove(str, i) {
  430. this.CONFIRM('删除', '确定删除该条数据吗', true).then(res => {
  431. if (res) {
  432. this.queryData[str].splice(i, 1);
  433. }
  434. });
  435. },
  436. // 显示列表中的标题项
  437. displayListItem(item, field) {
  438. const fieldItem = this.scheme[field];
  439. const value = item[field];
  440. switch (fieldItem.type) {
  441. case 'currentInfo':
  442. case 'organize':
  443. return fieldItem.dataType === 'time' ? value : get(this.GET_GLOBAL(fieldItem.dataType), `${value}.name`, '');
  444. case 'radio':
  445. case 'select':
  446. const selectItem = this.dataSource[field].find(t => t.value === String(value));
  447. return get(selectItem, 'text', '');
  448. case 'checkbox':
  449. if (!value || value.split(',').length <= 0) {
  450. return '';
  451. }
  452. const checkboxItems = value.split(',');
  453. return this.dataSource[field]
  454. .filter(t => checkboxItems.includes(t.value))
  455. .map(t => t.text)
  456. .join(',');
  457. case 'datetime':
  458. if (!value) {
  459. return '';
  460. }
  461. return moment(value).format(Number(fieldItem.dateformat) === 0 ? 'YYYY年 M月 D日' : 'YYYY-MM-DD HH:mm');
  462. default:
  463. return value === null || value === undefined ? '' : value;
  464. }
  465. }
  466. },
  467. created() {
  468. this.init();
  469. }
  470. };
  471. </script>
  472. <style lang="less" scoped>
  473. @import '~@/common/css/sidepage.less';
  474. @import '~@/common/css/customlist.less';
  475. @import '~@/common/css/common.less';
  476. .checkInT {
  477. padding: 0.5px 15px;
  478. line-height: 40px;
  479. font-size: 12px;
  480. }
  481. .checkInBtn {
  482. text-align: center;
  483. line-height: 40px;
  484. color: @pubColor;
  485. background-color: #fff;
  486. border-bottom: 0.5px solid #eee;
  487. }
  488. .checkInBtn text {
  489. position: relative;
  490. top: 2px;
  491. margin-right: 5px;
  492. font-size: 20px;
  493. }
  494. .remove {
  495. float: right;
  496. }
  497. </style>