周期性试验修改

master
jinna 1 day ago
parent 59a84b59b8
commit 87ea2db065
  1. 9
      src/api/qualityManagement/periodicTesting/projectCycle.js
  2. 196
      src/views/periodicTesting/projectCycle.vue

@ -104,4 +104,13 @@ export const setUser = (params) =>{
})
}
// 批量设置试验周期
export const setCycleBat = (data) =>{
return request({
url:'/api/blade-desk/QA/CycleTest/update-cycle-bat',
method:'post',
data
})
}

@ -28,6 +28,7 @@
<el-button type="danger" @click="handleDeletes"> </el-button>
<el-button type="success" @click="handleUser">人员设置</el-button>
<el-button type="primary" @click="handleCycle">批量设置周期</el-button>
</template>
<template #menu-right>
<el-button type="primary" @click="handleImport">导入</el-button>
@ -74,6 +75,104 @@
</span>
</template>
</el-dialog>
<!-- 批量设置周期 -->
<el-dialog append-to-body title="批量设置周期" v-model="cycleDialog" width="550px">
<el-form ref="cycleForm" :model="cycleForm" label-width="80px" :rules="cycleRules">
<el-form-item label="试验周期" prop="jobType">
<el-select
placeholder="请选择试验周期"
v-model="cycleForm.jobType"
style="width: 268px"
@change="changeCycle1"
>
<el-option label="每周" :value="1"></el-option>
<el-option label="每月" :value="2"></el-option>
<el-option label="每年" :value="3"></el-option>
</el-select>
</el-form-item>
<div style="margin-left: 80px" v-show="cycleForm.jobType == 1">
<el-checkbox-group v-model="cycleForm.weekList">
<el-checkbox label="周一" value="1" />
<el-checkbox label="周二" value="2"></el-checkbox>
<el-checkbox label="周三" value="3"></el-checkbox>
<el-checkbox label="周四" value="4"></el-checkbox>
<el-checkbox label="周五" value="5"></el-checkbox>
<el-checkbox label="周六" value="6"></el-checkbox>
<el-checkbox label="周日" value="7"></el-checkbox>
</el-checkbox-group>
</div>
<div style="margin-left: 80px" v-show="cycleForm.jobType == 2">
<div style="display: flex; align-items: center">
<span>时间每月</span>
<el-select v-model="cycleForm.monthValue" style="width: 120px; margin: 0 5px">
<el-option v-for="item in 31" :key="item" :label="item" :value="item"></el-option>
</el-select>
<span></span>
<el-button style="margin-left: 10px" type="primary" circle @click="addMonth"
><el-icon> <Plus /> </el-icon
></el-button>
</div>
<div style="display: flex; flex-wrap: wrap; margin-top: 10px">
<el-tag
v-for="tag in cycleMonthTags"
:key="tag"
closable
type="info"
style="width: 62px; margin-right: 5px; margin-top: 10px"
@close="closeMonthTag(tag, index)"
>
{{ tag }}
</el-tag>
</div>
<div>
<el-checkbox
v-model="cycleForm.isPutOff"
label="任务若遇周末或当月无该日期,顺延至下周一"
/>
</div>
</div>
<div style="margin-left: 100px" v-show="cycleForm.jobType == 3">
<div style="display: flex; align-items: center">
<span>时间</span>
<el-select v-model="cycleForm.yearMonth" style="width: 120px; margin: 0 5px">
<el-option v-for="item in 12" :key="item" :label="item" :value="item"></el-option>
</el-select>
<span></span>
<el-select v-model="cycleForm.yearDays" style="width: 120px; margin: 0 5px">
<el-option v-for="item in 31" :key="item" :label="item" :value="item"></el-option>
</el-select>
<span></span>
<el-button style="margin-left: 10px" type="primary" circle @click="addYears"
><el-icon> <Plus /> </el-icon
></el-button>
</div>
<div style="display: flex; flex-wrap: wrap; margin-top: 10px">
<el-tag
v-for="(tag, index) in cycleYearTags"
:key="tag"
closable
type="info"
style="width: 86px; margin-right: 5px; margin-top: 10px"
@close="closeYearsTag(tag, index)"
>
{{ tag }}
</el-tag>
</div>
<div>
<el-checkbox
v-model="cycleForm.isPutOff"
label="任务若遇周末或当月无该日期,顺延至下周一"
/>
</div>
</div>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="cycleDialog = false"> </el-button>
<el-button type="primary" @click="submitCycle"> </el-button>
</span>
</template>
</el-dialog>
<!-- 导入 -->
<basic-import v-if="isShowImport" title="导入" :isShow="isShowImport"
templateUrl="/blade-desk/QA/CycleTest/download-excel-template"
@ -84,7 +183,7 @@
</template>
<script>
import { getList, remove,issueTask,getUserList,setUser } from '@/api/qualityManagement/periodicTesting/projectCycle.js';
import { getList, remove,issueTask,getUserList,setUser,setCycleBat } from '@/api/qualityManagement/periodicTesting/projectCycle.js';
import addProjectCycleDialog from './components/addProjectCycleDialog.vue'
import {dateFormat} from '@/utils/date'
import basicImport from '@/components/basic-import/main.vue'
@ -114,6 +213,11 @@ export default {
total: 0,
},
issueDialog: false,
cycleDialog:false,
cycleForm:{},
cycleRules:{
jobType: [{ required: true, message: '请选择试验周期', trigger: 'blur' }],
},
issueForm: {},
formRules: {
processUserId: [{ required: true, message: '请选择工艺员', trigger: 'blur' }],
@ -125,6 +229,8 @@ export default {
showDialog: false,
monthTags: [],
yearTags: [],
cycleMonthTags:[],
cycleYearTags:[],
option: {
tip: false,
height: 'auto',
@ -364,6 +470,14 @@ export default {
this.issueForm = {}
}
},
//
handleCycle(){
if (this.selectionList.length == 0) {
this.$message.error('请至少选择一条数据!');
} else {
this.cycleDialog = true
}
},
//
handleDelete(row) {
this.$confirm('确定删除此条数据?', {
@ -397,26 +511,36 @@ export default {
this.projectForm.yearDays = '';
this.yearTags = [];
},
//
changeCycle1() {
this.cycleForm.monthValue = '';
this.cycleForm.weekList = [];
this.cycleMonthTags = [];
this.cycleForm.yearMonth = '';
this.cycleForm.yearDays = '';
this.cycleYearTags = [];
},
//
addMonth() {
let value = this.projectForm.monthValue + '日';
if (this.monthTags.find(item => item == value)) return;
this.monthTags.push(this.projectForm.monthValue + '日');
let value = this.cycleForm.monthValue + '日';
if (this.cycleMonthTags.find(item => item == value)) return;
this.cycleMonthTags.push(this.cycleForm.monthValue + '日');
},
//
addYears() {
let value = this.projectForm.yearMonth + '月' + this.projectForm.yearDays + '日';
if (this.yearTags.find(item => item == value)) return;
if (this.projectForm.yearMonth == '' || this.projectForm.yearDays == '') return;
this.yearTags.push(this.projectForm.yearMonth + '月' + this.projectForm.yearDays + '日');
let value = this.cycleForm.yearMonth + '月' + this.cycleForm.yearDays + '日';
console.log('value--------------',value)
if (this.cycleYearTags.find(item => item == value)) return;
if (this.cycleForm.yearMonth == '' || this.cycleForm.yearDays == '') return;
this.cycleYearTags.push(this.cycleForm.yearMonth + '月' + this.cycleForm.yearDays + '日');
},
//
closeMonthTag(item, index) {
this.monthTags = this.monthTags.filter(tags => tags != item);
this.cycleMonthTags = this.cycleMonthTags.filter(tags => tags != item);
},
//
closeYearsTag(item, index) {
this.yearTags = this.yearTags.filter(tags => tags != item);
this.cycleYearTags = this.cycleYearTags.filter(tags => tags != item);
},
//
submitForm() {
@ -452,6 +576,58 @@ export default {
}
});
},
//
submitCycle(){
this.$refs.cycleForm.validate(valid =>{
if(valid){
let monthArr = []
let yearArr = []
if(this.cycleForm.jobType == 2){
if(this.cycleMonthTags.length == 0){
this.$message.error('请选择日期')
return
}
monthArr = this.cycleMonthTags.map(str => {
//
const num = str.match(/\d+/)?.[0] || '0';
//
return num.padStart(2, '0');
});
}
if(this.cycleForm.jobType == 1){
if(this.cycleForm.weekList.length == 0){
this.$message.error('请选择日期')
return
}
}
if(this.cycleForm.jobType == 3){
if(this.cycleYearTags.length == 0){
this.$message.error('请选择日期')
return
}
yearArr = this.cycleYearTags.map(str => {
// 使 + + +
const match = str.match(/(\d+)月(\d+)日/);
if (!match) return '0000'; //
const month = match[1].padStart(2, '0');
const day = match[2].padStart(2, '0');
return month + day;
});
}
let params = {
ids:this.selectionList.map(item => item.id).join(','),
jobType:this.cycleForm.jobType,
jobTypeWeekValue:this.cycleForm.jobType == 1 ? this.cycleForm.weekList.join(',') : '',
jobTypeMonthValue:this.cycleForm.jobType == 2 ? monthArr.join(',') : '',
jobTypeYearValue:this.cycleForm.jobType == 3 ? yearArr.join(',') : '',
isPutOff:this.cycleForm.isPutOff ? 1 : 0,
}
console.log('params===============',params)
}
})
},
//
selectionChange(list) {
this.selectionList = list;

Loading…
Cancel
Save