元素控制

main-20240105
gongzeliang 8 months ago
parent d012d2c68d
commit 8af169e325

@ -0,0 +1,37 @@
import request from '@/plugin/axios'
// 创建供应商合同
export function getFieldTemplate(type) {
return request({
url: '/bs/field-template/type/' + type,
method: 'get'
})
}
export function addFieldTemplate(data) {
return request({
url: '/bs/field-template/addField',
method: 'post',
data: data
})
}
export function deleteField(field,type) {
return request({
url: '/bs/field-template/'+field+'/'+type,
method: 'delete',
})
}
export function queryOption(field,type) {
return request({
url: '/bs/field-template/option/'+field+'/'+type,
method: 'get',
})
}
export function queryFieldTemplate(type) {
return request({
url: '/bs/field-template/type/'+type,
method: 'get',
})
}

@ -5,7 +5,7 @@
<div class="section"> <span class="line"> </span> 审批内容</div>
<div class="trips-box">
<div class="item-box">
<van-field v-model="form.contractNumber" :disabled="['edit','show'].includes(this.$route.query.type)" @blur="handleCtBlur" placeholder="请输入" :rules="[{ required: true, message: '请输入' }]" required label="合同编号" clear-trigger="always" input-align="right" />
<van-field v-model="form.contractNumber" :disabled="['edit','show'].includes(this.$route.query.type)" placeholder="请输入" :rules="[{ required: true, message: '请输入' }]" required label="合同编号" clear-trigger="always" input-align="right" />
<van-field v-model="form.contractName" required placeholder="请输入" :disabled="disabled" :rules="[{ required: true, message: '请输入' }]" label="合同名称" clear-trigger="always" input-align="right" />
<van-field right-icon="arrow" :rules="[{ required: true, message: '请选择' }]" :disabled="disabled ||oaListIsDisabled" :class="form.startTime ? 'actived-disabled':''" :name="`time`" placeholder="请选择" v-model="form.startTime1" @click="handleDateShow('startTime')" label="合同开始时间" clear-trigger="always" input-align="right" />
<van-field right-icon="arrow" :rules="[{ required: true, message: '请选择' }]" :disabled="disabled ||oaListIsDisabled" :class="form.endTime ? 'actived-disabled':''" :name="`time`" placeholder="请选择" v-model="form.endTime1" @click="handleDateShow('endTime')" label="合同结束时间" clear-trigger="always" input-align="right" />
@ -35,6 +35,20 @@
<van-field v-model="form.taxRate" :disabled="disabled" name="taxRate" type="number" placeholder="请输入" input-align="right" label="税率" />
<van-field right-icon="arrow" :rules="[{ required: true, message: '请选择' }]" :disabled="disabled" :class="form.dateSigning ? 'actived-disabled':''" :name="`time`" placeholder="请选择" v-model="form.dateSigning1" @click="handleDateShow('dateSigning')" label="签订时间" clear-trigger="always" input-align="right" />
<van-field v-model="form.other" :disabled="disabled" name="reason" autosize rows="2" label="合同描述" required :rules="[{ required: true, message: '请输入' }]" clear-trigger="always" input-align="right" placeholder="请输入" type="textarea" />
<!-- 元素管理-->
<template v-for="(item,index) in form.fieldTemplateList">
<van-field v-if="item.type == '1'" :required="item.required" :rules="[{ message: `${item.label}不能为空`, required: item.required}]" v-model="item.value" :label="item.label" :disabled="disabled || oaListIsDisabled" :name="item.field" placeholder="请输入" input-align="right"></van-field>
<van-field v-if="item.type == '2'" :label="item.label" :required="item.required" :name="item.field" :disabled="disabled || oaListIsDisabled" input-align="right" :rules="[{ message: `${item.label}不能为空`, required: item.required}]" label-width="9em">
<template #input>
<van-switch v-model="item.value" :disabled="disabled || oaListIsDisabled"/>
</template>
</van-field>
<van-field v-if="item.type == '3'" :required="item.required" right-icon="arrow" :rules="[{ message: `${item.label}不能为空`, required: item.required}]" :disabled="disabled || oaListIsDisabled" :class="item.value ? 'actived-disabled':''" :name="`time`" placeholder="请选择" v-model="form.fieldTemplateList[index][`${item.field}1`]" @click="handleDateShow(item.field,index)" :label="item.label" clear-trigger="always" input-align="right" />
<van-field v-if="item.type == '4'" :required="item.required" type="number" :rules="[{ message: `${item.label}不能为空`, required: item.required}]" v-model="item.value" :label="item.label" :disabled="disabled || oaListIsDisabled" :name="item.field" placeholder="请输入" input-align="right"></van-field>
<RePick v-if="item.type == '5'" :isRequrie="item.required" v-model="item.value" :disabled="disabled || oaListIsDisabled" titleKey="label" idKey="value" :label="item.label" :name="item.field" :list="item.map" isCell clearable />
<RePick v-if="item.type == '6'" :isRequrie="item.required" v-model="item.value" :disabled="disabled || oaListIsDisabled" titleKey="label" idKey="value" :label="item.label" :name="item.field" :list="item.map" multiple isCell clearable />
</template>
</div>
</div>
<div class="section mt5"> <span class="line"> </span>附件</div>
@ -95,6 +109,7 @@ import {
import { Dialog } from 'vant'
import {getCustomerContractTypeListAll} from "@/api/bs/contractType";
import {getProjectPage} from "@/api/bs/project";
import { queryFieldTemplate } from '@/api/bs/template'
export default {
//import使
name: 'contract-custom',
@ -171,7 +186,10 @@ export default {
dealContent: null,
other: null,
},
oaReimburseFeeitemList: []
oaReimburseFeeitemList: [],
dateType:'',
fieldType:'',
fieldTemplateList:[]
};
},
@ -276,7 +294,7 @@ export default {
amount: actualAmount,
startTime,
endTime,
managerPhone
managerPhone,
}
}
this.$loading(false)
@ -365,7 +383,8 @@ export default {
...item,
planTime: dayjs(item.planTime).valueOf()
}
})
}),
// proposerPerson:this.userInfo.id
}
this.$loading(true, 'form')
// this.handleCtBlur({
@ -405,6 +424,7 @@ export default {
})
},
handleInitForm() {
let _this = this
const { id, type } = this.$route.query || {}
this.typeStr = type
if (id) {
@ -437,10 +457,32 @@ export default {
this.$nextTick(() => {
this.$refs.BottomBtn.handleFilterBtnList()
})
this.$set(this.form, 'dateSigning1', `${dayjs(this.form.dateSigning).format('YYYY/MM/DD')}`)
this.$set(this.form, 'proposerTime1', `${dayjs(this.form.proposerTime).format('YYYY/MM/DD')}`)
this.$set(this.form, 'startTime1', `${dayjs(this.form.startTime).format('YYYY/MM/DD')}`)
this.$set(this.form, 'endTime1', `${dayjs(this.form.endTime).format('YYYY/MM/DD')}`)
this.form.fieldTemplateList.forEach(function (item,index){
if(item.type == 3){
_this.$set(item, `${item.field}1`, `${dayjs(item.value).format('YYYY/MM/DD')}`)
}
if(item.type == 2){
item.value =item.value? Boolean(item.value):false
}
})
console.log('this.form..', this.form);
}).finally(() => {
this.$loading(false, 'loadingSb')
})
}else {
queryFieldTemplate(1).then((res) => {
res.data.forEach(function (item){
if(item.type == 6){
item.value = item.value?item.value:[]
}
})
this.fieldTemplateList = res.data
this.$set(this.form, 'fieldTemplateList', res.data)
});
}
},
handleNewConfirmPo(arr, index) {
@ -540,20 +582,41 @@ export default {
this.capitalSource = res.data.list || [];
});
},
handleDateShow(dateType) {
handleDateShow(dateType,type) {
let _this = this
if (this.disabled) return
this.dateType = dateType
this.$nextTick(() => {
let date = dateType == 'dateSigning'?this.form.dateSigning:dateType=='proposerTime'?this.form.proposerTime:dateType=='startTime'?this.form.startTime:dateType=='endTime'?this.form.endTime:''
this.$refs.vanCalendar && this.$refs.vanCalendar.reset()
this.dateShow = true
if (date) {
let time = dayjs(Number(date)).format('YYYY/MM/DD');
this.defaultDate = new Date(time)
}
})
_this.dateType = dateType
_this.fieldType = type
if(type){
_this.$nextTick(() => {
let date = _this.form.fieldTemplateList[type][dateType] || ''
_this.$refs.vanCalendar && _this.$refs.vanCalendar.reset()
_this.dateShow = true
if (date) {
let time = dayjs(Number(date)).format('YYYY/MM/DD');
_this.defaultDate = new Date(time)
}
})
}else {
_this.$nextTick(() => {
let date = dateType == 'dateSigning'?_this.form.dateSigning:dateType=='proposerTime'?_this.form.proposerTime:dateType=='startTime'?_this.form.startTime:dateType=='endTime'?_this.form.endTime:''
_this.$refs.vanCalendar && _this.$refs.vanCalendar.reset()
_this.dateShow = true
if (date) {
let time = dayjs(Number(date)).format('YYYY/MM/DD');
_this.defaultDate = new Date(time)
}
})
}
},
handleDateSelect(val) {
if(this.fieldType){
this.$set(this.form.fieldTemplateList[this.fieldType], `${this.dateType}1`, `${dayjs(val).format('YYYY/MM/DD')}`)
this.$set(this.form.fieldTemplateList[this.fieldType], 'value', `${dayjs(val).valueOf()}`)
this.dateShow = false
return;
}
if(this.dateType == 'dateSigning'){
this.$set(this.form, 'dateSigning1', `${dayjs(val).format('YYYY/MM/DD')}`)
this.$set(this.form, 'dateSigning', `${dayjs(val).valueOf()}`)

@ -11,7 +11,7 @@
<!-- </van-field>-->
<van-field right-icon="arrow" :rules="[{ required: true, message: '请选择' }]" :disabled="disabled ||oaListIsDisabled" :class="form.startTime ? 'actived-disabled':''" :name="`time`" placeholder="请选择" v-model="form.startTime1" @click="handleDateShow('startTime')" label="合同开始时间" clear-trigger="always" input-align="right" />
<van-field right-icon="arrow" :rules="[{ required: true, message: '请选择' }]" :disabled="disabled ||oaListIsDisabled" :class="form.endTime ? 'actived-disabled':''" :name="`time`" placeholder="请选择" v-model="form.endTime1" @click="handleDateShow('endTime')" label="合同结束时间" clear-trigger="always" input-align="right" />
<RePick v-model="form.supplierId" :disabled="disabled ||oaListIsDisabled " titleKey="companyAme" idKey="id" label="供应商名称" name="supplierId" :list="supplierList" isRequrie isCell clearable />
<RePick v-model="form.supplierId" :disabled="disabled ||oaListIsDisabled " titleKey="companyName" idKey="id" label="供应商名称" name="supplierId" :list="supplierList" isRequrie isCell clearable />
<RePick v-model="form.departmentId" :disabled="disabled" label="签约部门" @change="handleChange" :name="`departmentId`" :list="userDeptTree" isRequrie isCascader isShowSearch title="签约部门" titleKey="name" isCell clearable />
<RePick v-model="form.signatoryId" :disabled="disabled" titleKey="nickname" idKey="id" label="签约人员" name="signatoryId" :list="signatoryList" isRequrie isCell clearable />
<RePick v-model="form.contractType" :disabled="disabled" titleKey="contractName" idKey="id" label="合同类型" name="contractType" :list="typeList" isRequrie isCell clearable />
@ -35,6 +35,20 @@
<van-field v-model="form.taxRate" :disabled="disabled" name="taxRate" type="number" placeholder="请输入" input-align="right" label="税率" />
<van-field right-icon="arrow" :rules="[{ required: true, message: '请选择' }]" :disabled="disabled" :class="form.dateSigning ? 'actived-disabled':''" :name="`time`" placeholder="请选择" v-model="form.dateSigning1" @click="handleDateShow('dateSigning')" label="签订时间" clear-trigger="always" input-align="right" />
<van-field v-model="form.other" :disabled="disabled" name="reason" autosize rows="2" label="合同简述" required :rules="[{ required: true, message: '请输入' }]" clear-trigger="always" input-align="right" placeholder="请输入" type="textarea" />
<!-- 元素控制-->
<template v-for="(item,index) in form.fieldTemplateList">
<van-field v-if="item.type == '1'" :rules="[{ message: `${item.label}不能为空`, required: item.required}]" :required="item.required" v-model="item.value" :label="item.label" :disabled="disabled || oaListIsDisabled" :name="item.field" placeholder="请输入" input-align="right"></van-field>
<van-field v-if="item.type == '2'" :label="item.label" required :name="item.field" :disabled="disabled || oaListIsDisabled" input-align="right" :rules="[{ message: `${item.label}不能为空`, required: item.required}]" label-width="9em">
<template #input>
<van-switch v-model="item.value" :disabled="disabled || oaListIsDisabled"/>
</template>
</van-field>
<van-field v-if="item.type == '3'" right-icon="arrow" :required="item.required" :rules="[{ message: `${item.label}不能为空`, required: item.required}]" :disabled="disabled || oaListIsDisabled" :class="item.value ? 'actived-disabled':''" :name="`time`" placeholder="请选择" v-model="form.fieldTemplateList[index][`${item.field}1`]" @click="handleDateShow(item.field,index)" :label="item.label" clear-trigger="always" input-align="right" />
<van-field v-if="item.type == '4'" type="number" :required="item.required" :rules="[{ message: `${item.label}不能为空`, required: item.required}]" v-model="item.value" :label="item.label" :disabled="disabled || oaListIsDisabled" :name="item.field" placeholder="请输入" input-align="right"></van-field>
<RePick v-if="item.type == '5'" :isRequrie="item.required" v-model="item.value" :disabled="disabled || oaListIsDisabled" titleKey="label" idKey="value" :label="item.label" :name="item.field" :list="item.map" isCell clearable />
<RePick v-if="item.type == '6'" :isRequrie="item.required" v-model="item.value" :disabled="disabled || oaListIsDisabled" titleKey="label" idKey="value" :label="item.label" :name="item.field" :list="item.map" multiple isCell clearable />
</template>
</div>
</div>
<div class="section mt5"> <span class="line"> </span>附件</div>
@ -95,6 +109,7 @@ import {
} from "@/api/system/user";
import { getCustomerContractTypeListAll } from '@/api/bs/contractType'
import {getProjectPage} from "@/api/bs/project";
import { queryFieldTemplate } from '@/api/bs/template'
export default {
//import使
name: 'contract-supplier',
@ -175,7 +190,9 @@ export default {
other: null,
},
oaReimburseFeeitemList: [],
dateType:''
dateType:'',
fieldType:'',
fieldTemplateList:[]
};
},
@ -373,7 +390,8 @@ export default {
...item,
planTime: dayjs(item.planTime).valueOf()
}
})
}),
// proposerPerson:this.userInfo.id
}
this.$loading(true, 'form')
createSupplierContract(newForm).then((res) => {
@ -408,6 +426,7 @@ export default {
})
},
handleInitForm() {
let _this = this
const { id, type } = this.$route.query || {}
this.typeStr = type
if (id) {
@ -440,10 +459,32 @@ export default {
this.$nextTick(() => {
this.$refs.BottomBtn.handleFilterBtnList()
})
this.$set(this.form, 'dateSigning1', `${dayjs(this.form.dateSigning).format('YYYY/MM/DD')}`)
this.$set(this.form, 'proposerTime1', `${dayjs(this.form.proposerTime).format('YYYY/MM/DD')}`)
this.$set(this.form, 'startTime1', `${dayjs(this.form.startTime).format('YYYY/MM/DD')}`)
this.$set(this.form, 'endTime1', `${dayjs(this.form.endTime).format('YYYY/MM/DD')}`)
res.data.fieldTemplateList.forEach(function (item){
if(item.type == 3){
_this.$set(item, `${item.field}1`, `${dayjs(item.value).format('YYYY/MM/DD')}`)
}
if(item.type == 2){
item.value =item.value? Boolean(item.value):false
}
})
console.log('this.form..', this.form);
}).finally(() => {
this.$loading(false, 'loadingSb')
})
}else {
queryFieldTemplate(2).then((res) => {
res.data.forEach(function (item){
if(item.type == 6){
item.value = item.value?item.value:[]
}
})
this.fieldTemplateList = res.data
this.$set(this.form, 'fieldTemplateList', res.data)
});
}
},
handleUpload(list) {
@ -538,31 +579,41 @@ export default {
});
})
},
handleDateShow(dateType) {
handleDateShow(dateType,type) {
let _this = this
if (this.disabled) return
this.dateType = dateType
this.$nextTick(() => {
let date = dateType == 'dateSigning'?this.form.dateSigning:dateType=='proposerTime'?this.form.proposerTime:dateType=='startTime'?this.form.startTime:dateType=='endTime'?this.form.endTime:''
this.$refs.vanCalendar && this.$refs.vanCalendar.reset()
this.dateShow = true
if (date) {
let time = dayjs(Number(date)).format('YYYY/MM/DD');
this.defaultDate = new Date(time)
}
})
},
handlePDateShow(time, index) {
if (this.disabled) return
this.$nextTick(() => {
this.$refs.pVanCalendar && this.$refs.pVanCalendar.reset()
this.palnTimeShow = true
this.pIndex = index
if (time) {
this.pDefaultDate = dayjs(time).toDate()
}
})
_this.dateType = dateType
_this.fieldType = type
if(type){
_this.$nextTick(() => {
let date = _this.form.fieldTemplateList[type][dateType] || ''
_this.$refs.vanCalendar && _this.$refs.vanCalendar.reset()
_this.dateShow = true
if (date) {
let time = dayjs(Number(date)).format('YYYY/MM/DD');
_this.defaultDate = new Date(time)
}
})
}else {
_this.$nextTick(() => {
let date = dateType == 'dateSigning'?_this.form.dateSigning:dateType=='proposerTime'?_this.form.proposerTime:dateType=='startTime'?_this.form.startTime:dateType=='endTime'?_this.form.endTime:''
_this.$refs.vanCalendar && _this.$refs.vanCalendar.reset()
_this.dateShow = true
if (date) {
let time = dayjs(Number(date)).format('YYYY/MM/DD');
_this.defaultDate = new Date(time)
}
})
}
},
handleDateSelect(val) {
if(this.fieldType){
this.$set(this.form.fieldTemplateList[this.fieldType], `${this.dateType}1`, `${dayjs(val).format('YYYY/MM/DD')}`)
this.$set(this.form.fieldTemplateList[this.fieldType], 'value', `${dayjs(val).valueOf()}`)
this.dateShow = false
return;
}
if(this.dateType == 'dateSigning'){
this.$set(this.form, 'dateSigning1', `${dayjs(val).format('YYYY/MM/DD')}`)
this.$set(this.form, 'dateSigning', `${dayjs(val).valueOf()}`)
@ -579,18 +630,20 @@ export default {
this.$set(this.form, 'endTime1', `${dayjs(val).format('YYYY/MM/DD')}`)
this.$set(this.form, 'endTime', `${dayjs(val).valueOf()}`)
}
// if (list && list.length) {
// this.$set(this.form, 'time', `${dayjs(list[0]).format('YY/MM/DD')}~${dayjs(list[1]).format('YY/MM/DD')}`)
// this.$set(this.form, 'startTime', dayjs(list[0]).valueOf())
// this.$set(this.form, 'endTime', dayjs(list[1]).valueOf())
// } else {
// this.$set(this.form, 'time', null)
// this.$set(this.form, 'startTime', null)
// this.$set(this.form, 'endTime', null)
// }
this.dateShow = false
},
handlePDateShow(time, index) {
if (this.disabled) return
this.$nextTick(() => {
this.$refs.pVanCalendar && this.$refs.pVanCalendar.reset()
this.palnTimeShow = true
this.pIndex = index
if (time) {
this.pDefaultDate = dayjs(time).toDate()
}
})
},
handlePlanDateSelect(date) {
if (date) {
let num = this.oaReimburseFeeitemList.length - 1

Loading…
Cancel
Save