146 lines
5.1 KiB
HTML
146 lines
5.1 KiB
HTML
<!--#
|
|
layout("/layouts/platform.html"){
|
|
#-->
|
|
<style>
|
|
|
|
.el-card__header {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
}
|
|
|
|
</style>
|
|
<div id="app" v-cloak>
|
|
|
|
<guava ref="guava">
|
|
<el-card shadow="never">
|
|
<template #header>
|
|
<div>
|
|
<h3 style="color: #1867b0">新建考核指标</h3>
|
|
</div>
|
|
<div>
|
|
<el-button type="primary" @click="doAdd()">
|
|
提交
|
|
</el-button>
|
|
</div>
|
|
</template>
|
|
<template>
|
|
<kh-zb :data="formData" @change="v=>{this.formData=v}"></kh-zb>
|
|
</template>
|
|
</el-card>
|
|
</guava>
|
|
|
|
</div>
|
|
|
|
<script>
|
|
var vue = new Vue({
|
|
el: '#app',
|
|
data() {
|
|
return {
|
|
v: 'index',
|
|
formData: {},
|
|
}
|
|
},
|
|
components: {
|
|
'kh-zb': httpVueLoader('/components/kh/KhZb.vue?v=' + moment(new Date()).unix()),
|
|
},
|
|
methods: {
|
|
async doAdd() {
|
|
let flag = true
|
|
if (!this.formData.annual) {
|
|
this.$message({
|
|
message: "年度不能为空",
|
|
type: 'error'
|
|
})
|
|
return
|
|
}
|
|
if (!this.formData.assessment) {
|
|
this.$message({
|
|
message: "考核名称不能为空",
|
|
type: 'error'
|
|
})
|
|
return
|
|
}
|
|
this.formData.nrs.forEach(nr => {
|
|
nr.bzs.forEach(bz => {
|
|
if (!nr.content) {
|
|
this.$message({
|
|
message: "考核内容不能为空",
|
|
type: 'error'
|
|
})
|
|
flag = false;
|
|
throw Error()
|
|
} else if (!bz.inspection) {
|
|
this.$message({
|
|
message: "考核标准不能为空",
|
|
type: 'error'
|
|
})
|
|
flag = false;
|
|
throw Error()
|
|
} /*else if (!bz.score) {
|
|
this.$message({
|
|
message: "分数不能为空",
|
|
type: 'error'
|
|
})
|
|
flag = false;
|
|
throw Error()
|
|
}*/
|
|
})
|
|
})
|
|
if (flag) {
|
|
const resp = await $.post('/platform/ghkh/Xjkhzb/doAdd',{kh_zb: JSON.stringify(this.formData)})
|
|
if (resp.code === 0){
|
|
this.formData.nrs.forEach(nr => {
|
|
nr.bzs.forEach(bz => {
|
|
nr.content = ""
|
|
bz.inspection = ""
|
|
bz.score = ""
|
|
bz.single_score = ''
|
|
bz.associatedmodule = ''
|
|
})
|
|
this.formData.annual = ""
|
|
this.formData.assessment = ""
|
|
})
|
|
this.$message({
|
|
message: resp.msg,
|
|
type: 'success'
|
|
});
|
|
location.href='/platform/ghkh/khzb'
|
|
}else {
|
|
this.$message({
|
|
message: resp.msg,
|
|
type: 'error'
|
|
});
|
|
}
|
|
// $.post(base + "/platform/ghkh/Xjkhzb/doAdd", {kh_zb: JSON.stringify(this.formData)}, (res) => {
|
|
// if (res.code === 0) {
|
|
// this.formData.nrs.forEach(nr => {
|
|
// nr.bzs.forEach(bz => {
|
|
// nr.content = ""
|
|
// bz.inspection = ""
|
|
// bz.score = ""
|
|
// bz.single_score = ''
|
|
// bz.associatedmodule = ''
|
|
// })
|
|
// this.formData.annual = ""
|
|
// this.formData.assessment = ""
|
|
// })
|
|
// this.$message({
|
|
// message: res.msg,
|
|
// type: 'success'
|
|
// });
|
|
// location.href = '/platform/ghkh/khzb'
|
|
// }
|
|
// },
|
|
// )
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
})
|
|
</script>
|
|
<!--#
|
|
}
|
|
#-->
|