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

@ -3,16 +3,16 @@
<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>
@ -20,14 +20,14 @@
</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">
@ -35,38 +35,40 @@
<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,10 +79,10 @@
<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: {
}, },
@ -92,111 +94,133 @@
required: false required: false
} }
}, },
data () { data() {
return { return {
model:{ model: {
ruleNo:'', ruleNo: '',
ruleCode:'' ruleCode: ''
},
labelCol1: {
xs: { span: 24 },
sm: { span: 3 },
},
wrapperCol1: {
xs: { span: 24 },
sm: { span: 20 },
}, },
labelCol: { labelCol: {
xs: { span: 24 }, xs: { span: 24 },
sm: { span: 5 }, sm: { span: 6 },
}, },
wrapperCol: { wrapperCol: {
xs: { span: 24 }, xs: { span: 24 },
sm: { span: 16 }, 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, confirmLoading: false,
validatorRules: { validatorRules: {
moduleId: [ moduleId: [
{ required: true, message: '请输入对应模块id!'}, { required: true, message: '请输入对应模块id!' },
], ],
functionId: [ functionId: [
{ required: true, message: '请输入对应功能id!'}, { required: true, message: '请输入对应功能id!' },
], ],
ruleNo: [ ruleNo: [
{ required: true, message: '请输入规则序号!'}, { required: true, message: '请输入规则序号!' },
], ],
ruleCode: [ ruleCode: [
{ required: true, message: '请输入规则编码!'}, { required: true, message: '请输入规则编码!' },
], ],
tableId: [ tableId: [
{ required: true, message: '请输入对应实体id!'}, { required: true, message: '请输入对应实体id!' },
], ],
// fieldId: [ // fieldId: [
// { required: true, message: '!'}, // { required: true, message: '!'},
// ], // ],
workLevel: [ workLevel: [
{ required: true, message: '请输入任务等级!'}, { required: true, message: '请输入任务等级!' },
], ],
workStatus: [ workStatus: [
{ required: true, message: '请输入任务状态!'}, { required: true, message: '请输入任务状态!' },
], ],
realDuration: [ realDuration: [
{ required: true, message: '请输入实际时长!'}, { required: true, message: '请输入实际时长!' },
], ],
status: [ status: [
{ required: true, message: '请输入规则状态!'}, { required: true, message: '请输入规则状态!' },
], ],
verisonStatus: [ verisonStatus: [
{ required: true, message: '请输入版本状态!'}, { required: true, message: '请输入版本状态!' },
], ],
verison: [ verison: [
{ required: true, message: '请输入版本号!'}, { required: true, message: '请输入版本号!' },
], ],
}, },
url: { url: {
add: "/rulex/rulex/add", add: "/rulex/rulex/add",
edit: "/rulex/rulex/edit", edit: "/rulex/rulex/edit",
queryById: "/rulex/rulex/queryById", queryById: "/rulex/rulex/queryById",
query:'modulex/modulex/queryById', query: 'modulex/modulex/queryById',
sort:'/rulex/rulex/sort' sort: '/rulex/rulex/sort'
}, },
table:'tablex,table_name,id', table: 'tablex,table_name,id',
field:'fieldx,field_name,id', field: 'fieldx,field_name,id',
} }
}, },
computed: { computed: {
formDisabled(){ formDisabled() {
return this.disabled return this.disabled
}, },
}, },
created () { created() {
//model //model
this.model.moduleId=this.$route.query.moduleid this.model.moduleId = this.$route.query.moduleid
// this.table="tablex,table_name,id,module_id="+this.model.moduleId // this.table="tablex,table_name,id,module_id="+this.model.moduleId
this.model.functionId=this.$route.query.functionid this.model.functionId = this.$route.query.functionid
this.sort() this.sort()
this.shiti() this.shiti()
this.modelDefault = JSON.parse(JSON.stringify(this.model)); this.modelDefault = JSON.parse(JSON.stringify(this.model));
console.log(this.modelDefault,'2222');
}, },
methods: { methods: {
sort(){ sort() {
getAction(this.url.sort,{id:this.model.functionId}).then((res)=>{ getAction(this.url.sort, { id: this.model.functionId }).then((res) => {
console.log(res) console.log(res)
this.model.ruleNo=res.result.substring(0,3); this.model.ruleNo = res.result.substring(0, 3);
this.model.ruleCode=res.result.substring(3)+this.model.ruleNo; this.model.ruleCode = res.result.substring(3) + this.model.ruleNo;
console.log(this.model.ruleNo) console.log(this.model.ruleNo)
}) })
}, },
shiti(){ shiti() {
getAction(this.url.query,{id:this.model.moduleId}).then((res)=>{ getAction(this.url.query, { id: this.model.moduleId }).then((res) => {
this.model.tableId=res.result.relatedBean this.model.tableId = res.result.relatedBean
this.field="fieldx,field_name,id,table_id="+this.model.tableId; this.field = "fieldx,field_name,id,table_id=" + this.model.tableId;
console.log(this.model.tableId,"-----------") console.log(this.model.tableId, "-----------")
}) })
}, },
ziduan(){ ziduan() {
this.field="fieldx,field_name,id,table_id="+this.model.tableId; this.field = "fieldx,field_name,id,table_id=" + this.model.tableId;
}, },
add () { add() {
this.edit(this.modelDefault); this.edit(this.modelDefault);
}, },
edit (record) { edit(record) {
this.model = Object.assign({}, record); this.model = Object.assign({}, record);
this.visible = true; this.visible = true;
}, },
submitForm () { submitForm() {
const that = this; const that = this;
// //
this.$refs.form.validate(valid => { this.$refs.form.validate(valid => {
@ -204,18 +228,18 @@
that.confirmLoading = true; that.confirmLoading = true;
let httpurl = ''; let httpurl = '';
let method = ''; let method = '';
if(!this.model.id){ if (!this.model.id) {
httpurl+=this.url.add; httpurl += this.url.add;
method = 'post'; method = 'post';
}else{ } else {
httpurl+=this.url.edit; httpurl += this.url.edit;
method = 'put'; method = 'put';
} }
httpAction(httpurl,this.model,method).then((res)=>{ httpAction(httpurl, this.model, method).then((res) => {
if(res.success){ if (res.success) {
that.$message.success(res.message); that.$message.success(res.message);
that.$emit('ok'); that.$emit('ok');
}else{ } else {
that.$message.warning(res.message); that.$message.warning(res.message);
} }
}).finally(() => { }).finally(() => {
@ -226,5 +250,10 @@
}) })
}, },
} }
} }
</script> </script>
<style lang="less" scoped>
/deep/.ant-col-24 .ant-form-item .ant-col-xs-24 {
text-align: center;
}
</style>
Loading…
Cancel
Save