|
@@ -75,16 +75,16 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import dayjs from 'dayjs'
|
|
|
+import dayjs from 'dayjs';
|
|
|
|
|
|
-const { userInfo } = storeToRefs(useAuthStore())
|
|
|
+const { userInfo } = storeToRefs(useAuthStore());
|
|
|
|
|
|
-import { useMessage } from 'wot-design-uni'
|
|
|
-import { useToast } from 'wot-design-uni'
|
|
|
+import { useMessage } from 'wot-design-uni';
|
|
|
+import { useToast } from 'wot-design-uni';
|
|
|
|
|
|
-const toast = useToast()
|
|
|
-const messageBox = useMessage()
|
|
|
-import { ref } from 'vue'
|
|
|
+const toast = useToast();
|
|
|
+const messageBox = useMessage();
|
|
|
+import { ref } from 'vue';
|
|
|
|
|
|
const formData = ref({
|
|
|
COL_0: {
|
|
@@ -276,16 +276,16 @@ const formData = ref({
|
|
|
tableName: 'ods_oildelivery',
|
|
|
value: '',
|
|
|
},
|
|
|
-})
|
|
|
+});
|
|
|
|
|
|
-let id = ''
|
|
|
+let id = '';
|
|
|
onLoad((options) => {
|
|
|
if (options.query) {
|
|
|
// 正在加载
|
|
|
- toast.loading({ loadingType: 'ring', msg: '加载中' })
|
|
|
- const item = JSON.parse(decodeURIComponent(options.query))
|
|
|
- console.log(item)
|
|
|
- id = item.ID
|
|
|
+ toast.loading({ loadingType: 'ring', msg: '加载中' });
|
|
|
+ const item = JSON.parse(decodeURIComponent(options.query));
|
|
|
+ console.log(item);
|
|
|
+ id = item.ID;
|
|
|
uni.request({
|
|
|
url: 'https://miniapp.zhangmushiye.com/bi-api/report/dataapi/driverXiangmu',
|
|
|
method: 'GET',
|
|
@@ -293,28 +293,28 @@ onLoad((options) => {
|
|
|
phone: userInfo.value.COL_1,
|
|
|
},
|
|
|
success: (res) => {
|
|
|
- xiangmuList.value = res.data.data
|
|
|
+ xiangmuList.value = res.data.data;
|
|
|
},
|
|
|
- })
|
|
|
+ });
|
|
|
DemoApi.projectList(userInfo.value).then((res) => {
|
|
|
- oldColumns.value = res.data
|
|
|
+ oldColumns.value = res.data;
|
|
|
// 排重
|
|
|
columns.value = res.data.filter((item, index, arr) => {
|
|
|
- return arr.findIndex((item2) => item2.COL_1 === item.COL_1) === index
|
|
|
+ return arr.findIndex((item2) => item2.COL_1 === item.COL_1) === index;
|
|
|
});
|
|
|
oilList.value = res.data.filter((item, index, arr) => {
|
|
|
- return arr.findIndex((item2) => item2.COL_5 === item.COL_5) === index
|
|
|
+ return arr.findIndex((item2) => item2.COL_5 === item.COL_5) === index;
|
|
|
});
|
|
|
Object.values(formData.value).forEach((item2) => {
|
|
|
- item2.value = item[item2.field]
|
|
|
+ item2.value = item[item2.field];
|
|
|
});
|
|
|
fileList.value = item.COL_19.map((item) => {
|
|
|
return {
|
|
|
name: item.name,
|
|
|
url: 'https://miniapp.zhangmushiye.com/' + item.url,
|
|
|
- }
|
|
|
+ };
|
|
|
});
|
|
|
- toast.close()
|
|
|
+ toast.close();
|
|
|
});
|
|
|
} else {
|
|
|
uni.request({
|
|
@@ -324,9 +324,9 @@ onLoad((options) => {
|
|
|
phone: userInfo.value.COL_1,
|
|
|
},
|
|
|
success: (res) => {
|
|
|
- xiangmuList.value = res.data.data
|
|
|
+ xiangmuList.value = res.data.data;
|
|
|
},
|
|
|
- })
|
|
|
+ });
|
|
|
|
|
|
// DemoApi.projectList(userInfo.value).then((res) => {
|
|
|
// oldColumns.value = res.data
|
|
@@ -340,62 +340,62 @@ onLoad((options) => {
|
|
|
// toast.close()
|
|
|
// })
|
|
|
}
|
|
|
-})
|
|
|
+});
|
|
|
const formSubmit = () => {
|
|
|
if (!formData.value.COL_9.value) {
|
|
|
- toast.show('请选择项目名称')
|
|
|
+ toast.show('请选择项目名称');
|
|
|
return;
|
|
|
}
|
|
|
if (!formData.value.COL_8.value) {
|
|
|
- toast.show('请选择客户名称')
|
|
|
+ toast.show('请选择客户名称');
|
|
|
return;
|
|
|
}
|
|
|
if (!formData.value.COL_3.value) {
|
|
|
- toast.show('请输入加油数量')
|
|
|
+ toast.show('请输入加油数量');
|
|
|
return;
|
|
|
}
|
|
|
// 单位
|
|
|
if (!formData.value.unit_type.value) {
|
|
|
- toast.show('请选择单位')
|
|
|
+ toast.show('请选择单位');
|
|
|
return;
|
|
|
}
|
|
|
if (!formData.value.COL_19.value) {
|
|
|
- toast.show('请上传加油票据')
|
|
|
+ toast.show('请上传加油票据');
|
|
|
return;
|
|
|
}
|
|
|
- let params = {}
|
|
|
+ let params = {};
|
|
|
Object.values(formData.value).forEach((item) => {
|
|
|
- const value = item.value
|
|
|
- params[item.fieldId] = value
|
|
|
+ const value = item.value;
|
|
|
+ params[item.fieldId] = value;
|
|
|
});
|
|
|
- params[615] = dayjs(params[615]).valueOf()
|
|
|
- console.log(id)
|
|
|
+ params[615] = dayjs(params[615]).valueOf();
|
|
|
+ console.log(id);
|
|
|
if (id) {
|
|
|
- params[629] = dayjs(params[629]).valueOf()
|
|
|
- params[630] = dayjs().valueOf()
|
|
|
+ params[629] = dayjs(params[629]).valueOf();
|
|
|
+ params[630] = dayjs().valueOf();
|
|
|
}
|
|
|
params[631] = params[631].map((item) => {
|
|
|
if (item.url.msg.includes('miniapp.zhangmushiye.com')) {
|
|
|
- item.url.msg = item.url.msg.replace('https://miniapp.zhangmushiye.com/', '')
|
|
|
+ item.url.msg = item.url.msg.replace('https://miniapp.zhangmushiye.com/', '');
|
|
|
}
|
|
|
return {
|
|
|
url: item.url.msg,
|
|
|
- }
|
|
|
+ };
|
|
|
});
|
|
|
- console.log(params)
|
|
|
+ console.log(params);
|
|
|
// return;
|
|
|
- params = JSON.stringify(params)
|
|
|
+ params = JSON.stringify(params);
|
|
|
messageBox
|
|
|
.confirm({
|
|
|
title: '提示',
|
|
|
msg: '确认提交吗?',
|
|
|
})
|
|
|
.then(() => {
|
|
|
- toast.loading({ loadingType: 'ring', msg: '提交中' })
|
|
|
+ toast.loading({ loadingType: 'ring', msg: '提交中' });
|
|
|
let url =
|
|
|
- 'https://miniapp.zhangmushiye.com/visual-api/paas/visualdev/OnlineDev/7164c3e7895f49fd0c4e2742e81cb726'
|
|
|
+ 'https://miniapp.zhangmushiye.com/visual-api/paas/visualdev/OnlineDev/7164c3e7895f49fd0c4e2742e81cb726';
|
|
|
if (id) {
|
|
|
- url = url + '/' + id
|
|
|
+ url = url + '/' + id;
|
|
|
// PUT 提交
|
|
|
uni.request({
|
|
|
url,
|
|
@@ -405,13 +405,13 @@ const formSubmit = () => {
|
|
|
id,
|
|
|
},
|
|
|
success: (res) => {
|
|
|
- toast.success('提交成功')
|
|
|
- uni.navigateBack()
|
|
|
+ toast.success('提交成功');
|
|
|
+ uni.navigateBack();
|
|
|
},
|
|
|
fail: (err) => {
|
|
|
- toast.error('提交失败')
|
|
|
+ toast.error('提交失败');
|
|
|
},
|
|
|
- })
|
|
|
+ });
|
|
|
} else {
|
|
|
uni.request({
|
|
|
url,
|
|
@@ -420,64 +420,64 @@ const formSubmit = () => {
|
|
|
data: params,
|
|
|
},
|
|
|
success: (res) => {
|
|
|
- toast.success('提交成功')
|
|
|
- uni.navigateBack()
|
|
|
+ toast.success('提交成功');
|
|
|
+ uni.navigateBack();
|
|
|
},
|
|
|
fail: (err) => {
|
|
|
- toast.error('提交失败')
|
|
|
+ toast.error('提交失败');
|
|
|
},
|
|
|
- })
|
|
|
+ });
|
|
|
}
|
|
|
})
|
|
|
.catch((error) => {
|
|
|
- console.log(error)
|
|
|
+ console.log(error);
|
|
|
});
|
|
|
-}
|
|
|
+};
|
|
|
|
|
|
-// 获取gps
|
|
|
-uni.getFuzzyLocation({
|
|
|
- type: 'gcj02',
|
|
|
- success: function (res) {
|
|
|
- console.log(res)
|
|
|
- formData.value.COL_13.value = res.longitude
|
|
|
- formData.value.COL_14.value = res.latitude
|
|
|
- },
|
|
|
-})
|
|
|
-import DemoApi from '@/api/DemoApi'
|
|
|
+// // 获取gps
|
|
|
+// uni.getFuzzyLocation({
|
|
|
+// type: 'gcj02',
|
|
|
+// success: function (res) {
|
|
|
+// console.log(res)
|
|
|
+// formData.value.COL_13.value = res.longitude
|
|
|
+// formData.value.COL_14.value = res.latitude
|
|
|
+// },
|
|
|
+// })
|
|
|
+import DemoApi from '@/api/DemoApi';
|
|
|
|
|
|
-const fileList = ref([])
|
|
|
+const fileList = ref([]);
|
|
|
|
|
|
function handleChange(files) {
|
|
|
- const file = []
|
|
|
+ const file = [];
|
|
|
files.fileList.forEach((item) => {
|
|
|
- const response = {}
|
|
|
+ const response = {};
|
|
|
try {
|
|
|
- response.msg = JSON.parse(item.response)
|
|
|
+ response.msg = JSON.parse(item.response);
|
|
|
} catch (e) {
|
|
|
- response.msg = item.response
|
|
|
+ response.msg = item.response;
|
|
|
}
|
|
|
if (!item.response) {
|
|
|
response.msg = {
|
|
|
msg: item.url,
|
|
|
- }
|
|
|
+ };
|
|
|
}
|
|
|
file.push({
|
|
|
name: '收据图片',
|
|
|
url: response.msg,
|
|
|
- })
|
|
|
+ });
|
|
|
});
|
|
|
- formData.value.COL_19.value = file
|
|
|
+ formData.value.COL_19.value = file;
|
|
|
}
|
|
|
|
|
|
// 项目列表
|
|
|
-const oldColumns = ref([])
|
|
|
-const columns = ref([])
|
|
|
-const xiangmuList = ref([])
|
|
|
+const oldColumns = ref([]);
|
|
|
+const columns = ref([]);
|
|
|
+const xiangmuList = ref([]);
|
|
|
// 油品列表
|
|
|
-const oilList = ref([])
|
|
|
+const oilList = ref([]);
|
|
|
|
|
|
// 客户列表
|
|
|
-const kehuList = ref([])
|
|
|
+const kehuList = ref([]);
|
|
|
watch(
|
|
|
() => formData.value.COL_9.value,
|
|
|
(val) => {
|
|
@@ -488,32 +488,32 @@ watch(
|
|
|
xiangmu_id: val,
|
|
|
},
|
|
|
success: (res) => {
|
|
|
- kehuList.value = res.data.data
|
|
|
+ kehuList.value = res.data.data;
|
|
|
},
|
|
|
- })
|
|
|
+ });
|
|
|
|
|
|
DemoApi.projectList({ COL_4: val }).then((res) => {
|
|
|
- oldColumns.value = res.data
|
|
|
+ oldColumns.value = res.data;
|
|
|
columns.value = res.data.filter((item, index, arr) => {
|
|
|
- return arr.findIndex((item2) => item2.COL_1 === item.COL_1) === index
|
|
|
+ return arr.findIndex((item2) => item2.COL_1 === item.COL_1) === index;
|
|
|
});
|
|
|
oilList.value = res.data.filter((item, index, arr) => {
|
|
|
- return arr.findIndex((item2) => item2.COL_5 === item.COL_5) === index
|
|
|
+ return arr.findIndex((item2) => item2.COL_5 === item.COL_5) === index;
|
|
|
});
|
|
|
- })
|
|
|
+ });
|
|
|
}
|
|
|
-)
|
|
|
+);
|
|
|
const kehuChange = (e) => {
|
|
|
// formData.value.COL_9.value = e.selectedItems.COL_9
|
|
|
-}
|
|
|
+};
|
|
|
// 油品型号
|
|
|
-const oilModelList = ref([])
|
|
|
+const oilModelList = ref([]);
|
|
|
watch(
|
|
|
() => formData.value.COL_1.value,
|
|
|
(val) => {
|
|
|
- oilModelList.value = oilList.value.filter((item) => item.COL_4 === val)
|
|
|
+ oilModelList.value = oilList.value.filter((item) => item.COL_4 === val);
|
|
|
}
|
|
|
-)
|
|
|
+);
|
|
|
|
|
|
watch(
|
|
|
formData.value,
|
|
@@ -523,30 +523,30 @@ watch(
|
|
|
item.COL_0 === formData.value.COL_9.value &&
|
|
|
item.COL_4 === formData.value.COL_1.value &&
|
|
|
item.COL_5 === formData.value.COL_2.value
|
|
|
- )
|
|
|
+ );
|
|
|
if (!find) {
|
|
|
- return 0
|
|
|
+ return 0;
|
|
|
}
|
|
|
// 油品密度
|
|
|
- formData.value.COL_4.value = find.COL_6
|
|
|
+ formData.value.COL_4.value = find.COL_6;
|
|
|
// 送油单价
|
|
|
- formData.value.COL_6.value = find.COL_7
|
|
|
+ formData.value.COL_6.value = find.COL_7;
|
|
|
// 吨数
|
|
|
- const ton = ((formData.value.COL_3.value * +find.COL_6) / 1000).toFixed(3)
|
|
|
- formData.value.COL_5.value = ton
|
|
|
+ const ton = ((formData.value.COL_3.value * +find.COL_6) / 1000).toFixed(3);
|
|
|
+ formData.value.COL_5.value = ton;
|
|
|
// 送油金额
|
|
|
- const price = (ton * +find.COL_7).toFixed(3)
|
|
|
- formData.value.COL_7.value = price
|
|
|
+ const price = (ton * +find.COL_7).toFixed(3);
|
|
|
+ formData.value.COL_7.value = price;
|
|
|
|
|
|
// 项目编号
|
|
|
// formData.value.COL_9.value = find.COL_0
|
|
|
// 项目名称
|
|
|
formData.value.COL_10.value = xiangmuList.value.find(
|
|
|
(item) => item.COL_4 === formData.value.COL_9.value
|
|
|
- ).COL_3
|
|
|
+ ).COL_3;
|
|
|
},
|
|
|
{ deep: true }
|
|
|
-)
|
|
|
+);
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss">
|