diff --git a/common/utils/upload.js b/common/utils/upload.js
index 5e0a4ab..ecd4952 100644
--- a/common/utils/upload.js
+++ b/common/utils/upload.js
@@ -6,6 +6,7 @@ import { fileUpload } from '@/api/common';
// 统一的多文件上传方法(单/多图都走这个)
export const uploadImages = async (options) => {
+ console.log(options)
const {
filePaths,
fileKey = 'file',
@@ -28,6 +29,7 @@ export const uploadImages = async (options) => {
// 遍历上传(单/多图统一遍历逻辑)
for (let i = 0; i < filePaths.length; i++) {
+ console.log(filePaths[i])
try {
const url = await new Promise((resolve, reject) => {
uni.uploadFile({
diff --git a/manifest.json b/manifest.json
index f35456e..f7c12fd 100644
--- a/manifest.json
+++ b/manifest.json
@@ -54,7 +54,7 @@
},
/* 小程序特有相关 */
"mp-weixin" : {
- "appid" : "wxcb4cd34066b97d82",
+ "appid" : "wx4ba1e0a1b7075371",
"setting" : {
"urlCheck" : false
},
diff --git a/pages-sub/daily/maintain-manage/add-record.vue b/pages-sub/daily/maintain-manage/add-record.vue
index 5edeb94..85aba29 100644
--- a/pages-sub/daily/maintain-manage/add-record.vue
+++ b/pages-sub/daily/maintain-manage/add-record.vue
@@ -229,16 +229,8 @@ export default {
},
onLoad(option) {
console.log('页面参数:', option)
- // 入口 URL 里出现过 `planNo=${planNo} &businessType=` 这种多一个空格的历史写法,
- // 会让 planNo 带上尾空格 → 后端按 planNo 查不到计划(提交报「养护计划不存在」)。
- // 这里统一 trim,不依赖每个入口都写对
- const params = {}
- Object.keys(option || {}).forEach(key => {
- const val = option[key]
- params[key] = typeof val === 'string' ? val.trim() : val
- })
- this.paramsOptins = params
- const { businessType, planTypeId } = params
+ this.paramsOptins = option
+ const { businessType, planTypeId } = option
this.loadDynamicFields(businessType, planTypeId)
},
onReady() {
@@ -566,22 +558,6 @@ export default {
getImgUrlList(imgList) {
return imgList.filter(item => item.status === 'success').map(item => item.url)
},
- /**
- * 开始照片:把所有「图片」(fieldType=7) 动态字段里上传成功的 URL 拍平成一个数组。
- * 不写死字段 code —— 配置里叫 tu_pian 还是别的名字都能取到;
- * 判空口径与校验规则 buildRequiredRule 一致(看 fileListMap 的 status,而不是 inspectForm)
- */
- collectBeginImgs() {
- const fields = this.dynamicFields || []
- const urls = []
- fields.forEach(field => {
- if (field.fieldType !== 7) return
- this.getImgUrlList(this.fileListMap[field.fieldCode] || []).forEach(url => {
- if (url) urls.push(url)
- })
- })
- return urls
- },
// ========== 动态字段:渲染与取值辅助 ==========
/**
* 类型6 多选是否要求每项填「使用数量」(ext_config.needQuantity)
@@ -726,13 +702,13 @@ uploadFieldFiles(item: any, event: any) {
const fileList = Array.isArray(rawFile) ? rawFile : [rawFile]
const targetImgList = this.fileListMap[item.fieldCode] || (this.fileListMap[item.fieldCode] = [])
const filePaths = fileList.map(file => file.url)
- const tempItems = fileList.map(item => ({
- ...item,
- status: 'uploading',
- message: '上传中'
- }))
- const startIndex = targetImgList.length
- targetImgList.push(...tempItems)
+ // const tempItems = fileList.map(item => ({
+ // ...item,
+ // status: 'uploading',
+ // message: '上传中'
+ // }))
+ // const startIndex = targetImgList.length
+ // targetImgList.push(...tempItems)
this.uploadToField(item, fileList.filter(file => file && file.url).map(file => ({
url: file.url,
@@ -776,62 +752,66 @@ uploadFieldFiles(item: any, event: any) {
* 把选中的本地文件逐个上传并把 http 地址回填到 fileListMap / inspectForm。
* 7图片与8附件共用(uploadImages 是通用 uni.uploadFile,不限图片类型)
*/
- async uploadToField(item: any, files: any[]) {
- const code = item.fieldCode
- const maxCount = this.maxCountOf(item, 5)
- const maxSizeMb = this.maxSizeMbOf(item, 5)
- const validFiles = (files || []).filter(file => file && file.url && !this.isOversize(file, maxSizeMb))
- if (!validFiles.length) {
- return
- }
- const targetList = this.fileListMap[code] || (this.fileListMap[code] = [])
- if (targetList.length + validFiles.length > maxCount) {
- uni.showToast({ title: `最多只能上传${maxCount}个`, icon: 'none' })
- return
- }
- const startIndex = targetList.length
- targetList.push(...validFiles.map(file => ({
- url: file.url, status: 'uploading', message: '上传中', name: file.name || ''
- })))
- try {
- const uploadResultUrls = await uploadImages({
- filePaths: validFiles.map(file => file.url),
- ignoreError: true
+ async uploadToField(item: any, files: any[]) {
+const code = item.fieldCode
+const maxCount = this.maxCountOf(item, 5)
+const maxSizeMb = this.maxSizeMbOf(item, 5)
+const validFiles = (files || []).filter(file => file && file.url && !this.isOversize(file, maxSizeMb))
+if (!validFiles.length) {
+return
+}
+const targetList = this.fileListMap[code] || (this.fileListMap[code] = [])
+if (targetList.length + validFiles.length > maxCount) {
+uni.showToast({ title: `最多只能上传${maxCount}个`, icon: 'none' })
+return
+}
+// 保存起始下标
+const startIndex = targetList.length
+// 只在这里push一次
+targetList.push(...validFiles.map(file => ({
+url: file.url, status: 'uploading', message: '上传中', name: file.name || ''
+})))
+try {
+const uploadResultUrls = await uploadImages({
+filePaths: validFiles.map(file => file.url),
+ignoreError: true
})
- uploadResultUrls.forEach((url, index) => {
- if (targetList[startIndex + index]) {
- targetList.splice(startIndex + index, 1, {
- url, status: 'success', message: '', name: validFiles[index].name || ''
+uploadResultUrls.forEach((url, index) => {
+// 用startIndex + index 替换对应条目
+if (targetList[startIndex + index]) {
+targetList.splice(startIndex + index, 1, {
+url, status: 'success', message: '', name: validFiles[index].name || ''
})
}
})
- for (let i = uploadResultUrls.length; i < validFiles.length; i++) {
- if (targetList[startIndex + i]) {
- targetList.splice(startIndex + i, 1, {
- url: validFiles[i].url, status: 'failed', message: '上传失败', name: validFiles[i].name || ''
+for (let i = uploadResultUrls.length; i < validFiles.length; i++) {
+if (targetList[startIndex + i]) {
+targetList.splice(startIndex + i, 1, {
+url: validFiles[i].url, status: 'failed', message: '上传失败', name: validFiles[i].name || ''
})
}
}
- if (uploadResultUrls.length < validFiles.length) {
- uni.showToast({
- title: `成功${uploadResultUrls.length}个,失败${validFiles.length - uploadResultUrls.length}个`,
- icon: 'none'
+if (uploadResultUrls.length < validFiles.length) {
+uni.showToast({
+title: `成功${uploadResultUrls.length}个,失败${validFiles.length - uploadResultUrls.length}个`,
+icon: 'none'
})
}
} catch (err) {
- console.error(`【${code}】文件上传失败:`, err)
- for (let i = 0; i < validFiles.length; i++) {
- if (targetList[startIndex + i]) {
- targetList.splice(startIndex + i, 1, {
- url: validFiles[i].url, status: 'failed', message: '上传失败', name: validFiles[i].name || ''
+console.error(`【${code}】文件上传失败:`, err)
+for (let i = 0; i < validFiles.length; i++) {
+if (targetList[startIndex + i]) {
+targetList.splice(startIndex + i, 1, {
+url: validFiles[i].url, status: 'failed', message: '上传失败', name: validFiles[i].name || ''
})
}
}
- uni.showToast({ title: '上传失败,请重试', icon: 'none' })
+uni.showToast({ title: '上传失败,请重试', icon: 'none' })
}
- this.syncFileValue(item)
- this.$refs.inspectFormRef.validateField(code)
- },
+this.syncFileValue(item)
+this.$refs.inspectFormRef.validateField(code)
+},
+
/**
* 删除 7图片/8附件 的某一个已选文件
*/
@@ -942,10 +922,7 @@ uploadFieldFiles(item: any, event: any) {
const submitData = {
planNo: this.paramsOptins.planNo,
imgHost: "1",
- // 开始照片 = 动态「图片」(fieldType=7) 字段里已上传成功的 URL。
- // 页面上已没有固定的「上传图片」行(图片/附件都是配置出来的动态字段),
- // 没配图片字段或没传图时是空数组 —— 后端 beginImg 已改为选填
- beginImg: this.collectBeginImgs(),
+ beginImg: this.getImgUrlList(this.imagesList),
commonUserList: [],
remark: this.inspectForm.remark.trim(),
}
@@ -1011,15 +988,7 @@ uploadFieldFiles(item: any, event: any) {
.date-input-wrap {
width: 100%;
}
-.fixed-bottom-btn-wrap {
- position: fixed;
- bottom: 0;
- left: 0;
- width: 100%;
- padding: 20rpx;
- box-sizing: border-box;
- background-color: #fff;
-}
+
// 放大u-number-box输入框
.large-number-box {
:deep(.u-number-box__input) {
diff --git a/pages-sub/problem/work-order-manage/add-order.vue b/pages-sub/problem/work-order-manage/add-order.vue
index 4cec18f..8aa3c50 100644
--- a/pages-sub/problem/work-order-manage/add-order.vue
+++ b/pages-sub/problem/work-order-manage/add-order.vue
@@ -72,6 +72,22 @@
+
+
+
+
+
+
+
+
+
+
@@ -128,6 +144,30 @@ const formatBusiLineOptions = () => {
console.log(busiLineOptions.value)
};
+
+const keyInspectionOptions = reactive([
+ {
+ name: '否',
+ disabled: false,
+ },
+ {
+ name: '是',
+ disabled: false,
+ },
+
+]);
+
+// up-radio-group的v-model绑定的值如果设置为某个radio的name,就会被默认选中
+const radiovalue1 = ref('否');
+
+const groupChange = (n) => {
+ console.log('groupChange', n);
+};
+
+const radioChange = (n) => {
+ console.log('radioChange', n);
+};
+
// ========== 工具方法 ==========
// 编码 → 中文名称。字典未拉到时(登录时字典请求是容错的)兜底显示原始编码,
// 保证选项不为空、页面仍可用
@@ -198,6 +238,7 @@ const workOrderForm = reactive({
lat: 0, // 原有字段
lon: 0, // 原有字段
expectedFinishDate: '', // 原有字段
+ keyInspection: '否'
})
// ========== 表单校验规则(核心调整:新增busiLineCn校验规则) ==========
@@ -307,7 +348,9 @@ const echoOrderData = (orderItem) => {
workOrderForm.lat = orderItem.lat || 0;
workOrderForm.lon = orderItem.lon || 0;
workOrderForm.expectedFinishDate = orderItem.expectedFinishDate ? timeFormat(orderItem.expectedFinishDate, 'yyyy-mm-dd hh:MM:ss') : '';
-
+if (orderItem.keyInspection !== undefined) {
+ workOrderForm.keyInspection = orderItem.keyInspection === 1 ? '是' : '否'
+}
// 3. 上传图片回显(兼容useUploadImgs格式)
if (orderItem.problemsImgs && Array.isArray(orderItem.problemsImgs) && orderItem.problemsImgs.length > 0) {
const imgList = orderItem.problemsImgs.map((imgUrl, index) => ({
@@ -531,6 +574,7 @@ const submitWorkOrder = async () => {
return;
}
console.log('完成时间:' + workOrderForm.expectedFinishDate)
+ const keyInspectionVal = workOrderForm.keyInspection === '是' ? 1 : 0
// 构建公共提交数据
const commonSubmitData = {
roadId: workOrderForm.roadId,
@@ -543,6 +587,7 @@ const submitWorkOrder = async () => {
lonLatAddress: workOrderForm.workLocation,
pressingType: workOrderForm.pressingType,
orderName: workOrderForm.orderName,
+ keyInspection: keyInspectionVal,
expectedFinishDate: workOrderForm.expectedFinishDate == "" ? "" : new Date(workOrderForm.expectedFinishDate).getTime(),
sourceId: 1,
sourceName: workOrderForm.busiLineCn, // 从form字段获取业务线中文名称