This commit is contained in:
zhaomeijing
2022-04-19 18:41:16 +08:00
parent c1a5e0256e
commit 3cb94f601c
@@ -1,7 +1,7 @@
<template>
<a-spin :spinning="confirmLoading">
<!-- <j-form-container :disabled="formDisabled">-->
<div class="form-tag">
<!-- <j-form-container :disabled="formDisabled">-->
<div class="form-tag">
<a-form>
<a-form-model
class="tag-content"
@@ -11,498 +11,492 @@
:label-col="labelCol"
:wrapper-col="wrapperCol"
>
<a-row>
<p class="tag-info">{{$t('essentialInformation')}}</p>
<a-divider dashed />
<!-- 所属模块-->
<a-col :span="24">
<a-form-model-item :label="$t('Module')" prop="isModel">
<!-- <j-dict-select-tag type="list" v-model="form.isModel" dictCode="module" :placeholder="$t('PleaseSelectModule')" />-->
<a-select :placeholder="$t('PleaseSelectModule')" v-model="form.isModel" @change="handleChange" :disabled="disableEdit">
<a-select-option :key="'1'" :value="'1'">
{{$t('DocumentLibrary')}}
</a-select-option>
<a-select-option :key="'0'" :value="'0'">
{{$t('DocumentSplitting')}}
</a-select-option>
</a-select>
</a-form-model-item>
</a-col>
<!-- 属性名称-->
<a-col :span="24">
<a-form-model-item :label="$t('AttributeName')" prop="dbFieldTxt">
<a-input v-model="form.dbFieldTxt" :placeholder="$t('PleaseEnterPropertyName')" :maxLength="120" ></a-input>
</a-form-model-item>
</a-col>
<!-- 英文名称-->
<a-col :span="24">
<a-form-model-item :label="$t('enName')" prop="dbFieldEnName">
<a-input v-model="form.dbFieldEnName" :placeholder="$t('PleaseEnterYourEnglishName')" :maxLength="120" ></a-input>
</a-form-model-item>
</a-col>
<!-- 属性类型-->
<a-col :span="24">
<a-form-model-item :label="$t('AttributeType')" prop="fieldShowType" >
<j-dict-select-tag type="list" v-model="form.fieldShowType" dictCode="field_show_type" :placeholder="$t('PleaseSelectAttributeType')" :disabled="disabledEdit" />
</a-form-model-item>
</a-col>
<a-col :span="24" v-if="isTagContent">
<a-form-model-item :label="$t('OptionContent')" prop="dictId">
<template>
<a-select :placeholder="$t('PleaseSelectOptionContent')" v-model="form.dictId" @change="handleChange">
<a-select-option v-for="(item,index) in contentOption" :key="item.id" :value="item.id">
{{item.dictName}}
</a-select-option>
</a-select>
</template>
<!-- <j-dict-select-tag type="list" v-model="form.dictName" dictCode="" placeholder="请选择选项内容" />-->
</a-form-model-item>
</a-col>
<a-col :span="24" v-if="isLength">
<a-form-model-item :label="$t('FieldLength')" prop="dbLength">
<a-input-number v-model="form.dbLength" :min="1" :max="200" :placeholder="$t('PleaseEnterFieldLength')" style="width: 100%" :formatter="limitNumber" :parser="limitNumber" />
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item :label="$t('DisplayOrder')" prop="orderNum">
<a-input-number v-model="form.orderNum" :placeholder="$t('PleaseEnterDisplayOrder')" style="width: 100%" :min="1" :formatter="limitNumber" :parser="limitNumber" />
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item :label="$t('Required')" prop="fieldMustInput">
<j-dict-select-tag type="list" v-model="form.fieldMustInput" dictCode="yn" :placeholder="$t('selectWhetherRequired')" />
</a-form-model-item>
</a-col>
<p class="tag-info">{{submitKey == 1 ? $t('DocumentLibraryModuleDisplay'):$t('documentSplitDisplay')}}</p>
<a-divider dashed />
<a-col :span="24">
<!-- 文档库列表展示-->
<a-form-model-item :label="$t('DocumentLibraryListDisplay')" prop="isShowList" v-if="submitKey == 1">
<j-dict-select-tag type="list" v-model="form.isShowList" dictCode="yn"
:placeholder="$t('selectDisplayList')" />
<a-row>
<p class="tag-info">{{$t('essentialInformation')}}</p>
<a-divider dashed />
<!-- 所属模块-->
<a-col :span="24">
<a-form-model-item :label="$t('Module')" prop="isModel">
<!-- <j-dict-select-tag type="list" v-model="form.isModel" dictCode="module" :placeholder="$t('PleaseSelectModule')" />-->
<a-select :placeholder="$t('PleaseSelectModule')" v-model="form.isModel" @change="handleChange" :disabled="disableEdit">
<a-select-option :key="'1'" :value="'1'">
{{$t('DocumentLibrary')}}
</a-select-option>
<a-select-option :key="'0'" :value="'0'">
{{$t('DocumentSplitting')}}
</a-select-option>
</a-select>
</a-form-model-item>
</a-col>
<!-- 属性名称-->
<a-col :span="24">
<a-form-model-item :label="$t('AttributeName')" prop="dbFieldTxt">
<a-input v-model="form.dbFieldTxt" :placeholder="$t('PleaseEnterPropertyName')" :maxLength="120" ></a-input>
</a-form-model-item>
</a-col>
<!-- 英文名称-->
<a-col :span="24">
<a-form-model-item :label="$t('enName')" prop="dbFieldEnName">
<a-input v-model="form.dbFieldEnName" :placeholder="$t('PleaseEnterYourEnglishName')" :maxLength="120" ></a-input>
</a-form-model-item>
</a-col>
<!-- 属性类型-->
<a-col :span="24">
<a-form-model-item :label="$t('AttributeType')" prop="fieldShowType" >
<j-dict-select-tag type="list" v-model="form.fieldShowType" dictCode="field_show_type" :placeholder="$t('PleaseSelectAttributeType')" :disabled="disabledEdit" />
</a-form-model-item>
</a-col>
<a-col :span="24" v-if="isTagContent">
<a-form-model-item :label="$t('OptionContent')" prop="dictId">
<template>
<a-select :placeholder="$t('PleaseSelectOptionContent')" v-model="form.dictId" @change="handleChange">
<a-select-option v-for="(item,index) in contentOption" :key="item.id" :value="item.id">
{{item.dictName}}
</a-select-option>
</a-select>
</template>
<!-- <j-dict-select-tag type="list" v-model="form.dictName" dictCode="" placeholder="请选择选项内容" />-->
</a-form-model-item>
</a-col>
<a-col :span="24" v-if="isLength">
<a-form-model-item :label="$t('FieldLength')" prop="dbLength">
<a-input-number v-model="form.dbLength" :min="1" :max="200" :placeholder="$t('PleaseEnterFieldLength')" style="width: 100%" :formatter="limitNumber" :parser="limitNumber" />
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item :label="$t('DisplayOrder')" prop="orderNum">
<a-input-number v-model="form.orderNum" :placeholder="$t('PleaseEnterDisplayOrder')" style="width: 100%" :min="1" :formatter="limitNumber" :parser="limitNumber" />
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item :label="$t('Required')" prop="fieldMustInput">
<j-dict-select-tag type="list" v-model="form.fieldMustInput" dictCode="yn" :placeholder="$t('selectWhetherRequired')" />
</a-form-model-item>
</a-col>
<p class="tag-info">{{submitKey == 1?$t('DocumentLibraryModuleDisplay'):$t('documentSplitDisplay')}}</p>
<a-divider dashed />
<a-col :span="24">
<a-form-model-item :label="$t('DocumentLibraryListDisplay')" prop="isShowList" v-if="submitKey == 1">
<j-dict-select-tag type="list" v-model="form.isShowList" dictCode="yn"
:placeholder="$t('selectDisplayList')" />
</a-form-model-item>
<!-- 文档拆分列表展示-->
<a-form-model-item :label="$t('documentSplitList')" prop="isShowList" v-if="submitKey == 2">
<j-dict-select-tag type="list" v-model="form.isShowList" dictCode="yn"
:placeholder="$t('selectDisplayList')" />
</a-form-model-item>
</a-col>
<a-col :span="24" v-if="moduleShow">
<!-- 展示区域-->
<a-form-model-item :label="$t('DisplayArea')" prop="showArea">
<a-select :placeholder="$t('SelectDisplayArea')" v-model="form.showArea" @change="handleChange">
<a-select-option v-for="(item,index) in areaOptions" :key="item.id" :value="item.id">
{{item.showArea}}
</a-select-option>
</a-select>
<!-- <j-dict-select-tag type="list" v-model="form.showArea" dictCode="" placeholder="请选择展示区域" />-->
</a-form-model-item>
</a-col>
<a-col :span="24" v-if="isSearch">
<a-form-model-item :label="$t('Search')" prop="isQuery">
<j-dict-select-tag type="list" v-model="form.isQuery" dictCode="yn" :placeholder="$t('SelectWhetherToSearch')" />
</a-form-model-item>
</a-col>
</a-form-model-item>
<a-form-model-item :label="$t('documentSplitList')" prop="isShowList" v-if="submitKey == 2">
<j-dict-select-tag type="list" v-model="form.isShowList" dictCode="yn"
:placeholder="$t('selectDisplayList')" />
</a-form-model-item>
</a-col>
<a-col :span="24" v-if="moduleShow">
<a-form-model-item :label="$t('DisplayArea')" prop="showArea">
<a-select :placeholder="$t('SelectDisplayArea')" v-model="form.showArea" @change="handleChange">
<a-select-option v-for="(item,index) in areaOptions" :key="item.id" :value="item.id">
{{item.showArea}}
</a-select-option>
</a-select>
<!-- <j-dict-select-tag type="list" v-model="form.showArea" dictCode="" placeholder="请选择展示区域" />-->
</a-form-model-item>
</a-col>
<a-col :span="24" v-if="isSearch">
<a-form-model-item :label="$t('Search')" prop="isQuery">
<j-dict-select-tag type="list" v-model="form.isQuery" dictCode="yn" :placeholder="$t('SelectWhetherToSearch')" />
</a-form-model-item>
</a-col>
<p class="tag-info" v-if="moduleShow">{{$t('DisplayOtherModules')}}</p>
<a-divider dashed v-if="moduleShow" />
<a-col :span="24" v-if="moduleShow">
<a-form-model-item :label="$t('RegulationsListDisplay')" prop="isShowLawsList">
<j-dict-select-tag type="list" v-model="form.isShowLawsList" dictCode="yn" :placeholder="$t('selectDisplayListRegulations')" />
</a-form-model-item>
</a-col>
<a-col :span="24" v-if="moduleShow">
<a-form-model-item :label="$t('SearchCenterDisplay')" prop="isShowSearch">
<j-dict-select-tag type="list" v-model="form.isShowSearch" dictCode="yn" :placeholder="$t('selectSearchCenterDisplayed')" />
</a-form-model-item>
</a-col>
<!-- <a-col v-if="showFlowSubmitButton" :span="24" style="text-align: center">-->
<!-- <a-button @click="submitForm">提 交</a-button>-->
<!-- </a-col>-->
</a-row>
<p class="tag-info" v-if="moduleShow">{{$t('DisplayOtherModules')}}</p>
<a-divider dashed v-if="moduleShow" />
<a-col :span="24" v-if="moduleShow">
<a-form-model-item :label="$t('RegulationsListDisplay')" prop="isShowLawsList">
<j-dict-select-tag type="list" v-model="form.isShowLawsList" dictCode="yn" :placeholder="$t('selectDisplayListRegulations')" />
</a-form-model-item>
</a-col>
<a-col :span="24" v-if="moduleShow">
<a-form-model-item :label="$t('SearchCenterDisplay')" prop="isShowSearch">
<j-dict-select-tag type="list" v-model="form.isShowSearch" dictCode="yn" :placeholder="$t('selectSearchCenterDisplayed')" />
</a-form-model-item>
</a-col>
<!-- <a-col v-if="showFlowSubmitButton" :span="24" style="text-align: center">-->
<!-- <a-button @click="submitForm">提 交</a-button>-->
<!-- </a-col>-->
</a-row>
</a-form-model>
</a-form>
</div>
<!-- </j-form-container>-->
</div>
<!-- </j-form-container>-->
</a-spin>
</template>
<script>
import { httpAction, getAction, postAction } from '@/api/manage'
import pick from 'lodash.pick'
import { validateDuplicateValue } from '@/utils/util'
import { httpAction, getAction, postAction } from '@/api/manage'
import pick from 'lodash.pick'
import { validateDuplicateValue } from '@/utils/util'
export default {
name: 'TagForm',
components: {
export default {
name: 'TagForm',
components: {
},
props: {
//流程表单data
formData: {
type: Object,
default: ()=>{},
required: false
},
props: {
//流程表单data
formData: {
type: Object,
default: ()=>{},
required: false
//表单模式:true流程表单 false普通表单
formBpm: {
type: Boolean,
default: false,
required: false
},
//表单禁用
disabled: {
type: Boolean,
default: false,
required: false
},
drawerVisible:{
type: Boolean,
default: false,
},
editData:{
type: Object,
default:{}
},
editId:{
type:String,
default:''
},
submitEdit:{
type:String,
default:''
},
disableEdit:{
type:Boolean,
default:false
},
submitKey:{
type:String,
default:'1'
}
},
data () {
return {
form: {},
model: {},
labelCol: {
xs: { span: 24 },
sm: { span: 6 },
},
//表单模式:true流程表单 false普通表单
formBpm: {
type: Boolean,
default: false,
required: false
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 },
},
//表单禁用
disabled: {
type: Boolean,
default: false,
required: false
confirmLoading: false,
validatorRules: {
isModel: [
{ required: true, message: this.$t('PleaseSelectModule'),trigger: 'change'},
],
dbFieldTxt: [
{ required: true, message: this.$t('PleaseEnterPropertyName'),trigger: 'blur'},
{ min:1, max: 20, message: this.$t('cantExeed')+'20'+this.$t('characters'), trigger: 'blur' },
],
dbFieldName: [
{ required: true, message: this.$t('PleaseEnterYourEnglishName'),trigger: 'blur'},
{ min:1, max: 20, message: this.$t('cantExeed')+'20'+this.$t('characters'), trigger: 'blur' },
],
dbFieldEnName:[
{ max: 50, message: this.$t('cantExeed')+'50'+this.$t('characters'), trigger: 'blur' },
],
fieldShowType: [
{ required: true, message: this.$t('PleaseSelectAttributeType'),trigger: 'change'},
],
dictId: [
{ required: true, message: this.$t('PleaseSelectOptionContent'),trigger: 'change'},
],
dbLength: [
{ required: true, message: this.$t('PleaseEnterFieldLength'),trigger: 'blur'},
],
orderNum: [
{ required: true, message: this.$t('PleaseEnterDisplayOrder'),trigger: 'blur'},
],
fieldMustInput: [
{ required: true, message: this.$t('selectWhetherRequired'),trigger: 'change'},
],
isShowList: [
{ required: true, message: this.$t('selectDisplayList'),trigger: 'change'},
],
showArea: [
{ required: true, message: this.$t('SelectDisplayArea'),trigger: 'change'},
],
isQuery: [
{ required: true, message: this.$t('SelectWhetherToSearch'),trigger: 'change'},
],
isShowLawsList: [
{ required: true, message: this.$t('selectDisplayListRegulations'),trigger: 'change'},
],
isShowSearch: [
{ required: true, message: this.$t('selectSearchCenterDisplayed'),trigger: 'change'},
],
},
drawerVisible:{
type: Boolean,
default: false,
addVisible:false,
url: {
add: "tag/onlCgformTag/add",
edit: "tag/onlCgformTag/edit",
queryById: "tag/onlCgformTag/queryById"
},
editData:{
type: Object,
default:{}
},
editId:{
type:String,
default:''
},
submitEdit:{
type:String,
default:''
},
disableEdit:{
type:Boolean,
default:false
},
submitKey:{
type:String,
default:'1'
//展示区域选项内容
areaOptions:[],
//选项内容选项
contentOption:[],
contentFlag:3,
contentOption1:[],
contentOption2:[],
isTagContent:false,
isSearch:true,
isLength:true,
flag:false, //表单提交标识
disabledEdit:false,
moduleShow:true
}
},
watch:{
'form.fieldShowType'(val){
// this.contentFlag=val
if(val==0){
this.contentOption=[...this.contentOption2]
this.isTagContent=true
}else if(val==3||val==4){
this.contentOption=[...this.contentOption1]
this.isTagContent=true
}else{
this.isTagContent=false
}
if(val==7){
this.isSearch=false
this.form.isQuery=0
}else{
this.isSearch=true
}
if(val==1||val==8||val==9||val==10||val==11||val=='sel_user'){
this.isLength=true
}else{
this.isLength=false
}
},
data () {
return {
form: {},
model: {},
labelCol: {
xs: { span: 24 },
sm: { span: 6 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 },
},
confirmLoading: false,
validatorRules: {
isModel: [
{ required: true, message: this.$t('PleaseSelectModule'),trigger: 'change'},
],
dbFieldTxt: [
{ required: true, message: this.$t('PleaseEnterPropertyName'),trigger: 'blur'},
{ min:1, max: 20, message: this.$t('cantExeed')+'20'+this.$t('characters'), trigger: 'blur' },
],
dbFieldName: [
{ required: true, message: this.$t('PleaseEnterYourEnglishName'),trigger: 'blur'},
{ min:1, max: 20, message: this.$t('cantExeed')+'20'+this.$t('characters'), trigger: 'blur' },
],
dbFieldEnName:[
{ max: 50, message: this.$t('cantExeed')+'50'+this.$t('characters'), trigger: 'blur' },
],
fieldShowType: [
{ required: true, message: this.$t('PleaseSelectAttributeType'),trigger: 'change'},
],
dictId: [
{ required: true, message: this.$t('PleaseSelectOptionContent'),trigger: 'change'},
],
dbLength: [
{ required: true, message: this.$t('PleaseEnterFieldLength'),trigger: 'blur'},
],
orderNum: [
{ required: true, message: this.$t('PleaseEnterDisplayOrder'),trigger: 'blur'},
],
fieldMustInput: [
{ required: true, message: this.$t('selectWhetherRequired'),trigger: 'change'},
],
isShowList: [
{ required: true, message: this.$t('selectDisplayList'),trigger: 'change'},
],
showArea: [
{ required: true, message: this.$t('SelectDisplayArea'),trigger: 'change'},
],
isQuery: [
{ required: true, message: this.$t('SelectWhetherToSearch'),trigger: 'change'},
],
isShowLawsList: [
{ required: true, message: this.$t('selectDisplayListRegulations'),trigger: 'change'},
],
isShowSearch: [
{ required: true, message: this.$t('selectSearchCenterDisplayed'),trigger: 'change'},
],
},
addVisible:false,
url: {
add: "tag/onlCgformTag/add",
edit: "tag/onlCgformTag/edit",
queryById: "tag/onlCgformTag/queryById"
},
//展示区域选项内容
areaOptions:[],
//选项内容选项
contentOption:[],
contentFlag:3,
contentOption1:[],
contentOption2:[],
isTagContent:false,
isSearch:true,
isLength:true,
flag:false, //表单提交标识
disabledEdit:false,
moduleShow:true
}
submitEdit(){
},
watch:{
'form.fieldShowType'(val){
// this.contentFlag=val
if(val==0){
this.contentOption=[...this.contentOption2]
this.isTagContent=true
}else if(val==3||val==4){
this.contentOption=[...this.contentOption1]
this.isTagContent=true
}else{
this.isTagContent=false
}
if(val==7){
this.isSearch=false
this.form.isQuery=0
}else{
this.isSearch=true
}
if(val==1||val==8||val==9||val==10||val==11||val=='sel_user'){
this.isLength=true
}else{
this.isLength=false
}
},
submitEdit(){
disableEdit(){
},
disableEdit(){
},
'form.isModel'(val){
console.log(form.isModel,'form.isModelform.isModel')
console.log('val',val)
if(val=='1'){
this.moduleShow=true
}else if(val=='0'){
this.moduleShow=false
}
}
},
computed: {
changeType(val){
// console.log('changtType',val)
},
formDisabled(){
if(this.formBpm===true){
if(this.formData.disabled===false){
return false
}
'form.isModel'(val){
console.log('val',val)
if(val=='1'){
this.moduleShow=true
}else if(val=='0'){
this.moduleShow=false
}
}
},
computed: {
changeType(val){
// console.log('changtType',val)
},
formDisabled(){
if(this.formBpm===true){
if(this.formData.disabled===false){
return false
}
return true
}
return this.disabled
},
showFlowSubmitButton(){
if(this.formBpm===true){
if(this.formData.disabled===false){
return true
}
return this.disabled
},
showFlowSubmitButton(){
if(this.formBpm===true){
if(this.formData.disabled===false){
return true
}
return false
}
},
created () {
//如果是流程中表单,则需要加载流程表单data
this.showFlowData();
},
mounted() {
// console.log('disableEdit',this.disableEdit)
this.loadContent()
this.loadShowArea()
// console.log('edit',this.submitEdit)
if(this.submitEdit==='add'){
if(this.submitKey==='1'){
this.form.isModel='1'
}else if(this.submitKey==='2'){
this.form.isModel='0'
}
this.disabledEdit=false
}else if(this.submitEdit==='edit'){
this.disabledEdit=true
this.form={...this.editData}
}
},
methods: {
//获取选项内容
loadContent(){
let params = {};
getAction(`sys/dict/queryDictName`,params).then((res)=>{
if(res.success){
let data=[...res.result]
this.contentOption1=[]
this.contentOption2=[]
data.map(res=>{
if(res.attributeType=='1'){
this.contentOption1.push(res)
}else if(res.attributeType=='2'){
this.contentOption2.push(res)
}
})
if(this.form.fieldShowType==0){
this.contentOption=[...this.contentOption2]
this.isTagContent=true
}else if(this.form.fieldShowType==3||this.form.fieldShowType=='4'){
this.contentOption=[...this.contentOption1]
this.isTagContent=true
}else{
this.isTagContent=false
}
}
return false
}
});
},
created () {
//如果是流程中表单,则需要加载流程表单data
this.showFlowData();
},
mounted() {
// console.log('disableEdit',this.disableEdit)
this.loadContent()
this.loadShowArea()
// console.log('edit',this.submitEdit)
if(this.submitEdit==='add'){
console.log(this.submitKey,'this.submitKeythis.submitKey')
if(this.submitKey==='1'){
console.log(this.submitKey,'this.submitKeythis.submitKey')
this.form.isModel='1'
}else if(this.submitKey==='2'){
this.form.isModel='0'
//获取展示区域
loadShowArea(){
let params = {};
getAction(`tag/onlCgformArea/queryShowArea`,params).then((res)=>{
if(res.success){
this.areaOptions=res.result
}
this.disabledEdit=false
}else if(this.submitEdit==='edit'){
this.disabledEdit=true
this.form={...this.editData}
});
},
add () {
this.edit({});
},
edit (record) {
this.form.resetFields();
this.model = Object.assign({}, record);
this.visible = true;
this.$nextTick(() => {
// this.form.setFieldsValue(pick(this.model,'isModel','dbFieldTxt','dbFieldName','fieldShowType','dictName','dbLength','orderNum','fieldMustInput','isShowList','showArea','isQuery','isShowLawsList','isShowSearch'))
})
},
//渲染流程表单数据
showFlowData(){
if(this.formBpm === true){
let params = {id:this.formData.dataId};
getAction(this.url.queryById,params).then((res)=>{
if(res.success){
this.edit (res.result);
}
});
}
},
methods: {
//获取选项内容
loadContent(){
let params = {};
getAction(`sys/dict/queryDictName`,params).then((res)=>{
if(res.success){
let data=[...res.result]
this.contentOption1=[]
this.contentOption2=[]
data.map(res=>{
if(res.attributeType=='1'){
this.contentOption1.push(res)
}else if(res.attributeType=='2'){
this.contentOption2.push(res)
submitForm () {
// const that = this;
// 触发表单验证
// console.log(this.$refs.tagform)
this.$refs.tagEditForm.validate((valid)=>{
// console.log('valid',valid)
if (valid) {
if(!this.flag){
this.flag=true
this.confirmLoading = true;
let httpurl = '';
let method = '';
// console.log('this.editId',this.editId)
if(this.submitEdit=='add'){
httpurl+=this.url.add;
method = 'post';
this.form.id=''
this.form.isReadOnly=0
}else if(this.submitEdit=='edit'){
httpurl+=this.url.edit;
method = 'put';
this.form.id=this.editId
}
this.form.dbIsKey='0'
this.form.dbIsNull='1'
this.form.dbPointLength='0'
this.form.isShowForm='1'
this.form.dbFieldName=this.form.dbFieldTxt
this.contentOption.forEach(item=>{
if(item.id==this.form.dictId){
// console.log('11111')
this.form.dictField=item.dictCode
this.form.dictText=item.dictName
}
})
if(this.form.fieldShowType==0){
this.contentOption=[...this.contentOption2]
this.isTagContent=true
}else if(this.form.fieldShowType==3||this.form.fieldShowType=='4'){
this.contentOption=[...this.contentOption1]
this.isTagContent=true
}else{
this.isTagContent=false
// console.log('form',this.form)
console.log('model',this.form.isModel)
let onlineId=''
let url=''
if(this.form.isModel=='1'){
onlineId='48308196e7b04761b533dc31bc899707'
}else if(this.form.isModel=='0'){
onlineId='c998a34ea4b84089932197ed0705c757'
}
}
});
},
//获取展示区域
loadShowArea(){
let params = {};
getAction(`tag/onlCgformArea/queryShowArea`,params).then((res)=>{
if(res.success){
this.areaOptions=res.result
}
});
},
add () {
this.edit({});
},
edit (record) {
this.form.resetFields();
this.model = Object.assign({}, record);
this.visible = true;
this.$nextTick(() => {
// this.form.setFieldsValue(pick(this.model,'isModel','dbFieldTxt','dbFieldName','fieldShowType','dictName','dbLength','orderNum','fieldMustInput','isShowList','showArea','isQuery','isShowLawsList','isShowSearch'))
})
},
//渲染流程表单数据
showFlowData(){
if(this.formBpm === true){
let params = {id:this.formData.dataId};
getAction(this.url.queryById,params).then((res)=>{
if(res.success){
this.edit (res.result);
}
});
}
},
submitForm () {
// const that = this;
// 触发表单验证
// console.log(this.$refs.tagform)
this.$refs.tagEditForm.validate((valid)=>{
// console.log('valid',valid)
if (valid) {
if(!this.flag){
this.flag=true
this.confirmLoading = true;
let httpurl = '';
let method = '';
// console.log('this.editId',this.editId)
if(this.submitEdit=='add'){
httpurl+=this.url.add;
method = 'post';
this.form.id=''
this.form.isReadOnly=0
}else if(this.submitEdit=='edit'){
httpurl+=this.url.edit;
method = 'put';
this.form.id=this.editId
}
this.form.dbIsKey='0'
this.form.dbIsNull='1'
this.form.dbPointLength='0'
this.form.isShowForm='1'
this.form.dbFieldName=this.form.dbFieldTxt
this.contentOption.forEach(item=>{
if(item.id==this.form.dictId){
// console.log('11111')
this.form.dictField=item.dictCode
this.form.dictText=item.dictName
}
})
// console.log('form',this.form)
console.log('model',this.form.isModel)
let onlineId=''
let url=''
if(this.form.isModel=='1'){
onlineId='48308196e7b04761b533dc31bc899707'
}else if(this.form.isModel=='0'){
onlineId='c998a34ea4b84089932197ed0705c757'
}
httpAction(httpurl,this.form,method).then((res)=>{
if(res.success){
this.$message.success(this.$t('OperationSuccessful'));
postAction(`online/cgform/api/doDbSynch/${onlineId}/normal
httpAction(httpurl,this.form,method).then((res)=>{
if(res.success){
this.$message.success(this.$t('OperationSuccessful'));
postAction(`online/cgform/api/doDbSynch/${onlineId}/normal
`,{}).then(res=>{
})
this.$emit('ok',false);
}else{
this.$message.warning(res.message);
}
}).finally(() => {
this.confirmLoading = false;
this.flag=false
})
}
})
this.$emit('ok',false);
}else{
this.$message.warning(res.message);
}
}).finally(() => {
this.confirmLoading = false;
this.flag=false
})
}
})
},
popupCallback(row){
this.form.setFieldsValue(pick(row,'isModel','dbFieldTxt','dbFieldName','fieldShowType','dictName','dbLength','orderNum','fieldMustInput','isShowForm','areaId','isQuery','isShowLawsList','isShowSearch'))
},
//正则替换小数点
limitNumber(value) {
if (typeof value === 'string') {
return !isNaN(Number(value)) ? value.replace(/\./g, '') : 0
} else if (typeof value === 'number') {
return !isNaN(value) ? String(value).replace(/\./g, '') : 0
} else {
return 0
}
},
handleChange(value) {
// console.log(`selected ${value}`);
},
}
})
},
popupCallback(row){
this.form.setFieldsValue(pick(row,'isModel','dbFieldTxt','dbFieldName','fieldShowType','dictName','dbLength','orderNum','fieldMustInput','isShowForm','areaId','isQuery','isShowLawsList','isShowSearch'))
},
//正则替换小数点
limitNumber(value) {
if (typeof value === 'string') {
return !isNaN(Number(value)) ? value.replace(/\./g, '') : 0
} else if (typeof value === 'number') {
return !isNaN(value) ? String(value).replace(/\./g, '') : 0
} else {
return 0
}
},
handleChange(value) {
// console.log(`selected ${value}`);
},
}
}
</script>
<style lang="less" scoped>
.form-tag{
.tag-content{
}
}
.tag-info{
margin-left: 30px;
.form-tag{
.tag-content{
}
}
.tag-info{
margin-left: 30px;
}
</style>
<style lang="less">
.tag-content{
.ant-select-selection-selected-value{
color:rgba(0, 0, 0, 0.65);
}
.tag-content{
.ant-select-selection-selected-value{
color:rgba(0, 0, 0, 0.65);
}
}
</style>