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"> <j-form-container :disabled="formDisabled">
<a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail"> <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
<a-row> <a-row>
<!-- <a-col :span="24">--> <!-- <a-col :span="24">-->
<!-- <a-form-model-item label="对应模块id" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="moduleId">--> <!-- <a-form-model-item label="对应模块id" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="moduleId">-->
<!-- <a-input v-model="model.moduleId" placeholder="请输入对应模块id" ></a-input>--> <!-- <a-input v-model="model.moduleId" placeholder="请输入对应模块id" ></a-input>-->
<!-- </a-form-model-item>--> <!-- </a-form-model-item>-->
<!-- </a-col>--> <!-- </a-col>-->
<!-- <a-col :span="24">--> <!-- <a-col :span="24">-->
<!-- <a-form-model-item label="对应功能id" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="functionId">--> <!-- <a-form-model-item label="对应功能id" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="functionId">-->
<!-- <a-input v-model="model.functionId" placeholder="请输入对应功能id" ></a-input>--> <!-- <a-input v-model="model.functionId" placeholder="请输入对应功能id" ></a-input>-->
<!-- </a-form-model-item>--> <!-- </a-form-model-item>-->
<!-- </a-col>--> <!-- </a-col>-->
<a-col :span="24"> <a-col :span="24">
<a-form-model-item label="规则序号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ruleNo"> <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-form-model-item>
</a-col> </a-col>
<a-col :span="24"> <a-col :span="24">
<a-form-model-item label="规则编码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ruleCode"> <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-form-model-item>
</a-col> </a-col>
<a-col :span="24"> <a-col :span="24">
<a-form-model-item label="对应实体" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="tableId"> <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-form-model-item>
</a-col> </a-col>
<a-col :span="24"> <a-col :span="24">
<a-form-model-item label="对应字段" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="fieldId"> <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-form-model-item>
</a-col> </a-col>
<!-- <a-col :span="24">--> <!-- <a-col :span="24">-->
<!-- <a-form-model-item label="责任人" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="managerUsers">--> <!-- <a-form-model-item label="责任人" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="managerUsers">-->
<!-- <a-input v-model="model.managerUsers" placeholder="请输入责任人" ></a-input>--> <!-- <a-input v-model="model.managerUsers" placeholder="请输入责任人" ></a-input>-->
<!-- </a-form-model-item>--> <!-- </a-form-model-item>-->
<!-- </a-col>--> <!-- </a-col>-->
<a-col :span="24"> <a-col :span="24">
<a-form-model-item label="任务等级" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="workLevel"> <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-form-model-item>
</a-col> </a-col>
<!-- <a-col :span="24">--> <!-- <a-col :span="24">-->
<!-- <a-form-model-item label="任务状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="workStatus">--> <!-- <a-form-model-item label="任务状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="workStatus">-->
<!-- <j-dict-select-tag type="list" v-model="model.workStatus" dictCode="" placeholder="请选择任务状态" />--> <!-- <j-dict-select-tag type="list" v-model="model.workStatus" dictCode="" placeholder="请选择任务状态" />-->
<!-- </a-form-model-item>--> <!-- </a-form-model-item>-->
<!-- </a-col>--> <!-- </a-col>-->
<a-col :span="24"> <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-input-number v-model="model.duration" placeholder="请输入任务时长" style="width: 100%" />
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
<a-col :span="24"> <a-col :span="24">
<a-form-model-item label="分析图" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="diagrams"> <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-form-model-item>
</a-col> </a-col>
</a-row> </a-row>
<a-row> <a-row>
<a-col :span="24"> <a-col >
<a-form-model-item label="规则描述" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="pmDescribe"> <a-form-model-item label="规则描述" :labelCol="labelCol1" :wrapperCol="wrapperCol1" prop="pmDescribe" >
<j-editor v-model="model.pmDescribe" /> <j-editor v-model="model.pmDescribe"/>
<!-- :labelCol="{ span: 2 }" :wrapperCol="{ span: 22 }" -->
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
</a-row> </a-row>
@ -77,154 +79,181 @@
<script> <script>
import { httpAction, getAction } from '@/api/manage' import { httpAction, getAction } from '@/api/manage'
import { validateDuplicateValue } from '@/utils/util' import { validateDuplicateValue } from '@/utils/util'
export default { export default {
name: 'RulexForm', name: 'RulexForm',
components: { 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: { },
// created() {
disabled: { //model
type: Boolean, this.model.moduleId = this.$route.query.moduleid
default: false, // this.table="tablex,table_name,id,module_id="+this.model.moduleId
required: false 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 () { shiti() {
return { getAction(this.url.query, { id: this.model.moduleId }).then((res) => {
model:{ this.model.tableId = res.result.relatedBean
ruleNo:'', this.field = "fieldx,field_name,id,table_id=" + this.model.tableId;
ruleCode:'' console.log(this.model.tableId, "-----------")
}, })
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',
}
}, },
computed: { ziduan() {
formDisabled(){ this.field = "fieldx,field_name,id,table_id=" + this.model.tableId;
return this.disabled
},
}, },
created () { add() {
//model this.edit(this.modelDefault);
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));
}, },
methods: { edit(record) {
sort(){ this.model = Object.assign({}, record);
getAction(this.url.sort,{id:this.model.functionId}).then((res)=>{ this.visible = true;
console.log(res) },
this.model.ruleNo=res.result.substring(0,3); submitForm() {
this.model.ruleCode=res.result.substring(3)+this.model.ruleNo; const that = this;
console.log(this.model.ruleNo) //
}) this.$refs.form.validate(valid => {
}, if (valid) {
shiti(){ that.confirmLoading = true;
getAction(this.url.query,{id:this.model.moduleId}).then((res)=>{ let httpurl = '';
this.model.tableId=res.result.relatedBean let method = '';
this.field="fieldx,field_name,id,table_id="+this.model.tableId; if (!this.model.id) {
console.log(this.model.tableId,"-----------") httpurl += this.url.add;
}) method = 'post';
}, } else {
ziduan(){ httpurl += this.url.edit;
this.field="fieldx,field_name,id,table_id="+this.model.tableId; method = 'put';
},
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;
})
} }
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