|
@@ -23,6 +23,7 @@
|
|
|
:maxlength="20"
|
|
:maxlength="20"
|
|
|
v-model="form.code"
|
|
v-model="form.code"
|
|
|
placeholder="请输入"
|
|
placeholder="请输入"
|
|
|
|
|
+ :disabled="type == 'edit'"
|
|
|
/>
|
|
/>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
@@ -56,7 +57,11 @@
|
|
|
header="工作时间段"
|
|
header="工作时间段"
|
|
|
body-style="padding: 22px 22px 0 22px;"
|
|
body-style="padding: 22px 22px 0 22px;"
|
|
|
>
|
|
>
|
|
|
- <timeTable ref="timeTable" @timeAll="gettimeAll" :delDetailIds="delDetailIds"></timeTable>
|
|
|
|
|
|
|
+ <timeTable
|
|
|
|
|
+ ref="timeTable"
|
|
|
|
|
+ @timeAll="gettimeAll"
|
|
|
|
|
+ :delDetailIds="delDetailIds"
|
|
|
|
|
+ ></timeTable>
|
|
|
</el-card>
|
|
</el-card>
|
|
|
</el-form>
|
|
</el-form>
|
|
|
<template v-slot:footer>
|
|
<template v-slot:footer>
|
|
@@ -69,137 +74,137 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
-import {
|
|
|
|
|
- saveteamtime,
|
|
|
|
|
- updateteamtime
|
|
|
|
|
-} from '@/api/workforceManagement/classes';
|
|
|
|
|
-import timeTable from './timeTable.vue';
|
|
|
|
|
-export default {
|
|
|
|
|
- components: {
|
|
|
|
|
- timeTable
|
|
|
|
|
- },
|
|
|
|
|
- data() {
|
|
|
|
|
- const defaultForm = {
|
|
|
|
|
- id: '',
|
|
|
|
|
- code: '',
|
|
|
|
|
- name: '',
|
|
|
|
|
- totalWorkHour: '',
|
|
|
|
|
- details: []
|
|
|
|
|
- };
|
|
|
|
|
- return {
|
|
|
|
|
- defaultForm,
|
|
|
|
|
- // 表单数据
|
|
|
|
|
- form: { ...defaultForm },
|
|
|
|
|
- // 表单验证规则
|
|
|
|
|
- rules: {
|
|
|
|
|
- code: [{ required: true, message: '请输入', trigger: 'blur' }],
|
|
|
|
|
- name: [{ required: true, message: '请输入', trigger: 'blur' }]
|
|
|
|
|
- },
|
|
|
|
|
- visible: false,
|
|
|
|
|
- type: '', // add/edit
|
|
|
|
|
- loading: false,
|
|
|
|
|
- options: {
|
|
|
|
|
- workshopId: [],
|
|
|
|
|
- productionLineId: [],
|
|
|
|
|
- workStationId: []
|
|
|
|
|
- },
|
|
|
|
|
- delDetailIds:[]
|
|
|
|
|
- };
|
|
|
|
|
- },
|
|
|
|
|
- computed: {
|
|
|
|
|
- title() {
|
|
|
|
|
- switch (this.type) {
|
|
|
|
|
- case 'add':
|
|
|
|
|
- return '新增班次';
|
|
|
|
|
- break;
|
|
|
|
|
- case 'edit':
|
|
|
|
|
- return '修改班次';
|
|
|
|
|
- break;
|
|
|
|
|
- default:
|
|
|
|
|
- break;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
- created() {},
|
|
|
|
|
- methods: {
|
|
|
|
|
- open(type, row) {
|
|
|
|
|
- this.type = type;
|
|
|
|
|
- this.visible = true;
|
|
|
|
|
- if (type == 'edit') {
|
|
|
|
|
- for (const key of Object.keys(this.form)) {
|
|
|
|
|
- if (row[key]) {
|
|
|
|
|
- this.form[key] = row[key];
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ import {
|
|
|
|
|
+ saveteamtime,
|
|
|
|
|
+ updateteamtime
|
|
|
|
|
+ } from '@/api/workforceManagement/classes';
|
|
|
|
|
+ import timeTable from './timeTable.vue';
|
|
|
|
|
+ export default {
|
|
|
|
|
+ components: {
|
|
|
|
|
+ timeTable
|
|
|
|
|
+ },
|
|
|
|
|
+ data () {
|
|
|
|
|
+ const defaultForm = {
|
|
|
|
|
+ id: '',
|
|
|
|
|
+ code: '',
|
|
|
|
|
+ name: '',
|
|
|
|
|
+ totalWorkHour: '',
|
|
|
|
|
+ details: []
|
|
|
|
|
+ };
|
|
|
|
|
+ return {
|
|
|
|
|
+ defaultForm,
|
|
|
|
|
+ // 表单数据
|
|
|
|
|
+ form: { ...defaultForm },
|
|
|
|
|
+ // 表单验证规则
|
|
|
|
|
+ rules: {
|
|
|
|
|
+ code: [{ required: true, message: '请输入', trigger: 'blur' }],
|
|
|
|
|
+ name: [{ required: true, message: '请输入', trigger: 'blur' }]
|
|
|
|
|
+ },
|
|
|
|
|
+ visible: false,
|
|
|
|
|
+ type: '', // add/edit
|
|
|
|
|
+ loading: false,
|
|
|
|
|
+ options: {
|
|
|
|
|
+ workshopId: [],
|
|
|
|
|
+ productionLineId: [],
|
|
|
|
|
+ workStationId: []
|
|
|
|
|
+ },
|
|
|
|
|
+ delDetailIds: []
|
|
|
|
|
+ };
|
|
|
|
|
+ },
|
|
|
|
|
+ computed: {
|
|
|
|
|
+ title () {
|
|
|
|
|
+ switch (this.type) {
|
|
|
|
|
+ case 'add':
|
|
|
|
|
+ return '新增班次';
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 'edit':
|
|
|
|
|
+ return '修改班次';
|
|
|
|
|
+ break;
|
|
|
|
|
+ default:
|
|
|
|
|
+ break;
|
|
|
}
|
|
}
|
|
|
- this.$nextTick(() => {
|
|
|
|
|
- // 反显时间段
|
|
|
|
|
- if (row.details) {
|
|
|
|
|
- this.$refs.timeTable.form.datasource = row.details;
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
- /* 保存编辑 */
|
|
|
|
|
- save() {
|
|
|
|
|
- this.$refs.form.validate((valid) => {
|
|
|
|
|
- if (!valid) {
|
|
|
|
|
- return false;
|
|
|
|
|
|
|
+ created () {},
|
|
|
|
|
+ methods: {
|
|
|
|
|
+ open (type, row) {
|
|
|
|
|
+ this.type = type;
|
|
|
|
|
+ this.visible = true;
|
|
|
|
|
+ if (type == 'edit') {
|
|
|
|
|
+ for (const key of Object.keys(this.form)) {
|
|
|
|
|
+ if (row[key]) {
|
|
|
|
|
+ this.form[key] = row[key];
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
|
+ // 反显时间段
|
|
|
|
|
+ if (row.details) {
|
|
|
|
|
+ this.$refs.timeTable.form.datasource = row.details;
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
|
|
+ },
|
|
|
|
|
+ /* 保存编辑 */
|
|
|
|
|
+ save () {
|
|
|
|
|
+ this.$refs.form.validate((valid) => {
|
|
|
|
|
+ if (!valid) {
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- if (this.type == 'add') {
|
|
|
|
|
- delete this.form.id;
|
|
|
|
|
- }
|
|
|
|
|
- this.$refs.timeTable.verification().then((res) => {
|
|
|
|
|
- this.loading = true;
|
|
|
|
|
- this.form.details = this.$refs.timeTable.form.datasource;
|
|
|
|
|
- let fn;
|
|
|
|
|
- switch (this.type) {
|
|
|
|
|
- case 'add':
|
|
|
|
|
- fn = saveteamtime;
|
|
|
|
|
- break;
|
|
|
|
|
- case 'edit':
|
|
|
|
|
- fn = updateteamtime;
|
|
|
|
|
- this.form.delDetailIds = this.delDetailIds
|
|
|
|
|
- break;
|
|
|
|
|
- default:
|
|
|
|
|
- break;
|
|
|
|
|
|
|
+ if (this.type == 'add') {
|
|
|
|
|
+ delete this.form.id;
|
|
|
}
|
|
}
|
|
|
- fn(this.form)
|
|
|
|
|
- .then((msg) => {
|
|
|
|
|
- this.loading = false;
|
|
|
|
|
- this.$message.success(msg);
|
|
|
|
|
- this.handleClose();
|
|
|
|
|
- this.$emit('done');
|
|
|
|
|
- })
|
|
|
|
|
- .catch((e) => {
|
|
|
|
|
- this.loading = false;
|
|
|
|
|
- this.$message.error(e.message);
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ this.$refs.timeTable.verification().then((res) => {
|
|
|
|
|
+ this.loading = true;
|
|
|
|
|
+ this.form.details = this.$refs.timeTable.form.datasource;
|
|
|
|
|
+ let fn;
|
|
|
|
|
+ switch (this.type) {
|
|
|
|
|
+ case 'add':
|
|
|
|
|
+ fn = saveteamtime;
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 'edit':
|
|
|
|
|
+ fn = updateteamtime;
|
|
|
|
|
+ this.form.delDetailIds = this.delDetailIds;
|
|
|
|
|
+ break;
|
|
|
|
|
+ default:
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ fn(this.form)
|
|
|
|
|
+ .then((msg) => {
|
|
|
|
|
+ this.loading = false;
|
|
|
|
|
+ this.$message.success(msg);
|
|
|
|
|
+ this.handleClose();
|
|
|
|
|
+ this.$emit('done');
|
|
|
|
|
+ })
|
|
|
|
|
+ .catch((e) => {
|
|
|
|
|
+ this.loading = false;
|
|
|
|
|
+ this.$message.error(e.message);
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
});
|
|
});
|
|
|
- });
|
|
|
|
|
- },
|
|
|
|
|
- // 重置表单
|
|
|
|
|
- restForm() {
|
|
|
|
|
- this.$refs.form.clearValidate();
|
|
|
|
|
- this.form = { ...this.defaultForm };
|
|
|
|
|
- },
|
|
|
|
|
- handleClose() {
|
|
|
|
|
- this.delDetailIds = []
|
|
|
|
|
- this.restForm();
|
|
|
|
|
- this.$refs.timeTable.restTable();
|
|
|
|
|
- this.visible = false;
|
|
|
|
|
- },
|
|
|
|
|
- gettimeAll(val) {
|
|
|
|
|
- this.form.totalWorkHour = val;
|
|
|
|
|
|
|
+ },
|
|
|
|
|
+ // 重置表单
|
|
|
|
|
+ restForm () {
|
|
|
|
|
+ this.$refs.form.clearValidate();
|
|
|
|
|
+ this.form = { ...this.defaultForm };
|
|
|
|
|
+ },
|
|
|
|
|
+ handleClose () {
|
|
|
|
|
+ this.delDetailIds = [];
|
|
|
|
|
+ this.restForm();
|
|
|
|
|
+ this.$refs.timeTable.restTable();
|
|
|
|
|
+ this.visible = false;
|
|
|
|
|
+ },
|
|
|
|
|
+ gettimeAll (val) {
|
|
|
|
|
+ this.form.totalWorkHour = val;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
-};
|
|
|
|
|
|
|
+ };
|
|
|
</script>
|
|
</script>
|
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|
|
|
-.location-warp {
|
|
|
|
|
- display: flex;
|
|
|
|
|
- .detail {
|
|
|
|
|
- margin-left: 10px;
|
|
|
|
|
|
|
+ .location-warp {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ .detail {
|
|
|
|
|
+ margin-left: 10px;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
-}
|
|
|
|
|
</style>
|
|
</style>
|