| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- <template>
- <uni-data-picker class="uni_item" placeholder="请选择工单类别" :showSearch= "showSearch" :readonly="readonly" :localdata="dataOrderType" v-model="WorkOrderCategory" @change="changeType" @nodeclick="nodeclick" @popupclosed="popupclosed" @searchTrue="searchTrue">
- </uni-data-picker>
- </template>
- <script>
- import pageData from "@/pages/myTask/repairList/addRepair/pageData.js"
- import {filterTreeDatas} from '@/utils/dataTreating.js'
- export default {
- data() {
- return {
- order: '',
- WorkOrderCategory: '',
- orderList: [],
- identification: '',
- dataOrderType: [],
- autoData:[],
- showSearch:true
- }
- },
- props: {
- orderType: {},
- typeid: {},
- readonly:false
- },
- created() {
- this.getDpartment()
- },
- methods: {
- getDpartment() {
- pageData.getGongDanType(this.typeid,(res, data) => {
- this.orderList = data
- this.dataOrderType = res
- if(this.orderType) {
- this.getOrder(res, data, this.orderType)
- }
- })
- },
- getOrder(data, tree, id) {
- let newtext = ''
- for (const i in tree) {
- if (tree[i].id == id) {
- this.getTree(data, tree[i].text)
- } else if (tree[i].children) {
- this.getOrder(data, tree[i].children, id)
- }
- }
-
- },
- getTree(tree, text) {
- for (const i in tree) {
- if (tree[i].text == text) {
- this.WorkOrderCategory = tree[i].value
- } else if (tree[i].children) {
- this.getTree(tree[i].children, text)
- }
- }
- },
- changeType(e,f,g){
- const valueData = e.detail.value
- this.WorkOrderCategory = valueData[valueData.length-1].value
- },
- searchTrue(e){
- this.WorkOrderCategory = e.value
- },
- nodeclick(data) {
- // this.WorkOrderCategory = data.value
- this.order = data.value
- this.identification = this.$mHelper.getIdentification(this.orderList,data.value)
- this.$emit('post-select-data',data.value,data.id,data.orderType,this.identification, data.text)
- // this.$http.get("GongDanType/GetModule", {mId:data.value}).then((response) => {
- // if (response.state.toLowerCase() === "success") {
- // if(response.data.autodept!=''){
- // this.autoData = JSON.parse(response.data.autodept)
- // this.$emit('post-select-data',data.value,data.id,data.orderType,identification, data.text,this.autoData)
- // }
- // }
- // })
- },
- popupclosed(data) {
- this.WorkOrderCategory = this.order
- }
- }
- }
- </script>
- <style>
- </style>
|