Browse Source

提交测试

zhuxinbo 5 năm trước cách đây
mục cha
commit
7a9ca4093f

+ 3 - 0
src/components/jeecg/JTreeSelect.vue

@@ -91,6 +91,7 @@
           this.treeValue = ""
         } else {
           getAction(`${this.view}${this.dict}`, {key: this.value}).then(res => {
+              console.log(res.result)
             if (res.success) {
               this.treeValue = {
                 key: this.value,
@@ -166,8 +167,10 @@
         }
         getAction(this.url, param).then(res => {
           if (res.success && res.result) {
+              console.log(res.result)
             for (let i of res.result) {
               i.value = i.key
+            //   i.disabled = true
               if (i.leaf == false) {
                 i.isLeaf = false
               } else if (i.leaf == true) {

+ 208 - 0
src/components/jeecg/noParentTreeSelect.vue

@@ -0,0 +1,208 @@
+<template>
+  <a-tree-select
+    allowClear
+    labelInValue
+    style="width: 100%"
+    :disabled="disabled"
+    :dropdownStyle="{ maxHeight: '400px', overflow: 'auto' }"
+    :placeholder="placeholder"
+    :loadData="asyncLoadTreeData"
+    :value="treeValue"
+    :treeData="treeData"
+    @change="onChange"
+    @search="onSearch">
+  </a-tree-select>
+</template>
+<script>
+
+  /*
+  * 异步树加载组件 通过传入表名 显示字段 存储字段 加载一个树控件
+  * <j-tree-select dict="aa_tree_test,aad,id" pid-field="pid" ></j-tree-select>
+  * */
+  import {getAction} from '@/api/manage'
+
+  export default {
+    name: 'JTreeSelect',
+    props: {
+      value: {
+        type: String,
+        required: false
+      },
+      placeholder: {
+        type: String,
+        default: '请选择',
+        required: false
+      },
+      dict: {
+        type: String,
+        default: '',
+        required: false
+      },
+      pidField: {
+        type: String,
+        default: 'pid',
+        required: false
+      },
+      pidValue: {
+        type: String,
+        default: '0',
+        required: false
+      },
+      disabled: {
+        type: Boolean,
+        default: false,
+        required: false
+      },
+      hasChildField: {
+        type: String,
+        default: '',
+        required: false
+      }
+    },
+    data() {
+      return {
+        treeValue: "",
+        treeData: [],
+        url: "/sys/dict/loadTreeData",
+        view: '/sys/dict/loadDictItem/',
+        tableName: "",
+        text: "",
+        code: "",
+
+      }
+    },
+    watch: {
+      value() {
+        this.loadItemByCode()
+      },
+      dict() {
+        this.initDictInfo()
+        this.loadRoot();
+      }
+    },
+    created() {
+      this.initDictInfo()
+      this.loadRoot()
+      this.loadItemByCode()
+    },
+    methods: {
+      loadItemByCode() {
+        if (!this.value || this.value == "0") {
+          this.treeValue = ""
+        } else {
+          getAction(`${this.view}${this.dict}`, {key: this.value}).then(res => {
+            if (res.success) {
+              this.treeValue = {
+                key: this.value,
+                value: this.value,
+                label: res.result
+              }
+            }
+          })
+        }
+      },
+      initDictInfo() {
+        let arr = this.dict.split(",")
+        this.tableName = arr[0]
+        this.text = arr[1]
+        this.code = arr[2]
+      },
+      asyncLoadTreeData(treeNode) {
+        return new Promise((resolve) => {
+          if (treeNode.$vnode.children) {
+            resolve()
+            return
+          }
+          let pid = treeNode.$vnode.key
+          let param = {
+            pid: pid,
+            tableName: this.tableName,
+            text: this.text,
+            code: this.code,
+            pidField: this.pidField,
+            hasChildField: this.hasChildField
+          }
+          getAction(this.url, param).then(res => {
+            if (res.success) {
+              for (let i of res.result) {
+                i.value = i.key
+                if (i.leaf == false) {
+                  i.isLeaf = true
+                } else if (i.leaf == true) {
+                  i.isLeaf = true
+                }
+              }
+              this.addChildren(pid, res.result, this.treeData)
+              this.treeData = [...this.treeData]
+            }
+            resolve()
+          })
+        })
+      },
+      addChildren(pid, children, treeArray) {
+        if (treeArray && treeArray.length > 0) {
+          for (let item of treeArray) {
+            if (item.key == pid) {
+              if (!children || children.length == 0) {
+                item.isLeaf = true
+              } else {
+                item.children = children
+              }
+              break
+            } else {
+              this.addChildren(pid, children, item.children)
+            }
+          }
+        }
+      },
+      loadRoot() {
+        let param = {
+          pid: this.pidValue,
+          tableName: this.tableName,
+          text: this.text,
+          code: this.code,
+          pidField: this.pidField,
+          hasChildField: this.hasChildField
+        }
+        getAction(this.url, param).then(res => {
+          if (res.success && res.result) {
+              console.log(res.result)
+            for (let i of res.result) {
+              i.value = i.key
+              i.disabled = true
+              if (i.leaf == false) {
+                i.isLeaf = false
+              } else if (i.leaf == true) {
+                i.isLeaf = true
+              }
+            }
+            this.treeData = [...res.result]
+          } else {
+            console.log("数根节点查询结果-else", res)
+          }
+        })
+      },
+      onChange(value) {
+        if (!value) {
+          this.$emit('change', '');
+          this.treeValue = ''
+        } else {
+          this.$emit('change', value.value);
+          this.treeValue = value
+        }
+
+      },
+      onSearch(value) {
+        console.log(value)
+      },
+      getCurrTreeData() {
+        return this.treeData
+      }
+    },
+    //2.2新增 在组件内定义 指定父组件调用时候的传值属性和事件类型 这个牛逼
+    model: {
+      prop: 'value',
+      event: 'change'
+    }
+  }
+</script>

+ 2 - 2
src/views/modules/Statistics/components/selecTable.vue

@@ -30,7 +30,7 @@
         :scroll="{ y: 300 }"
         :customRow="rowClick"
       >
-        <span slot="mediaId" slot-scope="text">{{ text == '1' ? '头条' : '快手' }}</span>
+        <span slot="mediaId" slot-scope="text">{{ text == '1' ? '头条' : text == '2'? '快手':text == '3'?'头条内广':'快手内广' }}</span>
       </a-table>
     </div>
   </a-form-item>
@@ -120,7 +120,7 @@ export default {
         // 事件
         on: {
           click: () => {
-            var str = record.mediaId == '1' ? '头条' : '快手'
+            var str = record.mediaId == '1' ? '头条' : record.mediaId == '2'? '快手':record.mediaId == '3'?'头条内广':'快手内广'
             this.keyValue = record.projectName + ' ' + str
             this.topMiddle = false
             this.data = this.dataElse

+ 16 - 1
src/views/modules/advertiser/ProjectList.vue

@@ -40,6 +40,19 @@
                 </a-select>
               </a-form-item>
             </a-col>
+            <a-col :md="6" :sm="6">
+            <a-form-item label="行业">
+                <j-tree-select
+                    v-model="queryParam.industryId"
+                    ref="treeSelect"
+                    placeholder="请选择行业"
+                    dict="sys_category,name,id"
+                    pidField="pid"
+                    pidValue="f5cb2d2d28417b3b65a6dd744bcb9a76"
+                >
+                </j-tree-select>
+                </a-form-item>
+            </a-col>
           </template>
           <a-col :md="6" :sm="8">
             <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
@@ -87,6 +100,7 @@
 
 <script>
   import ProjectModal from './modules/ProjectModal'
+  import JTreeSelect from '@/components/jeecg/JTreeSelect'
   import {
     httpAction,
     getAction
@@ -99,7 +113,8 @@
     name: 'ProjectList',
     mixins: [JeecgListMixin],
     components: {
-      ProjectModal
+      ProjectModal,
+      JTreeSelect
     },
     data() {
       return {

+ 1 - 1
src/views/modules/advertiser/modules/AdvertiserModal.vue

@@ -59,7 +59,7 @@
     getAction
   } from '@/api/manage'
   import pick from 'lodash.pick'
-  import JTreeSelect from '@/components/jeecg/JTreeSelect'
+  import JTreeSelect from '@/components/jeecg/noParentTreeSelect'
   import moment from "moment"
   import {
     mapGetters

+ 1 - 1
src/views/modules/advertiser/modules/ProjectModal.vue

@@ -123,7 +123,7 @@ import pick from 'lodash.pick'
 import moment from 'moment'
 import JSelectDepart from '@/components/jeecgbiz/JSelectDepart'
 import JSelectUserByDep from '@/components/jeecgbiz/JSelectUserByDep'
-import JTreeSelect from '@/components/jeecg/JTreeSelect'
+import JTreeSelect from '@/components/jeecg/noParentTreeSelect'
 import { mapGetters } from 'vuex'
 export default {
   name: 'ProjectModal',

+ 1 - 1
src/views/modules/kuaishouapp/account/accountIndex.vue

@@ -12,7 +12,7 @@
   <div class="account-index">
     <a-row class="image-list-heading vm-panel">
       <a-col :span="24" style="display:flex">
-        <Treeselect :appId.sync="appId" :multiple="false" ref="treeSelect" style="margin:8px 20px" />
+        <Treeselect :appId.sync="appId"  :multiple="false" request="2,4" ref="treeSelect" style="margin:8px 20px" />
         <a-button type="primary" style="margin:10px" @click="addUser">搜索</a-button>
       </a-col>
     </a-row>

+ 2 - 2
vue.config.js

@@ -64,13 +64,13 @@ module.exports = {
          }
        },*/
       '/jeecg-boot': {
-        // target: 'http://39.97.120.42:8080', //请求本地 需要jeecg-boot后台项目  生产环境
+        target: 'http://39.97.120.42:8080', //请求本地 需要jeecg-boot后台项目  生产环境
         // target: 'http://39.106.184.70:8080', //请求本地 需要jeecg-boot后台项目
         // target: 'http://192.168.1.13:8080', //请求本地 需要jeecg-boot后台项目  蒙蒙
         // target: 'http://192.168.1.22:8088', //请求本地 需要jeecg-boot后台项目  英豪
         // target: 'http://192.168.1.103:8080', //请求本地 需要jeecg-boot后台项目
         // target: 'http://192.168.2.115:8080', //请求本地 需要jeecg-boot后台项目  祚云
-        target: 'http://192.168.1.54:8080', //请求本地 需要jeecg-boot后台项目  孙震
+        // target: 'http://192.168.1.54:8080', //请求本地 需要jeecg-boot后台项目  孙震
         // target: 'http://192.168.1.165:8080', //请求本地 需要jeecg-boot后台项目  毕洁泉
         ws: false,
         changeOrigin: true