时间控件
This commit is contained in:
@@ -28,9 +28,10 @@ export namespace Device {
|
||||
createId: string; //出厂编号
|
||||
hardwareVersion: string; //固件版本
|
||||
softwareVersion: string; //软件版本
|
||||
protocol:string; //通讯协议
|
||||
ip: string; //IP地址
|
||||
port: number; //端口号
|
||||
encryption: string; //装置是否为加密版本
|
||||
encryption: number; //装置是否为加密版本
|
||||
series?: string| null; //装置识别码(3ds加密)
|
||||
devKey?: string| null; //装置秘钥(3ds加密)
|
||||
sampleID?: string| null; //样品编号
|
||||
|
||||
@@ -85,16 +85,16 @@ const props = defineProps({
|
||||
},
|
||||
default: {
|
||||
type: String,
|
||||
default: '日',
|
||||
default: '月',
|
||||
},
|
||||
})
|
||||
|
||||
// 定义事件
|
||||
const emit = defineEmits<{
|
||||
(e: 'update-dates', startDate: Date, endDate: Date): void;
|
||||
(e: 'update-dates', startDate: string, endDate: string): void;
|
||||
}>()
|
||||
const timeUnit = ref<string>(props.default) // 默认选择
|
||||
const startDate = ref<Date>(new Date()) // 起始日期
|
||||
const startDate = ref<Date>(new Date(0)) // 起始日期
|
||||
const endDate = ref<Date>(new Date()) // 结束日期
|
||||
const isNextDisabled = ref<boolean>(false) // 控制下一周期按钮的禁用状态
|
||||
const today = ref<Date>(new Date()) // 当前日期
|
||||
@@ -109,7 +109,7 @@ const timeUnits = ref<TimeUnit[]>(
|
||||
// 发出日期变化事件
|
||||
const emitDateChange = () => {
|
||||
emit('update-dates', formatDate(startDate.value), formatDate(endDate.value))
|
||||
//console.log('emitDateChange', startDate.value, endDate.value);
|
||||
console.log('emitDateChange', startDate.value, endDate.value)
|
||||
}
|
||||
|
||||
// 在组件挂载时更新日期范围
|
||||
|
||||
@@ -54,7 +54,11 @@
|
||||
<el-row :gutter="24" >
|
||||
<el-col :span="8">
|
||||
<el-form-item label="生产日期" prop="createDate">
|
||||
<el-input v-model='formContent.createDate' placeholder="请输入生产日期"/>
|
||||
<el-date-picker
|
||||
v-model="formContent.createDate"
|
||||
type="datetime"
|
||||
placeholder="请选择生产日期"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
@@ -75,10 +79,10 @@
|
||||
</el-row>
|
||||
<el-row :gutter="24" >
|
||||
<el-col :span="8">
|
||||
<el-form-item label='通讯协议' prop='devType'>
|
||||
<el-select v-model="formContent.devType" clearable placeholder="请选择通讯协议">
|
||||
<el-form-item label='通讯协议' prop='protocol'>
|
||||
<el-select v-model="formContent.protocol" clearable placeholder="请选择通讯协议">
|
||||
<el-option
|
||||
v-for="item in dictStore.getDictData('High_Cate')"
|
||||
v-for="item in dictStore.getDictData('Event_Type')"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.code"
|
||||
@@ -90,7 +94,6 @@
|
||||
<el-form-item label="IP地址" prop="ip">
|
||||
<!-- <el-input v-model='formContent.ip'/> -->
|
||||
<abc v-model:value="formContent.ip"/>
|
||||
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
@@ -101,13 +104,9 @@
|
||||
<el-col :span="8">
|
||||
<el-form-item label='是否加密' prop='encryption'>
|
||||
<el-select v-model="formContent.encryption" clearable placeholder="请选择是否加密">
|
||||
<el-option
|
||||
v-for="item in dictStore.getDictData('High_Cate')"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.code"
|
||||
/>
|
||||
</el-select>
|
||||
<el-option label="是" :value="1"></el-option>
|
||||
<el-option label="否" :value="0"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@@ -154,7 +153,8 @@
|
||||
import { computed, type Ref, ref } from 'vue';
|
||||
import { useDictStore } from '@/stores/modules/dict'
|
||||
import { CirclePlus, Delete } from '@element-plus/icons-vue'
|
||||
import { el } from 'element-plus/es/locale';
|
||||
// 使用 dayjs 库格式化
|
||||
import dayjs from 'dayjs';
|
||||
const dictStore = useDictStore()
|
||||
// 定义弹出组件元信息
|
||||
const dialogFormRef = ref()
|
||||
@@ -175,9 +175,10 @@
|
||||
createId: '',
|
||||
hardwareVersion: '',
|
||||
softwareVersion: '',
|
||||
protocol: '',
|
||||
ip: '',
|
||||
port: 0,
|
||||
encryption: '',
|
||||
encryption: 1,
|
||||
reCheckNum:0,
|
||||
state: 1,
|
||||
})
|
||||
@@ -200,9 +201,10 @@
|
||||
createId: '',
|
||||
hardwareVersion: '',
|
||||
softwareVersion: '',
|
||||
protocol: '',
|
||||
ip: '',
|
||||
port: 0,
|
||||
encryption: '',
|
||||
encryption: 1,
|
||||
reCheckNum:0,
|
||||
state: 1,
|
||||
}
|
||||
@@ -244,6 +246,7 @@
|
||||
try {
|
||||
dialogFormRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
formContent.value.createDate = dayjs(formContent.value.createDate).format('YYYY-MM-DD HH:mm:ss');
|
||||
if (formContent.value.id) {
|
||||
updatePqDev(formContent.value).then(result => {
|
||||
if(result.code != 'A0000'){
|
||||
@@ -276,7 +279,7 @@
|
||||
titleType.value = sign
|
||||
dialogVisible.value = true
|
||||
if (data.id) {
|
||||
data.createDate = data.createDate.replace('T', ' ')
|
||||
|
||||
formContent.value = { ...data }
|
||||
} else {
|
||||
resetFormContent()
|
||||
|
||||
@@ -51,8 +51,8 @@ const devicePopup = ref()
|
||||
|
||||
const getTableList = (params: any) => {
|
||||
let newParams = JSON.parse(JSON.stringify(params))
|
||||
newParams.createTimeEnd = endDate.value
|
||||
newParams.createTimeStart = startDate.value
|
||||
newParams.searchEndTime = endDate.value
|
||||
newParams.searchBeginTime = startDate.value
|
||||
return getPqDevList(newParams)
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
|
||||
<div class='flx-flex-start'>
|
||||
<TimeControl
|
||||
include={['日', '周', '月', '自定义']}
|
||||
default={'月'}
|
||||
default={'自定义'}
|
||||
onUpdate-dates={handleDateChange}
|
||||
/>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user