|
@@ -55,6 +55,7 @@
|
|
|
v-model="form.creationDate"
|
|
|
type="date"
|
|
|
style="width: 100%;"
|
|
|
+ @change="calculationPeriod"
|
|
|
value-format="yyyy-MM-dd"
|
|
|
placeholder="选择日期"
|
|
|
>
|
|
@@ -115,9 +116,13 @@
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
- <el-form-item label="有效期" prop="validityMonth">
|
|
|
- <el-input-number style="width: 100%;" v-model="form.validityMonth" :min="1" :controls="false"
|
|
|
- placeholder="请输入有效期月份数字"
|
|
|
+ <el-form-item label="有效期天数" prop="validityMonth">
|
|
|
+ <el-input-number
|
|
|
+ style="width: 100%;"
|
|
|
+ v-model="form.validityMonth"
|
|
|
+ :min="1" :controls="false"
|
|
|
+ placeholder="请输入有效期天数"
|
|
|
+ @change="calculationPeriod"
|
|
|
></el-input-number>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
@@ -203,11 +208,12 @@
|
|
|
import Cookies from 'js-cookie'
|
|
|
import { select } from '@/api/system/set'
|
|
|
import moment from 'moment/moment'
|
|
|
-import { listQuery, submit, viewSingle ,confirmDeletion} from '@/api/contractManagement'
|
|
|
+import { listQuery, submit, viewSingle, confirmDeletion } from '@/api/contractManagement'
|
|
|
import { listDept } from '@/api/system/dept'
|
|
|
import { getliable } from '@/api/project'
|
|
|
import { corpsList } from '@/api/costManagement'
|
|
|
import cUpload from '@/components/cUpload/index.vue'
|
|
|
+
|
|
|
export default {
|
|
|
name: 'index',
|
|
|
components: {
|
|
@@ -514,7 +520,7 @@ export default {
|
|
|
...this.$refs.avatar.form,
|
|
|
...data
|
|
|
}
|
|
|
- this.query({ ...this.search,...this.$refs.avatar.form })
|
|
|
+ this.query({ ...this.search, ...this.$refs.avatar.form })
|
|
|
},
|
|
|
submitData(formName) {
|
|
|
this.$refs[formName].validate((valid) => {
|
|
@@ -523,7 +529,7 @@ export default {
|
|
|
formData.append('tContractManagement', JSON.stringify(this.form))
|
|
|
formData.append('tEnclosure', JSON.stringify(this.tEnclosure))
|
|
|
submit(formData).then(res => {
|
|
|
- this.$message.success("保存成功")
|
|
|
+ this.$message.success('保存成功')
|
|
|
this.dialogVisible = false
|
|
|
this.query(this.search)
|
|
|
})
|
|
@@ -556,7 +562,7 @@ export default {
|
|
|
},
|
|
|
//查看-列表
|
|
|
viewMethod(scope, res, i) {
|
|
|
- viewSingle(scope.row.fId).then(res=>{
|
|
|
+ viewSingle(scope.row.fId).then(res => {
|
|
|
this.form = res.data.tContractManagement
|
|
|
this.tEnclosure = res.data.tEnclosure
|
|
|
this.dialogVisible = true
|
|
@@ -646,6 +652,24 @@ export default {
|
|
|
this.isItHidden = true
|
|
|
this.inDex = 4
|
|
|
})
|
|
|
+ },
|
|
|
+ //根据建立日期加有效期天数计算出保管期限
|
|
|
+ calculationPeriod(){
|
|
|
+ if (this.form.creationDate && this.form.validityMonth){
|
|
|
+ this.$set(this.form,"storagePeriodTime",this.getNewDay(this.form.creationDate,this.form.validityMonth))
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getNewDay(dateTemp, days) {
|
|
|
+ dateTemp = dateTemp.split('-')
|
|
|
+ let nDate = new Date(dateTemp[1] + '-' + dateTemp[2] + '-' + dateTemp[0]) //转换为MM-DD-YYYY格式
|
|
|
+ let millSeconds = Math.abs(nDate) + (days * 24 * 60 * 60 * 1000)
|
|
|
+ let rDate = new Date(millSeconds)
|
|
|
+ let year = rDate.getFullYear()
|
|
|
+ let month = rDate.getMonth() + 1
|
|
|
+ if (month < 10) month = '0' + month
|
|
|
+ let date = rDate.getDate()
|
|
|
+ if (date < 10) date = '0' + date
|
|
|
+ return (year + '-' + month + '-' + date)
|
|
|
}
|
|
|
}
|
|
|
}
|