|
@@ -21,7 +21,8 @@
|
|
|
<view class="header-row">
|
|
|
<text class="label">序号:</text>
|
|
|
<text class="value">{{ item.senum }}</text>
|
|
|
- <text class="status" :class="{'status-cancelled': item.status === 5, 'bg-red': item.status == 4}">{{ recordStatusDict[item.status.toString()] }}</text>
|
|
|
+ <text class="status"
|
|
|
+ :class="{'status-cancelled': item.status === 5, 'bg-red': item.status == 4}">{{ recordStatusDict[item.status.toString()] }}</text>
|
|
|
</view>
|
|
|
|
|
|
<view class="info-row">
|
|
@@ -60,22 +61,32 @@
|
|
|
|
|
|
<view class="tag-banner" style="">
|
|
|
<view class="tag-banner" v-for="(tag,index) in item.imgname" :key="index" v-if="item.imgname.length>0">
|
|
|
- <text class="img-banner" v-if="item.imgname[index]!=''&& closeTags[index]" @click="closeTag(index)">{{tag}}</text>
|
|
|
+ <text class="img-banner" v-if="item.imgname[index]!=''&& closeTags[index]"
|
|
|
+ @click="closeTag(index)">{{tag}}</text>
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
<view class="my-page">
|
|
|
<swiper class="swiper-box my-swiper" :current="0" :indicator-dots="true" v-if="item.urlpdt.length>0">
|
|
|
- <swiper-item v-for="(url, index) in item.urlpdt" :key="index" @tap="preview(url)" >
|
|
|
+ <swiper-item v-for="(url, index) in item.urlpdt" :key="index" @tap="preview(url)">
|
|
|
<view class="swiper-item ">
|
|
|
<image class="my-image" :src="url" mode="aspectFill" />
|
|
|
</view>
|
|
|
- <view v-if="item.imgname.length>0">
|
|
|
+ <view v-if="item.imgname.length>0">
|
|
|
<text class="demo-view-label">{{ item.imgname?.[index] ?? ''}}</text>
|
|
|
</view>
|
|
|
</swiper-item>
|
|
|
</swiper>
|
|
|
- <image :src="item.urlspl" mode="widthFix" v-if="item.urlpdt.length == 0 && item.urlspl!=''"></image>
|
|
|
+
|
|
|
+ <swiper class="swiper-box my-swiper mg-top" :current="0" :indicator-dots="true"
|
|
|
+ v-if="item.urlspl.length>0">
|
|
|
+ <swiper-item v-for="(url, index) in item.urlspl" :key="index" @tap="preview(url)">
|
|
|
+ <view class="swiper-item ">
|
|
|
+ <image class="my-image" :src="url" mode="aspectFill" />
|
|
|
+ </view>
|
|
|
+ </swiper-item>
|
|
|
+ </swiper>
|
|
|
+
|
|
|
<view v-if="item.urlspl">
|
|
|
<text class="demo-view-label">样张</text>
|
|
|
</view>
|
|
@@ -101,7 +112,7 @@
|
|
|
import {
|
|
|
ref
|
|
|
} from 'vue'
|
|
|
- import { getList, Record, recordStatusDict,updateData } from '@/api/work';
|
|
|
+ import { getList, Record, recordStatusDict, updateData } from '@/api/work';
|
|
|
|
|
|
//检查项目最大数量
|
|
|
var maxcount = 5
|
|
@@ -110,31 +121,34 @@
|
|
|
const closeTags = ref<boolean[]>([]);
|
|
|
var initRecords = [] as Record[]
|
|
|
|
|
|
- onLoad((options) => {
|
|
|
- const photoitem = options?.photoitem ?? ""
|
|
|
- const num = options?.num ?? "1"
|
|
|
- const pid = options?.pid ?? "1"
|
|
|
- maxcount = parseInt(num)
|
|
|
- //var closeTags = new Array(maxcount as Int).fill(true)
|
|
|
- //closeTags.value = Arrays.fill(true)
|
|
|
-
|
|
|
- console.log(closeTags.value)
|
|
|
-
|
|
|
+ // 存储页面参数
|
|
|
+ let photoitem = "";
|
|
|
+ let pid = "";
|
|
|
+
|
|
|
+ // 定义数据刷新函数
|
|
|
+ const refreshRecords = (index : number) => {
|
|
|
+ // 清空现有数据
|
|
|
+ initRecords = [];
|
|
|
+ closeTags.value = [];
|
|
|
+
|
|
|
// #ifdef APP-ANDROID
|
|
|
- getList('app_media_record', 'photoitem', photoitem, 'pid', pid, null).then((res : UTSJSONObject) => {
|
|
|
+ getList('app_media_record', 'photoitem', photoitem, 'pid', pid, null).then((res : UTSJSONObject) => {
|
|
|
let dataList = res?.['data'] as UTSJSONObject[] ?? Array<UTSJSONObject>()
|
|
|
if (dataList != null && dataList.length > 0) {
|
|
|
dataList.forEach(item => {
|
|
|
if (item != null) {
|
|
|
const imgnameStr = item?.['imgname'] as string ?? ''
|
|
|
const urlpdtStr = item?.['urlpdt'] as string ?? ''
|
|
|
- const imgnameArr = imgnameStr.indexOf(",")>-1? imgnameStr.split(",") : (imgnameStr!=''?[imgnameStr]:[])
|
|
|
- const urlpdtArr = urlpdtStr.indexOf(",")>-1? urlpdtStr.split(",") : (urlpdtStr!=''?[urlpdtStr]:[])
|
|
|
+ const urlsplStr = item?.['urlspl'] as string ?? ''
|
|
|
+ const imgnameArr = imgnameStr.indexOf(",") > -1 ? imgnameStr.split(",") : (imgnameStr != '' ? [imgnameStr] : [])
|
|
|
+ const urlpdtArr = urlpdtStr.indexOf(",") > -1 ? urlpdtStr.split(",") : (urlpdtStr != '' ? [urlpdtStr] : [])
|
|
|
+ const urlsplArr = urlsplStr.indexOf(",") > -1 ? urlsplStr.split(",") : (urlsplStr != '' ? [urlsplStr] : [])
|
|
|
item['imgname'] = imgnameArr
|
|
|
item['urlpdt'] = urlpdtArr
|
|
|
+ item['urlspl'] = urlsplArr
|
|
|
let record = JSON.parse<Record>(item.toJSONString());
|
|
|
if (record != null) {
|
|
|
- for(let i:Int=0;i<record.num; i++){
|
|
|
+ for (let i : Int = 0; i < record.num; i++) {
|
|
|
closeTags.value.push(true)
|
|
|
}
|
|
|
initRecords.push(record)
|
|
@@ -143,12 +157,33 @@
|
|
|
});
|
|
|
}
|
|
|
if (initRecords.length > 0) {
|
|
|
- current.value = initRecords[0].senum
|
|
|
- records.value = [initRecords[0]]
|
|
|
+ console.log(initRecords)
|
|
|
+ console.log(index)
|
|
|
+ if (index > 0) {
|
|
|
+ current.value = index
|
|
|
+ } else {
|
|
|
+ current.value = initRecords[0].senum
|
|
|
+ }
|
|
|
+ console.log(current.value)
|
|
|
+ records.value = initRecords.filter(item => item['senum'] == current.value)
|
|
|
console.log(records)
|
|
|
}
|
|
|
});
|
|
|
// #endif
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ onLoad((options) => {
|
|
|
+ photoitem = options?.photoitem ?? ""
|
|
|
+ const num = options?.num ?? "1"
|
|
|
+ pid = options?.pid ?? "1"
|
|
|
+ maxcount = parseInt(num)
|
|
|
+
|
|
|
+ console.log(closeTags.value)
|
|
|
+
|
|
|
+ // 加载初始数据
|
|
|
+ refreshRecords(0);
|
|
|
});
|
|
|
|
|
|
|
|
@@ -164,7 +199,7 @@
|
|
|
partno: 'TD10-01',
|
|
|
num: 2,
|
|
|
status: '未执行',
|
|
|
- urlspl: '/static/images/demo.png',
|
|
|
+ urlspl: ['/static/images/demo.png'],
|
|
|
imgname: ['1.jpg', '2.jpg'],
|
|
|
urlpdt: ['/static/images/demo.png', '/static/images/demo.png']
|
|
|
},
|
|
@@ -179,7 +214,7 @@
|
|
|
partno: 'TD10-02',
|
|
|
num: 3,
|
|
|
status: '未执行',
|
|
|
- urlspl: '/static/images/demo.png',
|
|
|
+ urlspl: ['/static/images/demo.png'],
|
|
|
imgname: ['1.jpg', '2.jpg', '3.jpg'],
|
|
|
urlpdt: ['/static/images/demo.png', '/static/images/demo.png', '/static/images/demo.png']
|
|
|
}] as Record[];
|
|
@@ -192,64 +227,71 @@
|
|
|
}
|
|
|
const closeTag = (index : number) => {
|
|
|
let record = records.value[0]
|
|
|
- if(record.status==3){
|
|
|
- uni.showToast({
|
|
|
- title: '拍照任务已完成',
|
|
|
- icon: 'error',
|
|
|
- duration: 2000
|
|
|
- });
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
+ // if(record.status==3){
|
|
|
+ // uni.showToast({
|
|
|
+ // title: '拍照任务已完成',
|
|
|
+ // icon: 'error',
|
|
|
+ // duration: 2000
|
|
|
+ // });
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+
|
|
|
uni.showModal({
|
|
|
- title: '系统提示',
|
|
|
- content: '确认是否删除图片',
|
|
|
- cancelText: '取消',
|
|
|
- confirmText: '确定',
|
|
|
- success: function(res) {
|
|
|
- if (res.confirm) {
|
|
|
- closeTags.value[index] = false
|
|
|
- let imgname = record.imgname.filter((img,i)=> i!= index)
|
|
|
- let urlpdt = record.urlpdt.filter((url,i)=> i!= index)
|
|
|
- let updatedData = ''
|
|
|
- if(imgname.length!=urlpdt.length){
|
|
|
- uni.showToast({
|
|
|
- title: '图片数据不正确',
|
|
|
- icon: 'error',
|
|
|
- duration: 2000
|
|
|
- });
|
|
|
- return;
|
|
|
- }
|
|
|
- console.log(urlpdt)
|
|
|
- if(imgname.length==0 && urlpdt.length==0){
|
|
|
- updatedData = "imgname='',urlpdt=''"
|
|
|
- }else if(imgname.length==1 && urlpdt.length==1) {
|
|
|
- updatedData = "imgname='"+imgname[0]+ "',urlpdt='"+urlpdt[0]+"'"
|
|
|
- }else{
|
|
|
- updatedData = "imgname='"+imgname.join(",")+ "',urlpdt='"+urlpdt.join(",")+"'"
|
|
|
- }
|
|
|
-
|
|
|
- updateData('app_media_record', updatedData, 'sxid', record.sxid.toString()).then((res : UTSJSONObject) => {
|
|
|
- let dataList = res?.['data'] as UTSJSONObject[] ?? Array<UTSJSONObject>()
|
|
|
- if (dataList != null && dataList.length > 0) {
|
|
|
- console.log(dataList[0])
|
|
|
+ title: '系统提示',
|
|
|
+ content: '确认是否删除图片',
|
|
|
+ cancelText: '取消',
|
|
|
+ confirmText: '确定',
|
|
|
+ success: function (res) {
|
|
|
+ if (res.confirm) {
|
|
|
+ closeTags.value[index] = false
|
|
|
+ let imgname = record.imgname.filter((img, i) => i != index)
|
|
|
+ let urlpdt = record.urlpdt.filter((url, i) => i != index)
|
|
|
+ let updatedData = ''
|
|
|
+ if (imgname.length != urlpdt.length) {
|
|
|
uni.showToast({
|
|
|
- title: "删除成功!",
|
|
|
+ title: '图片数据不正确',
|
|
|
+ icon: 'error',
|
|
|
+ duration: 2000
|
|
|
});
|
|
|
-
|
|
|
+ return;
|
|
|
}
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
+ console.log(urlpdt)
|
|
|
+ if (imgname.length == 0 && urlpdt.length == 0) {
|
|
|
+ updatedData = "imgname='',urlpdt=''"
|
|
|
+ } else if (imgname.length == 1 && urlpdt.length == 1) {
|
|
|
+ updatedData = "imgname='" + imgname[0] + "',urlpdt='" + urlpdt[0] + "'"
|
|
|
+ } else {
|
|
|
+ updatedData = "imgname='" + imgname.join(",") + "',urlpdt='" + urlpdt.join(",") + "'"
|
|
|
+ }
|
|
|
+
|
|
|
+ if (imgname.length == 0) {
|
|
|
+ updatedData += ',status=1 '
|
|
|
+ } else if (imgname.length < record.num) {
|
|
|
+ updatedData += ',status=2 '
|
|
|
+ }
|
|
|
+
|
|
|
+ updateData('app_media_record', updatedData, 'sxid', record.sxid.toString()).then((res : UTSJSONObject) => {
|
|
|
+ let dataList = res?.['data'] as UTSJSONObject[] ?? Array<UTSJSONObject>()
|
|
|
+ if (dataList != null && dataList.length > 0) {
|
|
|
+ console.log(dataList[0])
|
|
|
+ uni.showToast({
|
|
|
+ title: "删除成功!",
|
|
|
+ });
|
|
|
+ // 刷新页面数据
|
|
|
+ refreshRecords(record.senum);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
})
|
|
|
}
|
|
|
-
|
|
|
- const preview = (imageUrl: string) => {
|
|
|
+
|
|
|
+ const preview = (imageUrl : string) => {
|
|
|
uni.previewImage({
|
|
|
- urls: [imageUrl], // 需要预览的图片链接列表
|
|
|
- current: 0, // 当前显示图片的索引
|
|
|
- indicator: 'number', // 图片指示器样式
|
|
|
- loop: false // 是否可循环预览
|
|
|
+ urls: [imageUrl], // 需要预览的图片链接列表
|
|
|
+ current: 0, // 当前显示图片的索引
|
|
|
+ indicator: 'number', // 图片指示器样式
|
|
|
+ loop: false // 是否可循环预览
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -538,10 +580,15 @@
|
|
|
font-size: 12px;
|
|
|
padding: 0 10rpx;
|
|
|
}
|
|
|
+
|
|
|
.tag-banner {
|
|
|
- flex-direction: column;
|
|
|
- flex-wrap: wrap;
|
|
|
- margin: 4px 0;
|
|
|
- font-size: 12px;
|
|
|
+ flex-direction: column;
|
|
|
+ flex-wrap: wrap;
|
|
|
+ margin: 4px 0;
|
|
|
+ font-size: 12px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .mg-top {
|
|
|
+ margin-top: 20rpx;
|
|
|
}
|
|
|
</style>
|