|
@@ -8,6 +8,8 @@ import * as api from "@/api/dashboardEditor/dashboardEditor";
|
|
|
import { type TDashboardTemplate } from "@/api/dashboardEditor/dashboardEditor";
|
|
|
import { BizException, ExceptionEnum } from "@/utils/BizException";
|
|
|
import { stringIsBlank } from "@/utils/blank-utils";
|
|
|
+import SystemDeptSelect from "@/components/system/dept-select/SystemDeptSelect.vue";
|
|
|
+import { getDept } from "@/api/public-api";
|
|
|
|
|
|
const dashboardEditorRef = useCompShallowRef(IframeEditor);
|
|
|
|
|
@@ -18,6 +20,8 @@ const store = reactive({
|
|
|
wardList: [],
|
|
|
currentTemplate: {} as null | TDashboardTemplate,
|
|
|
collapseValue: "",
|
|
|
+ templateType: 0,
|
|
|
+ templateTypeList: [] as { code: number; name: string; url: string }[],
|
|
|
});
|
|
|
|
|
|
const tmpGroupDataSource = computed(() => {
|
|
@@ -32,8 +36,13 @@ const tmpGroupDataSource = computed(() => {
|
|
|
return tmp;
|
|
|
});
|
|
|
|
|
|
-async function handleWardChange(code) {
|
|
|
- store.currentTemplate = await api.getDashboardTemplateByWardCode(code);
|
|
|
+async function handleWardChange() {
|
|
|
+ const { currentWard, templateType } = store;
|
|
|
+
|
|
|
+ store.currentTemplate = await api.getDashboardTemplateByWardCode(
|
|
|
+ currentWard,
|
|
|
+ templateType
|
|
|
+ );
|
|
|
dashboardEditorRef.value.clearHtml();
|
|
|
if (store.currentTemplate == null) {
|
|
|
dashboardEditorRef.value.insertTable(17, 11);
|
|
@@ -44,9 +53,18 @@ async function handleWardChange(code) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-onMounted(() => {
|
|
|
+function handleTemplateTypeChange() {
|
|
|
+ queryDataSource();
|
|
|
+ handleWardChange();
|
|
|
+}
|
|
|
+
|
|
|
+function queryDataSource() {
|
|
|
+ const tmp = store.templateTypeList.find(item => {
|
|
|
+ return item.code === store.templateType;
|
|
|
+ });
|
|
|
+
|
|
|
magicApi({
|
|
|
- url: "/public/dashboard/dataSource",
|
|
|
+ url: tmp.url,
|
|
|
method: "post",
|
|
|
data: { isSource: true },
|
|
|
})
|
|
@@ -56,9 +74,20 @@ onMounted(() => {
|
|
|
})
|
|
|
.catch(() => {
|
|
|
store.dataSource = [];
|
|
|
+ store.group = {};
|
|
|
});
|
|
|
+}
|
|
|
|
|
|
- getAllWards()
|
|
|
+onMounted(() => {
|
|
|
+ magicApi({
|
|
|
+ url: "/public/dashboard/getTemplateType",
|
|
|
+ method: "get",
|
|
|
+ }).then(res => {
|
|
|
+ store.templateTypeList = res;
|
|
|
+ queryDataSource();
|
|
|
+ });
|
|
|
+
|
|
|
+ getDept()
|
|
|
.then(res => {
|
|
|
store.wardList = res;
|
|
|
store.wardList.unshift({
|
|
@@ -79,10 +108,12 @@ async function handleSave(htmlData) {
|
|
|
store.currentTemplate = {
|
|
|
wardCode: store.currentWard,
|
|
|
htmlDataTemp: htmlData,
|
|
|
+ templateType: store.templateType,
|
|
|
};
|
|
|
} else {
|
|
|
store.currentTemplate.htmlDataTemp = htmlData;
|
|
|
store.currentTemplate.wardCode = store.currentWard;
|
|
|
+ store.currentTemplate.templateType = store.templateType;
|
|
|
}
|
|
|
store.currentTemplate = await api.saveTemplate(store.currentTemplate);
|
|
|
}
|
|
@@ -133,9 +164,16 @@ defineOptions({
|
|
|
<xc-el-option :data="store.wardList" />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
+ <el-form-item label="类型:">
|
|
|
+ <el-select
|
|
|
+ v-model="store.templateType"
|
|
|
+ @change="handleTemplateTypeChange"
|
|
|
+ >
|
|
|
+ <xc-el-option :data="store.templateTypeList" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
<el-form-item>
|
|
|
<el-button type="primary" @click="handleRelease">发布</el-button>
|
|
|
- <el-button type="success" @click="handlePreview">预览</el-button>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
</header>
|