Selaa lähdekoodia

车位管理修复

fangq 4 vuotta sitten
vanhempi
commit
50c4f4651c
1 muutettua tiedostoa jossa 29 lisäystä ja 23 poistoa
  1. 29 23
      src/views/estate/parkingspace.vue

+ 29 - 23
src/views/estate/parkingspace.vue

@@ -27,6 +27,10 @@
                    @click="handleDelete">删 除
         </el-button>
       </template>
+      <template slot="residentialId" slot-scope="scope">{{scope.row.residentialName}}</template>
+      <template slot="residentialIdForm" slot-scope="scope">
+        <select-dialog-residential :disabled="residentialDisabled" :id="form.residentialId" :name="form.residentialName" :callback="selectCallback"></select-dialog-residential>
+      </template>
     </avue-crud>
   </basic-container>
 </template>
@@ -35,8 +39,10 @@
   import {getList, getDetail, add, update, remove} from "@/api/estate/parkingspace";
   import {getList as getResidentialList} from "@/api/community/residential";
   import {mapGetters} from "vuex";
+  import SelectDialogResidential from "../../components/select-dialog/select-dialog-residential";
 
   export default {
+    components: {SelectDialogResidential},
     data() {
       return {
         form: {},
@@ -48,6 +54,7 @@
           total: 0
         },
         selectionList: [],
+        residentialDisabled: false,
         option: {
           height:'auto',
           calcHeight: 30,
@@ -134,38 +141,28 @@
                 trigger: "blur"
               }],
             },
-            {
-              label: "所属小区",
-              prop: "residentialName",
-              editDisplay: false,
-              addDisplay: false,
-              viewDisplay: false,
-            },
             {
               label: "所属小区",
               prop: "residentialId",
               type: "select",
-              search: true,
-              searchFilterable: true,
-              remote: true,
-              cascaderItem: ['parkingLotId'],
-              // dicUrl: "/api/cyzh-community/residential/list?agencyId={{key}}",
-              dicUrl: "/api/cyzh-community/residential/select?size=500&name={{key}}",
-              // dicFormatter:(res)=>{
-              //   return res.data.records;//返回字典的层级结构
-              // },
+              slot:true,
+              formslot:true,
+              // dicUrl: "/api/cyzh-community/residential/list?agencyId={{key}}&&size=9999",
+              dicUrl: "/api/cyzh-community/residential/list?size=500",
+              dicFormatter:(res)=>{
+                return res.data.records;//返回字典的层级结构
+              },
+              // dicFlag: false,
               filterable: true,
               props: {
                 label: "name",
                 value: "id"
               },
               rules: [{
-                required: true,
+                required: false,
                 message: "请选择所属小区",
                 trigger: "blur"
-              }],
-              hide: true,
-              // viewDisplay: false
+              }]
             },
             // {
             //   label: "机构路径",
@@ -183,7 +180,7 @@
               search: true,
               // dicFlag: false,
               // remote: true,
-              dicUrl: "/api/cyzh-estate/parkinglot/list?size=100&residentialId={{key}}",
+              dicUrl: "/api/cyzh-estate/parkinglot/list",
               props: {
                 label: 'parkName',
                 value: 'id'
@@ -249,14 +246,21 @@
       }
     },
     watch: {
-      "form.residentialId"() {
+      /*"form.residentialId"() {
         getResidentialList(1, 10, {id: this.form.residentialId}).then(res => {
           this.form.residentialName = res.data.data.records[0].name;
           JSON.stringify()
         })
-      }
+      }*/
     },
     methods: {
+      selectCallback(row){
+        this.form.residentialId = row.id;
+        this.form.residentialName = row.name;
+        if (this.option.column[5].prop == 'parkingLotId' && this.option.column[5].dicUrl.indexOf('residentialId') == -1){
+          this.option.column[5].dicUrl += '?residentialId=' + this.form.residentialId + '&size=100';
+        }
+      },
       rowSave(row, done, loading) {
         add(row).then(() => {
           this.onLoad(this.page);
@@ -323,7 +327,9 @@
           });
       },
       beforeOpen(done, type) {
+        this.residentialDisabled = false;
         if (["edit", "view"].includes(type)) {
+          this.residentialDisabled = type == "view";
           getDetail(this.form.id).then(res => {
             this.form = res.data.data;
           });