html, body {
margin: 0;
padding: 0;
height: 100%;
width: 100%;
background: #00499e;
}
#app {
padding: 20px;
border: 15px solid #00499e;
background: white;
border-radius: 25px;
height: 100%;
display: flex;
display: -webkit-flex;
flex-direction: column;
box-sizing: border-box;
font-size: 14px;
overflow-y: auto;
}
#app.isPc {
height: auto;
}
.primary {
color: #409EFF;
}
.page-header {
color: #333;
margin-left: -10px;
margin-bottom: 10px;
font-size: 16px;
text-align: center;
flex-shrink: 0;
}
.mobile-table {
flex: 1;
height: 96%;
overflow-y: auto;
-webkit-overflow-scrolling: touch;
padding: 10px;
box-sizing: border-box;
-webkit-box-sizing: border-box;
font-size: 13px;
margin-bottom: 2px;
}
.mobile-card {
margin-bottom: 20px;
position: relative;
}
.mobile-name {
font-size: 18px;
font-weight: bold;
color: #333;
line-height: 24px;
margin-bottom: 10px;
}
.mobile-right {
float: right;
font-size: 12px;
color: #999;
font-weight: normal;
}
.mobile-row .el-col {
margin-top: 10px;
}
.pc-pagination {
padding: 10px;
text-align: right;
}
.tips {
color: #aaa;
font-size: 14px;
line-height: 20px;
height: 20px;
text-align: center;
}
.tips i {
font-size: 20px;
}
.detail {
font-size: 12px;
color: #dedede;
margin-top: 10px;
margin-bottom: -10px;
text-align: center;
}
.el-message-box {
width: 80%;
max-width: 400px;
}
.el-dialog {
max-width: 600px;
}
.form-input, .form-select {
width: 100%;
}
.card-selected {
position: absolute;
right: 0;
top: 0;
font-size: 20px;
color: #aaa;
}
.selected {
color: #1279ff;
}
@click="back"
class="el-icon-back">
@click="edit('add')"
class="el-icon-plus">
@click="cancelEdit">取消
{{title}}
@click="editStatus=true;selection = []"
class="el-icon-more-outline">
@click="visible=true"
class="el-icon-cold-drink">
class="el-icon-setting" @click="openSettingDialog">
:label="xx.xmmc">
:label="xx.dmmc">
:show-all-levels="false"
class="form-select" clearable
v-model="params.qxdm"
placeholder="请选择案例区县"
@change="handleChange"
:options="types.qxdms"
:props="{label: 'dmmc', value: 'dmdm', emitPath: false}">
placeholder="请选择案例所属学校">
:label="xx.dmmc">
查询
重置
设置
新建
查看
详情
icon="el-icon-edit-outline">
@click="deleteCase(scope.row)">
:current-page.sync="params.page" :total="params.total">
{{item.xmmc}}
{{item.alzt}}
{{item.qxdmmc}}
{{item.xxdmmc}}
{{item.xuxm}}
{{item.xtime}}
查看案例材料
@click.prevent.stop="edit('modify', item)"
icon="el-icon-edit-outline">
@click.prevent.stop="deleteCase(item)">
:label="xx.xmmc">
:label="xx.dmmc">
:show-all-levels="false"
class="form-select" clearable
v-model="params.qxdm"
placeholder="请选择案例区县"
@change="handleChange"
:options="types.qxdms"
:props="{label: 'dmmc', value: 'dmdm', emitPath: false}">
placeholder="请选择案例所属学校">
:label="xx.dmmc">
查询
重置
:label="xx.dmmc">
提交
取消
var pageparm = getQueryString("pageparm"),
formMap = {
pageparm: '项目名称',
alzt: '案例状态',
xxdm: '案例学校名称',
qxdm: '案例区县名称'
};
new Vue({
el: '#app',
data: function () {
var that = this
return {
title: '案例管理',
editStatus: false,
selection: [],
formMap,
loading: true,
visible: false,
right: {
A: true,
M: true,
D: true
},
projectCodes: [],
types: {
qxdms: [],
xxdms: [],
alzts: []
},
pageparm: getQueryString('pageparm'),
params: {
size: 8,
page: 1,
total: 0,
pageparm: getQueryString('pageparm'),
alzt: '',
qxdm: '',
xxdm: ''
},
settingDialog: {
visible: false,
alzt: ''
},
list: [],
isMobile: !IsPC()
}
},
computed: {
noMore() {
return this.list.length >= this.params.total
},
disabled() {
return this.loading || this.noMore
}
},
methods: {
back() {
history.back()
},
handleChange(val) {
if (!val) {
this.types.xxdms = []
} else {
this.getTypes('gb-xxdm', val)
}
this.params.xxdm = ''
},
cancelEdit() {
this.selection.forEach(function (item) {
item.selected = false
})
this.selection = []
this.editStatus = false
},
handleClickCard(row) {
if (!this.editStatus) {
this.edit('show', row)
} else {
row.selected = !row.selected
if (row.selected) {
this.selection.push(row)
} else {
this.selection = this.selection.filter(function (item) {
return item.alid !== row.alid
})
}
}
},
submitSetting() {
if (!this.settingDialog.alzt) {
this.$message.warning('请选择轮次')
return
}
var params = {
alid: this.selection.map(function (item) {
return item.alid
}).join(','),
alzt: this.settingDialog.alzt,
act: 'AsetZT'
}, that = this
axios.get(baseUrl + 'PSAL/PSALWLIST', {params}).then(function (res) {
if (res.status === 200) {
that.editStatus = false
that.settingDialog.visible = false
that.settingDialog.alzt = ''
if (that.isMobile) {
that.params.page = 1
}
that.$message.success('设置成功')
that.changePage()
}
})
},
selectRow(rows) {
this.selection = rows
},
openSettingDialog() {
if (this.selection.length === 0) {
this.$message.warning('请选择要设置的数据')
return
}
this.settingDialog.visible = true
this.settingDialog.lcdm = ''
this.settingDialog.zuid = ''
},
goDocument(row) {
location.href = './PSALDETAIDOC.html?alid=' + row.alid
},
deleteCase(row) {
var that = this
this.$confirm('是否确定删除' + row.almc + '?').then(function (flag) {
if (flag) {
var params = {
act: 'Delete',
alid: row.alid,
pageparm: that.params.pageparm
}
axios.get(baseUrl + 'PSAL/PSALWLIST', {params}).then(function (res) {
if (res.status === 200) {
if (that.isMobile) {
that.params.page = 1
}
that.changePage()
}
})
}
})
},
edit(type, row) {
var url = './PSALDETAI.html?type=' + type
if (type !== 'add') {
url = url + '&alid=' + row.alid
} else {
url = url + '&redir=' + 'PSALWLIST'
}
location.href = url
},
getData() {
var params = {
act: 'Rdata',
pagesize: this.params.size,
pageindex: this.params.page
}
for (var key in this.params) {
if (this.params.hasOwnProperty(key) && (typeof this.params[key] === 'string') && this.params[key]) {
params[key] = this.params[key]
}
}
return axios.get(baseUrl + 'PSAL/PSALWLIST' + pageparm, {
params: params
})
},
loadData() {
var that = this
that.loading = true
that.getData().then(function (res) {
if (res.status === 200 && res.data) {
var data = res.data
data.rows.forEach(function (item) {
item.selected = false
that.list.push(item)
})
that.params.total = data.total
that.params.page++
} else {
that.list = []
}
that.loading = false
})
},
changePage() {
var that = this
that.loading = true
that.getData().then(function (res) {
that.loading = false
if (res.status === 200) {
that.list = res.data.rows.map(function (item) {
item.selected = false
return item
})
that.params.total = res.data.total || []
if (that.isMobile) {
that.params.page++
}
}
})
},
handleSubmit() {
this.visible = false
this.params.page = 1
this.changePage()
},
handleSet() {
this.params.page = 1
this.params.pageparm = this.pageparm
this.params.alzt = ''
this.params.qxdm = ''
this.params.xxdm = ''
this.visible = false
this.changePage()
},
getInitData() {
let that = this
axios.get(baseUrl + 'PSAL/PSALWLIST', {params: {act: 'pinit'}}).then(function (res) {
if (res.status === 200) {
that.title = res.data.mkmc || that.title
document.title = that.title
that.projectCodes = res.data.xmlist
that.pzluserid = res.data.pzluserid
that.pageparm = res.data.pageparm
if (res.data.rightid) {
for (var i = 0; i < res.data.rightid.length; i++) {
that.right[res.data.rightid[i]] = true
}
}
if (!that.params.pageparm) {
that.pageparm = that.projectCodes[0].xmdm
that.params.pageparm = that.projectCodes[0].xmdm
}
that.changePage()
}
})
},
getTypes(type, dmleft) {
let that = this
return axios.get(baseUrl + 'xctrl/getdmjson/' + type, {params: {dmleft}}).then(function (res) {
if (res.status === 200) {
if (type === 'gb-qxdm') {
var qxdms = [], qxdmMap = {}, second = {}
res.data.forEach(function (item) {
var key = item.dmdm.substring(0, item.dmdm.length - 2)
if (item.dmdm.length === 2) { // 第一层逻辑
if (!qxdmMap[item.dmdm]) {
qxdmMap[item.dmdm] = {
dmdm: item.dmdm,
dmmc: item.dmmc,
children: []
}
} else {
qxdmMap[item.dmdm].dmdm = item.dmdm
qxdmMap[item.dmdm].dmmc = item.dmmc
}
} else if (item.dmdm.length === 4) { // 第二层逻辑
if (!qxdmMap[key]) {
qxdmMap[key] = {
children: []
}
}
if (!second[item.dmdm]) {
second[item.dmdm] = {
dmdm: item.dmdm,
dmmc: item.dmmc,
children: []
}
} else {
second[item.dmdm].dmdm = item.dmdm
second[item.dmdm].dmmc = item.dmmc
}
qxdmMap[key].children.push(second[item.dmdm])
} else {
if (!second[key]) {
second[key] = {
children: []
}
}
second[key].children.push({
dmdm: item.dmdm,
dmmc: item.dmmc
})
}
})
for (var k in qxdmMap) {
if (qxdmMap.hasOwnProperty(k) && qxdmMap[k]) {
qxdms.push(qxdmMap[k])
}
}
that.types[type.split('-')[1] + 's'] = qxdms
} else {
that.types[type.split('-')[1] + 's'] = res.data
}
}
})
},
resize() {
this.isMobile = window.innerWidth <= 768
}
},
created() {
this.getTypes('anli-alzt')
this.getTypes('gb-qxdm')
this.getTypes('gb-xxdm')
this.getInitData()
},
mounted() {
window.addEventListener('resize', this.resize)
},
beforeDestroy() {
window.removeEventListener('resize', this.resize)
}
})
一键复制
编辑
Web IDE
原始数据
按行查看
历史