zcy 4 vuotta sitten
vanhempi
commit
a25b4c3f08

+ 13 - 21
src/views/basics/section/CheckAndEditModel.vue

@@ -11,6 +11,12 @@
       <a-form-model-item label="区间站场名称" prop="stationName">
         <a-input v-model="model.stationName" />
       </a-form-model-item>
+      <a-form-model-item label="线路" prop="lineId">
+        <j-list-select-tag
+          v-model="model.lineId"
+          dict-code="line"
+        />
+      </a-form-model-item>
       <a-form-model-item label="所属车间" prop="deptStations">
         <a-tree-select
           v-model="model.deptStations"
@@ -25,14 +31,6 @@
           :replace-fields="{children:'children', title:'label', key:'id', value: 'id' }"
         />
       </a-form-model-item>
-      <a-form-model-item label="线路" prop="lineId">
-        <j-list-select-tag
-          v-if="lineShow"
-          v-model="model.lineId"
-          :dept-id="model.deptStations"
-          dict-code="line"
-        />
-      </a-form-model-item>
       <a-form-model-item label="行别" prop="xingbie">
         <j-dict-select-tag
           v-model="model.xingbie"
@@ -67,7 +65,6 @@ export default {
   },
   data() {
     return {
-      lineShow: false,
       treeData: [],
       labelCol: { span: 4 },
       wrapperCol: { span: 19 },
@@ -89,32 +86,27 @@ export default {
       url: {
         add: '/business/catenary/bus/station/add',
         edit: '/business/catenary/bus/station/update',
-        tree: '/system/dept/treeSelect'
+        tree: '/business/catenary/bus/line/getDeptByLineId/'
       }
     }
   },
   watch: {
-    'model.deptStations': {
+    'model.lineId': {
       deep: true,
       handler: function(newV, oldV) {
-        if (newV.length > 0) {
-          this.lineShow = false
-          this.$nextTick(() => {
-            this.lineShow = true
-          })
-        } else {
-          this.lineShow = false
+        debugger
+        if (this.model.lineId) {
+          this.loadTree(this.model.lineId)
         }
       }
     }
   },
   created() {
-    this.loadTree()
   },
   methods: {
-    loadTree() {
+    loadTree(lineId) {
       this.treeData = []
-      getAction(this.url.tree).then((res) => {
+      getAction(this.url.tree + lineId).then((res) => {
         if (res.code === 200) {
           this.treeData = res.data
         }

+ 6 - 1
src/views/basics/section/index.vue

@@ -95,7 +95,12 @@
         :row-selection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
         @change="handleTableChange"
       >
-
+        <template slot="deptName" slot-scope="text, record">
+          {{record['deptStations'][0].deptName || record['deptStations'][0].deptId }}
+        </template>
+        <template slot="lineName" slot-scope="text, record">
+          {{ record['deptStations'][0].lineName || record['deptStations'][0].lineId }}
+        </template>
         <span slot="action" slot-scope="text, record">
           <a-button size="small" type="primary" @click="handleEdit(record)">
             编辑

+ 8 - 6
src/views/basics/section/indexColumns.js

@@ -19,26 +19,28 @@ function columns(vm) {
       title: '车间',
       align: 'center',
       dataIndex: 'deptName',
+      scopedSlots: { customRender: 'deptName' },
       key: 'deptName'
     },
     {
       title: '线别',
       align: 'center',
       dataIndex: 'lineName',
+      scopedSlots: { customRender: 'lineName' },
       key: 'lineName'
     },
-    {
-      title: '行别',
-      align: 'center',
-      dataIndex: 'xingbieText',
-      key: 'xingbieText'
-    },
     {
       title: '区间/站场',
       align: 'center',
       dataIndex: 'stationType',
       key: 'stationType'
     },
+    {
+      title: '行别',
+      align: 'center',
+      dataIndex: 'xingbieText',
+      key: 'xingbieText'
+    },
     {
       title: '起始公里标',
       align: 'center',