|
|
|
@ -27,7 +27,8 @@ |
|
|
|
|
<div class="tex">有效期至:</div> |
|
|
|
|
<el-date-picker |
|
|
|
|
v-model="value1" |
|
|
|
|
type="date" |
|
|
|
|
type="datetime" |
|
|
|
|
:picker-options="pickerOptions" |
|
|
|
|
placeholder="选择日期"> |
|
|
|
|
</el-date-picker> |
|
|
|
|
</div> |
|
|
|
@ -70,6 +71,11 @@ const value = ref('') |
|
|
|
|
const result = ref('') |
|
|
|
|
const inputs = ref([]) |
|
|
|
|
const keyList = ref([]) |
|
|
|
|
const pickerOptions = ref( |
|
|
|
|
{ // 日期时间选择器的选项 |
|
|
|
|
format: 'yyyy-MM-dd HH:mm:ss', // 设置日期时间的格式 |
|
|
|
|
valueStrictly: true, // 严格匹配绑定的值,避免用户选择的日期时间与绑定的值不同步的问题 |
|
|
|
|
}, ) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
watch(() => value.value,(newVale,oldValue) => { |
|
|
|
@ -90,14 +96,27 @@ watch(() => value2.value,(newVale,oldValue) => { |
|
|
|
|
onMounted(()=>{ |
|
|
|
|
let d = new Date(); |
|
|
|
|
let today = d.getFullYear() + "-" + (d.getMonth() + 1) + "-" + d.getDate(); |
|
|
|
|
let time = d.getHours() + ":" + d.getMinutes() + ":" + d.getSeconds(); |
|
|
|
|
|
|
|
|
|
console.log(today + " " + time); |
|
|
|
|
|
|
|
|
|
value1.value= today+ " " + time |
|
|
|
|
|
|
|
|
|
value1.value= today |
|
|
|
|
console.log(new Date()) |
|
|
|
|
getKey().then((res)=>{ |
|
|
|
|
keyList.value= res.data |
|
|
|
|
value.value= res.data[0].key |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
function convertISODate(isoString) { |
|
|
|
|
let date = new Date(isoString); |
|
|
|
|
let year = date.getFullYear(); |
|
|
|
|
let month = ("0" + (date.getMonth() + 1)).slice(-2); |
|
|
|
|
let day = ("0" + date.getDate()).slice(-2); |
|
|
|
|
let hour = ("0" + date.getHours()).slice(-2); |
|
|
|
|
let minute = ("0" + date.getMinutes()).slice(-2); |
|
|
|
|
let second = ("0" + date.getSeconds()).slice(-2); |
|
|
|
|
return year + "-" + month + "-" + day + " " + hour + ":" + minute + ":" + second; |
|
|
|
|
} |
|
|
|
|
function addInput() { |
|
|
|
|
if(inputs.value.length==0){ |
|
|
|
|
if(input1.value){ |
|
|
|
@ -190,16 +209,8 @@ function delInput() { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function toResult(){ |
|
|
|
|
const dateString = value1.value; |
|
|
|
|
const date = new Date(dateString); |
|
|
|
|
const formattedDate = date.toLocaleString('zh-CN', { |
|
|
|
|
year: 'numeric', |
|
|
|
|
month: '2-digit', |
|
|
|
|
day: '2-digit', |
|
|
|
|
hour: '2-digit', |
|
|
|
|
minute: '2-digit', |
|
|
|
|
second: '2-digit' |
|
|
|
|
}); |
|
|
|
|
let formattedDate = convertISODate(value1.value); |
|
|
|
|
console.log(formattedDate) |
|
|
|
|
if(inputs.value.length==0){ |
|
|
|
|
if(input1.value){ |
|
|
|
|
resultKey( |
|
|
|
|