|
@@ -43,8 +43,8 @@
|
|
|
</el-col>
|
|
|
|
|
|
<el-col :span="1.5">
|
|
|
- <el-form-item label="需求计划">
|
|
|
- <el-select :disabled="sonDisable" v-model="basicForm.planType" size="mini" style="width: 200px">
|
|
|
+ <el-form-item label="需求计划" prop="planType" :rules="{ required: true, message: '请选择需求计划', trigger: 'blur' }">
|
|
|
+ <el-select :disabled="sonDisable" v-model="basicForm.planType" size="mini" style="width: 200px" @change="changeplanType()">
|
|
|
<el-option v-for="dict in dict.type.sys_plan_type" :key="dict.value" :label="dict.label" :value="dict.value">
|
|
|
</el-option>
|
|
|
</el-select>
|
|
@@ -55,7 +55,7 @@
|
|
|
<el-form-item label="需求日期" prop="demandDate" :rules="{ required: true, message: '请选择需求日期', trigger: 'blur' }">
|
|
|
<el-date-picker
|
|
|
v-model="basicForm.demandDate"
|
|
|
- :disabled="sonDisable"
|
|
|
+ disabled
|
|
|
clearable
|
|
|
type="date"
|
|
|
value-format="yyyy-MM-dd"
|
|
@@ -571,9 +571,8 @@ export default {
|
|
|
demandPersonalName: '',
|
|
|
demandDept: '',
|
|
|
demandDeptName: '',
|
|
|
- planType: '1',
|
|
|
+ planType: 'ZJH',
|
|
|
demandDate: '',
|
|
|
- createTime: '',
|
|
|
source: '4',
|
|
|
billType: 'ZQBH',
|
|
|
isCustomerSpecified: 'N',
|
|
@@ -753,6 +752,8 @@ export default {
|
|
|
} else if(this.pageStu == 'edit') {
|
|
|
this.getDetails(this.row)
|
|
|
} else if (this.pageStu == 'add') {
|
|
|
+ // 新增时判断需求日期
|
|
|
+ this.dafaultDate()
|
|
|
this.loading = false
|
|
|
this.basicForm.demandPersonal = this.$store.state.user.name
|
|
|
this.basicForm.demandPersonalName = this.$store.state.user.nickName
|
|
@@ -763,6 +764,58 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ // 默认需求日期根据当天星期几判断
|
|
|
+ dafaultDate() {
|
|
|
+ // 获取当前时间
|
|
|
+ let date = new Date()
|
|
|
+ //获取当前时间的年份转为字符串
|
|
|
+ let year = date.getFullYear().toString()
|
|
|
+ //获取月份,由于月份从0开始,此处要加1,判断是否小于10,如果是在字符串前面拼接'0'
|
|
|
+ let month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1).toString() : (date.getMonth() + 1).toString() //'04'
|
|
|
+ //获取天,判断是否小于10,如果是在字符串前面拼接'0'
|
|
|
+ let da = date.getDate() < 10 ? '0' + date.getDate().toString() : date.getDate().toString() //'12'
|
|
|
+ let today = year + '-' + month + '-' + da
|
|
|
+ console.log('今天日期',today)
|
|
|
+ let weekDay = date.getDay()
|
|
|
+ console.log('今天星期几', weekDay)
|
|
|
+ // 改变需求计划的判断写这里面了
|
|
|
+ if (this.basicForm.planType == 'JJXQ') {
|
|
|
+ this.basicForm.demandDate = today
|
|
|
+ } else {
|
|
|
+ if (weekDay == 0) {this.basicForm.demandDate = this.getNextDate(today, 2)}
|
|
|
+ else if (weekDay == 1) {this.basicForm.demandDate = this.getNextDate(today, 1)}
|
|
|
+ else if (weekDay == 2) {this.basicForm.demandDate = today}
|
|
|
+ else if (weekDay == 3) {this.basicForm.demandDate = this.getNextDate(today, 6)}
|
|
|
+ else if (weekDay == 4) {this.basicForm.demandDate = this.getNextDate(today, 5)}
|
|
|
+ else if (weekDay == 5) {this.basicForm.demandDate = this.getNextDate(today, 4)}
|
|
|
+ else if (weekDay == 6) {this.basicForm.demandDate = this.getNextDate(today, 3)}
|
|
|
+ // console.log(this.getNextDate(today, 2))
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 获取某天日期的下一天,默认为第二天 默认输出格式为yyyy-mm-dd
|
|
|
+ getNextDate(date, day = 1, format = '{y}-{m}-{d}') {
|
|
|
+ if (date) {
|
|
|
+ date = date.match(/\d+/g).join('-'); // 格式为2022年09月19日处理
|
|
|
+ const nDate = new Date(date);
|
|
|
+ nDate.setDate(nDate.getDate() + day);
|
|
|
+
|
|
|
+ const formatObj = {
|
|
|
+ y: nDate.getFullYear(),
|
|
|
+ m: nDate.getMonth() + 1,
|
|
|
+ d: nDate.getDate(),
|
|
|
+ };
|
|
|
+ return format.replace(/{([ymd])+}/g, (result, key) => {
|
|
|
+ const value = formatObj[key];
|
|
|
+ return value.toString().padStart(2, '0');
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ console.log('date格式不正确');
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 改变需求计划改变需求日期
|
|
|
+ changeplanType() {
|
|
|
+ this.dafaultDate()
|
|
|
+ },
|
|
|
// 无限滚动加载配置
|
|
|
load() {
|
|
|
if (this.loadDisabled) return;
|
|
@@ -856,6 +909,8 @@ export default {
|
|
|
this.basicForm.demandPersonalName = this.$store.state.user.nickName
|
|
|
this.basicForm.demandDept = this.$store.state.user.deptId
|
|
|
this.basicForm.demandDeptName = this.$store.state.user.deptName
|
|
|
+ // 复制时判断需求日期
|
|
|
+ this.dafaultDate()
|
|
|
if (this.basicForm.demandPersonal) { this.reBackRefer('CONTACTS_PARAM', this.basicForm.demandPersonal, '需求人员') }
|
|
|
if (this.basicForm.demandDept) { this.reBackRefer('DEPT_PARAM', this.basicForm.demandDept) }
|
|
|
this.basicForm.puDemandItemList.forEach(item => {
|