diff --git a/src/api/model/system.ts b/src/api/model/system.ts
index 9bf11d8..c94d631 100644
--- a/src/api/model/system.ts
+++ b/src/api/model/system.ts
@@ -86,7 +86,7 @@ export default {
return await http.get("post/option", data);
},
import: async function (data = {}) {
- return await http.get("post/import", data);
+ return await http.post("post/import", data);
},
},
upload: async function (data, config = {}) {
diff --git a/src/components/piDictText/index.vue b/src/components/piDictText/index.vue
index c494103..fb2dc38 100644
--- a/src/components/piDictText/index.vue
+++ b/src/components/piDictText/index.vue
@@ -52,7 +52,7 @@ function genCacheKey() {
if (!props.cacheKey) {
return null;
}
- return `${props.cacheKey || dictConfig.api.name}:` + tools.crypto.MD5(`${stableStringify({key: props.type})}`).slice(0, 8).toUpperCase()
+ return `${props.cacheKey || dictConfig.api.name}:` + tools.md5(`${stableStringify({key: props.type})}`).slice(0, 8).toUpperCase()
}
function stableStringify(obj) {
diff --git a/src/components/piEditor/index.vue b/src/components/piEditor/index.vue
index dcbc5c5..ebd5e23 100644
--- a/src/components/piEditor/index.vue
+++ b/src/components/piEditor/index.vue
@@ -2,8 +2,7 @@
+ :defaultConfig="editorConfig" @onCreated="handleCreated"/>
props.modelValue, () => {
- html.value = props.modelValue
-}, {immediate: true})
-
-watch(html, () => {
- emit("update:modelValue", html.value)
+const html = computed({
+ get: () => props.modelValue,
+ set: (val) => emit("update:modelValue", val)
})
onUnmounted(() => {
@@ -80,6 +75,9 @@ onUnmounted(() => {
const handleCreated = (editor) => {
editorRef.value = editor
+ if (html.value) {
+ editor.setHtml(html.value)
+ }
}
function showPicker1() {
diff --git a/src/components/piExport/index.vue b/src/components/piExport/index.vue
index 5a82629..9982988 100644
--- a/src/components/piExport/index.vue
+++ b/src/components/piExport/index.vue
@@ -9,10 +9,7 @@ import tools from "@/utils/tools"
const {proxy} = getCurrentInstance()
const props = defineProps({
- api: {
- type: Object, default: () => {
- }
- },
+ api: {type: Object},
params: {
type: Object, default: () => {
}
@@ -25,12 +22,12 @@ let loading = ref(false)
async function download() {
const data = {module: props.module, name: props.name, params: props.params}
- let api = props.api
- if (!api) {
- api = api.tools.file.export
+ let apiUrl = props.api
+ if (!apiUrl) {
+ apiUrl = api.tools.file.export
}
loading.value = true
- const [res, err] = await tools.go(api(data))
+ const [res, err] = await tools.go(apiUrl(data))
loading.value = false
if (err) {
proxy.$message.error(res.msg)
diff --git a/src/components/piImage/index.vue b/src/components/piImage/index.vue
index 5170fb6..38a44a3 100644
--- a/src/components/piImage/index.vue
+++ b/src/components/piImage/index.vue
@@ -1,5 +1,5 @@
-
+
diff --git a/src/views/system/dept/save.vue b/src/views/system/dept/save.vue
index 816f10c..cc6d97d 100644
--- a/src/views/system/dept/save.vue
+++ b/src/views/system/dept/save.vue
@@ -78,18 +78,24 @@ function open(m = 'add', data = null) {
mode.value = m;
visible.value = true;
Object.assign(form.value, data)
+ return {setParent}
+}
+
+function setParent(parent_id=0) {
+ form.value.parent_id = parent_id
}
//加载树数据
async function getGroup() {
const res = await api.system.dept.list();
- groups.value = tools.makeTreeData(res.data, 0, "dept_id");
+ groups.value = tools.makeTreeData(res.data, 0, "dept_id", "parent_id");
}
//表单提交方法
async function submit() {
// 校验登录
- const validate = await formRef.value.validate().catch(() => {});
+ const validate = await formRef.value.validate().catch(() => {
+ });
if (!validate) {
return false
}
diff --git a/src/views/system/post/index.vue b/src/views/system/post/index.vue
index 5fcedb3..0902f8c 100644
--- a/src/views/system/post/index.vue
+++ b/src/views/system/post/index.vue
@@ -14,6 +14,11 @@
+
+
+
+
+
启用
@@ -49,6 +54,7 @@ import api from "@/api/index";
import {getCurrentInstance, nextTick, ref} from "vue"
import piImport from "@/components/piImport"
import piExport from "@/components/piExport"
+import piDictText from "@/components/piDictText"
defineOptions({
name: "systemPost"
diff --git a/src/views/system/post/save.vue b/src/views/system/post/save.vue
index 0cdfdb7..d5228ae 100644
--- a/src/views/system/post/save.vue
+++ b/src/views/system/post/save.vue
@@ -4,15 +4,20 @@
+
+
+
-
+
- 取 消
+ 取 消
保 存
@@ -44,7 +49,7 @@ let form = ref({
rank: 1
})
const rules = ref({
- post_name:[
+ post_name: [
{required: true, message: '请填写岗位名称'}
],
})
@@ -55,12 +60,15 @@ function open(m = 'add', data = null) {
Object.assign(form.value, data)
}
-async function submit(){
+async function submit() {
// 校验登录
- const validate = await formRef.value.validate().catch(() => {});
- if(!validate){ return false }
+ const validate = await formRef.value.validate().catch(() => {
+ });
+ if (!validate) {
+ return false
+ }
isSaveing.value = true;
- const res = form.value.post_id? await api.system.post.edit(form.value) : await api.system.post.add(form.value);
+ const res = form.value.post_id ? await api.system.post.edit(form.value) : await api.system.post.add(form.value);
isSaveing.value = false;
emit('success')
visible.value = false;