提交 de3ca116 authored 作者: 何忠建's avatar 何忠建

修复bug

上级 54a71c82
......@@ -57,29 +57,32 @@
</a-col> -->
<a-col :span="12">
<a-form-model-item label="负责人" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="headName">
<a-input v-model="model.headName" placeholder="请输入负责人"></a-input>
<a-input v-model="model.headName" placeholder="请选择负责人" readOnly @click="handleAddUserRole" ></a-input>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="联系方式" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="headPhone">
<a-input v-model="model.headPhone" placeholder="请输入联系方式"></a-input>
<a-input v-model="model.headPhone" placeholder="联系方式" readOnly disabled></a-input>
</a-form-model-item>
</a-col>
</a-row>
</a-form-model>
</j-form-container>
<Select-User-Modal ref="selectUserModal" @selectFinished="selectOK"></Select-User-Modal>
</a-spin>
</template>
<script>
import Vue from 'vue'
import { httpAction, getAction } from '@/api/manage'
import { validateDuplicateValue } from '@/utils/util'
import {ajaxGetDictItems,getDictItemsFromCache} from '@/api/api'
import { USER_INFO } from "@/store/mutation-types"
import SelectUserModal from './SelectUserModal'
export default {
name: 'PropertyChargruleForm',
components: {
components: {SelectUserModal
},
props: {
//表单禁用
......@@ -118,6 +121,7 @@
assetName: [{ required: true, message: '请输入设备名称', trigger: 'blur' }],
assetCode: [{ required: true, message: '请输入设备编码', trigger: 'change' }],
assetPosition: [{ required: true, message: '请输入所在位置', trigger: 'blur' }],
headName: [{ required: true, message: '请选择负责人', trigger: 'change' }],
// communityCode: [{ required: true, message: '请输入所属小区', trigger: 'blur' }]
},
url: {
......@@ -158,12 +162,24 @@
},
add () {
this.edit(this.modelDefault);
let data = Vue.ls.get(USER_INFO)
this.model.assetPosition = data.platformName
},
edit (record) {
console.log(record)
this.model = Object.assign({}, record);
this.visible = true;
},
handleAddUserRole() {
if (this.currentRoleId == '') {
this.$message.error('请选择一个角色!')
} else {
this.$refs.selectUserModal.visible = true
}
},
selectOK(data) {
this.model.headName = data.realname
this.model.headPhone = data.phone
},
submitForm () {
const that = this;
// 触发表单验证
......
<template>
<div>
<a-modal
centered
:title="title"
:width="1000"
:visible="visible"
@ok="handleOk"
@cancel="handleCancel"
cancelText="关闭">
<div>
<a-table
size="small"
bordered
rowKey="id"
:columns="columns1"
:dataSource="dataSource1"
:pagination="ipagination"
:loading="loading"
:scroll="{ y: 240 }"
:rowSelection="{selectedRowKeys: selectedRowKeys,onSelect:onSelect,onChange: onSelectChange,type:'radio'}"
@change="handleTableChange">
</a-table>
</div>
<!-- table区域-end -->
</a-modal>
</div>
</template>
<script>
import {filterObj} from '@/utils/util'
import {getAction} from '@/api/manage'
export default {
name: "SelectUserModal",
data() {
return {
title: "添加已有用户",
names: [],
visible: false,
placement: 'right',
description: '',
// 查询条件
queryParam: {},
// 表头
columns1: [
{
title: '#',
dataIndex: '',
key: 'rowIndex',
width: 50,
align: "center",
customRender: function (t, r, index) {
return parseInt(index) + 1;
}
},
{
title: '用户名称',
align: "center",
width: 100,
dataIndex: 'realname'
},
{
title: '性别',
align: "center",
width: 100,
dataIndex: 'sex_dictText'
},
{
title: '电话',
align: "center",
width: 100,
dataIndex: 'phone'
},
{
title: '部门',
align: "center",
width: 150,
dataIndex: 'orgCodeTxt'
}
],
//数据集
dataSource1: [],
dataSource2: [],
// 分页参数
ipagination: {
current: 1,
pageSize: 10,
pageSizeOptions: ['10', '20', '30'],
showTotal: (total, range) => {
return range[0] + "-" + range[1] + " 共" + total + "条"
},
showQuickJumper: true,
showSizeChanger: true,
total: 0
},
isorter: {
column: 'createTime',
order: 'desc',
},
loading: false,
selectedRowKeys: [],
selectedRows: [],
url: {
list: "/sys/user/list",
},
chooseUser:{}
}
},
created() {
this.loadData();
},
methods: {
searchQuery() {
this.loadData(1);
},
searchReset() {
this.queryParam = {};
this.loadData(1);
},
handleCancel() {
this.visible = false;
},
handleOk() {
console.log("data:" + this.chooseUser);
this.$emit("selectFinished", this.chooseUser);
this.visible = false;
},
add() {
this.visible = true;
},
loadData(arg) {
//加载数据 若传入参数1则加载第一页的内容
if (arg === 1) {
this.ipagination.current = 1;
}
var params = this.getQueryParams();//查询条件
getAction(this.url.list, params).then((res) => {
if (res.success) {
this.dataSource1 = res.result.records;
this.ipagination.total = res.result.total;
}
})
},
getQueryParams() {
var param = Object.assign({}, this.queryParam, this.isorter);
param.pageNo = this.ipagination.current;
param.pageSize = this.ipagination.pageSize;
return filterObj(param);
},
onSelect(record, selected) {
if (selected === true) {
this.chooseUser = record;
}
},
onSelectChange(selectedRowKeys, selectedRows) {
this.selectedRowKeys = selectedRowKeys;
this.selectionRows = selectedRows;
},
handleTableChange(pagination, filters, sorter) {
//分页、排序、筛选变化时触发
console.log(sorter);
//TODO 筛选
if (Object.keys(sorter).length > 0) {
this.isorter.column = sorter.field;
this.isorter.order = "ascend" == sorter.order ? "asc" : "desc"
}
this.ipagination = pagination;
this.loadData();
}
}
}
</script>
<style lang="less" scoped>
.ant-card-body .table-operator {
margin-bottom: 18px;
}
.ant-table-tbody .ant-table-row td {
padding-top: 15px;
padding-bottom: 15px;
}
.anty-row-operator button {
margin: 0 5px
}
.ant-btn-danger {
background-color: #ffffff
}
.ant-modal-cust-warp {
height: 100%
}
.ant-modal-cust-warp .ant-modal-body {
height: calc(100% - 110px) !important;
overflow-y: auto
}
.ant-modal-cust-warp .ant-modal-content {
height: 90% !important;
overflow-y: hidden
}
</style>
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论