--fix 内容分类 改成从字典取值

This commit is contained in:
yuping
2023-01-13 18:17:07 +08:00
parent 05e9732e3d
commit 29582b6beb
6 changed files with 829 additions and 955 deletions

View File

@@ -138,26 +138,15 @@
</div>
<div class="item_inp">
<div class="select i6_input">
<!-- <a-select-->
<!-- :getPopupContainer="-->
<!-- (triggerNode) => {-->
<!-- return triggerNode.parentNode || document.body;-->
<!-- }-->
<!-- "-->
<!-- v-model:value="fen_lei"-->
<!-- dropdownClassName="dropdown-style"-->
<!-- style="width: 440px"-->
<!-- placeholder="请选择"-->
<!-- :options="options2"-->
<!-- allowClear-->
<!-- showSearch-->
<!-- />-->
<a-tree-select style="width: 440px" placeholder="请选择内容分类" :treeDefaultExpandAll="true"
:getPopupContainer="
(triggerNode) => {
return triggerNode.parentNode || document.body;
}
" @change="changeTreeSelectValue" v-model:value="fen_lei" :tree-data="options2222">
:getPopupContainer="triggerNode => triggerNode.parentNode || document.body"
v-model:value="fen_lei"
:tree-data="sysTypeOptions"
:fieldNames="{
children: 'children',
label: 'dictName',
value: 'dictCode',
}">
</a-tree-select>
</div>
</div>
@@ -321,13 +310,12 @@
</template>
<script>
import {
reactive,
toRefs,
defineComponent,
ref,
shallowRef,
// onMounted,
onUnmounted,
reactive,
toRefs,
defineComponent,
ref,
shallowRef,
onUnmounted, computed, watch,
} from "vue";
import { validateName } from "@/api/index1";
import { message } from "ant-design-vue";
@@ -336,11 +324,11 @@ import { fileUp } from "../../api/indexEval";
import * as api1 from "../../api/index1";
import "@wangeditor/editor/dist/css/style.css";
import { Editor, Toolbar } from "@wangeditor/editor-for-vue";
//import ProjectManager from "@/components/project/ProjectManagerNew";
import NameInput from "@/components/project/NameInput";
import FJUpload from "@/components/common/FJUpload";
import * as moment from "moment";
import * as api2 from "../../api/indexAudit";
import {useStore} from "vuex";
export default defineComponent({
components: {
@@ -348,7 +336,6 @@ export default defineComponent({
Toolbar,
FJUpload,
NameInput,
//ProjectManager,
},
props: {
xzinputV1: {
@@ -514,6 +501,19 @@ export default defineComponent({
}
],
});
const store = useStore();
const sysTypeOptions = computed(() => store.state.sysType);
watch(()=>state.fen_lei,()=>{
state.fen_lei1 = findClassFullName(sysTypeOptions.value)
})
function findClassFullName(list,name=''){
return list && list.length && list.map(e=>{
return state.fen_lei == e.dictCode ? name?name+'-'+e.dictName:e.dictName : findClassFullName(e.children,name?name+'-'+e.dictName:e.dictName)
}).filter(name=>name).join('')
}
// 删除文件返回参数
const changevalue = (e) => {
@@ -855,8 +855,7 @@ export default defineComponent({
state.feng_mian_1 = item.picUrl;
state.qdms_inputV2 = item.targetUser;
state.qdms_inputV3 = item.meaning;
state.fen_lei = String(item.categoryId);
state.fen_lei1 = changeTreeSelectValue(String(item.categoryId));
state.fen_lei = item.categoryId;
state.chang_jin = String(item.sceneContent ? item.sceneContent : '');
state.tags_val = item.tips ? item.tips.split(",") : [];
state.qdms_inputV6 = item.intro;
@@ -911,37 +910,9 @@ export default defineComponent({
});
};
// 格式化树型结构选择数据
const changeTreeSelectValue = (values) => {
let data = state.options2222;
console.log(values, data)
let str = ''
for (let i = 0; i < data.length; i++) {
if (data[i].value == values) {
str = data[i].title
} else {
for (let j = 0; j < data[i].children.length; j++) {
if (data[i].children[j].value == values) {
str = data[i].title + '/' + data[i].children[j].title
} else {
if (data[i].children[j].children) {
for (let k = 0; k < data[i].children[j].children.length; k++) {
if (data[i].children[j].children[k].value == values) {
str = data[i].title + '/' + data[i].children[j].title + '/' + data[i].children[j].children[k].title
}
}
}
}
}
}
}
console.log('str-str-str-str', str)
state.fen_lei1 = str;
return str;
}
return {
...toRefs(state),
sysTypeOptions,
moment,
options2,
options3,
@@ -963,7 +934,6 @@ export default defineComponent({
handleCreated,
choicePic,
changevalue,
changeTreeSelectValue
};
},
});