@@ -54,82 +52,133 @@
-
- {{ form.wzmc.length }}/20
-
+ >
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+ 获取位置
+
+
+
+
+
+ 获取位置
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{
getMaterialList();
});
-// 购置日期
+// 购置日期相关
const showTimePicker = ref(false);
const currentDate = ref([
new Date().getFullYear(),
@@ -238,6 +293,32 @@ const onDateConfirm = ({ selectedValues }) => {
showTimePicker.value = false;
};
+// 选择单位相关
+const dwField = ref(null);
+const showDwPicker = ref(false);
+const dwOptions = [
+ { text: "辆", value: "辆" },
+ { text: "米", value: "米" },
+ { text: "桶", value: "桶" },
+ { text: "把", value: "把" },
+ { text: "吨", value: "吨" },
+ { text: "双", value: "双" },
+ { text: "件", value: "件" },
+ { text: "付", value: "付" },
+ { text: "个", value: "个" },
+ { text: "件", value: "件" },
+ { text: "自定义", value: "自定义" },
+];
+const onDwConfirm = (value) => {
+ if (value.selectedValues[0] === "自定义") {
+ showDwPicker.value = false;
+ dwField.value.focus();
+ } else {
+ form.material.dw = value.selectedValues[0];
+ showDwPicker.value = false;
+ }
+};
+
const handleSubmit = async () => {
try {
showLoadingToast({
@@ -245,8 +326,8 @@ const handleSubmit = async () => {
forbidClick: true,
loadingType: "spinner",
});
- form.yhzid = yhzDetail.value.id;
- form.qxmc = yhzDetail.value.qxmc;
+ form.material.yhzid = yhzDetail.value.id;
+ form.material.qxmc = yhzDetail.value.qxmc;
console.log("form", toRaw(form));
const res = await request({
url: "/snow-ops-platform/yjwz/add",
@@ -273,6 +354,111 @@ const handleSubmit = async () => {
}
};
+// 负责人相关
+const showFzrPicker = ref(false);
+const fzrOptions = ref([]);
+const onFzrConfirm = (value) => {
+ // 获取选中的负责人ID
+ const selectedId = value.selectedValues[0];
+
+ // 在fzrOptions中查找对应的负责人名称
+ const selectedPerson = fzrOptions.value.find(
+ (item) => item.value === selectedId
+ );
+ // 同时设置id和名称
+ if (selectedPerson) {
+ form.material.fzrid = selectedId;
+ form.material.fzr = selectedPerson.text;
+ } else {
+ form.material.fzrid = "";
+ form.material.fzr = "";
+ }
+ showFzrPicker.value = false;
+};
+
+// 图片上传相关
+const fileList = ref([]);
+// 文件删除
+const handleDelete = (file) => {
+ if (file.serverUrl) {
+ const index = form.photos.findIndex((p) => p.photoUrl === file.serverUrl);
+ if (index !== -1) {
+ form.photos.splice(index, 1);
+ }
+ }
+};
+// 文件上传
+const afterRead = async (file) => {
+ try {
+ const toast = showLoadingToast({
+ message: "上传中...",
+ forbidClick: true,
+ duration: 0, // 设置为0表示不会自动关闭
+ });
+ const formData = new FormData();
+ formData.append("file", file.file);
+ const res = await request({
+ url: "/snow-ops-platform/file/upload",
+ method: "post",
+ data: formData,
+ });
+ toast.close();
+ if (res.code === "00000") {
+ form.photos.push({ photoUrl: res.data });
+ const index = fileList.value.findIndex((f) => f.file === file.file);
+ if (index !== -1) {
+ fileList.value[index].serverUrl = res.data;
+ }
+
+ console.log("form.photos", toRaw(form.photos));
+ console.log("fileList.value", fileList.value);
+ } else {
+ throw new Error(res.message);
+ }
+ } catch (error) {
+ toast.close();
+ showToast({
+ type: "fail",
+ message: error.message,
+ });
+ }
+};
+
+// 获取经纬度
+const handleGetLocation = () => {
+ if (!navigator.geolocation) {
+ showToast("您的浏览器不支持地理位置获取");
+ return;
+ }
+
+ showLoadingToast({
+ message: "定位中...",
+ forbidClick: true,
+ });
+
+ navigator.geolocation.getCurrentPosition(
+ (position) => {
+ form.material.jd = position.coords.longitude.toFixed(6);
+ form.material.wd = position.coords.latitude.toFixed(6);
+ showToast("定位成功");
+ },
+ (error) => {
+ const errorMessage =
+ {
+ 1: "位置服务被拒绝",
+ 2: "暂时无法获取位置",
+ 3: "定位超时",
+ }[error.code] || "定位失败";
+ showToast(errorMessage);
+ },
+ {
+ enableHighAccuracy: true, // 高精度模式
+ timeout: 5000, // 超时时间
+ maximumAge: 0, // 不缓存位置
+ }
+ );
+};
+
watch(
() => searchValue.value,
(newVal, oldVal) => {
@@ -286,7 +472,38 @@ const onClickLeft = () => {
router.push("/");
};
-const handleAdd = () => {
+// 获取养护站人员列表
+const getPersonList = async () => {
+ try {
+ const data = {
+ pageNum: 1,
+ pageSize: 9999,
+ yhzid: yhzDetail.value.id,
+ };
+ const res = await request({
+ url: "/snow-ops-platform/yhzry/list",
+ method: "get",
+ params: data,
+ });
+ if (res.code === "00000") {
+ fzrOptions.value = res.data.records.map((item) => ({
+ text: item.xm,
+ value: item.userId,
+ }));
+ } else {
+ throw new Error("人员信息获取失败");
+ }
+ } catch (error) {
+ console.log(error);
+ showToast({
+ type: "fail",
+ message: error.message,
+ });
+ }
+};
+const handleAdd = async () => {
+ await getPersonList();
+ handleGetLocation();
showPopup.value = true;
};
diff --git a/packages/screen/src/views/SnowEventManagement/index.js b/packages/screen/src/views/SnowEventManagement/index.js
index 35f9c94..2d1bc69 100644
--- a/packages/screen/src/views/SnowEventManagement/index.js
+++ b/packages/screen/src/views/SnowEventManagement/index.js
@@ -196,11 +196,11 @@ const columns = [
label: '预计恢复时间',
},
{
- prop: 'actualRecoverTime',
+ prop: 'trafficActualRecoverTime',
label: '实际恢复时间',
},
{
- prop: 'serviceStationId',
+ prop: 'stationName',
label: '所属服务站',
},
{