avue-crud表格编辑窗体表格选择器用法

在这里插入图片描述

{
                     label: "农户代码",
                     prop:  "nhdm",
                     maxlength: 22,
                     clearable: false,
                     disabled: false,
                     span: 12, 
                     type: 'table',
                     children:{
                         border:true,
                         viewBtn:true,
                         addBtn:true,
                         showHeader:true,
                         dialogDirection: 'rtl',
                         dialogType: 'drawer',
                         searchLabelWidth: 150,                         
                         column:[
                            {
                              label: "户主姓名",
                              prop:  "hzxm",
                              maxlength: 100,
                              display: false,
                              hide: false,
                              search: true,
                              sortable: true,
                              width:100,
                              fixed:false,
                              //type:'select',
                              //dicData: dict_hzxm, 
                           },
                           {
                              label: "户主证件号码",
                              prop:  "hzzjhm",
                              maxlength: 30,
                              display: false,
                              hide: false,
                              search: true,
                              sortable: true,
                              width:180,
                              fixed:false,
                              //type:'select',
                              //dicData: dict_hzzjhm, 
                           },
                           {
                              label: "农户代码",
                              prop:  "nhdm",
                              maxlength: 22,
                              display: false,
                              hide: false,
                              search: false,
                              sortable: true,
                              width:180,
                              fixed:false,
                              //type:'select',
                              //dicData: dict_nhdm, 
                           },
                           {
                              label: "通讯地址",
                              prop:  "txdz",
                              maxlength: 254,
                              display: false,
                              hide: false,
                              search: false,
                              sortable: true,
                              width:250,
                              fixed:false,
                              //type:'select',
                              //dicData: dict_txdz, 
                           },
                         ],
                     },
                     formatter:(row)=>{
                         this.form.suyqrdm=row.suyqrdm;
                         this.form.shyqrdbxm=row.hzxm;
                         this.form.shyqrdbzjlx=row.hzzjlx;
                         this.form.shyqrdbzjhm=row.hzzjhm;
                         this.form.dz=row.txdz;
                         //this.form.nhdm=row.nhdm;
                         return row.nhdm;
                     },
                     onLoad:({page,value,data},callback)=>{
                        if(value){
                           this.initSelectNh(value,function(row){
                               callback(row);
                           });                           
                        }
                        //alert('分页参数'+JSON.stringify(page));
                        //
                        this.initList_nh(page,data,function(pageData){
                            callback(pageData);
                        });
                        
                     },
                     //dicData:dict_nhdm
                     //append:'选择',
                     //appendClick:()=>{
                          //alert('select');
                          //this.showDialog_select_nh=true;
                     //},
                     mock:{
                         type: 'word',
                         min: 0,
                         max: 22,
                     },
                     rules: [
                        {
                            required: true,
                            message: '不能为空',
                            trigger: 'blur',
                        },
                     ],
                  },

//获取分页数据 需使用同步模式await才能初始化表格数据

//初始化弹出对话框农户列表
      async initList_nh(page,data,callback)
      {
         var that=this;
         //
         var hzxm="";
         var hzzjhm="";
         if(data && data.hzxm)
         {
            hzxm=data.hzxm;
         }
         if(data && data.hzzjhm)
         {
            hzzjhm=data.hzzjhm;
         }
         var pageSize=10;
         var currentPage=1;
         if(page)
         {
            pageSize=page.pageSize;
            currentPage=page.currentPage;
         }
         var suyqrdm=api.GetSubStr(that.zjddm,0,18);
         //
         var sql = "select * from d_nh where nhdm like '"+suyqrdm+"%'";
         sql+=" and hzxm like '%"+hzxm+"%'"; 
         sql+=" and hzzjhm like  '%"+hzzjhm+"%'"; 
         var t_data=await api.getDataPage_sql_tb(sql,pageSize,currentPage);   //需同步执行
               
         //分页查询信息
         callback({
            total:t_data.data.data.total,
            data:t_data.data.data.rows,
         });
               
      },
      async initSelectNh(value,callback)
      {
            var sql = "select * from d_nh where nhdm='"+value+"'";            
            var t_data=await api.getData_sql_tb(sql);
                  
            //分页查询信息
            callback(
               t_data.data.data[0]
            );
      },

完整.vue代码

<template>
  <el-container>
     <el-main>

        <avue-crud ref="crud" :option="option" v-model="form" :data.sync="tableData" 
                   :search.sync="search"
                   :page.sync="page"
                   :before-open="beforeOpen"
                   :before-close="beforeClose"
                   @search-change="searchChange"
                   @refresh-change="refreshChange"
                   @current-change="currentChange"
                   @row-save="rowSave"
                   @row-del="rowDel"
                   @row-update="rowUpdate"
        >
            <template slot="id" slot-scope="{ row,index}">
                  <el-button type="text" @click.stop="$refs.crud.rowView(row, index)">{{row.id}}</el-button>
            </template>
            <template  slot="menuLeft">
                 选择农户房屋:
                 <avue-select 
                        v-model="selected_nmfwdm" 
                        placeholder="请选择农户房屋" 
                        type="tree"            
                        style="width:300px;"
                        prepend="选择农户房屋:"
                        :clearable="false" 
                        :dic="list_nmfwdm">
                  </avue-select>   
            </template>
            <template slot="menuForm">
               <el-button size="small" @click.native="addNhdmClick" icon="el-icon-share">添加农户</el-button>
               
            </template>
            <!--<template slot-scope="scope" slot="menu">
            <el-button size="small" @click.native="shareClick" icon="el-icon-share"></el-button>
            </template>-->
        </avue-crud>

        <el-dialog title="选择农户" 
        :visible.sync="showDialog_select_nh" 
        dialogClickModal="false" 
        append-to-body
        style="70%"
        >             
             <selectNhView ref="selectNhView" :zjddm="zjddm" style="z-index:3000"></selectNhView>
         </el-dialog>

     </el-main>
  </el-container>
</template>
<script>
import  *   as api       from "@/api/ajax";
import  *   as build     from "@/api/build";
//import      pubSub       from "pubsub-js";
//
import  selectNhView  from "./select_nh.vue";

//
export default {
  name:"d_shyqr",
  props:{
      zjddm:String,
  },
  components: {  
     selectNhView,
  },
  data() {
      return {
           id:'',
           tableData: [],
           page: {
              pageSize: 20,
              currentPage: 1,
              total: 0,
              layout: 'total, pager, prev, next, jumper',
              background: false,
           },
           //====================
           selected_nmfwdm:'',
           list_nmfwdm:[],
           //====================           
           search:{
                //fieldname:'',
           },
           option: {
              card:false,              
              //title:'d_shyqr',
              //titleSize:'h3',
              //titleStyle:{ color: 'red'},
              searchMenuSpan:6,
              searchShow:true,
              searchLabelWidth: 150,
              border: true,
              dialogClickModal:false,
              stripe:false,
              showHeader:true,
              dialogDirection: 'rtl',
              dialogType: 'drawer',
              index: false,
              selection:false,
              align:'center',
              menuType:'icon',
              menuAlign:'center',
              size: 'small',
              height: '100%',
              dateBtn:false,
              dateDefault: false,
              excelBtn: false,
              viewBtn:true,
              addBtn:true,
              editBtn:true,
              delBtn:false,
              filterBtn:false,
              detail: false,
              labelWidth: 190,
              submitText: '保存',
              //mockBtn:false,
              //printBtn:false,
              submitBtn: true,
              emptyBtn: false,
              column: [                  
                  {
                     label: "宅基地代码",
                     prop:  "zjddm",
                     maxlength: 23,
                     display: false,
                     hide: false,
                     search: false,
                     sortable: true,
                     width:100,
                     fixed:false,
                     //type:'select',
                     //dicData: dict_zjddm, 
                  },
                  {
                     label: "农民房屋代码",
                     prop:  "nmfwdm",
                     maxlength: 32,
                     display: false,
                     hide: false,
                     search: false,
                     sortable: true,
                     width:100,
                     fixed:false,
                     //type:'select',
                     //dicData: dict_nmfwdm, 
                  },
                  {
                     label: "使用权人代码",
                     prop:  "shyqrdm",
                     maxlength: 28,
                     display: false,
                     hide: false,
                     search: false,
                     sortable: true,
                     width:100,
                     fixed:false,
                     //type:'select',
                     //dicData: dict_shyqrdm, 
                  },
                  {
                     label: "使用权人代表姓名",
                     prop:  "shyqrdbxm",
                     maxlength: 100,
                     display: false,
                     hide: false,
                     search: false,
                     sortable: true,
                     width:100,
                     fixed:false,
                     //type:'select',
                     //dicData: dict_shyqrdbxm, 
                  },
                  {
                     label: "使用权人代表证件类型",
                     prop:  "shyqrdbzjlx",
                     maxlength: 2,
                     display: false,
                     hide: false,
                     search: false,
                     sortable: true,
                     width:100,
                     fixed:false,
                     //type:'select',
                     //dicData: dict_shyqrdbzjlx, 
                  },
                  {
                     label: "使用权人代表证件号码",
                     prop:  "shyqrdbzjhm",
                     maxlength: 30,
                     display: false,
                     hide: false,
                     search: false,
                     sortable: true,
                     width:100,
                     fixed:false,
                     //type:'select',
                     //dicData: dict_shyqrdbzjhm, 
                  },
                  {
                     label: "不动产单元号",
                     prop:  "bdcdyh",
                     maxlength: 28,
                     display: false,
                     hide: true,
                     search: false,
                     sortable: true,
                     width:100,
                     fixed:false,
                     //type:'select',
                     //dicData: dict_bdcdyh, 
                  },
                  {
                     label: "不动产权证号",
                     prop:  "bdcqzh",
                     maxlength: 50,
                     display: false,
                     hide: true,
                     search: false,
                     sortable: true,
                     width:100,
                     fixed:false,
                     //type:'select',
                     //dicData: dict_bdcqzh, 
                  },
                  {
                     label: "权证印刷序列号",
                     prop:  "qzysxlh",
                     maxlength: 100,
                     display: false,
                     hide: true,
                     search: false,
                     sortable: true,
                     width:100,
                     fixed:false,
                     //type:'select',
                     //dicData: dict_qzysxlh, 
                  },
                  {
                     label: "发证机关",
                     prop:  "fzjg",
                     maxlength: 254,
                     display: false,
                     hide: true,
                     search: false,
                     sortable: true,
                     width:100,
                     fixed:false,
                     //type:'select',
                     //dicData: dict_fzjg, 
                  },
                  {
                     label: "所属行业",
                     prop:  "sshy",
                     maxlength: 6,
                     display: false,
                     hide: true,
                     search: false,
                     sortable: true,
                     width:100,
                     fixed:false,
                     //type:'select',
                     //dicData: dict_sshy, 
                  },
                  {
                     label: "国家地区",
                     prop:  "gj",
                     maxlength: 6,
                     display: false,
                     hide: false,
                     search: false,
                     sortable: true,
                     width:100,
                     fixed:false,
                     //type:'select',
                     //dicData: dict_gj, 
                  },
                  {
                     label: "户籍所在省市",
                     prop:  "hjszss",
                     maxlength: 6,
                     display: false,
                     hide: true,
                     search: false,
                     sortable: true,
                     width:100,
                     fixed:false,
                     //type:'select',
                     //dicData: dict_hjszss, 
                  },
                  {
                     label: "性别",
                     prop:  "xb",
                     maxlength: 1,
                     display: false,
                     hide: true,
                     search: false,
                     sortable: true,
                     width:100,
                     fixed:false,
                     //type:'select',
                     //dicData: dict_xb, 
                  },
                  {
                     label: "电话",
                     prop:  "dh",
                     maxlength: 20,
                     display: false,
                     hide: false,
                     search: false,
                     sortable: true,
                     width:100,
                     fixed:false,
                     //type:'select',
                     //dicData: dict_dh, 
                  },
                  {
                     label: "地址",
                     prop:  "dz",
                     maxlength: 200,
                     display: false,
                     hide: false,
                     search: false,
                     sortable: true,
                     width:200,
                     fixed:false,
                     //type:'select',
                     //dicData: dict_dz, 
                  },
                  {
                     label: "是否使用权人之间共有",
                     prop:  "sfsyqrzjgy",
                     maxlength: 1,
                     display: false,
                     hide: false,
                     search: false,
                     sortable: true,
                     width:100,
                     fixed:false,
                     //type:'select',
                     //dicData: dict_sfsyqrzjgy, 
                  },
                  {
                     label: "分摊宗地面积",
                     prop:  "ftzdmj",
                     maxlength: 15,
                     display: false,
                     hide: true,
                     search: false,
                     sortable: true,
                     width:100,
                     fixed:false,
                     //type:'select',
                     //dicData: dict_ftzdmj, 
                  },
                  {
                     label: "权利人类型",
                     prop:  "qlrlx",
                     maxlength: 2,
                     display: false,
                     hide: true,
                     search: false,
                     sortable: true,
                     width:100,
                     fixed:false,
                     //type:'select',
                     //dicData: dict_qlrlx, 
                  },
                  {
                     label: "是否本农村集体经济组织成员",
                     prop:  "sfbncjtjjzzcy",
                     maxlength: 1,
                     display: false,
                     hide: true,
                     search: false,
                     sortable: true,
                     width:100,
                     fixed:false,
                     //type:'select',
                     //dicData: dict_sfbncjtjjzzcy, 
                  },
                  {
                     label: "所有权人代码",
                     prop:  "suyqrdm",
                     maxlength: 18,
                     display: false,
                     hide: true,
                     search: false,
                     sortable: true,
                     width:100,
                     fixed:false,
                     //type:'select',
                     //dicData: dict_suyqrdm, 
                  },
                  {
                     label: "农户代码",
                     prop:  "nhdm",
                     maxlength: 22,
                     display: false,
                     hide: false,
                     search: false,
                     sortable: true,
                     width:100,
                     fixed:false,
                     //type:'select',
                     //dicData: dict_nhdm, 
                  },
                  {
                     label: "户口类型",
                     prop:  "hklx",
                     maxlength: 2,
                     display: false,
                     hide: true,
                     search: false,
                     sortable: true,
                     width:100,
                     fixed:false,
                     //type:'select',
                     //dicData: dict_hklx, 
                  },
                  {
                     label: "备注",
                     prop:  "bz",
                     maxlength: 254,
                     display: false,
                     hide: true,
                     search: false,
                     sortable: true,
                     width:100,
                     fixed:false,
                     //type:'select',
                     //dicData: dict_bz, 
                  },
                  {
                     label: "业务流水号",
                     prop:  "ywlsh",
                     maxlength: 50,
                     display: false,
                     hide: true,
                     search: false,
                     sortable: true,
                     width:100,
                     fixed:false,
                     //type:'select',
                     //dicData: dict_ywlsh, 
                  },
                  {
                     label: "创建时间",
                     prop:  "cjsj",
                     maxlength: 8,
                     display: false,
                     hide: true,
                     search: false,
                     sortable: true,
                     width:100,
                     fixed:false,
                     //type:'select',
                     //dicData: dict_cjsj, 
                  },
                  {
                     label: "是否删除",
                     prop:  "is_del",
                     maxlength: 1,
                     display: false,
                     hide: true,
                     search: false,
                     sortable: true,
                     width:100,
                     fixed:false,
                     //type:'select',
                     //dicData: dict_is_del, 
                  },
                  {
                     label: "更新时间",
                     prop:  "update_time",
                     maxlength: 8,
                     display: false,
                     hide: true,
                     search: false,
                     sortable: true,
                     width:100,
                     fixed:false,
                     //type:'select',
                     //dicData: dict_update_time, 
                  },
                  {
                     label: "删除原因",
                     prop:  "del_yy",
                     maxlength: 255,
                     display: false,
                     hide: true,
                     search: false,
                     sortable: true,
                     width:100,
                     fixed:false,
                     //type:'select',
                     //dicData: dict_del_yy, 
                  },
                  {
                     label: "id",
                     prop:  "id",
                     maxlength: 32,
                     display: false,
                     hide: true,
                     search: false,
                     sortable: true,
                     width:100,
                     fixed:false,
                     //type:'select',
                     //dicData: dict_id, 
                  },
                  {
                     label: "要素代码",
                     prop:  "ysdm",
                     maxlength: 6,
                     display: false,
                     hide: true,
                     search: false,
                     sortable: true,
                     width:100,
                     fixed:false,
                     //type:'select',
                     //dicData: dict_ysdm, 
                  },
              ],
              group: [
              {
                  label: '使用权人信息',
                  collapse:true,
                  arrow:false,
                  prop: 'd_shyqr',
                  icon: 'el-icon-edit-outline',
                  column: [                  
                  {
                     label: "宅基地代码",
                     prop:  "zjddm",
                     maxlength: 23,
                     clearable: false,
                     disabled: true,
                     span: 12, 
                     type: 'input',
                     //dicData:dict_zjddm
                     //append:'生成',
                     //appendClick:()=>{
                     //},
                     mock:{
                         type: 'word',
                         min: 0,
                         max: 23,
                     },
                     rules: [
                        {
                            required: true,
                            message: '不能为空',
                            trigger: 'blur',
                        },
                     ],
                  },
                  {
                     label: "农民房屋代码",
                     prop:  "nmfwdm",
                     maxlength: 32,
                     clearable: false,
                     disabled: true,
                     span: 12, 
                     type: 'input',
                     //dicData:dict_nmfwdm
                     //append:'生成',
                     //appendClick:()=>{
                     //},
                     mock:{
                         type: 'word',
                         min: 0,
                         max: 32,
                     },
                     rules: [
                        {
                            required: false,
                            message: '不能为空',
                            trigger: 'blur',
                        },
                     ],
                  },
                  {
                     label: "农户代码",
                     prop:  "nhdm",
                     maxlength: 22,
                     clearable: false,
                     disabled: false,
                     span: 12, 
                     type: 'table',
                     children:{
                         border:true,
                         viewBtn:true,
                         addBtn:true,
                         showHeader:true,
                         dialogDirection: 'rtl',
                         dialogType: 'drawer',
                         searchLabelWidth: 150,                         
                         column:[
                            {
                              label: "户主姓名",
                              prop:  "hzxm",
                              maxlength: 100,
                              display: false,
                              hide: false,
                              search: true,
                              sortable: true,
                              width:100,
                              fixed:false,
                              //type:'select',
                              //dicData: dict_hzxm, 
                           },
                           {
                              label: "户主证件号码",
                              prop:  "hzzjhm",
                              maxlength: 30,
                              display: false,
                              hide: false,
                              search: true,
                              sortable: true,
                              width:180,
                              fixed:false,
                              //type:'select',
                              //dicData: dict_hzzjhm, 
                           },
                           {
                              label: "农户代码",
                              prop:  "nhdm",
                              maxlength: 22,
                              display: false,
                              hide: false,
                              search: false,
                              sortable: true,
                              width:180,
                              fixed:false,
                              //type:'select',
                              //dicData: dict_nhdm, 
                           },
                           {
                              label: "通讯地址",
                              prop:  "txdz",
                              maxlength: 254,
                              display: false,
                              hide: false,
                              search: false,
                              sortable: true,
                              width:250,
                              fixed:false,
                              //type:'select',
                              //dicData: dict_txdz, 
                           },
                         ],
                     },
                     formatter:(row)=>{
                         this.form.suyqrdm=row.suyqrdm;
                         this.form.shyqrdbxm=row.hzxm;
                         this.form.shyqrdbzjlx=row.hzzjlx;
                         this.form.shyqrdbzjhm=row.hzzjhm;
                         this.form.dz=row.txdz;
                         //this.form.nhdm=row.nhdm;
                         return row.nhdm;
                     },
                     onLoad:({page,value,data},callback)=>{
                        if(value){
                           this.initSelectNh(value,function(row){
                               callback(row);
                           });                           
                        }
                        //alert('分页参数'+JSON.stringify(page));
                        //
                        this.initList_nh(page,data,function(pageData){
                            callback(pageData);
                        });
                        
                     },
                     //dicData:dict_nhdm
                     //append:'选择',
                     //appendClick:()=>{
                          //alert('select');
                          //this.showDialog_select_nh=true;
                     //},
                     mock:{
                         type: 'word',
                         min: 0,
                         max: 22,
                     },
                     rules: [
                        {
                            required: true,
                            message: '不能为空',
                            trigger: 'blur',
                        },
                     ],
                  },
                  {
                     label: "使用权人代码",
                     prop:  "shyqrdm",
                     maxlength: 28,
                     clearable: false,
                     disabled: true,
                     span: 12, 
                     type: 'input',
                     //dicData:dict_shyqrdm
                     //append:'生成',
                     //appendClick:()=>{
                     //},
                     mock:{
                         type: 'word',
                         min: 0,
                         max: 28,
                     },
                     rules: [
                        {
                            required: false,
                            message: '不能为空',
                            trigger: 'blur',
                        },
                     ],
                  },
                  {
                     label: "使用权人代表姓名",
                     prop:  "shyqrdbxm",
                     maxlength: 100,
                     clearable: false,
                     disabled: false,
                     span: 12, 
                     type: 'input',
                     //dicData:dict_shyqrdbxm
                     //append:'生成',
                     //appendClick:()=>{
                     //},
                     mock:{
                         type: 'word',
                         min: 0,
                         max: 100,
                     },
                     rules: [
                        {
                            required: true,
                            message: '不能为空',
                            trigger: 'blur',
                        },
                     ],
                  },
                  {
                     label: "使用权人代表证件类型",
                     prop:  "shyqrdbzjlx",
                     maxlength: 2,
                     clearable: false,
                     disabled: false,
                     span: 12, 
                     type: 'select',
                     dicData:dicts_zt.ZJLX,//dict_ZJLX,
                     //append:'生成',
                     //appendClick:()=>{
                     //},
                     mock:{
                         type: 'word',
                         min: 0,
                         max: 2,
                     },
                     rules: [
                        {
                            required: true,
                            message: '不能为空',
                            trigger: 'blur',
                        },
                     ],
                  },
                  {
                     label: "使用权人代表证件号码",
                     prop:  "shyqrdbzjhm",
                     maxlength: 30,
                     clearable: false,
                     disabled: false,
                     span: 12, 
                     type: 'input',
                     //dicData:dict_shyqrdbzjhm
                     //append:'生成',
                     //appendClick:()=>{
                     //},
                     mock:{
                         type: 'word',
                         min: 0,
                         max: 30,
                     },
                     rules: [
                        {
                            required: true,
                            message: '不能为空',
                            trigger: 'blur',
                        },
                     ],
                  },
                  {
                     label: "权利人类型",
                     prop:  "qlrlx",
                     maxlength: 2,
                     clearable: false,
                     disabled: false,
                     span: 12, 
                     type: 'select',
                     dicData:dicts_zt.QLRLX,//dict_qlrlx
                     //append:'生成',
                     //appendClick:()=>{
                     //},
                     mock:{
                         type: 'word',
                         min: 0,
                         max: 2,
                     },
                     rules: [
                        {
                            required: true,
                            message: '不能为空',
                            trigger: 'blur',
                        },
                     ],
                  },
                  {
                     label: "是否使用权人之间共有",
                     prop:  "sfsyqrzjgy",
                     maxlength: 1,
                     clearable: false,
                     disabled: false,
                     span: 12, 
                     type: 'select',
                     dicData:dicts_zt.SF,//dict_SF,
                     //append:'生成',
                     //appendClick:()=>{
                     //},
                     mock:{
                         type: 'word',
                         min: 0,
                         max: 1,
                     },
                     rules: [
                        {
                            required: true,
                            message: '不能为空',
                            trigger: 'blur',
                        },
                     ],
                  },
                  {
                     label: "分摊宗地面积",
                     prop:  "ftzdmj",
                     maxlength: 15,
                     clearable: false,
                     disabled: false,
                     span: 12, 
                     type: 'input',
                     precision: 2,
                     append:'平方米',
                     rules: [
                        {
                            required: false,
                            message: '不能为空',
                            trigger: 'blur',
                        },
                     ],
                  },
                  
                  {
                     label: "国家地区",
                     prop:  "gj",
                     maxlength: 6,
                     clearable: false,
                     disabled: false,
                     span: 12, 
                     type: 'select',
                     dicData:dicts_zt.GJHDQ,//dict_GJHDQ,
                     //append:'生成',
                     //appendClick:()=>{
                     //},
                     mock:{
                         type: 'word',
                         min: 0,
                         max: 6,
                     },
                     rules: [
                        {
                            required: true,
                            message: '不能为空',
                            trigger: 'blur',
                        },
                     ],
                  },
                  {
                     label: "所属行业",
                     prop:  "sshy",
                     maxlength: 6,
                     clearable: false,
                     disabled: false,
                     span: 12, 
                     type: 'select',
                     dicData:dicts_zt.SSHY,//dict_SSHY,
                     //append:'生成',
                     //appendClick:()=>{
                     //},
                     mock:{
                         type: 'word',
                         min: 0,
                         max: 6,
                     },
                     rules: [
                        {
                            required: false,
                            message: '不能为空',
                            trigger: 'blur',
                        },
                     ],
                  },
                  {
                     label: "户籍所在省市",
                     prop:  "hjszss",
                     maxlength: 6,
                     clearable: false,
                     disabled: false,
                     span: 12, 
                     type: 'select',
                     dicData:dicts_zt.SSZD,//dict_SSZD,
                     //append:'生成',
                     //appendClick:()=>{
                     //},
                     mock:{
                         type: 'word',
                         min: 0,
                         max: 6,
                     },
                     rules: [
                        {
                            required: false,
                            message: '不能为空',
                            trigger: 'blur',
                        },
                     ],
                  },
                  {
                     label: "性别",
                     prop:  "xb",
                     maxlength: 1,
                     clearable: false,
                     disabled: false,
                     span: 12, 
                     type: 'select',
                     dicData:dicts_zt.XB,//dict_xb
                     //append:'生成',
                     //appendClick:()=>{
                     //},
                     mock:{
                         type: 'word',
                         min: 0,
                         max: 1,
                     },
                     rules: [
                        {
                            required: false,
                            message: '不能为空',
                            trigger: 'blur',
                        },
                     ],
                  },
                  {
                     label: "电话",
                     prop:  "dh",
                     maxlength: 20,
                     clearable: false,
                     disabled: false,
                     span: 12, 
                     type: 'input',
                     //dicData:dict_dh
                     //append:'生成',
                     //appendClick:()=>{
                     //},
                     mock:{
                         type: 'word',
                         min: 0,
                         max: 20,
                     },
                     rules: [
                        {
                            required: false,
                            message: '不能为空',
                            trigger: 'blur',
                        },
                     ],
                  },
                  {
                     label: "地址",
                     prop:  "dz",
                     maxlength: 200,
                     clearable: false,
                     disabled: false,
                     span: 12, 
                     type: 'input',
                     //dicData:dict_dz
                     //append:'生成',
                     //appendClick:()=>{
                     //},
                     mock:{
                         type: 'word',
                         min: 0,
                         max: 200,
                     },
                     rules: [
                        {
                            required: false,
                            message: '不能为空',
                            trigger: 'blur',
                        },
                     ],
                  },                                    
                  {
                     label: "是否本村集体经济组织成员",
                     prop:  "sfbncjtjjzzcy",
                     maxlength: 1,
                     clearable: false,
                     disabled: false,
                     span: 12, 
                     type: 'select',
                     dicData:dicts_zt.SF,//dict_SF,
                     //append:'生成',
                     //appendClick:()=>{
                     //},
                     mock:{
                         type: 'word',
                         min: 0,
                         max: 1,
                     },
                     rules: [
                        {
                            required: false,
                            message: '不能为空',
                            trigger: 'blur',
                        },
                     ],
                  },
                  {
                     label: "所有权人代码",
                     prop:  "suyqrdm",
                     maxlength: 18,
                     clearable: false,
                     disabled: false,
                     span: 12, 
                     type: 'input',
                     //dicData:dict_suyqrdm
                     //append:'生成',
                     //appendClick:()=>{
                     //},
                     mock:{
                         type: 'word',
                         min: 0,
                         max: 18,
                     },
                     rules: [
                        {
                            required: false,
                            message: '不能为空',
                            trigger: 'blur',
                        },
                     ],
                  },
                  
                  {
                     label: "户口类型",
                     prop:  "hklx",
                     maxlength: 2,
                     clearable: false,
                     disabled: false,
                     span: 12, 
                     type: 'select',
                     dicData:dicts_zt.HKLX,//dict_hklx
                     //append:'生成',
                     //appendClick:()=>{
                     //},
                     mock:{
                         type: 'word',
                         min: 0,
                         max: 2,
                     },
                     rules: [
                        {
                            required: false,
                            message: '不能为空',
                            trigger: 'blur',
                        },
                     ],
                  },
                  {
                     label: "备注",
                     prop:  "bz",
                     maxlength: 254,
                     clearable: false,
                     disabled: false,
                     span: 12, 
                     type: 'input',
                     //dicData:dict_bz
                     //append:'生成',
                     //appendClick:()=>{
                     //},
                     mock:{
                         type: 'word',
                         min: 0,
                         max: 254,
                     },
                     rules: [
                        {
                            required: false,
                            message: '不能为空',
                            trigger: 'blur',
                        },
                     ],
                  },
                  
                  {
                     label: "要素代码",
                     prop:  "ysdm",
                     maxlength: 6,
                     clearable: false,
                     disabled: true,
                     span: 12, 
                     type: 'input',
                     //dicData:dict_ysdm
                     //append:'生成',
                     //appendClick:()=>{
                     //},
                     mock:{
                         type: 'word',
                         min: 0,
                         max: 6,
                     },
                     rules: [
                        {
                            required: false,
                            message: '不能为空',
                            trigger: 'blur',
                        },
                     ],
                  },
                  ],
               },
              {
                  label: '发证信息',
                  collapse:true,
                  arrow:false,
                  prop: 'd_shyqr_fz_info',
                  icon: 'el-icon-edit-outline',
                  column: [
                      {
                     label: "不动产单元号",
                     prop:  "bdcdyh",
                     maxlength: 28,
                     clearable: false,
                     disabled: false,
                     span: 12, 
                     type: 'input',
                     //dicData:dict_bdcdyh
                     //append:'生成',
                     //appendClick:()=>{
                     //},
                     mock:{
                         type: 'word',
                         min: 0,
                         max: 28,
                     },
                     rules: [
                        {
                            required: false,
                            message: '不能为空',
                            trigger: 'blur',
                        },
                     ],
                  },
                  {
                     label: "不动产权证号",
                     prop:  "bdcqzh",
                     maxlength: 50,
                     clearable: false,
                     disabled: false,
                     span: 12, 
                     type: 'input',
                     //dicData:dict_bdcqzh
                     //append:'生成',
                     //appendClick:()=>{
                     //},
                     mock:{
                         type: 'word',
                         min: 0,
                         max: 50,
                     },
                     rules: [
                        {
                            required: false,
                            message: '不能为空',
                            trigger: 'blur',
                        },
                     ],
                  },
                  {
                     label: "权证印刷序列号",
                     prop:  "qzysxlh",
                     maxlength: 100,
                     clearable: false,
                     disabled: false,
                     span: 12, 
                     type: 'input',
                     //dicData:dict_qzysxlh
                     //append:'生成',
                     //appendClick:()=>{
                     //},
                     mock:{
                         type: 'word',
                         min: 0,
                         max: 100,
                     },
                     rules: [
                        {
                            required: false,
                            message: '不能为空',
                            trigger: 'blur',
                        },
                     ],
                  },
                  {
                     label: "发证机关",
                     prop:  "fzjg",
                     maxlength: 254,
                     clearable: false,
                     disabled: false,
                     span: 12, 
                     type: 'input',
                     //dicData:dict_fzjg
                     //append:'生成',
                     //appendClick:()=>{
                     //},
                     mock:{
                         type: 'word',
                         min: 0,
                         max: 254,
                     },
                     rules: [
                        {
                            required: false,
                            message: '不能为空',
                            trigger: 'blur',
                        },
                     ],
                  },
                  ],
               },
               {
                  label: '附加信息',
                  collapse:true,
                  arrow:false,
                  prop: 'd_shyqr_fj_info',
                  icon: 'el-icon-edit-outline',
                  column: [
                     {
                        label: "业务流水号",
                        prop:  "ywlsh",
                        maxlength: 50,
                        clearable: false,
                        disabled: true,
                        span: 12, 
                        type: 'input',
                        //dicData:dict_ywlsh
                        //append:'生成',
                        //appendClick:()=>{
                        //},
                        mock:{
                           type: 'word',
                           min: 0,
                           max: 50,
                        },
                        rules: [
                           {
                              required: false,
                              message: '不能为空',
                              trigger: 'blur',
                           },
                        ],
                     },
                     {
                        label: "创建时间",
                        prop:  "cjsj",
                        maxlength: 8,
                        clearable: false,
                        disabled: false,
                        span: 12, 
                        type: 'datetime',
                        format:'yyyy-MM-dd hh:mm:ss',
                        valueFormat:'yyyy-MM-dd hh:mm:ss',
                        mock:{
                           type:'datetime',
                           format:'yyyy-MM-dd hh:mm:ss',
                           now:true,
                        },
                        rules: [
                           {
                              required: false,
                              message: '不能为空',
                              trigger: 'blur',
                           },
                        ],
                     },
                     {
                        label: "是否删除",
                        prop:  "is_del",
                        maxlength: 1,
                        clearable: false,
                        disabled: false,
                        span: 12, 
                        type: 'select',
                        dicData:dicts_zt.SF,//dict_SF,
                        //append:'生成',
                        //appendClick:()=>{
                        //},
                        mock:{
                           type: 'word',
                           min: 0,
                           max: 1,
                        },
                        rules: [
                           {
                              required: false,
                              message: '不能为空',
                              trigger: 'blur',
                           },
                        ],
                     },
                     {
                        label: "更新时间",
                        prop:  "update_time",
                        maxlength: 8,
                        clearable: false,
                        disabled: false,
                        span: 12, 
                        type: 'datetime',
                        format:'yyyy-MM-dd hh:mm:ss',
                        valueFormat:'yyyy-MM-dd hh:mm:ss',
                        mock:{
                           type:'datetime',
                           format:'yyyy-MM-dd hh:mm:ss',
                           now:true,
                        },
                        rules: [
                           {
                              required: false,
                              message: '不能为空',
                              trigger: 'blur',
                           },
                        ],
                     },
                     {
                        label: "删除原因",
                        prop:  "del_yy",
                        maxlength: 255,
                        clearable: false,
                        disabled: false,
                        span: 12, 
                        type: 'input',
                        //dicData:dict_del_yy
                        //append:'生成',
                        //appendClick:()=>{
                        //},
                        mock:{
                           type: 'word',
                           min: 0,
                           max: 255,
                        },
                        rules: [
                           {
                              required: false,
                              message: '不能为空',
                              trigger: 'blur',
                           },
                        ],
                     },
                     {
                        label: "编号",
                        prop:  "id",
                        maxlength: 32,
                        clearable: false,
                        disabled: true,
                        span: 12, 
                        type: 'number',
                        precision: 0,
                        rules: [
                           {
                              required: false,
                              message: '不能为空',
                              trigger: 'blur',
                           },
                        ],
                     },
                  ]
               },
              ],
         },
         form: {
            id: 0, 
            ysdm: "", 
            zjddm: "", 
            nmfwdm: "", 
            shyqrdm: "", 
            shyqrdbxm: "", 
            shyqrdbzjlx: "", 
            shyqrdbzjhm: "", 
            bdcdyh: "", 
            bdcqzh: "", 
            qzysxlh: "", 
            fzjg: "", 
            sshy: "", 
            gj: "", 
            hjszss: "", 
            xb: "", 
            dh: "", 
            dz: "", 
            sfsyqrzjgy: "", 
            ftzdmj: null, 
            qlrlx: "", 
            sfbncjtjjzzcy: "", 
            suyqrdm: "", 
            nhdm: "", 
            hklx: "", 
            bz: "", 
            ywlsh: "", 
            cjsj: null, 
            is_del: "", 
            update_time: null, 
            del_yy: "", 
         },
         showDialog_select_nh:false,
      }
  },
  methods: 
  {   
      goBack() {
          this.$router.go(-1);
      },
      init() {
           var that = this;
           //
           that.initListNmfwdm();
           //
           that.initTablePage();
           //
           that.$refs.crud.columnInit();
      },
      initTablePage()
      {
            var that = this;
            //
            var sql = "select * from d_shyqr where id =" + that.id ;
            //sql+=" and col like '%%'" 
            api.getDataPage_sql(sql,this.page.pageSize,this.page.currentPage, function (r) {
                if (r.success && r.data && r.data.length > 0) {
                    that.tableData = r.data.rows;
                    that.page.total = r.data.total;
                }
            });
      },
      //
      initForm(){
         var that=this;
         //
         that.init();
         //
      },
      //初始化当前宅基地代码对应的农民房屋代码列表
      initListNmfwdm(){
          var that=this;
          //
          that.list_nmfwdm=[];
          that.selected_nmfwdm='';
          //
          var sql="select nmfwdm from d_nmfw where zjddm='"+that.zjddm+"'";
          api.getData_sql(sql,function(r){
              if(r.success && r.data && r.data.length>0)
              {
                  for(var i=0;i<r.data.length;i++)
                  {
                     var row=r.data[i];
                     that.list_nmfwdm.push({value:row.nmfwdm,label:row.nmfwdm});
                     if(i==0)
                     {
                         that.selected_nmfwdm=row.nmfwdm;
                     }
                  }
                  
              }
          });
      },
      //初始化弹出对话框农户列表
      async initList_nh(page,data,callback)
      {
         var that=this;
         //
         var hzxm="";
         var hzzjhm="";
         if(data && data.hzxm)
         {
            hzxm=data.hzxm;
         }
         if(data && data.hzzjhm)
         {
            hzzjhm=data.hzzjhm;
         }
         var pageSize=10;
         var currentPage=1;
         if(page)
         {
            pageSize=page.pageSize;
            currentPage=page.currentPage;
         }
         var suyqrdm=api.GetSubStr(that.zjddm,0,18);
         //
         var sql = "select * from d_nh where nhdm like '"+suyqrdm+"%'";
         sql+=" and hzxm like '%"+hzxm+"%'"; 
         sql+=" and hzzjhm like  '%"+hzzjhm+"%'"; 
         var t_data=await api.getDataPage_sql_tb(sql,pageSize,currentPage);   //需同步执行
               
         //分页查询信息
         callback({
            total:t_data.data.data.total,
            data:t_data.data.data.rows,
         });
               
      },
      async initSelectNh(value,callback)
      {
            var sql = "select * from d_nh where nhdm='"+value+"'";            
            var t_data=await api.getData_sql_tb(sql);
                  
            //分页查询信息
            callback(
               t_data.data.data[0]
            );
      },
      addNhdmClick(){
         var that=this;
         //
         that.showDialog_select_nh=true;
      },
      shareClick(){
      },
      searchChange(params, done) {
           done();
           this.$message.success(JSON.stringify(params));
      },
      refreshChange(val) {
           this.init();
      },
      currentChange(val) {
           this.page.currentPage = val
           this.init();
      },
      beforeOpen(done,type){
           var that=this;
            //            
            that.form.zjddm=that.zjddm;
            that.form.nmfwdm=that.selected_nmfwdm;
            that.form.ysdm="221040";
            that.form.shyqrdbzjlx="01";    //身份证=01
            that.form.sfsyqrzjgy='0';      //是否
            that.form.sfbncjtjjzzcy='0';   //是否
            that.form.gj="156";            //中国=156
            that.form.qlrlx="10";          //个人=10
            that.form.hjszss="510000";     //户籍所在省市 四川=510000
            that.form.sshy="K";            //房地产业=K
            that.form.xb="1";              //男性=1
            that.form.hklx="01";           //农业户口=01
            that.form.is_del="0";          //是否删除
            //that.form.sjly='08';         //宅基地专项调查=08
            //
            var t_xzqdm=that.$store.getters.currentXZQ.data.code;
            api.getXzqNameFull(t_xzqdm,function(fullName){                 
                 that.form.dz=fullName;
            });
            var sql="select nmfwmj from d_nmfw where nmfwdm='"+that.selected_nmfwdm+"'";  
            api.getData_sql(sql,function(r){
                    
                    if(r.success && r.data && r.data.length>0)
                    {
                        var nmfwmj=r.data[0].nmfwmj; 
                        that.form.ftzdmj=nmfwmj;                       
                    }
                    else
                    {
                        sql="select zdmj from dg_zjdzd where zjddm='"+that.zjddm+"'";
                        api.getData_sql(sql,function(rr){
                              var zdmj=0;
                              if(rr.success && rr.data && rr.data.length>0)
                              {
                                    zdmj=rr.data[0].zdmj;                        
                              }
                              that.form.ftzdmj=zdmj;
                        });

                    }
            }); 
            done();
      },
      beforeClose(done,type){
           done();
      },
      rowSave(form, done, loading) {
           //新增 save form值
           loading();
           this.form=form;
           this.save();
           setTimeout(()=>{done(form);},2000);
      },
      rowDel(form, index) {
           //删除 form值
           var that = this;
           api.confirm("删除【" + form.id + "】的所有权人, 是否继续?",function(){
               var c = new build.buildDelete();
               c.delete("d_shyqr").where("id", form.id).execute(function(r){
                   that.initTablePage();
               });
           },null);
      },
      rowUpdate(form, index, done, loading) {
           //修改 save form值
           this.form=form;
           this.save();
           setTimeout(()=>{done(form);},2000);
      },
      //保存功能
      save() {
        var that = this;
        //
        if (!that.form.ysdm || that.form.ysdm.length <= 0) {
             that.$message('要素代码不能为空');
             return;
        }
        if (!that.form.zjddm || that.form.zjddm.length <= 0) {
             that.$message('宅基地代码不能为空');
             return;
        }        
        if (!that.form.shyqrdm || that.form.shyqrdm.length <= 0) {
             that.$message('使用权人代码不能为空');
             return;
        }
        if (!that.form.shyqrdbxm || that.form.shyqrdbxm.length <= 0) {
             that.$message('使用权人代表姓名不能为空');
             return;
        }
        if (!that.form.shyqrdbzjlx || that.form.shyqrdbzjlx.length <= 0) {
             that.$message('使用权人代表证件类型不能为空');
             return;
        }
        if (!that.form.shyqrdbzjhm || that.form.shyqrdbzjhm.length <= 0) {
             that.$message('使用权人代表证件号码不能为空');
             return;
        }       
        if (!that.form.gj || that.form.gj.length <= 0) {
             that.$message('国家地区不能为空');
             return;
        }
        
        if (!that.form.sfsyqrzjgy || that.form.sfsyqrzjgy.length <= 0) {
             that.$message('是否使用权人之间共有不能为空');
             return;
        }        
        if (!that.form.qlrlx || that.form.qlrlx.length <= 0) {
             that.$message('权利人类型不能为空');
             return;
        }
        if (!that.form.sfbncjtjjzzcy || that.form.sfbncjtjjzzcy.length <= 0) {
             that.$message('是否本农村集体经济组织成员不能为空');
             return;
        }        
        if (!that.form.nhdm || that.form.nhdm.length <= 0) {
             that.$message('农户代码不能为空');
             return;
        }
        //
        if(that.form.sfbncjtjjzzcy=="1")
        {   //当使用权人是本农村集体经济组织成员时必选
            if (!that.form.suyqrdm || that.form.suyqrdm.length <= 0) {
                  that.$message('所有权代码不能为空');
                  return;
            }
        }
        //
        //delete that.form.$suyqxz;
        //
        //保存
        var t_url = config.business.url + "/api/shyqr/save";
        api.ajax_body(t_url, "post", that.form).then((r) => {
            if (r.success) {
               that.initTablePage();
               that.$message(r.data);
            } else {
            that.$message(r.data);
            }
        });
      },
  },
}
</script>


Logo

前往低代码交流专区

更多推荐