北尚诉办前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

168 lines
6.7 KiB

<template>
<el-card shadow="never" class="aui-card--fill">
<div class="mod-__gridoperatorinfo}">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<div>
<el-form-item label="区域">
<el-cascader v-model="ids" :options="options" :props="{ checkStrictly: true }" clearable>
</el-cascader>
</el-form-item>
</div>
<el-form-item>
<el-button @click="getDataList()">{{ $t('query') }}</el-button>
</el-form-item>
<el-form-item>
<el-button v-if="$hasPermission('custom:gridoperatorinfo:save')" type="primary" @click="addOrUpdateHandle()">{{ $t('add') }}</el-button>
</el-form-item>
<el-form-item>
<el-button v-if="$hasPermission('custom:gridoperatorinfo:delete')" type="danger" @click="deleteHandle()">{{ $t('deleteBatch') }}</el-button>
</el-form-item>
</el-form>
<el-table v-loading="dataListLoading" :data="dataList" border @selection-change="dataListSelectionChangeHandle" style="width: 100%;">
<el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column>
<el-table-column prop="realName" label="姓名" header-align="center" align="center"></el-table-column>
<el-table-column prop="sex" label="性别" header-align="center" align="center" :formatter="showFlagFormat"></el-table-column>
<el-table-column prop="mobile" label="联系电话" header-align="center" align="center"></el-table-column>
<el-table-column prop="identityNo" label="身份证号" header-align="center" align="center"></el-table-column>
<el-table-column prop="allDeptNames" label="所属网格" header-align="center" align="center"></el-table-column>Id
<el-table-column prop="dutyCategoryId" label="网格员类型" header-align="center" align="center" :formatter = "dutyCategoryFormat"></el-table-column>
<el-table-column prop="workUnit" label="工作单位" header-align="center" align="center"></el-table-column>
<el-table-column prop="sort" label="显示排序" header-align="center" align="center"></el-table-column>
<el-table-column prop="remark" label="备注" header-align="center" align="center"></el-table-column>
<el-table-column :label="$t('handle')" fixed="right" header-align="center" align="center" width="200">
<template slot-scope="scope">
<el-button v-if="$hasPermission('custom:gridoperatorinfo:update')" type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">{{ $t('update') }}</el-button>
<el-button v-if="$hasPermission('custom:gridoperatorinfo:delete')" type="text" size="small" @click="deleteHandle(scope.row.id)">{{ $t('delete') }}</el-button>
<el-button type="text" size="small" @click="gridOperatorDetailHandle(scope.row.id)">查看</el-button>
<el-switch
v-model="scope.row.showFlag"
active-color="#36c6d3"
active-value="1"
inactive-value="0"
@change="active_text($event, scope.row)"
></el-switch>
</template>
</el-table-column>
</el-table>
<el-pagination
:current-page="page"
:page-sizes="[10, 20, 50, 100]"
:page-size="limit"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="pageSizeChangeHandle"
@current-change="pageCurrentChangeHandle">
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
<gridoperatorinfo-detail v-if="gridOperatorInfoDetailStatus" ref="gridoperatorinfoDetail" @refreshDataList="getDataList"></gridoperatorinfo-detail>
</div>
</el-card>
</template>
<script>
import mixinViewModule from '@/mixins/view-module'
import AddOrUpdate from './gridoperatorinfo-add-or-update'
import GridoperatorinfoDetail from './gridoperatorinfo-detail'
export default {
mixins: [mixinViewModule],
data () {
return {
mixinViewModuleOptions: {
getDataListURL: '/custom/gridoperatorinfo/page',
getDataListIsPage: true,
deleteURL: '/custom/gridoperatorinfo',
deleteIsBatch: true
},
dataForm: {
id: ''
},
ids: [],
options: [],
gridOperatorInfoDetailStatus: false,
dutyCategorys: []
}
},
components: {
AddOrUpdate,
GridoperatorinfoDetail
},
created: function () {
this.getOptions()
this.getListCategory()
},
watch: {
'ids': function (val) {
if (val.length === 0) {
this.dataForm.streetId = ''
this.dataForm.communityId = ''
this.dataForm.gridId = ''
}
if (val.length === 1) {
this.dataForm.streetId = this.ids[0]
this.dataForm.communityId = ''
this.dataForm.gridId = ''
}
if (val.length === 2) {
this.dataForm.streetId = this.ids[0]
this.dataForm.communityId = this.ids[1]
this.dataForm.gridId = ''
}
if (val.length === 3) {
this.dataForm.streetId = this.ids[0]
this.dataForm.communityId = this.ids[1]
this.dataForm.gridId = this.ids[2]
}
}
},
methods: {
getOptions () {
this.$http.get(`/sys/dept/party/getDeptTreeForEpiDemic`).then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
this.options = res.data.options
}).catch(() => {})
},
showFlagFormat (row, column) {
if (row.sex === '0') {
return '女'
} else {
return '男'
}
},
gridOperatorDetailHandle (id) {
this.gridOperatorInfoDetailStatus = true
this.$nextTick(() => {
this.$refs.gridoperatorinfoDetail.dataForm.id = id
this.$refs.gridoperatorinfoDetail.init()
})
},
active_text (value, row) {
this.$http.post(`/custom/gridoperatorinfo/changeShowFlag`, row).then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
this.options = res.data.options
}).catch(() => {})
},
getListCategory () {
this.$http.get(`/custom/gridoperatordutycategory/getAllDutyCat`).then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
this.dutyCategorys = res.data
}).catch(() => { })
},
dutyCategoryFormat (row) {
let choosenItem = this.dutyCategorys.filter(item => item.id === row.dutyCategoryId)[0]
if (choosenItem !== undefined) {
return choosenItem.dutyCategoryName
}
}
}
}
</script>