123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326 |
- <!DOCTYPE html>
- <html>
- <head>
- <title>边民-列表</title>
- <meta charset="utf-8">
- <meta name="viewport"
- content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
- <!-- 所有的 css & js 资源 -->
- <link rel="stylesheet" href="https://unpkg.com/element-ui@2.13.0/lib/theme-chalk/index.css">
- <link rel="stylesheet" href="../../static/sa.css">
- <script src="../../static/kj/vue.min.js"></script>
- <script src="../../static/kj/element-ui/index.js"></script>
- <script src="../../static/kj/httpVueLoader.js"></script>
- <script src="../../static/kj/jquery.min.js"></script>
- <script src="../../static/kj/layer/layer.js"></script>
- <script src="../../static/sa.js"></script>
- <script src="../../static/kj/upload-util.js"></script>
- <style type="text/css">
- .c-panel .el-form .c-label {
- width: 7em !important;
- }
- .c-panel .el-form .el-input,
- .c-panel .el-form .el-textarea__inner {
- width: 250px;
- }
- </style>
- </head>
- <body>
- <div class="vue-box" style="display: none;" :style="'display: block;'">
- <div class="c-panel">
- <!-- ------------- 检索参数 ------------- -->
- <div class="c-title">检索参数</div>
- <el-form ref="form" :model='p' @submit.native.prevent>
- <sa-item type="text" name="姓名" v-model="p.name" :need="false"></sa-item>
- <sa-item type="num" name="手机号" v-model="p.phone" :need="false"></sa-item>
-
- <!-- <sa-item type="text" name="边民号" v-model="p.code" :need="false"></sa-item> -->
- <el-button type="primary" icon="el-icon-search" @click="p.pageNo = 1; f5()">查询</el-button>
- <el-button type="info" icon="el-icon-refresh" @click="sa.f5()">重置</el-button>
- <el-button v-if="sa.isAuth('tb-people-add')" size="mini" type="primary"
- @click="add()">新增</el-button>
- <!--<el-button v-if="sa.isAuth('tb-people-bind-shop')" size="mini" type="primary"
- @click="bindShopBatch()">批量绑定店铺</el-button>-->
- </el-form>
- <!-- ------------- 数据列表 ------------- -->
- <el-table class="data-table" ref="data-table" :data="dataList">
- <sa-td type="index" name="序号"></sa-td>
- <sa-td name="姓名" prop="name"></sa-td>
- <sa-td name="性别" prop="sex" type="enum" :jv="{'1': '男', '2': '女'}"></sa-td>
- <sa-td name="手机号码" prop="phone" type="phone"></sa-td>
- <sa-td name="身份证" prop="idCard" type="idCard"></sa-td>
- <sa-td name="互助组" prop="groupName"></sa-td>
- <sa-td name="银行" prop="bankName" width="160"></sa-td>
- <sa-td name="银行卡" prop="bankCode" width="200"></sa-td>
- <sa-td name="创建时间" prop="createTime"></sa-td>
- <el-table-column label="操作" width="280px" fixed="right">
- <template slot-scope="s">
- <el-button class="c-btn" type="success" icon="el-icon-view"
- @click="get(s.row)">查看</el-button>
- <el-button v-if="sa.isAuth('tb-people-edit')" class="c-btn" type="primary" icon="el-icon-edit"
- @click="editFn(s.row)">手机号</el-button>
- <el-button v-if="sa.isAuth('tb-people-edit')" class="c-btn" type="primary" icon="el-icon-edit"
- @click="updateBankInfo(s.row.id)">银行卡</el-button>
- <el-button v-if="sa.isAuth('tb-people-edit')" class="c-btn" type="warning" icon="el-icon-delete"
- @click="cleanFace(s.row)">人脸</el-button>
- </template>
- </el-table-column>
- </el-table>
- <!-- ------------- 分页 ------------- -->
- <div class="page-box">
- <el-pagination background layout="total, prev, pager, next, sizes, jumper"
- :current-page.sync="p.pageNo" :page-size.sync="p.pageSize" :total="dataCount"
- :page-sizes="[10, 20, 30, 40, 50, 100, 1000]" @current-change="f5()" @size-change="f5()">
- </el-pagination>
- </div>
- </div>
- <el-dialog :title="model.title" :visible.sync="model.visible" width="500px">
- <div class="c-item">
- <label class="c-label"><span style="color: red;">*</span>选择商铺:</label>
- <el-select v-model="model.form.shopId" placeholder="输入关键字搜索" filterable size="mini">
- <el-option label="请选择" :value="0" disabled></el-option>
- <el-option v-for="(item,index) in shopList" :key="index"
- :label="item.shopName+'('+item.shopNo+')'" :value="item.id"> </el-option>
- </el-select>
- </div>
- <span slot="footer" class="dialog-footer">
- <el-button @click="model.visible = false">取 消</el-button>
- <el-button type="primary" @click="sureSelect">确 定</el-button>
- </span>
- </el-dialog>
- <el-dialog :title="phone.title" :visible.sync="phone.visible" width="500px">
- <div>当前手机号:{{phone.form.phone}}</div>
- <sa-item type="num" name="新手机号" width="7em" v-model="phone.phone" br></sa-item>
- <span slot="footer" class="dialog-footer">
- <el-button @click="phone.visible = false">取 消</el-button>
- <el-button type="primary" @click="sureEdit">确 定</el-button>
- </span>
- </el-dialog>
- </div>
- <script>
- var app = new Vue({
- components: {
- "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue'),
- "sa-td": httpVueLoader('../../sa-frame/com/sa-td.vue'),
- },
- el: '.vue-box',
- data: {
- model: {
- title: '选择商铺',
- visible: false,
- form: {
- ids: '',
- shopId: '',
- shopName: ""
- }
- },
- phone: {
- title: '修改手机号',
- visible: false,
- phone:'',
- form: {
- ids: '',
- shopId: '',
- shopName: ""
- }
- },
- shopList: [],
- p: { // 查询参数
- name: '', // 姓名
- code: '', // 边民号
- sex: '', // 性别(1=男,2=女)
- age: '', // 年龄
- idCard: '', // 身份证
- phone: '', // 手机号码
- bankNo: '', // 银行编号
- bankCode: '', // 银行卡号
- bankName: '', // 银行名称
- groupId: '', // 所属互助组(1=测试组)
- groupName: '', // 互助组名称
- status: '', // 是否可用(0=否,1=是)
- role: '', // 角色(1=普通边民,2=兼组长)
- shopId: '', // 经度
- address: '', // 联系地址
- addressIds: '', // 地址ID
- detailAddress: '', // 详细地址
- isLock: '', // 是否锁定
- leftPrice: '', // 当天剩余额度
- pageNo: 1, // 当前页
- pageSize: 10, // 页大小
- sortType: 0 // 排序方式
- },
- dataCount: 0,
- dataList: [], // 数据集合
- },
- methods: {
- cleanFace(data){
- sa.confirm('是否清除该边民人脸?', function() {
- sa.ajax('/sp-admin/AppUser/cleanFace?id=' + data.id, function(res) {
- sa.ok('清除成功,需退出APP重新登录');
- sa.f5TableHeight(); // 刷新表格高度
- }.bind(this))
- }.bind(this));
- },
- editFn(data) {
- this.phone = {
- title: '修改【' + data.name + '】手机号',
- visible: true,
- phone:'',
- form: data
- }
- },
- sureEdit() {
- let phone=this.phone.phone;
- if(!sa.isPhone(phone)){
- sa.error('手机号不正确')
- return;
- }
- let data={
- id:this.phone.form.id,
- name:this.phone.name,
- phone: phone
- }
- sa.ajax('/level-one-server/TbPeople/editPhone', data, function(res) {
- sa.ok('修改成功');
- this.phone.visible = false;
- this.f5()
- }.bind(this));
- },
- bindShopBatch() {
- // 获取选中元素的id列表
- let selection = this.$refs['data-table'].selection;
- let ids = sa.getArrayField(selection, 'id');
- if (selection.length == 0) {
- return sa.msg('请至少选择一条数据')
- }
- this.model = {
- title: '批量绑定商铺',
- visible: true,
- form: {
- ids: ids.join(','),
- shopId: '',
- }
- }
- },
- selectShop(data) {
- this.model = {
- title: '绑定【' + data.name + '】商铺',
- visible: true,
- form: {
- ids: data.id,
- shopId: data.shopId,
- shopName: data.shopName
- }
- }
- },
- sureSelect() {
- let data = this.model.form;
- if (!data.shopId) {
- sa.error('请选择商铺')
- return;
- }
- sa.ajax('/level-one-server/TbPeople/bindShop', data, function(res) {
- sa.ok('绑定成功');
- this.model.visible = false;
- this.f5()
- }.bind(this));
- },
- removeBind(data) {
- sa.confirm('是否解绑商铺?', function() {
- sa.ajax('/level-one-server/TbPeople/removeBind?id=' + data.id, function(res) {
- sa.ok('解绑成功');
- this.f5()
- }.bind(this))
- }.bind(this));
- },
- getShopList() {
- sa.ajax('/level-one-server/TbShop/getList', {
- pageNo: 1,
- pageSize: 100,
- }, function(res) {
- this.shopList = res.data; // 数据
- }.bind(this));
- },
- // 刷新
- f5: function() {
- sa.ajax('/level-one-server/TbPeople/getList', sa.removeNull(this.p), function(res) {
- console.log("res", res)
- this.dataList = res.data; // 数据
- this.dataCount = res.dataCount; // 数据总数
- sa.f5TableHeight(); // 刷新表格高度
- }.bind(this));
- },
- // 查看
- get: function(data) {
- sa.showIframe('数据详情', 'tb-people-info.html?id=' + data.id, '1000px', '90%');
- },
- updateBankInfo(id) {
- sa.showIframe('修改银行卡信息', 'tb-people-bank.html?id=' + id, '650px', '40%');
- },
- // 修改
- update: function(data) {
- sa.showIframe('修改数据', 'tb-people-add.html?id=' + data.id, '1000px', '90%');
- },
- // 新增
- add: function(data) {
- sa.showIframe('新增数据', 'tb-people-add.html?id=-1', '1000px', '90%');
- },
- // 删除
- del: function(data) {
- sa.confirm('是否删除,此操作不可撤销', function() {
- sa.ajax('/level-one-server/TbPeople/delete?id=' + data.id, function(res) {
- sa.arrayDelete(this.dataList, data);
- sa.ok('删除成功');
- sa.f5TableHeight(); // 刷新表格高度
- }.bind(this))
- }.bind(this));
- },
- // 批量删除
- deleteByIds: function() {
- // 获取选中元素的id列表
- let selection = this.$refs['data-table'].selection;
- let ids = sa.getArrayField(selection, 'id');
- if (selection.length == 0) {
- return sa.msg('请至少选择一条数据')
- }
- // 提交删除
- sa.confirm('是否批量删除选中数据?此操作不可撤销', function() {
- sa.ajax('/level-one-server/TbPeople/deleteByIds', {
- ids: ids.join(',')
- }, function(res) {
- sa.arrayDelete(this.dataList, selection);
- sa.ok('删除成功');
- sa.f5TableHeight(); // 刷新表格高度
- }.bind(this))
- }.bind(this));
- },
- // 改 - 删除状态(0=禁用,1=启用)
- updateDeleteStatus: function(data) {
- // 声明变量记录是否成功
- var isOk = false;
- var oldValue = data.deleteStatus;
- var ajax = sa.ajax('/level-one-server/TbPeople/updateDeleteStatus', {
- id: data.id,
- value: data.deleteStatus
- }, function(res) {
- isOk = true;
- sa.msg('修改成功');
- }.bind(this));
- // 如果未能修改成功, 则回滚
- $.when(ajax).done(function() {
- if (isOk == false) {
- data.status = oldValue;
- }
- })
- },
- },
- created: function() {
- this.f5();
- this.getShopList()
- sa.onInputEnter();
- }
- })
- </script>
- </body>
- </html>
|