2025-11-04 16:50:49 +08:00
|
|
|
|
-- 只更新表单和自定义表单的JS增强,不更新其他信息
|
|
|
|
|
|
DELETE FROM "LOWCODE_FRAME"."LOWCODE_DBFORM_ENHANCE_JS" WHERE DBFORM_ID IN (SELECT ID FROM "LOWCODE_FRAME"."LOWCODE_DBFORM" WHERE TABLE_NAME IN ('lc_basic_safety_information') AND IS_DELETED = 0);
|
2025-11-07 13:57:50 +08:00
|
|
|
|
insert into "LOWCODE_FRAME"."LOWCODE_DBFORM_ENHANCE_JS"("ID", "TENANT_ID", "CREATE_USER", "CREATE_TIME", "CREATE_DEPT", "UPDATE_USER", "UPDATE_TIME", "IS_DELETED", "DBFORM_ID", "JS_TYPE", "JS_JSON") values(1966513983428063233, 1, 1, '2025-09-12 22:47:24', 100, 1, '2025-11-07 13:29:31', 0, 1966386366515343361, 'js', 'function isNotEmptyArray(arr) {
|
2025-11-04 16:50:49 +08:00
|
|
|
|
return Array.isArray(arr) && arr.length > 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function downloadFile(url, fileName) {
|
|
|
|
|
|
const xhr = new XMLHttpRequest();
|
|
|
|
|
|
xhr.open(''GET'', url);
|
|
|
|
|
|
xhr.responseType = ''blob'';
|
|
|
|
|
|
xhr.onload = function () {
|
|
|
|
|
|
const blob = xhr.response;
|
|
|
|
|
|
const link = document.createElement(''a'');
|
|
|
|
|
|
link.href = URL.createObjectURL(blob);
|
|
|
|
|
|
link.download = fileName;
|
|
|
|
|
|
link.click();
|
|
|
|
|
|
};
|
|
|
|
|
|
xhr.send();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function getFileName(url) {
|
|
|
|
|
|
const segments = url.split(''/'').filter(Boolean);
|
|
|
|
|
|
return segments[segments.length - 1] || '''';
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
|
initOption() { //表格显示前执行
|
|
|
|
|
|
// 修改资料分类的名称(分别为搜索栏以及表格列)
|
2025-11-07 13:57:50 +08:00
|
|
|
|
useFun.requestApi(''get'', ''/system/dict-data/page'', {
|
|
|
|
|
|
params: {
|
|
|
|
|
|
"dictType": ''basic_safety_main_category'',
|
2025-11-04 16:50:49 +08:00
|
|
|
|
"pageNo": 1,
|
|
|
|
|
|
"pageSize": -1
|
|
|
|
|
|
}
|
|
|
|
|
|
}).then(res => {
|
|
|
|
|
|
let dictData = res.list
|
|
|
|
|
|
|
|
|
|
|
|
let dataMap = {};
|
|
|
|
|
|
dictData.forEach(item => {
|
|
|
|
|
|
dataMap[item.value] = item.label
|
|
|
|
|
|
})
|
|
|
|
|
|
let file_main_name = dataMap[props.fixedSearch.file_main_type]
|
|
|
|
|
|
if (file_main_name != null && file_main_name != undefined) {
|
|
|
|
|
|
tableOption.value.column.file_sub_type.label = file_main_name + ''分类''
|
|
|
|
|
|
tableOption.value.column.file_sub_type_name.label = file_main_name + ''分类''
|
|
|
|
|
|
} else {
|
|
|
|
|
|
tableOption.value.column.file_sub_type.label = ''资料分类''
|
|
|
|
|
|
tableOption.value.column.file_sub_type_name.label = ''资料分类''
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
tableOption.value.column.create_user.label = ''上传人''
|
|
|
|
|
|
tableOption.value.column.create_time.label = ''上传时间''
|
|
|
|
|
|
tableOption.value.column.company_id.label = ''公司''
|
|
|
|
|
|
tableOption.value.column.department_id.label = ''部门''
|
|
|
|
|
|
|
|
|
|
|
|
// 处理一下二级分类的内容
|
2025-11-07 13:57:50 +08:00
|
|
|
|
useFun.requestApi(''get'', ''/system/dict-data/page'', {
|
|
|
|
|
|
params: {
|
|
|
|
|
|
"dictType": ''basic_safety_sub_category'',
|
2025-11-04 16:50:49 +08:00
|
|
|
|
"pageNo": 1,
|
|
|
|
|
|
"pageSize": -1
|
|
|
|
|
|
}
|
|
|
|
|
|
}).then(res => {
|
|
|
|
|
|
let filtered = res.list.filter(item => item.value.startsWith(props.fixedSearch.file_main_type))
|
|
|
|
|
|
useFun.setPropConfig(''file_sub_type'', { dicData: filtered })
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
async beforeFormData(formData, type) { //表单打开前执行
|
|
|
|
|
|
// 将一级分类传给formData,这样就可以保存这个一级类型
|
|
|
|
|
|
formData = {
|
|
|
|
|
|
...formData,
|
|
|
|
|
|
...props.fixedSearch,
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 将当前用户所在的公司,传递给表单,这样就可以默认了
|
|
|
|
|
|
const userData = useFun.useUserStoreWithOut()
|
|
|
|
|
|
if (isNotEmptyArray(userData.deptInfo)) {
|
|
|
|
|
|
let res = await useFun.requestApi(''get'', `/system/dept/get-user-company`, {
|
|
|
|
|
|
data: {}
|
|
|
|
|
|
})
|
|
|
|
|
|
if (res != null && res != undefined) {
|
|
|
|
|
|
formData.company_id = res.id
|
|
|
|
|
|
formData.company_name = res.name
|
|
|
|
|
|
} else {
|
|
|
|
|
|
// 查不到二级部门的情况也需要考虑,这样就考虑在哪个部门就把哪个部门设置为公司
|
|
|
|
|
|
if (Array.isArray(userData.deptInfo) && userData.deptInfo.length > 0) {
|
|
|
|
|
|
let dept = userData.deptInfo[0]
|
|
|
|
|
|
formData.company_id = dept.deptId
|
|
|
|
|
|
formData.company_name = dept.deptName
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
// 最终返回结果
|
|
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
|
|
resolve(formData);
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
download_file(row) {
|
|
|
|
|
|
// row.file_url 如何发起一个下载?
|
|
|
|
|
|
downloadFile(row.file_url, getFileName(row.file_url))
|
|
|
|
|
|
},
|
|
|
|
|
|
delete_btn(row) {
|
|
|
|
|
|
let ids = [row.id]
|
|
|
|
|
|
let tableId = props.tableId
|
|
|
|
|
|
useFun.requestApi(''delete'', `/jeelowcode/dbform-data/delete/${tableId}`, {
|
|
|
|
|
|
data: ids
|
|
|
|
|
|
}).then(() => {
|
|
|
|
|
|
// 成功动作,刷新表单
|
|
|
|
|
|
useFun.refreshChange()
|
|
|
|
|
|
}).catch(() => {
|
|
|
|
|
|
// 失败动作
|
|
|
|
|
|
message.alert(''删除失败'', ''提示'', { type: ''info'' })
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
}');
|
|
|
|
|
|
DELETE FROM "LOWCODE_FRAME"."LOWCODE_DESFORM" WHERE ID IN (SELECT DESFORM_WEB_ID FROM "LOWCODE_FRAME"."LOWCODE_DBFORM" WHERE TABLE_NAME IN ('lc_basic_safety_information') AND IS_DELETED = 0);
|
2025-11-07 13:57:50 +08:00
|
|
|
|
insert into "LOWCODE_FRAME"."LOWCODE_DESFORM"("ID", "TENANT_ID", "CREATE_USER", "CREATE_TIME", "CREATE_DEPT", "UPDATE_USER", "UPDATE_TIME", "IS_DELETED", "DESFORM_NAME", "DESFORM_JSON", "GROUP_DESFORM_ID", "IS_OPEN", "IS_TEMPLATE", "IS_HIDE", "I18N_DATA") values(1966404735134167042, 1, 1, '2025-09-12 15:33:18', 100, 1, '2025-11-07 13:34:19', 0, '安全基础资料表', '{"jsEnhance":"return {\n initData(formData) { //表单赋值前执行\n return new Promise(async (resolve, reject) => {\n let res = await useFun.requestApi(''get'', ''/system/dict-data/page'', {\n params: {\n \"dictType\": ''basic_safety_main_category'',\n \"pageNo\": 1,\n \"pageSize\": -1\n }\n })\n let dictData = res.list\n let dataMap = {};\n dictData.forEach(item => {\n dataMap[item.value] = item.label\n })\n let file_main_name = dataMap[formData.file_main_type]\n if (file_main_name != undefined) {\n useFun.setPropConfig(''file_sub_type'', { label: `${file_main_name}分类` })\n formData.$file_main_type = file_main_name\n } else {\n useFun.setPropConfig(''file_sub_type'', { label: ''资料分类'' })\n }\n\n // 二级分类与一级分类相关联\n useFun.requestApi(''get'', ''/system/dict-data/page'', {\n params: {\n \"dictType\": ''basic_safety_sub_category'',\n \"pageNo\": 1,\n \"pageSize\": -1\n }\n }).then(res => {\n let filtered = res.list.filter(item => item.value.startsWith(formData.file_main_type))\n let propConfig = useFun.getPropConfig(''file_sub_type'')\n useFun.setPropConfig(''file_sub_type'', { dicData: filtered })\n })\n resolve(formData)\n })\n },\n beforeSubmit(submitData) { //表单提交前执行\n // 将属性名配置正常\n submitData.department_name = formData.value.$department_id\n submitData.file_sub_type_name = formData.value.$file_sub_type\n submitData.file_main_type_name = formData.value.$file_main_type\n return new Promise((resolve, reject) => {\n resolve(submitData)\n })\n },\n}\n","scssEnhance":".low-form__1966404735134167042 {\n padding: 0 0 !important;\n\n .avue-form__group avue-form__group--flex {}\n\n .el-card__body {\n padding: unset !important;\n }\n\n .control-fields_2089442 {\n min-width: 341px !important;\n max-width: 341px !important;\n }\n\n .control-approveStatusName {\n min-width: 64%;\n }\n\n .el-col-md-3 {\n margin-left: 0 !important;\n }\n\n .control-fields_2642050 {\n left: 90px;\n min-width: 164px !important;\n max-width: 164px !important;\n }\n\n .control-fields_9126239 {\n left: 34px;\n min-width: 164px !important;\n max-width: 164px !important;\n }\n\n .control-create_time {\n left: -49px;\n top: 5px;\n\n p {\n margin: unset !important;\n }\n }\n\n .control-billNo {\n left: 2px;\n bottom: -5px;\n min-width: 234px !important;\n max-width: 234px !important;\n\n p {\n margin: unset !important;\n }\n }\n\n .avue-form.avue--detail {\n\n .head_title,\n .head_detail_label,\n .head_detail_label,\n .head_type_value,\n .head_number_label,\n .head_number_value,\n .head_created_time_label,\n .head_created_time_value,\n .head_status_label,\n .head_separator2,\n .head_separator1 {\n margin-top: unset !important;\n }\n\n .ce_class {\n top: 7px !important;\n }\n\n .control-create_time {\n left: -40px !important;\n top: -6px !important;\n }\n\n * {\n border: none !important;\n }\n\n .control-approveStatusName {\n margin-top: 0 !important;\n border: none !important;\n }\n\n .control-fields_9126239 {\n left: 34px !important;\n top: -11px;\n }\n\n .control-fields_2642050 {\n left: 89px !important;\n top: -11px;\n }\n\n .control-billNo {\n left: 40 !important;\n top: -5px !important;\n }\n\n .head_title {\n border: none !important;\n }\n }\n
|