|
@@ -17,10 +17,10 @@
|
|
|
<n-select v-model:value="item.T_value" label-field="T_id" value-field="T_sn" :options="classList"
|
|
|
v-else-if="item.T_label === 4"/>
|
|
|
<!-- 时间 -->
|
|
|
- <n-date-picker v-model:formatted-value="item.T_value" value-format="yyyy-MM-dd HH:mm" type="datetime" clearable
|
|
|
+ <n-date-picker @focus="focusFun(item,index)" @blur="blurFun" v-model:formatted-value="item.T_value" value-format="yyyy-MM-dd HH:mm" type="datetime" clearable
|
|
|
class="w-full" v-else-if="item.T_label === 7" />
|
|
|
<!-- 时间区间 -->
|
|
|
- <n-date-picker v-model:formatted-value="item.T_value" value-format="yyyy-MM-dd HH:mm" type="datetimerange"
|
|
|
+ <n-date-picker @focus="focusFun(item,index)" @blur="blurFun" v-model:formatted-value="item.T_value" value-format="yyyy-MM-dd HH:mm" type="datetimerange"
|
|
|
clearable class="w-full" v-else-if="item.T_label === 9" />
|
|
|
<!-- 图片 -->
|
|
|
<template v-else-if="item.T_label === 10">
|
|
@@ -42,7 +42,7 @@
|
|
|
<!-- 时间 注释 -->
|
|
|
<template v-else-if="item.T_label === 12">
|
|
|
<n-space vertical class="w-full">
|
|
|
- <n-date-picker
|
|
|
+ <n-date-picker @focus="focusFun(item,index)" @blur="blurFun"
|
|
|
v-model:formatted-value="item.T_value[0]"
|
|
|
format="yyyy-MM-dd HH:mm"
|
|
|
:time-picker-props="{ format: 'HH:mm' }"
|
|
@@ -56,6 +56,7 @@
|
|
|
<template v-else-if="item.T_label === 13">
|
|
|
<n-space vertical class="w-full">
|
|
|
<n-date-picker
|
|
|
+ @focus="focusFun(item,index)" @blur="blurFun"
|
|
|
v-model:formatted-value="item.T_value[0]"
|
|
|
format="yyyy-MM-dd HH:mm"
|
|
|
:time-picker-props="{ format: 'HH:mm' }"
|
|
@@ -90,7 +91,7 @@
|
|
|
|
|
|
import { getVerifyTemplateMapDataList,putVerifyTemplateMapData} from '@/api';
|
|
|
import { getToken } from '@/utils/storage/sessionToken';
|
|
|
-import { watch } from 'vue';
|
|
|
+import { ref, watch } from 'vue';
|
|
|
import { InformationCircleOutline } from '@vicons/ionicons5';
|
|
|
|
|
|
const props = defineProps({
|
|
@@ -116,34 +117,53 @@ const props = defineProps({
|
|
|
const formValue = reactive({
|
|
|
formList: [],
|
|
|
});
|
|
|
+const focusData = reactive({
|
|
|
+ fNum:null,
|
|
|
+ obj:{}
|
|
|
+})
|
|
|
+const blurFun = () =>{
|
|
|
+ console.log('失去焦点')
|
|
|
+}
|
|
|
+const focusFun = (obj,index)=>{
|
|
|
+ focusData.fNum = index
|
|
|
+ focusData.obj = obj
|
|
|
+}
|
|
|
//监听单个时间点击赋值
|
|
|
watch(
|
|
|
() => props.time,
|
|
|
(newValue) => {
|
|
|
- console.log('时间', newValue,newValue.length,newValue.slice(0,16))
|
|
|
- formValue.formList.forEach((item, i) => {
|
|
|
-
|
|
|
- if (item.T_label === 7) {
|
|
|
- formValue.formList[i].T_value = newValue.length==19?newValue.slice(0,16):newValue
|
|
|
+ console.log('单击',newValue,focusData.fNum)
|
|
|
+ if(focusData.fNum==null){
|
|
|
+ return
|
|
|
+ }else{
|
|
|
+ console.log('继续单击',newValue,focusData.fNum,focusData.obj)
|
|
|
+ if (focusData.obj.T_label === 7) {
|
|
|
+ formValue.formList[focusData.fNum].T_value = newValue.length==19?newValue.slice(0,16):newValue
|
|
|
}
|
|
|
- if (item.T_label === 12) {
|
|
|
- formValue.formList[i].T_value[0] = newValue.length==19?newValue.slice(0,16):newValue
|
|
|
+ if (focusData.obj.T_label === 12) {
|
|
|
+ formValue.formList[focusData.fNum].T_value[0] = newValue.length==19?newValue.slice(0,16):newValue
|
|
|
}
|
|
|
- })
|
|
|
+
|
|
|
+ }
|
|
|
+ focusData.fNum = null
|
|
|
+
|
|
|
}
|
|
|
);
|
|
|
//监听框选时间区间选择时间
|
|
|
watch(
|
|
|
() => props.temporalInterval,
|
|
|
(newValue) => {
|
|
|
- formValue.formList.forEach((item,i)=>{
|
|
|
- if(item.T_label === 9){
|
|
|
- formValue.formList[i].T_value = newValue
|
|
|
- }
|
|
|
- if(item.T_label === 13){
|
|
|
- formValue.formList[i].T_value[0] = newValue
|
|
|
- }
|
|
|
- })
|
|
|
+ console.log('框选',newValue)
|
|
|
+ if(focusData.fNum==null){
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if(focusData.obj.T_label === 9){
|
|
|
+ formValue.formList[focusData.fNum].T_value = newValue
|
|
|
+ }
|
|
|
+ if(focusData.obj.T_label === 13){
|
|
|
+ formValue.formList[focusData.fNum].T_value[0] = newValue
|
|
|
+ }
|
|
|
+ focusData.fNum = null
|
|
|
}
|
|
|
);
|
|
|
watch(()=>formValue.formList, async(newValue,old)=>{
|
|
@@ -168,27 +188,28 @@ const dataPicker = ()=>{
|
|
|
return new Promise(resolve=>{
|
|
|
formValue.formList.forEach(item=>{
|
|
|
let obj = {...item}
|
|
|
- if(obj.T_label==3 || obj.T_label==9){//多选id sn|sn|
|
|
|
-
|
|
|
+ if(obj.T_label==3 || obj.T_label==9){//多选id sn|sn|
|
|
|
obj.T_value!=null? obj.T_value = obj.T_value.join("|"): obj.T_value = null
|
|
|
}else if(obj.T_label==12){
|
|
|
- console.log('当前为12',obj.T_value)
|
|
|
+ // console.log('当前为12',obj.T_value)
|
|
|
obj.T_value = obj.T_value.join("/")
|
|
|
|
|
|
}else if(obj.T_label==13){
|
|
|
- console.log('当前为13',obj.T_value)
|
|
|
- if(obj.T_value[0]!=null){
|
|
|
+ // console.log('当前为13',obj.T_value)
|
|
|
+ if(obj.T_value[0]!=null && obj.T_value[1]!=null){
|
|
|
obj.T_value = obj.T_value[0].join("|") + '/' + obj.T_value[1]
|
|
|
- console.log('13选择了',obj.T_value)
|
|
|
+ }else if(obj.T_value[0]==null && obj.T_value[1]!=null){
|
|
|
+ obj.T_value = '/'+ obj.T_value[1]
|
|
|
+ }else if(obj.T_value[0]!=null && obj.T_value[1]==null){
|
|
|
+ obj.T_value = obj.T_value[0].join("|") + '/'
|
|
|
}else{
|
|
|
- obj.T_value = '/'+ obj.T_value[1]==null?'':obj.T_value[1]
|
|
|
+ obj.T_value = ''
|
|
|
}
|
|
|
}
|
|
|
arr.push(obj)
|
|
|
})
|
|
|
resolve(arr)
|
|
|
})
|
|
|
- console.log('失去焦点',formValue.formList)
|
|
|
}
|
|
|
//
|
|
|
const queryData = reactive({
|
|
@@ -243,7 +264,7 @@ const getTemplateList = async () => {
|
|
|
|
|
|
}
|
|
|
} else if (item.T_label === 13) {
|
|
|
- if(item.T_value=='' || item.T_value==null){
|
|
|
+ if(item.T_value=='' || item.T_value==null || item.T_value=='null'){
|
|
|
item.T_value = [null,null]
|
|
|
}else{
|
|
|
if(item.T_value.split('/')[0]==""){//前面时间区间没选
|
|
@@ -256,7 +277,6 @@ const getTemplateList = async () => {
|
|
|
item.T_value = item.T_value ? item.T_value : null;
|
|
|
}
|
|
|
});
|
|
|
- console.log('结果',formValue.formList)
|
|
|
} catch (e) {
|
|
|
console.log(e);
|
|
|
}
|