master^2
deng 1 year ago
commit 6e8f2e9440
  1. 373
      ant-design-vue-jeecg/src/views/rulex/modules/RulexForm.vue

@ -3,70 +3,72 @@
<j-form-container :disabled="formDisabled">
<a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
<a-row>
<!-- <a-col :span="24">-->
<!-- <a-form-model-item label="对应模块id" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="moduleId">-->
<!-- <a-input v-model="model.moduleId" placeholder="请输入对应模块id" ></a-input>-->
<!-- </a-form-model-item>-->
<!-- </a-col>-->
<!-- <a-col :span="24">-->
<!-- <a-form-model-item label="对应功能id" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="functionId">-->
<!-- <a-input v-model="model.functionId" placeholder="请输入对应功能id" ></a-input>-->
<!-- </a-form-model-item>-->
<!-- </a-col>-->
<!-- <a-col :span="24">-->
<!-- <a-form-model-item label="对应模块id" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="moduleId">-->
<!-- <a-input v-model="model.moduleId" placeholder="请输入对应模块id" ></a-input>-->
<!-- </a-form-model-item>-->
<!-- </a-col>-->
<!-- <a-col :span="24">-->
<!-- <a-form-model-item label="对应功能id" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="functionId">-->
<!-- <a-input v-model="model.functionId" placeholder="请输入对应功能id" ></a-input>-->
<!-- </a-form-model-item>-->
<!-- </a-col>-->
<a-col :span="24">
<a-form-model-item label="规则序号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ruleNo">
<a-input v-model="model.ruleNo" placeholder="请输入规则序号" disabled></a-input>
<a-input v-model="model.ruleNo" placeholder="请输入规则序号" disabled></a-input>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="规则编码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ruleCode">
<a-input v-model="model.ruleCode" placeholder="请输入规则编码" ></a-input>
<a-input v-model="model.ruleCode" placeholder="请输入规则编码"></a-input>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="对应实体" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="tableId">
<j-dict-select-tag type="list" v-model="model.tableId" :dictCode=table placeholder="请选择对应实体" disabled/>
<j-dict-select-tag type="list" v-model="model.tableId" :dictCode=table placeholder="请选择对应实体" disabled />
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="对应字段" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="fieldId">
<j-dict-select-tag type="list" v-model="model.fieldId" :dictCode=field placeholder="请选择对应字段" />
<j-dict-select-tag type="list" v-model="model.fieldId" :dictCode=field placeholder="请选择对应字段" />
</a-form-model-item>
</a-col>
<!-- <a-col :span="24">-->
<!-- <a-form-model-item label="责任人" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="managerUsers">-->
<!-- <a-input v-model="model.managerUsers" placeholder="请输入责任人" ></a-input>-->
<!-- </a-form-model-item>-->
<!-- </a-col>-->
<!-- <a-col :span="24">-->
<!-- <a-form-model-item label="责任人" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="managerUsers">-->
<!-- <a-input v-model="model.managerUsers" placeholder="请输入责任人" ></a-input>-->
<!-- </a-form-model-item>-->
<!-- </a-col>-->
<a-col :span="24">
<a-form-model-item label="任务等级" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="workLevel">
<j-dict-select-tag type="list" v-model="model.workLevel" dictCode="work_level" placeholder="请选择任务等级" />
<!-- 回去后台取对应数据-->
<j-dict-select-tag type="radio" v-model="model.workLevel" dictCode="work_level" placeholder="请选择任务等级" />
</a-form-model-item>
</a-col>
<!-- <a-col :span="24">-->
<!-- <a-form-model-item label="任务状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="workStatus">-->
<!-- <j-dict-select-tag type="list" v-model="model.workStatus" dictCode="" placeholder="请选择任务状态" />-->
<!-- </a-form-model-item>-->
<!-- </a-col>-->
<!-- <a-col :span="24">-->
<!-- <a-form-model-item label="任务状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="workStatus">-->
<!-- <j-dict-select-tag type="list" v-model="model.workStatus" dictCode="" placeholder="请选择任务状态" />-->
<!-- </a-form-model-item>-->
<!-- </a-col>-->
<a-col :span="24">
<a-form-model-item label="任务时长" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="duration">
<a-form-model-item label="任务时长" labelAlign="right" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="duration">
<a-input-number v-model="model.duration" placeholder="请输入任务时长" style="width: 100%" />
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="分析图" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="diagrams">
<j-image-upload isMultiple v-model="model.diagrams" ></j-image-upload>
<j-image-upload isMultiple v-model="model.diagrams"></j-image-upload>
</a-form-model-item>
</a-col>
</a-row>
<a-row>
<a-col :span="24">
<a-form-model-item label="规则描述" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="pmDescribe">
<j-editor v-model="model.pmDescribe" />
<a-col >
<a-form-model-item label="规则描述" :labelCol="labelCol1" :wrapperCol="wrapperCol1" prop="pmDescribe" >
<j-editor v-model="model.pmDescribe"/>
<!-- :labelCol="{ span: 2 }" :wrapperCol="{ span: 22 }" -->
</a-form-model-item>
</a-col>
</a-row>
@ -77,154 +79,181 @@
<script>
import { httpAction, getAction } from '@/api/manage'
import { validateDuplicateValue } from '@/utils/util'
import { httpAction, getAction } from '@/api/manage'
import { validateDuplicateValue } from '@/utils/util'
export default {
name: 'RulexForm',
components: {
export default {
name: 'RulexForm',
components: {
},
props: {
//
disabled: {
type: Boolean,
default: false,
required: false
}
},
data() {
return {
model: {
ruleNo: '',
ruleCode: ''
},
labelCol1: {
xs: { span: 24 },
sm: { span: 3 },
},
wrapperCol1: {
xs: { span: 24 },
sm: { span: 20 },
},
labelCol: {
xs: { span: 24 },
sm: { span: 6 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 },
},
// labelCol: { // 24label a
// xxl: 5, // 1600px
// xl: 8, // 1200px
// lg: 10, // 992px
// md: 12 // 768px
// },
// wrapperCol: { // 24label 24-a
// xxl: 19,
// xl: 16,
// lg: 14,
// md: 12},
confirmLoading: false,
validatorRules: {
moduleId: [
{ required: true, message: '请输入对应模块id!' },
],
functionId: [
{ required: true, message: '请输入对应功能id!' },
],
ruleNo: [
{ required: true, message: '请输入规则序号!' },
],
ruleCode: [
{ required: true, message: '请输入规则编码!' },
],
tableId: [
{ required: true, message: '请输入对应实体id!' },
],
// fieldId: [
// { required: true, message: '!'},
// ],
workLevel: [
{ required: true, message: '请输入任务等级!' },
],
workStatus: [
{ required: true, message: '请输入任务状态!' },
],
realDuration: [
{ required: true, message: '请输入实际时长!' },
],
status: [
{ required: true, message: '请输入规则状态!' },
],
verisonStatus: [
{ required: true, message: '请输入版本状态!' },
],
verison: [
{ required: true, message: '请输入版本号!' },
],
},
url: {
add: "/rulex/rulex/add",
edit: "/rulex/rulex/edit",
queryById: "/rulex/rulex/queryById",
query: 'modulex/modulex/queryById',
sort: '/rulex/rulex/sort'
},
table: 'tablex,table_name,id',
field: 'fieldx,field_name,id',
}
},
computed: {
formDisabled() {
return this.disabled
},
props: {
//
disabled: {
type: Boolean,
default: false,
required: false
}
},
created() {
//model
this.model.moduleId = this.$route.query.moduleid
// this.table="tablex,table_name,id,module_id="+this.model.moduleId
this.model.functionId = this.$route.query.functionid
this.sort()
this.shiti()
this.modelDefault = JSON.parse(JSON.stringify(this.model));
console.log(this.modelDefault,'2222');
},
methods: {
sort() {
getAction(this.url.sort, { id: this.model.functionId }).then((res) => {
console.log(res)
this.model.ruleNo = res.result.substring(0, 3);
this.model.ruleCode = res.result.substring(3) + this.model.ruleNo;
console.log(this.model.ruleNo)
})
},
data () {
return {
model:{
ruleNo:'',
ruleCode:''
},
labelCol: {
xs: { span: 24 },
sm: { span: 5 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 },
},
confirmLoading: false,
validatorRules: {
moduleId: [
{ required: true, message: '请输入对应模块id!'},
],
functionId: [
{ required: true, message: '请输入对应功能id!'},
],
ruleNo: [
{ required: true, message: '请输入规则序号!'},
],
ruleCode: [
{ required: true, message: '请输入规则编码!'},
],
tableId: [
{ required: true, message: '请输入对应实体id!'},
],
// fieldId: [
// { required: true, message: '!'},
// ],
workLevel: [
{ required: true, message: '请输入任务等级!'},
],
workStatus: [
{ required: true, message: '请输入任务状态!'},
],
realDuration: [
{ required: true, message: '请输入实际时长!'},
],
status: [
{ required: true, message: '请输入规则状态!'},
],
verisonStatus: [
{ required: true, message: '请输入版本状态!'},
],
verison: [
{ required: true, message: '请输入版本号!'},
],
},
url: {
add: "/rulex/rulex/add",
edit: "/rulex/rulex/edit",
queryById: "/rulex/rulex/queryById",
query:'modulex/modulex/queryById',
sort:'/rulex/rulex/sort'
},
table:'tablex,table_name,id',
field:'fieldx,field_name,id',
}
shiti() {
getAction(this.url.query, { id: this.model.moduleId }).then((res) => {
this.model.tableId = res.result.relatedBean
this.field = "fieldx,field_name,id,table_id=" + this.model.tableId;
console.log(this.model.tableId, "-----------")
})
},
computed: {
formDisabled(){
return this.disabled
},
ziduan() {
this.field = "fieldx,field_name,id,table_id=" + this.model.tableId;
},
created () {
//model
this.model.moduleId=this.$route.query.moduleid
// this.table="tablex,table_name,id,module_id="+this.model.moduleId
this.model.functionId=this.$route.query.functionid
this.sort()
this.shiti()
this.modelDefault = JSON.parse(JSON.stringify(this.model));
add() {
this.edit(this.modelDefault);
},
methods: {
sort(){
getAction(this.url.sort,{id:this.model.functionId}).then((res)=>{
console.log(res)
this.model.ruleNo=res.result.substring(0,3);
this.model.ruleCode=res.result.substring(3)+this.model.ruleNo;
console.log(this.model.ruleNo)
})
},
shiti(){
getAction(this.url.query,{id:this.model.moduleId}).then((res)=>{
this.model.tableId=res.result.relatedBean
this.field="fieldx,field_name,id,table_id="+this.model.tableId;
console.log(this.model.tableId,"-----------")
})
},
ziduan(){
this.field="fieldx,field_name,id,table_id="+this.model.tableId;
},
add () {
this.edit(this.modelDefault);
},
edit (record) {
this.model = Object.assign({}, record);
this.visible = true;
},
submitForm () {
const that = this;
//
this.$refs.form.validate(valid => {
if (valid) {
that.confirmLoading = true;
let httpurl = '';
let method = '';
if(!this.model.id){
httpurl+=this.url.add;
method = 'post';
}else{
httpurl+=this.url.edit;
method = 'put';
}
httpAction(httpurl,this.model,method).then((res)=>{
if(res.success){
that.$message.success(res.message);
that.$emit('ok');
}else{
that.$message.warning(res.message);
}
}).finally(() => {
that.confirmLoading = false;
})
edit(record) {
this.model = Object.assign({}, record);
this.visible = true;
},
submitForm() {
const that = this;
//
this.$refs.form.validate(valid => {
if (valid) {
that.confirmLoading = true;
let httpurl = '';
let method = '';
if (!this.model.id) {
httpurl += this.url.add;
method = 'post';
} else {
httpurl += this.url.edit;
method = 'put';
}
httpAction(httpurl, this.model, method).then((res) => {
if (res.success) {
that.$message.success(res.message);
that.$emit('ok');
} else {
that.$message.warning(res.message);
}
}).finally(() => {
that.confirmLoading = false;
})
}
})
},
}
})
},
}
</script>
}
</script>
<style lang="less" scoped>
/deep/.ant-col-24 .ant-form-item .ant-col-xs-24 {
text-align: center;
}
</style>
Loading…
Cancel
Save