index.tsx 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817
  1. import {
  2. ref,
  3. defineComponent,
  4. computed,
  5. onMounted,
  6. onUnmounted,
  7. reactive,
  8. } from 'vue';
  9. import { useRoute, useRouter } from 'vue-router';
  10. import { upload, UploadData } from '@/api/common';
  11. import cloneDeep from 'lodash/cloneDeep';
  12. import { useCommonStore, useIncidentStore, useMainStore } from '@/store';
  13. import QueryMap from '@/components/QueryMap';
  14. import Map from '@/components/MapView';
  15. import { BaseMediaUrl,isImage,isVideo } from '@/utils/index';
  16. import { api_getusergps } from '@/service/login';
  17. import { api_getuserInfo } from '@/service/warehouse';
  18. // import MediaUpload from '@/components/MediaUpload';
  19. /** @ts-ignore */
  20. import icon_map_location from '@/assets/icons/home/icon_map_location@2x.png';
  21. /** @ts-ignore */
  22. import icon_location from '@/assets/icons/incident/location.png';
  23. /** @ts-ignore */
  24. import icon_location_svg1 from '@/assets/icons/incident/location1.png';
  25. import './index.scss';
  26. import {
  27. DropdownItemOption,
  28. NavBar,
  29. DropdownMenu,
  30. DropdownItem,
  31. Icon,
  32. PullRefresh,
  33. Sticky,
  34. Collapse,
  35. CollapseItem,
  36. Loading,
  37. Form,
  38. Field,
  39. CellGroup,
  40. Popup,
  41. Picker,
  42. ActionBar,
  43. Button,
  44. Notify,
  45. Uploader,
  46. UploaderFileListItem,
  47. Toast,
  48. DatetimePicker
  49. } from 'vant';
  50. import { isArray } from 'lodash';
  51. import moment from 'moment';
  52. export default defineComponent({
  53. name: 'IncidentManagementReport',
  54. setup() {
  55. const store = useIncidentStore();
  56. const commonStore = useCommonStore();
  57. const detail = computed(() => store.incidentDetail?.baseInfo);
  58. const addr = ref('');
  59. const form = ref({ ...detail.value });
  60. const formRef = ref();
  61. const showCreateByPicker = ref(false);
  62. const showCreateByDeptPicker = ref(false);
  63. const showCreateTypeByPicker = ref(false);
  64. const currentDate=ref(new Date());
  65. const route = useRoute();
  66. const router = useRouter();
  67. const isshowprew = ref(false);
  68. const videosrclist = reactive([]);
  69. const imagessrclist = reactive([]);
  70. const videop = ref();
  71. const videopsrc = ref('');
  72. const isshowmove = ref(false);
  73. const state = reactive({
  74. map: null,
  75. _marker: null,
  76. loading: false,
  77. postition: {
  78. longitude: '',
  79. latitude: '',
  80. name: '',
  81. },
  82. });
  83. let allmark:Array<any> = [];
  84. const handleUpload = (file) => {
  85. Toast.loading({
  86. message: '上传中...',
  87. duration: 0,
  88. forbidClick: true,
  89. });
  90. upload(file)
  91. .then((res) => {
  92. Toast.clear();
  93. let type = /\w+([.jpg|.png|.gif|.swf|.bmp|.jpeg]){1}$/.test(
  94. res.data.fileName?.substr(
  95. res.data.fileName?.lastIndexOf('.') + 1,
  96. ) ?? '',
  97. );
  98. if (!type) {
  99. videosrclist.push(res.data);
  100. } else {
  101. imagessrclist.push(res.data);
  102. }
  103. })
  104. .catch((error) => {
  105. Toast.clear();
  106. });
  107. };
  108. const handleSaveReport = async () => {
  109. const { id } = route.query;
  110. const saveFn = id ? store.putIncidentItem : store.postIncidentItem;
  111. // console.log(formRef);
  112. form.value.happenTime = moment(form.value.happenTime).format(
  113. 'YYYY-MM-DD HH:mm:ss',
  114. );
  115. const result = await saveFn({
  116. ...form.value,
  117. // level: Number(form.value.level) ?? null,
  118. // type: Number(form.value.type) ?? null,
  119. pic: imagessrclist.map((i: UploadData) => i.url).join(','),
  120. video: videosrclist.map((i: UploadData) => i.url).join(','),
  121. source: '1',
  122. // status: route.params.status as unknown as number,
  123. });
  124. if (result) {
  125. router.push('/');
  126. }
  127. };
  128. // const getLocation = () => {
  129. // api_getusergps().then((res) => {
  130. // var lat = null;
  131. // var lon = null;
  132. // var iserror = false;
  133. // try {
  134. // lat = res.result[0].lat;
  135. // lon = res.result[0].lon;
  136. // if (lat == null || lat == undefined) iserror = true;
  137. // } catch (e) {
  138. // iserror = true;
  139. // }
  140. // if (!iserror) {
  141. // var location = `${lon},${lat}`;
  142. // fetch(
  143. // `https://minedata.cn/service/lbs/reverse/v1/regeo?location=${location}&key=${window.key}`,
  144. // {
  145. // method: 'GET',
  146. // headers: new Headers({
  147. // 'Content-Type': 'application/json',
  148. // }),
  149. // },
  150. // )
  151. // .then((res) => res.json())
  152. // .then((data) => {
  153. // // console.log(data)
  154. // // console.log(data.regeocodes[0].formatted_address);
  155. // var ll = data.regeocodes[0].formatted_address;
  156. // if (!window.map) {
  157. // Notify({
  158. // type: 'danger',
  159. // message: '地图插件初始化异常, 请刷新页面 (Ctrl + R)',
  160. // });
  161. // return;
  162. // }
  163. // window.map.flyTo({
  164. // center: [
  165. // Number(location.split(',')[0]),
  166. // Number(location.split(',')[1]),
  167. // ],
  168. // zoom: 14,
  169. // bearing: 0,
  170. // pitch: 0,
  171. // duration: 2000,
  172. // });
  173. // if (window.map && window._marker) {
  174. // window._marker.remove();
  175. // window._marker = null;
  176. // }
  177. // if (window.map) {
  178. // var el = document.createElement('div');
  179. // el.id = 'marker';
  180. // el.style.backgroundImage = `url(${icon_map_location})`;
  181. // el.style.backgroundSize = 'cover';
  182. // el.style.width = '24px';
  183. // el.style.height = '24px';
  184. // el.style.borderRadius = '50%';
  185. // const popup = new window.minemap.Popup({
  186. // closeOnClick: false,
  187. // closeButton: false,
  188. // offset: [0, -15],
  189. // }).setText(ll);
  190. // window._marker = new window.minemap.Marker(el, {
  191. // offset: [-12, -12],
  192. // })
  193. // .setLngLat([
  194. // Number(location.split(',')[0]),
  195. // Number(location.split(',')[1]),
  196. // ])
  197. // .setPopup(popup)
  198. // .addTo(window.map);
  199. // }
  200. // window._marker.togglePopup();
  201. // // var ll =
  202. // // data.regeocodes[0].formatted_address.replaceAll(
  203. // // '江苏省宿迁市',
  204. // // "");
  205. // form.value.locations = location;
  206. // form.value.addr = ll;
  207. // });
  208. // // minemap.service
  209. // // .adminByPointData({
  210. // // location: `${position.coords.longitude},${position.coords.latitude}`,
  211. // // })
  212. // // .then(function (response) {
  213. // // console.log(response.data);
  214. // // })
  215. // // .catch(function (error) {
  216. // // console.error(error);
  217. // // });
  218. // // (ee) => {
  219. // // console.log(ee);
  220. // // },
  221. // } else {
  222. // Notify({
  223. // type: 'danger',
  224. // message: 'App不支持地理定位。',
  225. // });
  226. // }
  227. // });
  228. // };
  229. const selectpoint = () => {
  230. if (isshowmove.value) {
  231. var center = state.map.getCenter();
  232. getlocalname(center.lng.toFixed(6) + ',' + center.lat.toFixed(6));
  233. } else {
  234. isshowmove.value = true;
  235. if (state.map && state._marker) {
  236. state._marker.remove();
  237. }
  238. }
  239. };
  240. const setpoint = (longitude, latitude, name) => {
  241. if (state._marker) {
  242. state._marker.remove();
  243. }
  244. var el = document.createElement('div');
  245. el.id = 'marker';
  246. el.style.backgroundImage = `url(${icon_map_location})`;
  247. el.style.backgroundSize = 'cover';
  248. el.style.width = '24px';
  249. el.style.height = '24px';
  250. el.style.borderRadius = '50%';
  251. const popup = new window.minemap.Popup({
  252. closeOnClick: false,
  253. closeButton: false,
  254. offset: [0, -15],
  255. }).setText(name);
  256. state._marker = new window.minemap.Marker(el, {
  257. offset: [-12, -12],
  258. })
  259. .setLngLat([longitude, latitude])
  260. .setPopup(popup)
  261. .addTo(state.map);
  262. state.map.flyTo({
  263. center: [longitude, latitude],
  264. zoom: 14,
  265. bearing: 0,
  266. pitch: 0,
  267. duration: 2000,
  268. });
  269. state._marker.togglePopup();
  270. form.value.addr = name;
  271. form.value.locations = longitude + ',' + latitude;
  272. // whdata.value.longitude = longitude;
  273. isshowmove.value = false;
  274. };
  275. const dores = (data) => {
  276. // console.log(data.pois)
  277. var clearallmark = () => {
  278. if (state.map && state._marker) {
  279. state._marker.remove();
  280. }
  281. if (allmark.length > 0) {
  282. allmark.map((item) => {
  283. item.remove();
  284. });
  285. allmark = [];
  286. }
  287. };
  288. clearallmark();
  289. var top = [];
  290. var bottom = [];
  291. data.pois.map((item) => {
  292. if (top.length < 1) {
  293. top = [
  294. Number(item.location.split(',')[0]),
  295. Number(item.location.split(',')[1]),
  296. ];
  297. bottom = [
  298. Number(item.location.split(',')[0]),
  299. Number(item.location.split(',')[1]),
  300. ];
  301. }
  302. var el = document.createElement('div');
  303. el.id = 'marker';
  304. el.style.backgroundImage = `url(${icon_map_location})`;
  305. el.style.backgroundSize = 'cover';
  306. el.style.width = '24px';
  307. el.style.height = '24px';
  308. el.style.borderRadius = '50%';
  309. el.onclick = () => {
  310. clearallmark();
  311. setpoint(
  312. Number(item.location.split(',')[0]),
  313. Number(item.location.split(',')[1]),
  314. item.name,
  315. );
  316. };
  317. const popup = new window.minemap.Popup({
  318. closeOnClick: false,
  319. closeButton: false,
  320. offset: [0, -15],
  321. }).setText(item.name);
  322. var mark = new window.minemap.Marker(el, {
  323. offset: [-12, -12],
  324. })
  325. .setLngLat([
  326. Number(item.location.split(',')[0]),
  327. Number(item.location.split(',')[1]),
  328. ])
  329. .setPopup(popup)
  330. .addTo(state.map);
  331. allmark.push(mark);
  332. mark.togglePopup();
  333. if (top[0] < Number(item.location.split(',')[0])) {
  334. top[0] = Number(item.location.split(',')[0]);
  335. }
  336. if (top[1] > Number(item.location.split(',')[1])) {
  337. top[1] = Number(item.location.split(',')[1]);
  338. }
  339. if (bottom[0] > Number(item.location.split(',')[0])) {
  340. bottom[0] = Number(item.location.split(',')[0]);
  341. }
  342. if (bottom[1] < Number(item.location.split(',')[1])) {
  343. bottom[1] = Number(item.location.split(',')[1]);
  344. }
  345. });
  346. state.map.fitBounds([top, bottom]);
  347. }
  348. const searchaddr = () => {
  349. isshowmove.value = false;
  350. fetch(
  351. `https://tocc.jtj.suqian.gov.cn:21100/service/lbs/search/v1/keywords?keywords=${form.value.addr}&city=宿迁&citylimit=true&page_idx=1&page_size=10&key=${window.key}`,
  352. )
  353. .then((res) => res.json())
  354. .then((data) => {
  355. dores(data);
  356. });
  357. };
  358. const getlocalname = (location) => {
  359. fetch(
  360. // `https://service.minedata.cn/service/lbs/reverse/v1/regeo?location=${location}&key=77ef70465c2d4888b3a5132523494b94`,
  361. `https://tocc.jtj.suqian.gov.cn:21100/service/lbs/search/v1/around?location=${location}&key=${window.key}`
  362. )
  363. .then((res) => res.json())
  364. .then((data) => {
  365. dores(data);
  366. // setpoint(
  367. // Number(location.split(',')[0]),
  368. // Number(location.split(',')[1]),
  369. // data.regeocodes[0].formatted_address,
  370. // );
  371. });
  372. };
  373. const getLocation = () => {
  374. api_getusergps().then((res) => {
  375. var lat = null;
  376. var lon = null;
  377. var iserror = false;
  378. try {
  379. lat = res.result[0].lat;
  380. lon = res.result[0].lon;
  381. if (lat === null || lat === undefined) iserror = true;
  382. } catch (e) {
  383. iserror = true;
  384. }
  385. if (!iserror) {
  386. // debugger
  387. var location = `${lon},${lat}`;
  388. getlocalname(location);
  389. // setpoint(lon,lat,data.regeocodes[0].formatted_address)
  390. } else {
  391. // Notify({
  392. // type: 'danger',
  393. // message: 'App不支持地理定位。',
  394. // });
  395. }
  396. });
  397. };
  398. try {
  399. api_getuserInfo().then((res) => {
  400. try {
  401. getLocation();
  402. } catch (E) {}
  403. });
  404. } catch (e) {
  405. Toast.fail({ message: e + '' });
  406. }
  407. onMounted(async () => {
  408. commonStore.getGlobalDict('zhdd_incident_level');
  409. commonStore.getGlobalDict('zhdd_incident_type');
  410. commonStore.getGlobalDict('zhdd_org_upload');
  411. route.query.id && (await store.getIncidentItem(route.query.id as string));
  412. addr.value = detail?.value?.addr ?? '';
  413. if (detail.value) {
  414. form.value = cloneDeep(detail.value);
  415. }
  416. form.value.happenTime = moment(new Date()).format('YYYY-MM-DD HH:mm');
  417. });
  418. onUnmounted(() => {
  419. commonStore.uploadFiles = [];
  420. store.incidentDetail = {};
  421. store.incidentDetail = {
  422. baseInfo: {},
  423. process: [],
  424. task: [],
  425. };
  426. });
  427. return () => (
  428. <div class="incident-report-container ">
  429. <NavBar
  430. title="应急事件上报"
  431. left-arrow
  432. fixed
  433. onClick-left={() => {
  434. // router.push('/home')
  435. // uni.postMessage({
  436. // data: 'test',
  437. // });
  438. try {
  439. uni.navigateBack();
  440. } catch (E) {}
  441. }}
  442. onClick-right={() =>{
  443. useMainStore().gotohelp("be2dc45c2e644314a6b5a1ff2bf24420");
  444. }
  445. }
  446. v-slots={{ right: () => <Icon size="18" name="question-o" /> }}
  447. />
  448. <Popup
  449. style="width:100%;background:rgba(0,0,0,0)"
  450. v-model:show={isshowprew.value}
  451. onClose={() => {
  452. videop.value.pause();
  453. }}>
  454. <video
  455. ref={videop}
  456. src={videopsrc.value}
  457. controls
  458. autoplay="true"
  459. style="width:100%"></video>
  460. </Popup>
  461. <Form>
  462. <CellGroup>
  463. <Field
  464. v-model={form.value.name}
  465. name="事件标题"
  466. label="事件标题"
  467. placeholder="请输入"
  468. required
  469. rules={[{ required: true, message: '事件标题必填' }]}
  470. />
  471. <Field
  472. v-model={form.value.happenTime}
  473. // rows={2}
  474. // autosize
  475. readonly
  476. is-link
  477. name="发生时间"
  478. label="发生时间"
  479. rules={[{ required: true, message: '事件发生时间必填' }]}
  480. // type="textarea"
  481. required
  482. placeholder="点击选择时间"
  483. onClick={() => (showCreateByDeptPicker.value = true)}
  484. />
  485. <Popup
  486. v-model:show={showCreateByDeptPicker.value}
  487. position="bottom">
  488. <DatetimePicker
  489. v-model={currentDate.value}
  490. type="datetime"
  491. title="选择时间"
  492. onConfirm={(value) => {
  493. //
  494. form.value.happenTime =
  495. moment(value).format('YYYY-MM-DD HH:mm');;
  496. // form.value.type = value.value;
  497. console.log(value, '---');
  498. showCreateByDeptPicker.value = false;
  499. }}
  500. onCancel={() => {
  501. showCreateByDeptPicker.value = false;
  502. }}
  503. />
  504. </Popup>
  505. {/* <Field
  506. v-model={form.value.createBy}
  507. name="上报人"
  508. label="上报人"
  509. placeholder="请输入"
  510. required
  511. rules={[{ required: true, message: '上报人必填' }]}
  512. />
  513. <Field
  514. v-model={form.value.createDeptText}
  515. name="上报单位"
  516. is-link
  517. readonly
  518. label="上报单位"
  519. placeholder="请选择"
  520. required
  521. rules={[{ required: true, message: '上报单位必填' }]}
  522. onClick={() => (showCreateByDeptPicker.value = true)}
  523. />
  524. <Field
  525. v-model={form.value.typeText}
  526. is-link
  527. readonly
  528. name="事件类型"
  529. label="事件类型"
  530. placeholder="请选择"
  531. required
  532. rules={[{ required: true, message: '事件类型必填' }]}
  533. onClick={() => (showCreateTypeByPicker.value = true)}
  534. />
  535. <Popup
  536. v-model:show={showCreateTypeByPicker.value}
  537. position="bottom">
  538. <Picker
  539. columns={commonStore.globalDict['zhdd_incident_type']?.map(
  540. (i) => ({ text: i.dictLabel, value: i.dictValue }),
  541. )}
  542. onConfirm={(value) => {
  543. form.value.typeText = value.text;
  544. form.value.type = value.value;
  545. console.log(value, '---');
  546. showCreateTypeByPicker.value = false;
  547. }}
  548. onCancel={() => {
  549. showCreateTypeByPicker.value = false;
  550. }}
  551. />
  552. </Popup>
  553. <Field
  554. v-model={form.value.levelText}
  555. is-link
  556. readonly
  557. name="事件等级"
  558. label="事件等级"
  559. placeholder="请选择"
  560. required
  561. rules={[{ required: true, message: '事件等级必填' }]}
  562. onClick={() => (showCreateByPicker.value = true)}
  563. />
  564. <Popup v-model:show={showCreateByPicker.value} position="bottom">
  565. <Picker
  566. columns={commonStore.globalDict['zhdd_incident_level']?.map(
  567. (i) => ({ text: i.dictLabel, value: i.dictValue }),
  568. )}
  569. onConfirm={(value) => {
  570. form.value.levelText = value.text;
  571. form.value.level = value.value;
  572. console.log(value, '---');
  573. showCreateByPicker.value = false;
  574. }}
  575. onCancel={() => {
  576. showCreateByPicker.value = false;
  577. }}
  578. />
  579. </Popup>
  580. <Popup
  581. v-model:show={showCreateByDeptPicker.value}
  582. position="bottom">
  583. <Picker
  584. columns={commonStore.globalDict['zhdd_org_upload']?.map(
  585. (i) => ({ text: i.dictLabel, value: i.dictValue }),
  586. )}
  587. onConfirm={(value) => {
  588. form.value.createDeptText = value.text;
  589. form.value.createDept = value.value;
  590. console.log(value, '---');
  591. showCreateByDeptPicker.value = false;
  592. }}
  593. onCancel={() => {
  594. showCreateByDeptPicker.value = false;
  595. }}
  596. />
  597. </Popup> */}
  598. <Field
  599. v-model={form.value.des}
  600. rows={2}
  601. autosize
  602. name="事件描述"
  603. label="事件描述"
  604. type="textarea"
  605. placeholder="请输入"
  606. />
  607. <div style={'position:relative'}>
  608. <Field
  609. v-model={form.value.addr}
  610. name="事件地点"
  611. label="事件地点"
  612. placeholder="请输入"
  613. required
  614. // style={'width:85%'}
  615. onChange={(add: string) => {
  616. addr.value = add.target.value;
  617. }}
  618. rules={[{ required: true, message: '事件地点必填' }]}
  619. v-slots={{
  620. button: () => {
  621. return (
  622. <van-button
  623. size="small"
  624. type="primary"
  625. color="#f2f4fa"
  626. onClick={searchaddr}>
  627. <van-icon color="black" name="search" />
  628. </van-button>
  629. );
  630. },
  631. }}></Field>
  632. {/* <Button
  633. style={'border:none;position:absolute;right:10px;top:0'}
  634. onClick={() => {
  635. getLocation();
  636. }}>
  637. <img style={'width:20px;height:20px'} src={icon_location} />
  638. </Button> */}
  639. </div>
  640. {/* <QueryMap
  641. address={addr.value}
  642. v-model:locations={form.value.locations}
  643. v-model:longitude={(form.value.locations ?? '').split(',')[0]}
  644. v-model:latitude={(form.value.locations ?? '').split(',')[1]}
  645. onChoose={(name) => {
  646. form.value.addr = name;
  647. }}
  648. onRestPositon={() => {
  649. addr.value = store.incidentDetail.baseInfo?.addr ?? '';
  650. form.value.addr = store.incidentDetail.baseInfo?.addr;
  651. form.value.locations = store.incidentDetail.baseInfo?.locations;
  652. }}
  653. /> */}
  654. {
  655. <div style="padding: 15px; background: #fff; position: relative">
  656. <Map
  657. v-model:map={state.map}
  658. style={
  659. 'height: 240px;borderradius: 2px;boxshadow: 0px 0px 0px 1px #d9d9d9;'
  660. }
  661. />
  662. {isshowmove.value ? (
  663. <div class="mark">
  664. <img src={icon_map_location} />
  665. </div>
  666. ) : (
  667. ''
  668. )}
  669. <div class="marklocation" onClick={getLocation}>
  670. <img src={icon_location_svg1} />
  671. </div>
  672. <div style={'position: absolute; right: 21px; top: 21px'}>
  673. <van-button type="primary" size="mini" onClick={selectpoint}>
  674. {isshowmove.value ? '确定' : '选点'}
  675. </van-button>
  676. </div>
  677. </div>
  678. }
  679. <Field
  680. name="上传图片"
  681. label="上传图片"
  682. placeholder="请输入"
  683. v-slots={{
  684. input: () => (
  685. <Uploader
  686. accept="image/*"
  687. v-model={form.value.pic}
  688. max-size={20 * 1024 * 1024}
  689. onOversize={() => {
  690. Toast('最大支持20M的图片');
  691. }}
  692. onDelete={(filep, detail) => {
  693. imagessrclist.splice(detail.index, 1);
  694. console.log(imagessrclist);
  695. }}
  696. afterRead={(
  697. file: UploaderFileListItem | UploaderFileListItem[],
  698. ) => {
  699. handleUpload((isArray(file) ? file[0] : file).file);
  700. return false;
  701. }}
  702. />
  703. ),
  704. }}
  705. />
  706. <Field
  707. name="上传视频"
  708. label="上传视频"
  709. placeholder="请输入"
  710. v-slots={{
  711. input: () => (
  712. <Uploader
  713. accept="video/*"
  714. v-model={form.value.video}
  715. max-size={100 * 1024 * 1024}
  716. onOversize={() => {
  717. Toast('最大支持100M的视屏');
  718. }}
  719. afterRead={(
  720. file: UploaderFileListItem | UploaderFileListItem[],
  721. ) => {
  722. handleUpload((isArray(file) ? file[0] : file).file);
  723. return false;
  724. }}
  725. onDelete={(filep, detail) => {
  726. videosrclist.splice(detail.index, 1);
  727. console.log(videosrclist);
  728. }}
  729. onClick-preview={(index) => {
  730. isshowprew.value = true;
  731. try {
  732. videopsrc.value = URL.createObjectURL(index.file);
  733. videop.value.play();
  734. videop.value.currentTime = 0;
  735. } catch (error) {}
  736. }}
  737. // v-slots={{
  738. // 'preview-cover': () => (
  739. // <video
  740. // style="width:100%;height:100%"
  741. // controls
  742. // src="https://vod-progressive.akamaized.net/exp=1643032410~acl=%2Fvimeo-prod-skyfire-std-us%2F01%2F2673%2F7%2F188365455%2F623960082.mp4~hmac=e4a0fb352e805ff4fe74317441bf6f6deb059508cc7bb2f7aa92884023b13818/vimeo-prod-skyfire-std-us/01/2673/7/188365455/623960082.mp4?filename=Emoji+Saver+-+Drama.mp4"></video>
  743. // ),
  744. // }}
  745. />
  746. ),
  747. }}
  748. />
  749. </CellGroup>
  750. <div style={{ height: '80px' }}></div>
  751. <ActionBar>
  752. <div style={{ padding: '10px 20px' }}>
  753. <Button block type="primary" onClick={handleSaveReport}>
  754. 提交
  755. </Button>
  756. </div>
  757. </ActionBar>
  758. </Form>
  759. </div>
  760. );
  761. },
  762. });