Commit 6b79c83d authored by xuke's avatar xuke

rules

parents b9a17161 44482294
...@@ -93,11 +93,11 @@ const handleSearch = () => { ...@@ -93,11 +93,11 @@ const handleSearch = () => {
}; };
// 重置按钮 // 重置按钮
const handleReset = () => { // const handleReset = () => {
formInline.keyWord = "" // formInline.keyWord = ""
config.supplyType = ["0", "1", "2", "3", "4"] // config.supplyType = ["0", "1", "2", "3", "4"]
getEnergyData() // getEnergyData()
} // }
const timeFormat = (time) => { const timeFormat = (time) => {
var time = new Date(time); var time = new Date(time);
......
...@@ -17,7 +17,7 @@ const dataBackup = ref([]); ...@@ -17,7 +17,7 @@ const dataBackup = ref([]);
const reviseWindowOpen = ref(false) // 修改按钮弹窗状态 const reviseWindowOpen = ref(false) // 修改按钮弹窗状态
const bindWindowOpen = ref(false) // 绑定按钮弹窗状态 const bindWindowOpen = ref(false) // 绑定按钮弹窗状态
const addWindowOpen = ref(false) // 新增按钮弹窗状态 const addWindowOpen = ref(false) // 新增按钮弹窗状态
const dependentSub = ref({}) // 修改和绑定弹窗数据依赖 const dependentSub = ref('') // 修改和绑定弹窗数据依赖
const tableHeaderClass = data => { // 表头样式 const tableHeaderClass = data => { // 表头样式
return 'table-header-class' return 'table-header-class'
} }
...@@ -194,6 +194,7 @@ function getOrganizationStructure() { ...@@ -194,6 +194,7 @@ function getOrganizationStructure() {
ElMessage.error('接口异常,获取数据失败.') ElMessage.error('接口异常,获取数据失败.')
}) })
} // 获取组织结构 } // 获取组织结构
function resetSearch(){ function resetSearch(){
isAutoSearchKey.value = '' isAutoSearchKey.value = ''
supplySearchKey.value = '' supplySearchKey.value = ''
......
...@@ -94,7 +94,7 @@ const rules = reactive({ ...@@ -94,7 +94,7 @@ const rules = reactive({
{ pattern: /^(\d{1,11})(\.[0-9]{1,4})?$/, "message": "风速必须是1-11位实数", trigger: "blur" } { pattern: /^(\d{1,11})(\.[0-9]{1,4})?$/, "message": "风速必须是1-11位实数", trigger: "blur" }
], ],
illumination: [ illumination: [
{ pattern: /^(\d{1,11})(\.[0-9]{1,4})?$/, "message": "光照必须是1-11位实数", trigger: "blur" } { pattern: /^(\d{1,2})?$/, "message": "光照必须是1-2位实数", trigger: "blur" }
], ],
sort: [ sort: [
{ pattern: /^(\d{1,11})$/, "message": "排序必须是1-11位正整数", trigger: "blur" } { pattern: /^(\d{1,11})$/, "message": "排序必须是1-11位正整数", trigger: "blur" }
...@@ -155,7 +155,7 @@ const rules = reactive({ ...@@ -155,7 +155,7 @@ const rules = reactive({
<el-col :span="8" class="content-col-label">光照:</el-col> <el-col :span="8" class="content-col-label">光照:</el-col>
<el-col :span="16" class="content-col-value"> <el-col :span="16" class="content-col-value">
<el-form-item prop="illumination" style="padding: 0;margin: 0;"> <el-form-item prop="illumination" style="padding: 0;margin: 0;">
<el-input :input-style="inputStyle" maxlength="11" v-model="addData.illumination" <el-input :input-style="inputStyle" maxlength="2" v-model="addData.illumination"
style="width: 510px" /> style="width: 510px" />
</el-form-item> </el-form-item>
</el-col> </el-col>
......
...@@ -68,7 +68,10 @@ function onSubmit() { ...@@ -68,7 +68,10 @@ function onSubmit() {
updateNullFields: '' updateNullFields: ''
}) })
}) })
emit('onConfirm', bindData.value) bindData.value.isAuto = bindData.value.isAuto === '自动模式' ? true : false;
bindData.value.isFixed = bindData.value.isFixed === '固定模式' ? true : false;
bindData.value.updateNullFields = ""
emit('onConfirm', bindData.value)gi
}else { }else {
ElMessage.error('请选择供热站') ElMessage.error('请选择供热站')
} }
...@@ -110,6 +113,7 @@ async function getTransfer(supplyId, isAvailable = true) { ...@@ -110,6 +113,7 @@ async function getTransfer(supplyId, isAvailable = true) {
function onOpen() { function onOpen() {
bindData.value.transfers = []
loadingInstance = ElLoading.service({target: '#bind-dialog'}) loadingInstance = ElLoading.service({target: '#bind-dialog'})
selectedTransfer.value.length = 0 // 清空已选择的换热站 selectedTransfer.value.length = 0 // 清空已选择的换热站
transferData.value.length = 0 // 清空显示的换热站 transferData.value.length = 0 // 清空显示的换热站
......
...@@ -23,7 +23,24 @@ const emit = defineEmits({ ...@@ -23,7 +23,24 @@ const emit = defineEmits({
return true return true
} }
}) })
const reviseData = ref({}) const reviseData = ref({
allowPagingId: "",
temperature: "",
wind: "",
illumination: "",
diffPercentage: "",
timeoutMin: "",
tempRegulation: "",
sort: "",
customizeName: "",
supplyName: "",
customizeId: "",
isFixed: "",
isAuto: "",
supplyId: "",
operateTime: "",
updateNullFields: ''
})
const formRef = ref() const formRef = ref()
...@@ -36,7 +53,7 @@ const rules = reactive({ ...@@ -36,7 +53,7 @@ const rules = reactive({
{pattern: /^(\d{1,11})(\.[0-9]{1,4})?$/, "message": "风速必须是1-11位实数", trigger: "blur"} {pattern: /^(\d{1,11})(\.[0-9]{1,4})?$/, "message": "风速必须是1-11位实数", trigger: "blur"}
], ],
illumination: [ illumination: [
{pattern: /^(\d{1,11})(\.[0-9]{1,4})?$/, "message": "光照必须是1-11位实数", trigger: "blur"} {pattern: /^(\d{1,2})?$/, "message": "光照必须是1-11位实数", trigger: "blur"}
], ],
sort: [ sort: [
{pattern: /^(\d{1,11})$/, "message": "排序必须是1-11位正整数", trigger: "blur"} {pattern: /^(\d{1,11})$/, "message": "排序必须是1-11位正整数", trigger: "blur"}
...@@ -50,12 +67,16 @@ const rules = reactive({ ...@@ -50,12 +67,16 @@ const rules = reactive({
] ]
}); });
watchEffect(() => { watchEffect(() => {
<<<<<<< HEAD
// reviseData.value = {...props.data} // reviseData.value = {...props.data}
props.data.transfers = [] props.data.transfers = []
props.data.updateNullFields = '' props.data.updateNullFields = ''
reviseData.value = cloneDeep(props.data) // 深拷贝数据 reviseData.value = cloneDeep(props.data) // 深拷贝数据
console.log("props.data===>", props.data); console.log("props.data===>", props.data);
console.log(reviseData.value); console.log(reviseData.value);
=======
reviseData.value = props.data // 深拷贝数据
>>>>>>> 44482294a0f0e141cfad6fc71ae5bd19c87d6aed
}) })
const inputStyle = { const inputStyle = {
color: 'black', color: 'black',
...@@ -74,18 +95,20 @@ const switchingisAuto = computed({ ...@@ -74,18 +95,20 @@ const switchingisAuto = computed({
} }
}) // 可写计算属性,手动、自动模式切换 }) // 可写计算属性,手动、自动模式切换
function onOpen() { function onOpen() {
formRef.value.resetFields() reviseData.value.updateNullFields = ""
} }
async function handleConfirm() { function handleConfirm() {
if (reviseData.value.hasOwnProperty('supplyId')) { reviseData.value.transfers = []
if (reviseData.value.supplyId) { formRef.value.validate(async valid => {
getTransferInterface({ if (valid) {
customizeId: reviseData.value.customizeId, if (reviseData.value.supplyId !== undefined && reviseData.value.supplyId !== '') {
supplyId: reviseData.value.supplyId const result = await getTransferInterface({
}).then(result => { customizeId: reviseData.value.customizeId,
supplyId: reviseData.value.supplyId
})
for (let item of result.data) { for (let item of result.data) {
if(item.selected.toLowerCase() === 'true'){ if (item.selected.toLowerCase() === 'true') {
reviseData.value.transfers.push( reviseData.value.transfers.push(
{ {
customizeId: reviseData.value.customizeId, customizeId: reviseData.value.customizeId,
...@@ -95,17 +118,27 @@ async function handleConfirm() { ...@@ -95,17 +118,27 @@ async function handleConfirm() {
) )
} }
} }
<<<<<<< HEAD
formRef.value.validate(valid => { formRef.value.validate(valid => {
if (valid) { if (valid) {
emit('onConfirm', reviseData.value) emit('onConfirm', reviseData.value)
} }
}) })
}) })
=======
} else {
delete reviseData.value.supplyId
}
reviseData.value.isAuto = reviseData.value.isAuto === '自动模式' ? true : false;
reviseData.value.isFixed = reviseData.value.isFixed === '固定模式' ? true : false;
console.log('修改数据', reviseData.value)
emit('onConfirm', reviseData.value)
>>>>>>> 44482294a0f0e141cfad6fc71ae5bd19c87d6aed
} }
} })
} }
<<<<<<< HEAD
// 重置表单 // 重置表单
const reset = () => { const reset = () => {
const form = unref(formRef) const form = unref(formRef)
...@@ -113,6 +146,9 @@ const reset = () => { ...@@ -113,6 +146,9 @@ const reset = () => {
} }
function onClose(){ function onClose(){
reset() reset()
=======
function onClose() {
>>>>>>> 44482294a0f0e141cfad6fc71ae5bd19c87d6aed
emit('onCancel') emit('onCancel')
} }
...@@ -160,7 +196,7 @@ function onClose(){ ...@@ -160,7 +196,7 @@ function onClose(){
<el-col :span="8" class="content-col-label">光照:</el-col> <el-col :span="8" class="content-col-label">光照:</el-col>
<el-col :span="16" class="content-col-value"> <el-col :span="16" class="content-col-value">
<el-form-item prop="illumination" style="padding: 0;margin: 0;"> <el-form-item prop="illumination" style="padding: 0;margin: 0;">
<el-input :input-style="inputStyle" maxlength="11" v-model="reviseData.illumination" <el-input :input-style="inputStyle" maxlength="2" v-model="reviseData.illumination"
style="width: 510px"/> style="width: 510px"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
...@@ -209,7 +245,7 @@ function onClose(){ ...@@ -209,7 +245,7 @@ function onClose(){
<template #footer> <template #footer>
<div class="dialog-footer"> <div class="dialog-footer">
<el-button type="primary" @click="handleConfirm">保存</el-button> <el-button type="primary" @click="handleConfirm">保存</el-button>
<el-button type="primary" @click="emit('onCancel')">关闭</el-button> <el-button type="primary" @click="onClose">关闭</el-button>
</div> </div>
</template> </template>
</el-dialog> </el-dialog>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment