|
|
|
@ -78,6 +78,9 @@
|
|
|
|
|
|
|
|
|
|
<div class="center-board">
|
|
|
|
|
<div class="action-bar">
|
|
|
|
|
<el-button icon="el-icon-view" type="text" @click="showJson">
|
|
|
|
|
上传json
|
|
|
|
|
</el-button>
|
|
|
|
|
<el-button icon="el-icon-download" type="text" @click="download">
|
|
|
|
|
导出vue文件
|
|
|
|
|
</el-button>
|
|
|
|
@ -132,6 +135,74 @@
|
|
|
|
|
@confirm="generate"
|
|
|
|
|
/>
|
|
|
|
|
<input id="copyNode" type="hidden">
|
|
|
|
|
|
|
|
|
|
<!-- 新增模板 -->
|
|
|
|
|
<el-dialog title="创建新模板" :visible.sync="createTemplate" width="680px" append-to-body :close-on-click-modal="false">
|
|
|
|
|
<el-form ref="form" :model="dialogForm" :rules="rules" label-width="120px">
|
|
|
|
|
<el-row>
|
|
|
|
|
<el-col :span="24">
|
|
|
|
|
<el-form-item label="模板名称" prop="templateName">
|
|
|
|
|
<el-input v-model="dialogForm.templateName" placeholder="请输入模板名称"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="24">
|
|
|
|
|
<el-form-item label="项目分类" prop="projectClassify">
|
|
|
|
|
<el-cascader
|
|
|
|
|
style="width: 100%;"
|
|
|
|
|
v-model="dialogForm.projectClassify"
|
|
|
|
|
:options="options"
|
|
|
|
|
:props="props"
|
|
|
|
|
@change="changeProjectClassify"
|
|
|
|
|
>
|
|
|
|
|
</el-cascader>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="24">
|
|
|
|
|
<el-form-item label="级别" prop="level">
|
|
|
|
|
<el-select v-model="dialogForm.level" placeholder="请选择级别" style="width: 100%;">
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="dict in dict.type.bms_level"
|
|
|
|
|
:key="dict.value"
|
|
|
|
|
:label="dict.label"
|
|
|
|
|
:value="dict.value"
|
|
|
|
|
></el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="24">
|
|
|
|
|
<el-form-item label="责任单位" prop="responsibilityUnit">
|
|
|
|
|
<el-select v-model="dialogForm.responsibilityUnit" placeholder="请选择责任单位" style="width: 100%;">
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="dict in dict.type.bms_responsibility_unit"
|
|
|
|
|
:key="dict.value"
|
|
|
|
|
:label="dict.label"
|
|
|
|
|
:value="dict.value"
|
|
|
|
|
></el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="24">
|
|
|
|
|
<el-form-item label="模板使用有效期" prop="reportTime">
|
|
|
|
|
<el-date-picker
|
|
|
|
|
v-model="dialogForm.reportTime"
|
|
|
|
|
type="daterange"
|
|
|
|
|
range-separator="-"
|
|
|
|
|
start-placeholder="模板使用有效期开始时间"
|
|
|
|
|
end-placeholder="模板使用有效期结束时间"
|
|
|
|
|
style="width: 100%;"
|
|
|
|
|
value-format="yyyy-MM-dd"
|
|
|
|
|
@change="changeDateRange"
|
|
|
|
|
>
|
|
|
|
|
</el-date-picker>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
</el-form>
|
|
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
|
|
<el-button @click="cancel">取 消</el-button>
|
|
|
|
|
<el-button type="primary" @click="submitForm" class="btn">确 定</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
</el-dialog>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
@ -150,6 +221,8 @@ import drawingDefault from '@/utils/generator/drawingDefault'
|
|
|
|
|
import logo from '@/assets/logo/logo.png'
|
|
|
|
|
import CodeTypeDialog from './CodeTypeDialog'
|
|
|
|
|
import DraggableItem from './DraggableItem'
|
|
|
|
|
import { templateInfo } from "@/api/onlineDeclartion/declarationManagement"
|
|
|
|
|
import { getAllList } from "@/api/system/dict/data";
|
|
|
|
|
|
|
|
|
|
let oldActiveId
|
|
|
|
|
let tempActiveData
|
|
|
|
@ -162,7 +235,15 @@ export default {
|
|
|
|
|
CodeTypeDialog,
|
|
|
|
|
DraggableItem
|
|
|
|
|
},
|
|
|
|
|
dicts: ['bms_responsibility_unit', 'bms_level'],
|
|
|
|
|
data() {
|
|
|
|
|
let validateTime = (rule, value, callback) => {
|
|
|
|
|
if (new Date(value[1]) < new Date()) {
|
|
|
|
|
callback(new Error('选择结束时间需大于当前时间'))
|
|
|
|
|
} else {
|
|
|
|
|
callback()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return {
|
|
|
|
|
logo,
|
|
|
|
|
idGlobal: 100,
|
|
|
|
@ -179,7 +260,55 @@ export default {
|
|
|
|
|
dialogVisible: false,
|
|
|
|
|
generateConf: null,
|
|
|
|
|
showFileName: false,
|
|
|
|
|
activeData: drawingDefault[0]
|
|
|
|
|
activeData: drawingDefault[0],
|
|
|
|
|
options: [],
|
|
|
|
|
props:{
|
|
|
|
|
lazy:true,
|
|
|
|
|
lazyLoad (node, resolve) {
|
|
|
|
|
const { level, data, children } = node;
|
|
|
|
|
if(children?.length == 0 ) {
|
|
|
|
|
getAllList({dictType: data.dict}).then(res=>{
|
|
|
|
|
const nodes = Array.from(res.data).map((item)=>{
|
|
|
|
|
return {
|
|
|
|
|
value:item.dictValue,
|
|
|
|
|
label:item.dictLabel,
|
|
|
|
|
dict:item.remark,
|
|
|
|
|
leaf: level >= 2
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
resolve(nodes)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
// 表单参数
|
|
|
|
|
dialogForm: {},
|
|
|
|
|
// 表单校验
|
|
|
|
|
rules: {
|
|
|
|
|
// year: [
|
|
|
|
|
// { required: true, message: "请选择年份", trigger: "blur" },
|
|
|
|
|
// ],
|
|
|
|
|
responsibilityUnit: [
|
|
|
|
|
{ required: true, message: "请选择责任单位", trigger: "blur" }
|
|
|
|
|
],
|
|
|
|
|
level: [
|
|
|
|
|
{ required: true, message: "请选择级别", trigger: "blur" }
|
|
|
|
|
],
|
|
|
|
|
projectClassify: [
|
|
|
|
|
{ required: true, message: "请选择项目分类", trigger: "blur" }
|
|
|
|
|
],
|
|
|
|
|
templateName: [
|
|
|
|
|
{ required: true, message: "请输入模板名称", trigger: "blur" }
|
|
|
|
|
],
|
|
|
|
|
reportTime: [
|
|
|
|
|
{ required: true, message: "请选择模板使用有效期", trigger: "blur" },
|
|
|
|
|
{validator: validateTime, trigger: 'blur'},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
projectBigType: undefined,
|
|
|
|
|
projectMiddleType: undefined,
|
|
|
|
|
projectSmallType: undefined,
|
|
|
|
|
createTemplate: true,
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
@ -223,8 +352,61 @@ export default {
|
|
|
|
|
clipboard.on('error', e => {
|
|
|
|
|
this.$message.error('代码复制失败')
|
|
|
|
|
})
|
|
|
|
|
this.getDataList();
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
getDataList(){
|
|
|
|
|
getAllList({dictType:"project_categories"}).then(res=>{
|
|
|
|
|
res.data.map(item => {
|
|
|
|
|
let obj = {};
|
|
|
|
|
obj.value = item.dictValue;
|
|
|
|
|
obj.label = item.dictLabel;
|
|
|
|
|
obj.dict = item.remark;
|
|
|
|
|
this.options.push(obj);
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
// 项目分类选择
|
|
|
|
|
changeProjectClassify(valId){
|
|
|
|
|
if(valId) {
|
|
|
|
|
this.projectBigType = valId[0]
|
|
|
|
|
this.projectMiddleType = valId[1]
|
|
|
|
|
this.projectSmallType = valId[2]
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
// 模板有效期选择
|
|
|
|
|
changeDateRange(val) {
|
|
|
|
|
// console.log('val: ', val);
|
|
|
|
|
this.dialogForm.useStart = val[0]
|
|
|
|
|
this.dialogForm.useEnd = val[1]
|
|
|
|
|
},
|
|
|
|
|
// 取消按钮
|
|
|
|
|
cancel() {
|
|
|
|
|
this.createTemplate = false;
|
|
|
|
|
this.reset();
|
|
|
|
|
},
|
|
|
|
|
// 表单重置
|
|
|
|
|
reset() {
|
|
|
|
|
this.dialogForm = {
|
|
|
|
|
responsibilityUnit: undefined,
|
|
|
|
|
templateName: undefined,
|
|
|
|
|
level: undefined,
|
|
|
|
|
projectClassify:[],
|
|
|
|
|
reportTime: [],
|
|
|
|
|
};
|
|
|
|
|
this.projectBigType = undefined
|
|
|
|
|
this.projectMiddleType = undefined
|
|
|
|
|
this.projectSmallType = undefined
|
|
|
|
|
this.resetForm("form");
|
|
|
|
|
},
|
|
|
|
|
/** 提交按钮 */
|
|
|
|
|
submitForm: function() {
|
|
|
|
|
this.$refs["form"].validate(valid => {
|
|
|
|
|
if (valid) {
|
|
|
|
|
this.createTemplate = false;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
activeFormItem(element) {
|
|
|
|
|
this.activeData = element
|
|
|
|
|
this.activeId = element.formId
|
|
|
|
@ -324,6 +506,24 @@ export default {
|
|
|
|
|
const css = cssStyle(makeUpCss(this.formData))
|
|
|
|
|
return beautifier.html(html + script + css, beautifierConf.html)
|
|
|
|
|
},
|
|
|
|
|
showJson() {
|
|
|
|
|
this.AssembleFormData()
|
|
|
|
|
// 级别,责任单位,模板使用有效期开始时间,模板使用有效期结束时间,模板名称
|
|
|
|
|
const { level, responsibilityUnit, useStart, useEnd, templateName } = this.dialogForm;
|
|
|
|
|
if(level && responsibilityUnit && useStart && useEnd && templateName) {
|
|
|
|
|
templateInfo({level, responsibilityUnit, templateName, useStart, useEnd, projectBigType:this.projectBigType, projectMiddleType:this.projectMiddleType, projectSmallType:this.projectSmallType,templateJson: JSON.stringify(this.formData)}).then(res=>{
|
|
|
|
|
if(res.code == 200) {
|
|
|
|
|
this.$router.push({
|
|
|
|
|
name: 'Template',
|
|
|
|
|
params: {code:200},
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
this.createTemplate = true;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
download() {
|
|
|
|
|
this.dialogVisible = true
|
|
|
|
|
this.showFileName = true
|
|
|
|
|