43 changed files with 3356 additions and 162 deletions
@ -0,0 +1,5 @@ |
|||||
|
go.sum database tree |
||||
|
29530890 |
||||
|
yb6t6HZvxxy4PrtbS+3QjpejyjLeRuqQ2INBTisrK38= |
||||
|
|
||||
|
— sum.golang.org Az3grvtY2DM7q7cq6/vo+qjK+WpbUaK7FrxZoFBSvTJ3U6QlFARxFVdrEusYH48zS1BENhlysJZH2iz7XZmGlOf1aAU= |
||||
|
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 6.1 KiB |
@ -0,0 +1,92 @@ |
|||||
|
<!-- |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2023-07-19 08:39:34 |
||||
|
@ 备注: 抽屉 |
||||
|
--> |
||||
|
<script lang='ts' setup> |
||||
|
import { ref, nextTick, watch, onMounted, onUnmounted } from 'vue' |
||||
|
import { aceEdit } from '@/api/DesignForm/utils' |
||||
|
|
||||
|
const props = withDefaults( |
||||
|
defineProps<{ |
||||
|
data?:object |
||||
|
modelValue: boolean |
||||
|
// eslint-disable-next-line vue/require-default-prop |
||||
|
title?: string |
||||
|
direction?: 'rtl' | 'ltr' |
||||
|
content: string |
||||
|
id?: string |
||||
|
// eslint-disable-next-line vue/require-default-prop |
||||
|
codeType?: string |
||||
|
}>(), |
||||
|
{ |
||||
|
id: 'editJson', |
||||
|
content: '', |
||||
|
direction: 'ltr' |
||||
|
} |
||||
|
) |
||||
|
const emits = defineEmits<{ |
||||
|
(e: 'beforeClose'): void |
||||
|
(e: 'confirm', content: string): void |
||||
|
(e: 'update:modelValue', val: boolean): void |
||||
|
}>() |
||||
|
const editor = ref<any>({}) |
||||
|
const visible = ref(false) |
||||
|
watch( |
||||
|
() => props.modelValue, |
||||
|
(val: boolean) => { |
||||
|
visible.value = val |
||||
|
if (val) { |
||||
|
initEditor() |
||||
|
} |
||||
|
} |
||||
|
) |
||||
|
const initEditor = () => { |
||||
|
nextTick(() => { |
||||
|
editor.value = aceEdit(props.content, props.id, props.codeType) |
||||
|
}) |
||||
|
} |
||||
|
const dialogConfirm = () => { |
||||
|
const editVal = editor.value.getValue() |
||||
|
emits('confirm', editVal) |
||||
|
} |
||||
|
const drawerBeforeClose = () => { |
||||
|
emits('update:modelValue', false) |
||||
|
emits('beforeClose') |
||||
|
} |
||||
|
onMounted(() => {}) |
||||
|
onUnmounted(() => { |
||||
|
if (Object.keys(editor.value).length !== 0) { |
||||
|
editor.value.destroy() |
||||
|
editor.value.container.remove() |
||||
|
} |
||||
|
}) |
||||
|
</script> |
||||
|
<template> |
||||
|
<el-drawer |
||||
|
v-model="visible" |
||||
|
size="60%" |
||||
|
:title="title" |
||||
|
:direction="direction as any" |
||||
|
class="ace-dialog" |
||||
|
:append-to-body="true" |
||||
|
:before-close="drawerBeforeClose" |
||||
|
> |
||||
|
<template #header> |
||||
|
<div v-html="title"></div> |
||||
|
</template> |
||||
|
<div>{{props.data}}</div> |
||||
|
<div v-if="visible" :id="id"></div> |
||||
|
<div class="dialog-footer"> |
||||
|
<el-button type="primary" size="small" @click="dialogConfirm"> |
||||
|
确定 |
||||
|
</el-button> |
||||
|
</div> |
||||
|
</el-drawer> |
||||
|
</template> |
||||
|
<style lang='scss' scoped> |
||||
|
#editJson, #editJsonCopy { |
||||
|
width: 100%; |
||||
|
height: calc(100vh - 90px); |
||||
|
} |
||||
|
</style> |
||||
@ -0,0 +1,254 @@ |
|||||
|
<!-- |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2023-07-19 08:39:34 |
||||
|
@ 备注: 抽屉 |
||||
|
--> |
||||
|
<script lang='ts' setup> |
||||
|
import { ref, nextTick, watch, onMounted, onUnmounted } from 'vue' |
||||
|
import { aceEdit } from '@/api/DesignForm/utils' |
||||
|
|
||||
|
const props = withDefaults( |
||||
|
defineProps<{ |
||||
|
modelValue: boolean |
||||
|
// eslint-disable-next-line vue/require-default-prop |
||||
|
title?: string |
||||
|
direction?: 'rtl' | 'ltr' |
||||
|
content: string |
||||
|
id?: string |
||||
|
// eslint-disable-next-line vue/require-default-prop |
||||
|
codeType?: string |
||||
|
data?: object |
||||
|
}>(), |
||||
|
{ |
||||
|
id: 'editJson', |
||||
|
content: '', |
||||
|
direction: 'ltr' |
||||
|
} |
||||
|
) |
||||
|
|
||||
|
interface treeStruct { |
||||
|
value: string |
||||
|
label?: string |
||||
|
children?: treeStruct[] |
||||
|
} |
||||
|
|
||||
|
const emits = defineEmits<{ |
||||
|
(e: 'beforeClose'): void |
||||
|
(e: 'confirm', content: string): void |
||||
|
(e: 'update:modelValue', val: boolean): void |
||||
|
}>() |
||||
|
const editor = ref<any>({}) |
||||
|
const visible = ref(false) |
||||
|
|
||||
|
const treeSelectAry = reactive<treeStruct[]>([]) |
||||
|
const editTitleFormRef = ref(ElForm); //编辑表单 |
||||
|
watch( |
||||
|
() => props.modelValue, |
||||
|
(val: boolean) => { |
||||
|
visible.value = val |
||||
|
if (val) { |
||||
|
initEditor() |
||||
|
} |
||||
|
} |
||||
|
) |
||||
|
const initEditor = () => { |
||||
|
nextTick(() => { |
||||
|
editor.value = aceEdit(props.content, props.id, props.codeType) |
||||
|
}) |
||||
|
} |
||||
|
const dialogConfirm = () => { |
||||
|
const editVal = editor.value.getValue() |
||||
|
emits('confirm', editVal) |
||||
|
} |
||||
|
const drawerBeforeClose = () => { |
||||
|
emits('update:modelValue', false) |
||||
|
emits('beforeClose') |
||||
|
} |
||||
|
onMounted(() => {}) |
||||
|
onUnmounted(() => { |
||||
|
if (Object.keys(editor.value).length !== 0) { |
||||
|
editor.value.destroy() |
||||
|
editor.value.container.remove() |
||||
|
} |
||||
|
}) |
||||
|
let jibuqi = 0 |
||||
|
const isTopHeader = ref(false) |
||||
|
const guodu = ref<treeStruct>({}) |
||||
|
const addIsShow = ref(false) |
||||
|
const pickAdd = (val:treeStruct) => { |
||||
|
guodu.value = val |
||||
|
isTopHeader.value = false |
||||
|
addIsShow.value = true |
||||
|
} |
||||
|
const pickAddClose = () => { |
||||
|
guodu.value = {} |
||||
|
treeSelectTitle.label = "" |
||||
|
addIsShow.value = false |
||||
|
butLoad.value = false |
||||
|
editTitleFormRef.value.resetFields(); |
||||
|
} |
||||
|
//添加顶级分类 |
||||
|
const addTopClass = () => { |
||||
|
isTopHeader.value = true |
||||
|
addIsShow.value = true |
||||
|
} |
||||
|
//确认添加 |
||||
|
const treeSelectTitle = reactive<treeStruct>({ |
||||
|
value: "1", |
||||
|
label: "" |
||||
|
}) |
||||
|
const butLoad = ref(false) |
||||
|
const pickIsTrue = () => { |
||||
|
butLoad.value = true |
||||
|
editTitleFormRef.value.validate((isValid: boolean) => { |
||||
|
if(isValid){ |
||||
|
jibuqi++ |
||||
|
if(isTopHeader.value){ |
||||
|
treeSelectAry.push({ |
||||
|
value: jibuqi, |
||||
|
label: treeSelectTitle.label, |
||||
|
children: [] |
||||
|
}) |
||||
|
}else{ |
||||
|
if(guodu.value.children){ |
||||
|
guodu.value.children.push({ |
||||
|
value: jibuqi, |
||||
|
label: treeSelectTitle.label, |
||||
|
children: [] |
||||
|
}) |
||||
|
}else{ |
||||
|
guodu.value.children=[ |
||||
|
{ |
||||
|
value: jibuqi, |
||||
|
label: treeSelectTitle.label, |
||||
|
children: [] |
||||
|
} |
||||
|
] |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
pickAddClose() |
||||
|
}else{ |
||||
|
butLoad.value = false |
||||
|
} |
||||
|
}) |
||||
|
} |
||||
|
/** |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2024-09-27 08:38:35 |
||||
|
@ 功能: 设定值 |
||||
|
*/ |
||||
|
const dialogConfirmTree = () => { |
||||
|
emits('confirm', treeSelectAry) |
||||
|
drawerBeforeClose() |
||||
|
} |
||||
|
/** |
||||
|
* 表单验证规则 |
||||
|
*/ |
||||
|
const editTitleRules = reactive({ |
||||
|
label: [{ required: true, message: "请输入名称", trigger: "blur" }], |
||||
|
}); |
||||
|
/** |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2024-09-27 13:51:31 |
||||
|
@ 功能: 删除指定节点数据 |
||||
|
*/ |
||||
|
const pickDel = (val:treeStruct) => { |
||||
|
console.log("要删除得节点-->",val.value) |
||||
|
delDiGui(treeSelectAry,val) |
||||
|
console.log("删除指定节点数据---结果-->",treeSelectAry) |
||||
|
} |
||||
|
/** |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2024-09-27 14:13:23 |
||||
|
@ 功能: 执行递归删除 |
||||
|
*/ |
||||
|
const delDiGui = (tree: treeStruct[],val:treeStruct) => { |
||||
|
for (let i = 0; i < tree.length; i++) { |
||||
|
const node = tree[i]; |
||||
|
if (node.value == val.value) { |
||||
|
tree.splice(i, 1); |
||||
|
return; |
||||
|
} |
||||
|
if (Array.isArray(node.children) && node.children.length) { |
||||
|
return delDiGui(node.children, val); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
<template> |
||||
|
<el-drawer |
||||
|
v-model="visible" |
||||
|
size="60%" |
||||
|
:title="title" |
||||
|
:direction="direction as any" |
||||
|
class="ace-dialog" |
||||
|
:append-to-body="true" |
||||
|
:before-close="drawerBeforeClose" |
||||
|
> |
||||
|
<template #header> |
||||
|
<div v-html="title"></div> |
||||
|
</template> |
||||
|
<div v-if="['cascader', 'treeSelect'].includes(props.data.type)">{{props.data}} |
||||
|
|
||||
|
<el-table |
||||
|
:data="treeSelectAry" |
||||
|
row-key="value" |
||||
|
default-expand-all |
||||
|
> |
||||
|
<el-table-column prop="label" label="名称" /> |
||||
|
<el-table-column label="操作" width="200" align="center"> |
||||
|
<template #header> |
||||
|
<el-button type="success" @click="addTopClass">添加顶级分类</el-button> |
||||
|
</template> |
||||
|
<template #default="scope"> |
||||
|
<el-button-group> |
||||
|
<el-button text type="success" @click="pickAdd(scope.row)">添加</el-button> |
||||
|
<el-button text type="warning" @click="pick(scope.row)">修改</el-button> |
||||
|
<el-button text type="danger" @click="pickDel(scope.row)">删除</el-button> |
||||
|
</el-button-group> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
</el-table> |
||||
|
|
||||
|
</div> |
||||
|
<div v-else :id="id"></div> |
||||
|
<div class="dialog-footer"> |
||||
|
<el-button v-if="['cascader', 'treeSelect'].includes(props.data.type)" type="primary" size="small" @click="dialogConfirmTree"> |
||||
|
确定 |
||||
|
</el-button> |
||||
|
<el-button v-else type="primary" size="small" @click="dialogConfirm"> |
||||
|
确定 |
||||
|
</el-button> |
||||
|
</div> |
||||
|
<el-dialog |
||||
|
v-model="addIsShow" |
||||
|
title="编辑" |
||||
|
width="500" |
||||
|
:before-close="pickAddClose" |
||||
|
> |
||||
|
<el-form ref="editTitleFormRef" :rules="editTitleRules" :model="treeSelectTitle" label-width="auto" style="max-width: 600px"> |
||||
|
<el-form-item label="名称:" prop="label"> |
||||
|
<el-input v-model="treeSelectTitle.label" /> |
||||
|
</el-form-item> |
||||
|
</el-form> |
||||
|
<template #footer> |
||||
|
<div class="dialog-footer"> |
||||
|
<el-button @click="pickAddClose">取消</el-button> |
||||
|
<el-button v-loading="butLoad" type="primary" @click="pickIsTrue">确定</el-button> |
||||
|
</div> |
||||
|
</template> |
||||
|
</el-dialog> |
||||
|
</el-drawer> |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
</template> |
||||
|
<style lang='scss' scoped> |
||||
|
#editJson, #editJsonCopy { |
||||
|
width: 100%; |
||||
|
height: calc(100vh - 90px); |
||||
|
} |
||||
|
</style> |
||||
@ -0,0 +1,47 @@ |
|||||
|
<!-- |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2024-09-29 13:46:55 |
||||
|
@ 备注: 级联器 |
||||
|
--> |
||||
|
<script lang='ts' setup> |
||||
|
const props = withDefaults( |
||||
|
defineProps<{ |
||||
|
modelValue?: string |
||||
|
disabled?: boolean |
||||
|
action?: string |
||||
|
name?: string |
||||
|
fileList?: Object |
||||
|
control?: Object |
||||
|
config?: Object |
||||
|
data?: Object |
||||
|
options?: Object |
||||
|
}>(), |
||||
|
{} |
||||
|
) |
||||
|
const emits = defineEmits<{ |
||||
|
(e: 'update:modelValue', value: string): void |
||||
|
}>() |
||||
|
const value = computed({ |
||||
|
get: () => { |
||||
|
console.log("图片上传处理-112->",props.modelValue) |
||||
|
return props.modelValue |
||||
|
}, |
||||
|
set: (newVal: any) => { |
||||
|
emits('update:modelValue', newVal) |
||||
|
return newVal |
||||
|
}, |
||||
|
}); |
||||
|
const handleChange = () => { |
||||
|
|
||||
|
} |
||||
|
</script> |
||||
|
<template> |
||||
|
<el-cascader |
||||
|
v-model="value" |
||||
|
:options="props.options" |
||||
|
@change="handleChange" |
||||
|
/> |
||||
|
</template> |
||||
|
<style lang='scss' scoped> |
||||
|
|
||||
|
</style> |
||||
@ -0,0 +1,43 @@ |
|||||
|
<!-- |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2024-09-25 15:01:57 |
||||
|
@ 备注: 时间控件 |
||||
|
--> |
||||
|
<script lang='ts' setup> |
||||
|
const props = withDefaults( |
||||
|
defineProps<{ |
||||
|
modelValue?: string |
||||
|
disabled?: boolean |
||||
|
data?:any |
||||
|
}>(), |
||||
|
{} |
||||
|
) |
||||
|
const emits = defineEmits<{ |
||||
|
(e: 'update:modelValue', value: string): void |
||||
|
}>() |
||||
|
const value = computed({ |
||||
|
get: () => { |
||||
|
return props.modelValue |
||||
|
}, |
||||
|
set: (newVal: any) => { |
||||
|
emits('update:modelValue', newVal) |
||||
|
}, |
||||
|
}); |
||||
|
</script> |
||||
|
<template> |
||||
|
<el-date-picker |
||||
|
align="left" |
||||
|
v-model="value" |
||||
|
:type="props.data.control.type" |
||||
|
range-separator="-" |
||||
|
start-placeholder="开始日期" |
||||
|
end-placeholder="结束日期" |
||||
|
:teleported="true" |
||||
|
:placeholder="props.data.control.placeholder" |
||||
|
:value-format="props.data.valueFormat" |
||||
|
:format="props.data.control.format" |
||||
|
/> |
||||
|
|
||||
|
</template> |
||||
|
<style lang='scss' scoped> |
||||
|
</style> |
||||
@ -0,0 +1,320 @@ |
|||||
|
<!-- |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2024-09-25 09:18:33 |
||||
|
@ 备注: 联系地址 |
||||
|
--> |
||||
|
<script lang='ts' setup> |
||||
|
import { AnalysisCss,AnalysisInputCss } from '@/components/DesignForm/public/form/calculate/cssInfo.ts' |
||||
|
import { |
||||
|
constControlChange, |
||||
|
constFormProps, |
||||
|
} from '@/api/DesignForm/utils' |
||||
|
import validate from '@/api/DesignForm/validate' |
||||
|
import { FormItem, FormList } from '@/api/DesignForm/types' |
||||
|
import Tooltips from '@/components/DesignForm/tooltip.vue' |
||||
|
|
||||
|
import areaObj from '@/widget/orgcitys/pca.json' |
||||
|
|
||||
|
const props = withDefaults( |
||||
|
defineProps<{ |
||||
|
data: FormList |
||||
|
tablekey: any |
||||
|
numrun?: number |
||||
|
modelValue?: any // 子表和弹性布局时时有传 |
||||
|
tProp?: string // 子表时的form-item的prop值,用于子表校验用 |
||||
|
}>(), |
||||
|
{} |
||||
|
) |
||||
|
const emits = defineEmits<{ |
||||
|
(e: 'update:modelValue', numVal: any): void |
||||
|
}>() |
||||
|
const formProps = inject(constFormProps, {}) as any |
||||
|
const type = computed(() => { |
||||
|
return formProps.value.type |
||||
|
}) |
||||
|
const control = computed(() => { |
||||
|
return props.data.control || {} |
||||
|
// return props.data |
||||
|
}) |
||||
|
const config = computed(() => { |
||||
|
return props.data.config || {} |
||||
|
}) |
||||
|
const changeEvent = inject(constControlChange, '') as any |
||||
|
const value = computed({ |
||||
|
get: () => { |
||||
|
return props.modelValue |
||||
|
}, |
||||
|
set: (newVal: any) => { |
||||
|
emits('update:modelValue', newVal) |
||||
|
}, |
||||
|
}); |
||||
|
// 控制编辑模式下是否可用 |
||||
|
const editDisabled = computed(() => { |
||||
|
if (type.value === 3) { |
||||
|
return true // 查看模式,为不可编辑状态 |
||||
|
} |
||||
|
if (type.value === 1 && config.value.addDisabled) { |
||||
|
return true |
||||
|
} |
||||
|
if (type.value === 2 && config.value.editDisabled) { |
||||
|
return true // 编辑模式 |
||||
|
} |
||||
|
return control.value.disabled |
||||
|
}) |
||||
|
const updateModel = (val: any) => { |
||||
|
let controlAttribute = "" |
||||
|
if(props.data.control){ |
||||
|
if(props.data.control.type){ |
||||
|
controlAttribute = props.data.control.type |
||||
|
} |
||||
|
} |
||||
|
// changeEvent && |
||||
|
// changeEvent({ |
||||
|
// key: props.data.name, |
||||
|
// value: val, |
||||
|
// data: props.data, |
||||
|
// tProp: props.tProp, |
||||
|
// type: props.data.type, |
||||
|
// attribute: controlAttribute |
||||
|
// }) |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
const getLabel = (ele: FormItem) => { |
||||
|
const showColon = formProps.value.showColon ? ':' : '' |
||||
|
if (ele) { |
||||
|
return ele.showLabel ? '' : ele.label + showColon |
||||
|
} else { |
||||
|
return '' |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 返回当前item项的校验规则 |
||||
|
const itemRules = computed(() => { |
||||
|
let temp |
||||
|
const itemR: any = props.data.item?.rules || [] |
||||
|
const customR = formatCustomRules() |
||||
|
// 如果三个都没有设置,则返回undefined |
||||
|
if (itemR?.length || customR?.length) { |
||||
|
temp = [...customR, ...itemR] |
||||
|
} |
||||
|
return temp |
||||
|
}) |
||||
|
// 处理自定义校验规则,将customRules转换后追加到rules里 |
||||
|
const formatCustomRules = () => { |
||||
|
const rulesReg: any = {} |
||||
|
validate && |
||||
|
validate.forEach(item => { |
||||
|
rulesReg[item.type] = item.regExp |
||||
|
}) |
||||
|
|
||||
|
// 获取校验方法 父级使用provide方法注入 |
||||
|
const temp: any = [] |
||||
|
props.data.customRules?.forEach((item: any) => { |
||||
|
if (!item.message && item.type !== 'methods') { |
||||
|
return // 方法时允许提示信息为空 |
||||
|
} |
||||
|
let obj = {} |
||||
|
if (item.type === 'required') { |
||||
|
obj = { required: true } |
||||
|
} else if (item.type === 'rules') { |
||||
|
// 自定义表达式 |
||||
|
obj = { pattern: item.rules } |
||||
|
} else if (item.type === 'methods') { |
||||
|
// 方法时 |
||||
|
const methods: any = item.methods |
||||
|
if (methods) { |
||||
|
obj = { validator: inject(methods, {}) } |
||||
|
} |
||||
|
} else if (item.type) { |
||||
|
obj = { pattern: rulesReg[item.type as string] } |
||||
|
} |
||||
|
// 这里判断下防某些条件下重复push的可能或存重复校验类型 |
||||
|
let message: any = { message: item.message } |
||||
|
if (!item.message) { |
||||
|
// 当使用validator校验时,如果存在message字段则不能使用 callback(new Error('x'));的提示 |
||||
|
message = {} |
||||
|
} |
||||
|
temp.push( |
||||
|
Object.assign( |
||||
|
{ |
||||
|
trigger: item.trigger || 'blur' |
||||
|
}, |
||||
|
obj, |
||||
|
message |
||||
|
) |
||||
|
) |
||||
|
}) |
||||
|
return temp |
||||
|
} |
||||
|
const addressBox = ref(false) |
||||
|
// 省 |
||||
|
const provinceArr = Object.keys(areaObj) |
||||
|
const province = ref(provinceArr[0]) |
||||
|
// 市 |
||||
|
const cityArr = computed(() => { |
||||
|
return Object.keys(areaObj[province.value]) |
||||
|
}) |
||||
|
const city = ref(cityArr.value[0]) |
||||
|
// 监听省份变化 |
||||
|
watch(province, (newVal) => { |
||||
|
city.value = Object.keys(areaObj[newVal])[0]; |
||||
|
|
||||
|
if(value.value != "" && value.value != null){ |
||||
|
let ads = value.value.split(" - ") |
||||
|
if(ads.length >=2){ |
||||
|
city.value = ads[1] |
||||
|
}else{ |
||||
|
city.value = Object.keys(areaObj[newVal])[0]; |
||||
|
} |
||||
|
}else{ |
||||
|
city.value = Object.keys(areaObj[newVal])[0]; |
||||
|
} |
||||
|
}); |
||||
|
// 区 |
||||
|
const areaArr = computed(() => { |
||||
|
return areaObj[province.value][city.value] |
||||
|
}) |
||||
|
const area = ref(areaArr.value[0]) |
||||
|
// 监听市变化 |
||||
|
watch(city, (newVal) => { |
||||
|
|
||||
|
if(value.value != "" && value.value != null){ |
||||
|
let ads = value.value.split(" - ") |
||||
|
if(ads.length >=3){ |
||||
|
area.value = ads[2] |
||||
|
}else{ |
||||
|
area.value = areaObj[province.value][newVal][0] |
||||
|
} |
||||
|
}else{ |
||||
|
area.value = areaObj[province.value][newVal][0] |
||||
|
} |
||||
|
|
||||
|
}) |
||||
|
const fullAddress = ref<string>("") |
||||
|
//打开地址选择弹窗 |
||||
|
const openAddress = () =>{ |
||||
|
if(value.value != "" && value.value != null){ |
||||
|
let ads = value.value.split(" - ") |
||||
|
// console.log(ads) |
||||
|
if(ads.length >= 4){ |
||||
|
province.value = ads[0] |
||||
|
fullAddress.value = ads[3] |
||||
|
}else if(ads.length >0){ |
||||
|
province.value = ads[0] |
||||
|
} |
||||
|
}else{ |
||||
|
province.value = provinceArr[0] |
||||
|
city.value = cityArr.value[0] |
||||
|
area.value = areaArr.value[0] |
||||
|
fullAddress.value = "" |
||||
|
} |
||||
|
addressBox.value=true |
||||
|
} |
||||
|
//关闭地址选择弹窗 |
||||
|
const addressBoxClose = () => { |
||||
|
addressBox.value=false |
||||
|
initAddressData() |
||||
|
} |
||||
|
//确定选择地址 |
||||
|
const submitAddress = () => { |
||||
|
// console.log(province.value,city.value,area.value,fullAddress.value) |
||||
|
if(province.value == "" || province.value == null){ |
||||
|
ElMessage.error('未选择省份!') |
||||
|
return |
||||
|
} |
||||
|
if(city.value == "" || city.value == null){ |
||||
|
ElMessage.error('未选择市/区!') |
||||
|
return |
||||
|
} |
||||
|
if(area.value == "" || area.value == null){ |
||||
|
ElMessage.error('未选择县/市!') |
||||
|
return |
||||
|
} |
||||
|
if(fullAddress.value == "" || fullAddress.value == null){ |
||||
|
ElMessage.error('未填写详细信息!') |
||||
|
return |
||||
|
} |
||||
|
value.value = province.value + " - " + city.value + " - " + area.value + " - " + fullAddress.value |
||||
|
console.log(province.value + " - " + city.value + " - " + area.value + " - " + fullAddress.value) |
||||
|
console.log(value.value) |
||||
|
addressBoxClose() |
||||
|
} |
||||
|
const initAddressData = () =>{ |
||||
|
province.value = provinceArr[0] |
||||
|
fullAddress.value = "" |
||||
|
} |
||||
|
const configStyle = computed(() => { |
||||
|
return props.data.styles || {} |
||||
|
}) |
||||
|
const getFormItemInputStyle = (ele: any,sty:number) => { |
||||
|
if(ele?.inputStyle){ |
||||
|
//console.log("返回栅格宽度4",AnalysisInputCss(ele?.inputStyle,sty)) |
||||
|
return AnalysisInputCss(ele?.inputStyle,sty) |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
<template> |
||||
|
|
||||
|
<div v-if="type === 4" class="form-value" v-html="value"></div> |
||||
|
<el-input v-else v-model="value" :disabled="editDisabled" clearable placeholder="请选择地址" style="width:100%" @click="openAddress" :style="getFormItemInputStyle(configStyle,2)" :input-style="getFormItemInputStyle(configStyle,3)" /> |
||||
|
|
||||
|
<el-dialog |
||||
|
v-model="addressBox" |
||||
|
title="填写地址" |
||||
|
width="600px" |
||||
|
:append-to-body="true" |
||||
|
:draggable="true" |
||||
|
:before-close="addressBoxClose" |
||||
|
> |
||||
|
<el-row> |
||||
|
<el-col :span="3">所在地区:</el-col> |
||||
|
<el-col :span="21"> |
||||
|
<el-row :gutter="20"> |
||||
|
<el-col :span="8"> |
||||
|
<el-select v-model="province" class="m-2" placeholder="省"> |
||||
|
<el-option v-for="item in provinceArr" :key="item" :label="item" :value="item" /> |
||||
|
</el-select> |
||||
|
</el-col> |
||||
|
<el-col :span="8"> |
||||
|
<el-select v-model="city" class="m-2" placeholder="市"> |
||||
|
<el-option v-for="item in cityArr" :key="item" :label="item" :value="item" /> |
||||
|
</el-select> |
||||
|
</el-col> |
||||
|
<el-col :span="8"> |
||||
|
<el-select v-model="area" class="m-2" placeholder="区/县"> |
||||
|
<el-option v-for="item in areaArr" :key="item" :label="item" :value="item" /> |
||||
|
</el-select> |
||||
|
</el-col> |
||||
|
|
||||
|
</el-row> |
||||
|
</el-col> |
||||
|
</el-row> |
||||
|
<el-row> |
||||
|
<el-col :span="3">详细地址:</el-col> |
||||
|
<el-col :span="21"> |
||||
|
<el-input |
||||
|
v-model="fullAddress" |
||||
|
:autosize="{ minRows: 2, maxRows: 4 }" |
||||
|
type="textarea" |
||||
|
placeholder="请输入详细地址" |
||||
|
style="width:100%" |
||||
|
/> |
||||
|
</el-col> |
||||
|
</el-row> |
||||
|
|
||||
|
<template #footer> |
||||
|
<span class="dialog-footer"> |
||||
|
<el-button @click="addressBoxClose">取消</el-button> |
||||
|
<el-button type="primary" @click="submitAddress">确定</el-button> |
||||
|
</span> |
||||
|
</template> |
||||
|
|
||||
|
|
||||
|
</el-dialog> |
||||
|
|
||||
|
</template> |
||||
|
<style lang='scss' scoped> |
||||
|
|
||||
|
</style> |
||||
@ -0,0 +1,174 @@ |
|||||
|
<!-- |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2024-09-17 10:44:30 |
||||
|
@ 备注: 上传组件 |
||||
|
--> |
||||
|
<script lang='ts' setup> |
||||
|
import { AnalysisCss,AnalysisInputCss } from '@/components/DesignForm/public/form/calculate/cssInfo' |
||||
|
import { uploadUrl,getRequest } from '@/api/DesignForm' |
||||
|
import { |
||||
|
formatNumber, |
||||
|
objectToArray, |
||||
|
constControlChange, |
||||
|
constSetFormOptions, |
||||
|
constFormProps, |
||||
|
constGetControlByName |
||||
|
} from '@/api/DesignForm/utils' |
||||
|
|
||||
|
const props = withDefaults( |
||||
|
defineProps<{ |
||||
|
modelValue?: string |
||||
|
disabled?: boolean |
||||
|
action?: string |
||||
|
name?: string |
||||
|
fileList?: Object |
||||
|
control?: Object |
||||
|
config?: Object |
||||
|
data?: Object |
||||
|
}>(), |
||||
|
{} |
||||
|
) |
||||
|
const emits = defineEmits<{ |
||||
|
(e: 'update:modelValue', value: string): void |
||||
|
}>() |
||||
|
const value = computed({ |
||||
|
get: () => { |
||||
|
console.log("图片上传处理-112->",props.modelValue) |
||||
|
// if(props.modelValue != ""){ |
||||
|
// return props.modelValue.split(","); |
||||
|
// }else{ |
||||
|
// return props.modelValue |
||||
|
// } |
||||
|
return props.modelValue |
||||
|
}, |
||||
|
set: (newVal: any) => { |
||||
|
emits('update:modelValue', newVal) |
||||
|
return newVal |
||||
|
}, |
||||
|
}); |
||||
|
const formProps = inject(constFormProps, {}) as any |
||||
|
// ------------图片上传处理----------- |
||||
|
const fileList = computed<any>(() => { |
||||
|
// const imgVal = formProps.value.model[props.data.name] |
||||
|
console.log("图片上传处理-2->",value.value) |
||||
|
const imgVal = value.value |
||||
|
console.log("图片上传处理-->",imgVal) |
||||
|
if (imgVal && typeof imgVal === 'string') { |
||||
|
// console.log("图片上传处理-2->",imgVal) |
||||
|
const temp: any = [] |
||||
|
imgVal.split(',').forEach((item: string) => { |
||||
|
// console.log("图片上传处理-3->",item) |
||||
|
temp.push({ |
||||
|
name: item, |
||||
|
url: item |
||||
|
}) |
||||
|
}) |
||||
|
return temp |
||||
|
} |
||||
|
return imgVal || [] // 这样可支持默认值为array([name:'',url:''这种形式]) |
||||
|
}) |
||||
|
//解析指定样式 |
||||
|
const getFormItemInputStyle = (ele: any,sty:number) => { |
||||
|
if(ele?.inputStyle){ |
||||
|
console.log("返回栅格宽度4",AnalysisInputCss(ele?.inputStyle,sty)) |
||||
|
return AnalysisInputCss(ele?.inputStyle,sty) |
||||
|
} |
||||
|
} |
||||
|
//组件css部分 |
||||
|
const configStyle = computed(() => { |
||||
|
return props.data.styles || {} |
||||
|
}) |
||||
|
// 从列表移除 |
||||
|
const uploadRemove = (uploadFile: any, uploadFiles: any) => { |
||||
|
const oldList: any = [] |
||||
|
fileList.value.forEach((item: any) => { |
||||
|
if (item.url !== uploadFile.url) { |
||||
|
oldList.push(item.url) |
||||
|
} |
||||
|
}) |
||||
|
value.value = oldList |
||||
|
updateModel(oldList.join(',')) |
||||
|
// props.control.value.onRemove && props.control.value.onRemove(uploadFile, uploadFiles) |
||||
|
// todo 需从服务端删除已上传图片时,这里需要发删除请求接口 |
||||
|
} |
||||
|
// 上传错误 |
||||
|
const uploadError = (err: any, file: any, fileList: any) => { |
||||
|
// console.log('uploadError') |
||||
|
ElMessage.error(file.name + '上传失败') |
||||
|
props.control.value.onError && props.control.value.onError(err, file, fileList) |
||||
|
} |
||||
|
const changeEvent = inject(constControlChange, '') as any |
||||
|
const updateModel = (val: any) => { |
||||
|
console.log("图片上传处理-111->",val) |
||||
|
value.value = val |
||||
|
let controlAttribute = "" |
||||
|
if(props.data.control){ |
||||
|
if(props.data.control.type){ |
||||
|
controlAttribute = props.data.control.type |
||||
|
} |
||||
|
} |
||||
|
// changeEvent && |
||||
|
// changeEvent({ |
||||
|
// key: props.data.name, |
||||
|
// value: val, |
||||
|
// data: props.data, |
||||
|
// tProp: props.tProp, |
||||
|
// type: props.data.type, |
||||
|
// attribute: controlAttribute |
||||
|
// }) |
||||
|
} |
||||
|
// 上传成功时 |
||||
|
const uploadSuccess = (response: any, uploadFile: any, uploadFiles: any) => { |
||||
|
// console.log("response==>",response) |
||||
|
// console.log("uploadFile==>",uploadFile) |
||||
|
// console.log("uploadFiles==>",uploadFiles) |
||||
|
const oldList = [] |
||||
|
fileList.value.forEach((item: any) => { |
||||
|
oldList.push(item.url) |
||||
|
}) |
||||
|
// oldList.push(response.path) |
||||
|
oldList.push(response.data.url) |
||||
|
|
||||
|
updateModel(oldList.join(',')) |
||||
|
|
||||
|
// props.control.value.onSuccess && |
||||
|
// props.control.value.onSuccess(response, uploadFile, uploadFiles) |
||||
|
// console.log("uploadSuccess===>",control.value) |
||||
|
// console.log("uploadSuccess=fileList==>",fileList) |
||||
|
} |
||||
|
</script> |
||||
|
<template> |
||||
|
<div> |
||||
|
<el-upload |
||||
|
v-bind="props.control" |
||||
|
:action="uploadUrl" |
||||
|
:name="props.name" |
||||
|
:class="{limit: props.control.limit <= fileList.length}" |
||||
|
:file-list="fileList as any" |
||||
|
:style="getFormItemInputStyle(configStyle,2)" |
||||
|
:on-error="uploadError" |
||||
|
:on-success="uploadSuccess" |
||||
|
:on-remove="uploadRemove" |
||||
|
> |
||||
|
<i class="icon-plus" v-if="props.control?.listType=='picture-card'"></i> |
||||
|
<el-button type="primary" plain v-else-if="props.control?.listType=='picture'"> |
||||
|
<span v-if="props.config?.btnText">{{ props.config?.btnText }} </span> |
||||
|
<span class="fa fa-plus" v-else></span> |
||||
|
</el-button> |
||||
|
<template v-else> |
||||
|
<el-button type="primary" plain v-if="props.config?.btnText"> |
||||
|
{{ props.config?.btnText }} |
||||
|
</el-button> |
||||
|
<i class="icon-plus" v-else></i> |
||||
|
</template> |
||||
|
<template #tip v-if="props.config?.tip"> |
||||
|
<div class="el-upload__tip"> |
||||
|
{{ props.config?.tip }} |
||||
|
</div> |
||||
|
</template> |
||||
|
</el-upload> |
||||
|
</div> |
||||
|
</template> |
||||
|
<style lang='scss' scoped> |
||||
|
|
||||
|
</style> |
||||
@ -0,0 +1,106 @@ |
|||||
|
<!-- |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2024-09-17 14:57:49 |
||||
|
@ 备注: 解析上传文件问题 |
||||
|
--> |
||||
|
<script lang='ts' setup> |
||||
|
import { AnalysisCss,AnalysisInputCss } from '@/components/DesignForm/public/form/calculate/cssInfo' |
||||
|
const props = defineProps({ |
||||
|
imgList:{ |
||||
|
type:String, |
||||
|
default:"" |
||||
|
}, |
||||
|
data:{ |
||||
|
type:Object, |
||||
|
default(){ |
||||
|
return {} |
||||
|
} |
||||
|
}, |
||||
|
control:{ |
||||
|
type:Object, |
||||
|
default(){ |
||||
|
return {} |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
const imgStr = ref<String>(props.imgList) |
||||
|
//组件css部分 |
||||
|
|
||||
|
/** |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2024-09-17 15:02:50 |
||||
|
@ 功能: 文件列表 |
||||
|
*/ |
||||
|
// const imgAry = () => { |
||||
|
// console.log("文件列表====>",imgStr.value) |
||||
|
// if(imgStr.value != ""){ |
||||
|
// // let zj = imgStr.value |
||||
|
// // let img = zj.Split(","); |
||||
|
// let arr = imgStr.value.match(/[^,]+/g); |
||||
|
// console.log("文件列表",arr) |
||||
|
// return arr |
||||
|
// }else{ |
||||
|
// return [] |
||||
|
// } |
||||
|
// } |
||||
|
const imgAry =computed({ |
||||
|
get: () => { |
||||
|
if(props.imgList != "" && props.imgList != null && props.imgList != undefined && props.imgList != "undefined"){ |
||||
|
// let zj = props.imgList |
||||
|
// let img = zj.Split(","); |
||||
|
let arr = props.imgList.match(/[^,]+/g); |
||||
|
console.log("文件列表",arr) |
||||
|
return arr |
||||
|
}else{ |
||||
|
return [] |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
const listType = () => { |
||||
|
if(props.control.listType){ |
||||
|
return props.control.listType |
||||
|
}else{ |
||||
|
return "text" |
||||
|
} |
||||
|
} |
||||
|
//解析指定样式 |
||||
|
const getFormItemInputStyle = (ele: any,sty:number) => { |
||||
|
if(ele?.inputStyle){ |
||||
|
console.log("返回栅格宽度4",AnalysisInputCss(ele?.inputStyle,sty)) |
||||
|
return AnalysisInputCss(ele?.inputStyle,sty) |
||||
|
} |
||||
|
} |
||||
|
const configStyle = computed(() => { |
||||
|
return props.data.styles || {} |
||||
|
}) |
||||
|
</script> |
||||
|
<template> |
||||
|
<div> |
||||
|
<div v-if="props.control.listType=='picture-card'"> |
||||
|
<div v-for="item in imgAry"> |
||||
|
<el-image class="imgCss" :style="getFormItemInputStyle(configStyle,2)" :src="item" :fit="fit" :preview-src-list="imgAry" /> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div v-else-if="props.control.listType=='picture'"> |
||||
|
<div v-for="item in imgAry"> |
||||
|
<el-image class="imgCss" :style="getFormItemInputStyle(configStyle,2)" :src="item" :fit="fit" :preview-src-list="imgAry" /> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div v-else> |
||||
|
<div v-for="item in imgAry"> |
||||
|
<el-link :underline="false" :href="item" target="_blank">{{ item }}</el-link><br> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</template> |
||||
|
<style lang='scss' scoped> |
||||
|
.imgCss{ |
||||
|
width: 100px; |
||||
|
height: 100px; |
||||
|
} |
||||
|
</style> |
||||
File diff suppressed because it is too large
@ -0,0 +1,86 @@ |
|||||
|
<!-- |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2024-09-19 13:16:56 |
||||
|
@ 备注: 性格分析过度 |
||||
|
--> |
||||
|
<script lang='ts' setup> |
||||
|
const downloadUrl = import.meta.env.VITE_APP_BASE_API+"/systemapi/rongxin/downLoadNineTestPage" |
||||
|
const downloadUrlStis = import.meta.env.VITE_APP_BASE_API+"/systemapi/rongxin/statisticsPersonality" |
||||
|
const props = defineProps({ |
||||
|
downTableType: { |
||||
|
type: String, |
||||
|
default: "10000003", |
||||
|
}, |
||||
|
downClassType: { |
||||
|
type: Number, |
||||
|
default: 1, |
||||
|
}, |
||||
|
orgTree: { |
||||
|
type: Object, |
||||
|
default() { |
||||
|
return {}; |
||||
|
}, |
||||
|
}, |
||||
|
}); |
||||
|
const dialogVisible = ref(true) |
||||
|
const emits = defineEmits(["closeXigePage"]); |
||||
|
const searchQuery = reactive({ |
||||
|
types:1, |
||||
|
org:"", |
||||
|
keywords:"", |
||||
|
typekey:props.downTableType?props.downTableType.toString():"" |
||||
|
}) |
||||
|
const handleTypeClose = () => { |
||||
|
emits("closeXigePage") |
||||
|
} |
||||
|
const orgTreeProps ={ |
||||
|
children: 'child', |
||||
|
label: 'name', |
||||
|
value:"id" |
||||
|
} //行政组织树对照值 |
||||
|
</script> |
||||
|
<template> |
||||
|
<el-dialog |
||||
|
v-model="dialogVisible" |
||||
|
title="选择下载范围" |
||||
|
width="500" |
||||
|
:before-close="handleTypeClose" |
||||
|
> |
||||
|
<el-form :model="searchQuery" label-width="90px" > |
||||
|
<el-form-item v-if="props.downClassType!=1" label="统计类型" label-position="left"> |
||||
|
<el-radio-group v-model="searchQuery.types"> |
||||
|
<el-radio :value="1">未做</el-radio> |
||||
|
<el-radio :value="2">已做</el-radio> |
||||
|
</el-radio-group> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="行政组织" label-position="left"> |
||||
|
<el-tree-select |
||||
|
v-model="searchQuery.org" |
||||
|
:data="props.orgTree" |
||||
|
check-strictly |
||||
|
:render-after-expand="false" |
||||
|
:props="orgTreeProps" |
||||
|
clearable |
||||
|
/> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="工号或姓名" label-position="left"> |
||||
|
<el-input v-model="searchQuery.keywords" clearable /> |
||||
|
</el-form-item> |
||||
|
<el-form-item> |
||||
|
<el-link v-if="props.downClassType==2" type="primary" :underline="false" :href="downloadUrlStis+'?keywords='+searchQuery.keywords+'&org='+searchQuery.org+'&typekey='+searchQuery.typekey+'&types='+searchQuery.types" target="_blank"> |
||||
|
<el-button type="primary"> |
||||
|
确定下载 |
||||
|
</el-button> |
||||
|
</el-link> |
||||
|
<el-link v-else type="primary" :underline="false" :href="downloadUrl+'?keywords='+searchQuery.keywords+'&adminorg='+searchQuery.org+'&typekey='+searchQuery.typekey" target="_blank"> |
||||
|
<el-button type="primary"> |
||||
|
确定下载 |
||||
|
</el-button> |
||||
|
</el-link> |
||||
|
</el-form-item> |
||||
|
</el-form> |
||||
|
</el-dialog> |
||||
|
</template> |
||||
|
<style lang='scss' scoped> |
||||
|
|
||||
|
</style> |
||||
Loading…
Reference in new issue