@@ -0,0 +1,188 @@ | |||
<!-- 会计科目选择弹出层组件 zhao --> | |||
<template> | |||
<van-popup v-model="popupVisible" position="bottom" :style="{'height': height || 'unset',}"> | |||
<van-search | |||
v-model="searchValue" | |||
placeholder="按科目编码/名称筛选" | |||
@input="onSearch" | |||
/> | |||
<van-tabs v-model="active" @change="onTabChanged"> | |||
<van-tab :title="item.subjectName" :name="item.subjectId" v-for="(item, index) in subjects"> | |||
<SubjectTreeChooserNodeItem :ref="'tree' + index" :subjects="item.children" @clicked="onItemClicked" :can-select-non-leaf="canSelectNonLeaf"></SubjectTreeChooserNodeItem> | |||
</van-tab> | |||
</van-tabs> | |||
</van-popup> | |||
</template> | |||
<script> | |||
import request from "@/utils/request"; | |||
import SubjectTreeChooserNodeItem from "./SubjectTreeChooserNodeItem"; | |||
export default { | |||
name: "SubjectTreeChooser", | |||
components: {SubjectTreeChooserNodeItem}, | |||
props: [ | |||
'value', 'visible', 'height', 'canSelectNonLeaf', | |||
], | |||
watch: { | |||
value: function (newVal, oldVal) { | |||
if(newVal != this.internalValue) | |||
{ | |||
this.internalValue = newVal; | |||
this.syncIndex(); | |||
} | |||
}, | |||
visible: function(newVal, oldVal) { | |||
if(this.popupVisible !== newVal) | |||
{ | |||
this.popupVisible = newVal; | |||
if(newVal) | |||
this.syncIndex(); | |||
} | |||
}, | |||
popupVisible: function(newVal, oldVal) { | |||
if(newVal !== this.visible) | |||
this.$emit('update:visible', newVal); | |||
}, | |||
}, | |||
created() { | |||
this.getSubjects(); | |||
}, | |||
data() { | |||
return { | |||
popupVisible: false, | |||
internalValue: this.value, | |||
searchValue: '', | |||
active: '1', | |||
subjects: [], | |||
}; | |||
}, | |||
methods: { | |||
getSubjects() { | |||
this.subjects = []; | |||
let map = {}; | |||
this.getDicts('subject_type').then((resp) => { | |||
this.subjects = resp.data.map((x) => { | |||
let item = { | |||
subjectId: x.dictValue, | |||
subjectName: x.dictLabel, | |||
subjectNameAll: x.dictLabel, | |||
subjectType: x.dictValue, | |||
subjectLevel: 0, | |||
children: [], | |||
visible: true, | |||
}; | |||
map[x.dictValue] = item; | |||
return item; | |||
}); | |||
let url = '/finance/subject/listAll'; // '/villageAffairs/public/subjects/153' | |||
request(url).then((resp) => { | |||
let list = this.makeTree(resp.rows || resp.data); | |||
for(let v of list) | |||
{ | |||
if(v.subjectId.length === 3) | |||
{ | |||
map[v.subjectType].children.push(v); | |||
} | |||
} | |||
}) | |||
}); | |||
}, | |||
onItemClicked(subject) { | |||
if(this.canSelectNonLeaf || subject.is_last === 'Y') | |||
{ | |||
this.internalValue = subject.subjectId | |||
this.$emit('input', subject.subjectId); | |||
this.$emit('select', subject); | |||
this.close(); | |||
} | |||
}, | |||
onItemToggle({subject, on}) { | |||
}, | |||
onCancel() { | |||
this.close(); | |||
}, | |||
makeTree(list) { | |||
function isnull(p) { | |||
return p === null || p === undefined || p === ''; | |||
} | |||
function makeTree_r(l, p) { | |||
const isRoot = isnull(p); | |||
let res = []; | |||
for(let v of l) | |||
{ | |||
if((isRoot && isnull(v.parentId)) || (!isRoot && v.parentId == p)) | |||
{ | |||
let arr = makeTree_r(l, v.subjectId); | |||
if(arr.length > 0) | |||
v.children = arr; | |||
else | |||
delete v.children; | |||
res.push(v); | |||
} | |||
} | |||
return res; | |||
} | |||
return makeTree_r(list.map((x) => { | |||
x.visible = true; | |||
return x; | |||
})); | |||
}, | |||
onSearch(value) { | |||
function handleTree_r(l, func) { | |||
let res = 0; | |||
for(let v of l) | |||
{ | |||
let r = func(v) ? 1 : 0; | |||
if(v.children && Array.isArray(v.children) && v.children.length > 0) | |||
{ | |||
r += handleTree_r(v.children, func); | |||
} | |||
v.visible = r > 0; | |||
res += r; | |||
} | |||
return res; | |||
} | |||
for(let v of this.subjects) | |||
{ | |||
if(v.subjectId === this.active && value) | |||
{ | |||
handleTree_r(v.children, (x) => x.subjectId.startsWith(value) || x.subjectName.indexOf(value) !== -1); | |||
} | |||
else | |||
{ | |||
handleTree_r(v.children, (x) => true); | |||
} | |||
} | |||
}, | |||
onTabChanged() { | |||
this.searchValue = ''; | |||
this.onSearch(); | |||
}, | |||
folderAll() { // TODO: not work | |||
for(let i in this.subjects) | |||
{ | |||
if(this.$refs['tree' + i]) | |||
this.$refs['tree' + i][0].folderAll(); | |||
} | |||
}, | |||
close() { | |||
this.popupVisible = false; | |||
this.folderAll(); | |||
this.searchValue = ''; | |||
this.active = '1'; | |||
this.$emit('cancel'); | |||
}, | |||
syncIndex() { | |||
if(this.subjects.length === 0 || !this.internalValue) | |||
return; | |||
this.active = this.internalValue[0]; | |||
}, | |||
}, | |||
} | |||
</script> | |||
<style scoped> | |||
</style> |
@@ -0,0 +1,68 @@ | |||
<!-- 会计科目选择节点组件 zhao --> | |||
<template> | |||
<van-collapse v-model="active"> | |||
<template v-for="(subject, index) in subjects"> | |||
<van-collapse-item :ref="'collapse' + index" :lazy-render="false" :title="subject.subjectId + ' ' + subject.subjectName" :name="subject.subjectId" :is-link="subject.is_last !== 'Y'" :class="subject.is_last === 'Y' ? 'subject-tree-node-leaf' : 'subject-tree-node-non-leaf'" v-if="subject.visible"> | |||
<template #title> | |||
<div @click="($event) => onItemClicked($event, subject)">{{ subject.subjectId }} {{ subject.subjectName }}</div> | |||
</template> | |||
<SubjectTreeChooserNodeItem :ref="'childCollapse' + index" :subjects="subject.children" v-if="subject.children && Array.isArray(subject.children) && subject.children.length > 0" @clicked="onChildItemClicked" :can-select-non-leaf="canSelectNonLeaf"> | |||
</SubjectTreeChooserNodeItem> | |||
</van-collapse-item> | |||
</template> | |||
</van-collapse> | |||
</template> | |||
<script> | |||
export default { | |||
name: "SubjectTreeChooserNodeItem", | |||
props: [ | |||
'subjects', 'canSelectNonLeaf', | |||
], | |||
watch: { | |||
}, | |||
created() { | |||
}, | |||
data() { | |||
return { | |||
active: [], | |||
}; | |||
}, | |||
methods: { | |||
onItemClicked($event, subject) { | |||
if(this.canSelectNonLeaf || subject.is_last === 'Y') | |||
{ | |||
this.$emit('clicked', subject); | |||
//$event.preventDefault(); | |||
$event.stopPropagation(); | |||
} | |||
}, | |||
onChildItemClicked(subject) { | |||
this.$emit('clicked', subject); | |||
}, | |||
folderAll() { // TODO: not work | |||
for(let i in this.subjects) | |||
{ | |||
if(this.$refs['childCollapse' + i]) | |||
this.$refs['childCollapse' + i][0].folderAll(); | |||
if(this.$refs['collapse' + i]) | |||
this.$refs['collapse' + i][0].toggle(false); | |||
} | |||
}, | |||
}, | |||
} | |||
</script> | |||
<style> | |||
.subject-tree-node-non-leaf .van-collapse-item__content { | |||
padding-right: 0; | |||
padding-top: 0; | |||
padding-bottom: 0; | |||
} | |||
.subject-tree-node-leaf .van-collapse-item__content { | |||
padding-right: 0; | |||
padding-top: 0; | |||
padding-bottom: 0; | |||
} | |||
</style> |
@@ -48,9 +48,9 @@ | |||
<div class="nav_list"> | |||
<router-link :to="{name:'sunVillageInfoListFinance'}" class="nav_item n_1">财务公开榜</router-link> | |||
<router-link :to="{name:'sunVillageInfoListTourists'}" class="nav_item n_2">零工公开榜</router-link> | |||
<router-link :to="{name:'sunVillageInfoListIssues'}" class="nav_item n_3">重大事项公开</router-link> | |||
<router-link :to="{name:'sunVillageInfoListRegister'}" class="nav_item n_6">零工登记</router-link> | |||
<router-link :to="{name:'sunVillageInfoListIssues'}" class="nav_item n_3">重大事项</router-link> | |||
<router-link :to="{name:'sunVillageInfoFixedAssets'}" class="nav_item n_4">固定资产</router-link> | |||
<router-link :to="{name:'sunVillageInfoFixedAssets'}" class="nav_item n_4">资产登记</router-link> | |||
<router-link :to="{name:'sunVillageInfoInformation'}" class="nav_item n_5">合同登记</router-link> | |||
<router-link :to="{name:'sunVillageInfoListBalanceRanking'}" class="nav_item n_7">科目余额</router-link> | |||
</div> | |||
@@ -17,7 +17,7 @@ | |||
<div class="nav_list"> | |||
<router-link :to="{name:'sunVillageInfoListFinance',query:{type:'code'}}" class="nav_item n_1">财务公开榜</router-link> | |||
<router-link :to="{name:'sunVillageInfoListTourists',query:{type:'code'}}" class="nav_item n_2">零工公开榜</router-link> | |||
<router-link :to="{name:'sunVillageInfoListIssues',query:{type:'code'}}" class="nav_item n_3">重大事项</router-link> | |||
<router-link :to="{name:'sunVillageInfoListIssues',query:{type:'code'}}" class="nav_item n_3">重大事项公开</router-link> | |||
<!-- <router-link :to="{name:'sunVillageInfoFixedAssets'}" class="nav_item n_4">固定资产</router-link>--> | |||
<!-- <router-link :to="{name:'sunVillageInfoInformation'}" class="nav_item n_5">合同登记</router-link>--> | |||
</div> | |||
@@ -23,7 +23,7 @@ | |||
</template> | |||
</van-field> | |||
<van-field readonly v-model="form.openName" placeholder="请输入名称" :rules="[{ required: true , message:'请输入名称' }]" input-align="right" :border="false" > | |||
<van-field readonly v-model="form.openName" :rules="[{ required: true , message:'请输入名称' }]" input-align="right" :border="false" > | |||
<template #label> | |||
<img src="../../assets/images/sunVillage_info/add_tit_icon_02.png" width="18"> | |||
<p style="margin-left: 5px;">公开名称</p> | |||
@@ -55,7 +55,7 @@ | |||
</div> | |||
</div> | |||
</div> | |||
<van-field readonly v-model="form.remark" placeholder="请输入备注" input-align="right" :border="false" > | |||
<van-field readonly v-model="form.remark" input-align="right" :border="false" > | |||
<template #label> | |||
<img src="../../assets/images/sunVillage_info/add_tit_icon_05.png" width="18"> | |||
<p style="margin-left: 5px;">备注</p> | |||
@@ -1,7 +1,7 @@ | |||
<template> | |||
<div class="home_wrapper"> | |||
<div class="header_main"> | |||
重大事项 | |||
重大事项公开榜 | |||
<div class="return_btn" @click="onClickLeft"></div> | |||
<div class="add_btn" @click="goAdd" v-show="showBtn"></div> | |||
</div> | |||
@@ -71,17 +71,18 @@ | |||
<img src="../../assets/images/sunVillage_info/addFile.png" width="120" /> | |||
</van-uploader> | |||
</div> | |||
<van-field v-model="form.remark" placeholder="请输入备注" input-align="right" :border="false" > | |||
<van-field v-model="form.content" type="textarea" autosize placeholder="请输入内容" input-align="right" :border="false" > | |||
<template #label> | |||
<img src="../../assets/images/sunVillage_info/add_tit_icon_05.png" width="18"> | |||
<p style="margin-left: 5px;">备注</p> | |||
<p style="margin-left: 5px;">内容</p> | |||
</template> | |||
</van-field> | |||
<van-field v-model="form.content" type="textarea" autosize placeholder="请输入内容" input-align="right" :border="false" > | |||
<van-field v-model="form.remark" placeholder="请输入备注" input-align="right" :border="false" > | |||
<template #label> | |||
<img src="../../assets/images/sunVillage_info/add_tit_icon_05.png" width="18"> | |||
<p style="margin-left: 5px;">内容</p> | |||
<p style="margin-left: 5px;">备注</p> | |||
</template> | |||
</van-field> | |||
@@ -23,7 +23,7 @@ | |||
</template> | |||
</van-field> | |||
<van-field readonly v-model="form.openName" placeholder="请输入名称" :rules="[{ required: true , message:'请输入名称' }]" input-align="right" :border="false" > | |||
<van-field readonly v-model="form.openName" :rules="[{ required: true , message:'请输入名称' }]" input-align="right" :border="false" > | |||
<template #label> | |||
<img src="../../assets/images/sunVillage_info/add_tit_icon_02.png" width="18"> | |||
<p style="margin-left: 5px;">公开名称</p> | |||
@@ -55,16 +55,18 @@ | |||
</div> | |||
</div> | |||
</div> | |||
<van-field readonly v-model="form.remark" placeholder="请输入备注" input-align="right" :border="false" > | |||
<van-field readonly v-model="form.content" type="textarea" autosize input-align="right" :border="false" > | |||
<template #label> | |||
<img src="../../assets/images/sunVillage_info/add_tit_icon_05.png" width="18"> | |||
<p style="margin-left: 5px;">备注</p> | |||
<p style="margin-left: 5px;">内容</p> | |||
</template> | |||
</van-field> | |||
<van-field readonly v-model="form.content" type="textarea" autosize placeholder="请输入备注" input-align="right" :border="false" > | |||
<van-field readonly v-model="form.remark" input-align="right" :border="false" > | |||
<template #label> | |||
<img src="../../assets/images/sunVillage_info/add_tit_icon_05.png" width="18"> | |||
<p style="margin-left: 5px;">内容</p> | |||
<p style="margin-left: 5px;">备注</p> | |||
</template> | |||
</van-field> | |||
@@ -71,12 +71,6 @@ | |||
<img src="../../assets/images/sunVillage_info/addFile.png" width="120" /> | |||
</van-uploader> | |||
</div> | |||
<van-field v-model="form.remark" placeholder="请输入备注" input-align="right" :border="false" > | |||
<template #label> | |||
<img src="../../assets/images/sunVillage_info/add_tit_icon_05.png" width="18"> | |||
<p style="margin-left: 5px;">备注</p> | |||
</template> | |||
</van-field> | |||
<van-field v-model="form.content" type="textarea" autosize placeholder="请输入内容" input-align="right" :border="false" > | |||
<template #label> | |||
@@ -84,6 +78,14 @@ | |||
<p style="margin-left: 5px;">内容</p> | |||
</template> | |||
</van-field> | |||
<van-field v-model="form.remark" placeholder="请输入备注" input-align="right" :border="false" > | |||
<template #label> | |||
<img src="../../assets/images/sunVillage_info/add_tit_icon_05.png" width="18"> | |||
<p style="margin-left: 5px;">备注</p> | |||
</template> | |||
</van-field> | |||
</div> | |||
<div style="margin: 16px auto;width: 50%;"> | |||
@@ -1,7 +1,7 @@ | |||
<template> | |||
<div class="home_wrapper"> | |||
<div class="header_main"> | |||
零工登记 | |||
零工信息 | |||
<div class="return_btn" @click="onClickLeft"></div> | |||
<div class="add_btn" @click="goAdd" v-show="showBtn"></div> | |||
</div> | |||
@@ -23,7 +23,7 @@ | |||
</template> | |||
</van-field> | |||
<van-field readonly v-model="form.openName" placeholder="请输入名称" :rules="[{ required: true , message:'请输入名称' }]" input-align="right" :border="false" > | |||
<van-field readonly v-model="form.openName" :rules="[{ required: true , message:'请输入名称' }]" input-align="right" :border="false" > | |||
<template #label> | |||
<img src="../../assets/images/sunVillage_info/add_tit_icon_02.png" width="18"> | |||
<p style="margin-left: 5px;">公开名称</p> | |||
@@ -55,7 +55,7 @@ | |||
</div> | |||
</div> | |||
</div> | |||
<van-field readonly v-model="form.remark" placeholder="请输入备注" input-align="right" :border="false" > | |||
<van-field readonly v-model="form.remark" input-align="right" :border="false" > | |||
<template #label> | |||
<img src="../../assets/images/sunVillage_info/add_tit_icon_05.png" width="18"> | |||
<p style="margin-left: 5px;">备注</p> | |||