<div id="findPerson">
    <div id="para">
        <input type="hidden" name="ProcedureName" value="example" />
        <input type="hidden" name="reportName" value="报表1" />
        <input type="hidden" name="sqlStr" value="" />
        <input type="hidden" name="uid" v-model="uid" />
        <input type="hidden" name="uName" v-model="uName" />

        <label>姓名:<input name="name" value="" placeholder="输入姓名或留空" /></label>
        <label>地址:<input name="address" value="" placeholder="输入地址数据" /></label>
        <label>地址:<input name="marry" value="" placeholder="是否结婚" /></label>
        <button v-on:click="find">查询</button>
        <button v-on:click="print">打印</button>
    </div>
    <div id="result" v-if="result.length > 0">
        <table class="table">
            <thead>
                <tr>
                    <td>姓名</td>
                    <td>年龄</td>
                    <td>性别</td>
                    <td>登录用户编号</td>
                    <td>登录用户名</td>
                </tr>
            </thead>
            <tbody>
                <tr v-for="i in result">
                    <td>{{i.name}}</td>
                    <td>{{i.age}}</td>
                    <td>{{i.sex}}</td>
                    <td>{{i.uid}}</td>
                    <td>{{i.Uname}}</td>
                </tr>
            </tbody>
        </table>
    </div>
</div>

<script type="text/javascript">
    var findPerson = new Vue({
        el: "#findPerson",
        data: {
            url: myjs.urls.getresult,
            result: [],
            uid: "",
            uName: "",
        },
        created() {
            this.uid = myjs.getUId();
            this.uName = myjs.getUName();
        },
        methods: {
            find() {
                var sql = myjs.createSql("#para");
                $("input[name='sqlStr']").val(sql);
                console.log(sql);
                myjs.post(this.url, { sql: sql }, function (d) {
                    findPerson.result = d;
                });
            },
            print() {
                var sql = myjs.createSql("#para");
                $("input[name='sqlStr']").val(sql);
                myjs.print();
            },
        }
    });
</script>
