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.
166 lines
5.3 KiB
166 lines
5.3 KiB
|
2 years ago
|
<!DOCTYPE html>
|
||
|
|
<html>
|
||
|
|
|
||
|
|
<head>
|
||
|
|
<title>置灰</title>
|
||
|
|
<#include "../../include/head-file.ftl">
|
||
|
|
|
||
|
|
</head>
|
||
|
|
|
||
|
|
<body>
|
||
|
|
<div id="form" v-loading="loading" v-cloak>
|
||
|
|
<el-header class="ms-header ms-tr" height="50px">
|
||
|
|
<el-button type="primary" class="iconfont icon-baocun" size="mini" @click="save()" :loading="saveDisabled">保存</el-button>
|
||
|
|
<!-- <el-button size="mini" class="iconfont icon-fanhui" plain onclick="javascript:history.go(-1)">返回</el-button> -->
|
||
|
|
</el-header>
|
||
|
|
<el-main class="ms-container">
|
||
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="120px" label-position="right" size="small">
|
||
|
|
|
||
|
|
<!--一键置灰-->
|
||
|
|
|
||
|
|
<el-form-item label="一键置灰" prop="yjzh">
|
||
|
|
<el-switch v-model="form.yjzh"
|
||
|
|
:disabled="false">
|
||
|
|
</el-switch>
|
||
|
|
</el-form-item>
|
||
|
|
|
||
|
|
<!--结束日期-->
|
||
|
|
|
||
|
|
<el-form-item label="结束日期" prop="zhEndtime">
|
||
|
|
<el-date-picker
|
||
|
|
v-model="form.zhEndtime"
|
||
|
|
placeholder="请选择结束日期" :readonly="false"
|
||
|
|
:disabled="!form.yjzh"
|
||
|
|
:editable="true"
|
||
|
|
:clearable="true"
|
||
|
|
value-format="yyyy-MM-dd"
|
||
|
|
:style="{width:'100%'}"
|
||
|
|
type="date">
|
||
|
|
</el-date-picker>
|
||
|
|
</el-form-item>
|
||
|
|
</el-form>
|
||
|
|
</el-main>
|
||
|
|
</div>
|
||
|
|
</body>
|
||
|
|
|
||
|
|
</html>
|
||
|
|
|
||
|
|
<script>
|
||
|
|
var formVue = new Vue({
|
||
|
|
el: '#form',
|
||
|
|
data:function() {
|
||
|
|
return {
|
||
|
|
loading:false,
|
||
|
|
saveDisabled: false,
|
||
|
|
//表单数据
|
||
|
|
form: {
|
||
|
|
// 一键置灰
|
||
|
|
yjzh:false,
|
||
|
|
//结束日期
|
||
|
|
zhEndtime:"",
|
||
|
|
|
||
|
|
},
|
||
|
|
rules:{
|
||
|
|
// 结束日期
|
||
|
|
zhEndtime: [{"required":true,"message":"请选择结束日期"}],
|
||
|
|
|
||
|
|
},
|
||
|
|
|
||
|
|
}
|
||
|
|
},
|
||
|
|
watch:{
|
||
|
|
|
||
|
|
},
|
||
|
|
components:{
|
||
|
|
},
|
||
|
|
computed:{
|
||
|
|
},
|
||
|
|
methods: {
|
||
|
|
|
||
|
|
save:function() {
|
||
|
|
var that = this;
|
||
|
|
var url = ms.manager + "/cms/pasZh/save.do"
|
||
|
|
if (that.form.id > 0) {
|
||
|
|
url = ms.manager + "/cms/pasZh/update.do";
|
||
|
|
}
|
||
|
|
this.$refs.form.validate(function(valid) {
|
||
|
|
if (valid) {
|
||
|
|
that.saveDisabled = true;
|
||
|
|
|
||
|
|
var form = JSON.parse(JSON.stringify(that.form));
|
||
|
|
ms.http.post(url, form).then(function (res) {
|
||
|
|
if (res.result) {
|
||
|
|
that.$notify({
|
||
|
|
title: "成功",
|
||
|
|
message: "保存成功",
|
||
|
|
type: 'success'
|
||
|
|
});
|
||
|
|
// ms.util.openSystemUrl("/cms/pasZh/index.do");
|
||
|
|
} else {
|
||
|
|
that.$notify({
|
||
|
|
title: "错误",
|
||
|
|
message: res.msg,
|
||
|
|
type: 'warning'
|
||
|
|
});
|
||
|
|
}
|
||
|
|
|
||
|
|
that.saveDisabled = false;
|
||
|
|
}).catch(function (err) {
|
||
|
|
console.err(err);
|
||
|
|
that.saveDisabled = false;
|
||
|
|
});
|
||
|
|
} else {
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
})
|
||
|
|
},
|
||
|
|
|
||
|
|
//获取当前置灰
|
||
|
|
get:function(id) {
|
||
|
|
var that = this;
|
||
|
|
this.loading = true
|
||
|
|
ms.http.get(ms.manager + "/cms/pasZh/get.do", {"id":id}).then(function (res) {
|
||
|
|
that.loading = false
|
||
|
|
if(res.result&&res.data) {
|
||
|
|
|
||
|
|
that.form = res.data;
|
||
|
|
}
|
||
|
|
});
|
||
|
|
},
|
||
|
|
update: function (row) {
|
||
|
|
var that = this;
|
||
|
|
ms.http.post(ms.manager+"/cms/pasZh/update.do", row).then(function (data) {
|
||
|
|
if (data.result) {
|
||
|
|
that.$notify({
|
||
|
|
title: '成功',
|
||
|
|
message: '更新成功',
|
||
|
|
type: 'success'
|
||
|
|
});
|
||
|
|
|
||
|
|
} else {
|
||
|
|
that.$notify({
|
||
|
|
title: '失败',
|
||
|
|
message: data.msg,
|
||
|
|
type: 'warning'
|
||
|
|
});
|
||
|
|
}
|
||
|
|
});
|
||
|
|
}, //结束日期日期格式化
|
||
|
|
zhEndtimeFormat:function(row, column, cellValue, index){
|
||
|
|
return ms.util.date.fmt(new Date(row.ZH_ENDTIME),'yyyy-MM-dd');
|
||
|
|
},
|
||
|
|
},
|
||
|
|
created:function() {
|
||
|
|
var that = this;
|
||
|
|
|
||
|
|
this.form.id = ms.util.getParameter("id");
|
||
|
|
if (this.form.id) {
|
||
|
|
this.get(this.form.id);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
</script>
|
||
|
|
<style>
|
||
|
|
</style>
|