diff --git a/src/api/bs/template.js b/src/api/bs/template.js new file mode 100644 index 0000000..1b0fc70 --- /dev/null +++ b/src/api/bs/template.js @@ -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', + }) +} diff --git a/src/views/contract/custom/index.vue b/src/views/contract/custom/index.vue index 0cbc436..e2f6cd9 100644 --- a/src/views/contract/custom/index.vue +++ b/src/views/contract/custom/index.vue @@ -5,7 +5,7 @@
审批内容
- + @@ -35,6 +35,20 @@ + + +
附件
@@ -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()}`) diff --git a/src/views/contract/supplier/index.vue b/src/views/contract/supplier/index.vue index f3fb865..a0c3fa2 100644 --- a/src/views/contract/supplier/index.vue +++ b/src/views/contract/supplier/index.vue @@ -11,7 +11,7 @@ - + @@ -35,6 +35,20 @@ + + +
附件
@@ -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