|
@@ -0,0 +1,230 @@
|
|
|
|
+<template>
|
|
|
|
+ <!-- 添加或修改项目信息对话框 -->
|
|
|
|
+ <div class="el-drawer__wrapper">
|
|
|
|
+ <el-drawer :title="title" v-model="visible" direction="rtl" size="100%">
|
|
|
|
+ <div class="page-container form-container">
|
|
|
|
+ <div class="form-btns-container">
|
|
|
|
+ <span class="title-label"><el-icon>
|
|
|
|
+ <Document />
|
|
|
|
+ </el-icon> 项目信息</span>
|
|
|
|
+ <el-button-group>
|
|
|
|
+ <el-button v-if="editStatus" type="primary" size="small" icon="Finished"
|
|
|
|
+ @click="submitForm">保存</el-button>
|
|
|
|
+ <el-button v-else type="warning" size="small" icon="Edit" @click="editStatus = true">编辑</el-button>
|
|
|
|
+ <el-button v-if="form.id && editStatus" type="info" size="small" icon="Close"
|
|
|
|
+ @click="editStatus = false">取消编辑</el-button>
|
|
|
|
+ <el-button v-if="form.id" type="success" size="small" @click="getForm">
|
|
|
|
+ <i class="fa fa-refresh" aria-hidden="true" /> 刷新
|
|
|
|
+ </el-button>
|
|
|
|
+ </el-button-group>
|
|
|
|
+ <div class="screen-btn" @click="handleScreen">
|
|
|
|
+ <template v-if="!isFullscreen">
|
|
|
|
+ <i class="fa fa-window-maximize" aria-hidden="true" />
|
|
|
|
+ <!-- <span>全屏</span> -->
|
|
|
|
+ </template>
|
|
|
|
+ <template v-else>
|
|
|
|
+ <i class="fa fa-window-restore" aria-hidden="true" />
|
|
|
|
+ <!-- <span>还原</span> -->
|
|
|
|
+ </template>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="close-btn" @click="cancel">
|
|
|
|
+ <i class="fa fa-times" aria-hidden="true" />
|
|
|
|
+ <!-- <span>关闭</span> -->
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="Y-scrollbar" style="position: absolute; top: 32px; bottom: 0; width: 100%; overflow: auto">
|
|
|
|
+ </div>
|
|
|
|
+ <el-form ref="dayworkRef" class="master-container" :model="form" :rules="rules" label-width="120px">
|
|
|
|
+ <el-row :gutter="30">
|
|
|
|
+ <el-col :span="6">
|
|
|
|
+ <el-form-item label="工序合格数" prop="processQualifiedNum">
|
|
|
|
+ <el-input v-if="editStatus" v-model="form.processQualifiedNum" placeholder="请输入工序合格数" />
|
|
|
|
+ <span v-else>{{ form.processQualifiedNum }}</span>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ <el-col :span="6">
|
|
|
|
+ <el-form-item label="员工编码" prop="userName">
|
|
|
|
+ <el-input v-if="editStatus" v-model="form.userName" placeholder="请输入员工编码" />
|
|
|
|
+ <span v-else>{{ form.userName }}</span>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ <el-col :span="6">
|
|
|
|
+ <el-form-item label="员工姓名" prop="nickName">
|
|
|
|
+ <el-input v-if="editStatus" v-model="form.nickName" placeholder="请输入员工姓名" />
|
|
|
|
+ <span v-else>{{ form.nickName }}</span>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ <el-col :span="6">
|
|
|
|
+ <el-form-item label="开始时间" prop="startTime">
|
|
|
|
+ <el-date-picker v-if="editStatus" clearable
|
|
|
|
+ v-model="form.startTime"
|
|
|
|
+ type="date"
|
|
|
|
+ value-format="YYYY-MM-DD"
|
|
|
|
+ placeholder="请选择开始时间">
|
|
|
|
+ </el-date-picker>
|
|
|
|
+ <span v--else>{{ form.startTime }}</span>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ <el-col :span="6">
|
|
|
|
+ <el-form-item label="结束时间" prop="endTime">
|
|
|
|
+ <el-date-picker v-if="editStatus" clearable
|
|
|
|
+ v-model="form.endTime"
|
|
|
|
+ type="date"
|
|
|
|
+ value-format="YYYY-MM-DD"
|
|
|
|
+ placeholder="请选择结束时间">
|
|
|
|
+ </el-date-picker>
|
|
|
|
+ <span v--else>{{ form.endTime }}</span>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ <el-col :span="6">
|
|
|
|
+ <el-form-item label="备注" prop="remark">
|
|
|
|
+ <el-input v-if="editStatus" v-model="form.remark" placeholder="请输入备注" />
|
|
|
|
+ <span v-else>{{ form.remark }}</span>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ </el-row>
|
|
|
|
+ </el-form>
|
|
|
|
+ </div>
|
|
|
|
+ </el-drawer>
|
|
|
|
+ </div>
|
|
|
|
+</template>
|
|
|
|
+<script setup>
|
|
|
|
+import {getDaywork,addDaywork,updateDaywork} from "@/api/business/daywork";
|
|
|
|
+const { proxy } = getCurrentInstance()
|
|
|
|
+/** 父组件传参 */
|
|
|
|
+const props = defineProps({
|
|
|
|
+ getList: {
|
|
|
|
+ type: Function,
|
|
|
|
+ default: () => { }
|
|
|
|
+ }
|
|
|
|
+})
|
|
|
|
+const { getList } = toRefs(props)
|
|
|
|
+/** 字典数组区 */
|
|
|
|
+/** 表单抽屉 页变量 */
|
|
|
|
+const title = ref("")
|
|
|
|
+const loading = ref(false)
|
|
|
|
+const multiple = ref(true)
|
|
|
|
+const visible = ref(false)
|
|
|
|
+const editStatus = ref(false)
|
|
|
|
+const isFullscreen = ref(false)
|
|
|
|
+const webHost = import.meta.env.VITE_APP_BASE_API
|
|
|
|
+const data = reactive({
|
|
|
|
+ form: {},
|
|
|
|
+ rules: {
|
|
|
|
+ processQualifiedNum: [
|
|
|
|
+ { required: true, message: "工序合格数不能为空", trigger: "blur" }
|
|
|
|
+ ],
|
|
|
|
+ userName: [
|
|
|
|
+ { required: true, message: "员工编码不能为空", trigger: "blur" }
|
|
|
|
+ ],
|
|
|
|
+ nickName: [
|
|
|
|
+ { required: true, message: "员工姓名不能为空", trigger: "blur" }
|
|
|
|
+ ],
|
|
|
|
+ startTime: [
|
|
|
|
+ { required: true, message: "开始时间不能为空", trigger: "blur" }
|
|
|
|
+ ],
|
|
|
|
+ endTime: [
|
|
|
|
+ { required: true, message: "结束时间不能为空", trigger: "blur" }
|
|
|
|
+ ],
|
|
|
|
+ status: [
|
|
|
|
+ { required: true, message: "批次生产状态不能为空", trigger: "change" }
|
|
|
|
+ ],
|
|
|
|
+ }
|
|
|
|
+});
|
|
|
|
+const { form, rules } = toRefs(data);
|
|
|
|
+/*********************** 方法区 ****************************/
|
|
|
|
+/** 打开抽屉 */
|
|
|
|
+function open(id) {
|
|
|
|
+ reset();
|
|
|
|
+ visible.value = true;
|
|
|
|
+ if (id) {
|
|
|
|
+ getDaywork(id).then(response => {
|
|
|
|
+ form.value = response.data;
|
|
|
|
+ editStatus.value = false
|
|
|
|
+ title.value = "修改项目信息"
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ editStatus.value = true
|
|
|
|
+ title.value = "添加项目信息"
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/** 取消按钮 */
|
|
|
|
+function cancel() {
|
|
|
|
+ visible.value = false;
|
|
|
|
+ reset();
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/** 表单重置 */
|
|
|
|
+function reset() {
|
|
|
|
+ form.value = {
|
|
|
|
+ id: null,
|
|
|
|
+ tenantId: null,
|
|
|
|
+ productionPlanId: null,
|
|
|
|
+ productionPlanDetailId: null,
|
|
|
|
+ productionPlanDetailSubDetailId: null,
|
|
|
|
+ lotId: null,
|
|
|
|
+ deptId: null,
|
|
|
|
+ productId: null,
|
|
|
|
+ technologicalProcessId: null,
|
|
|
|
+ processQualifiedNum: null,
|
|
|
|
+ userId: null,
|
|
|
|
+ userName: null,
|
|
|
|
+ nickName: null,
|
|
|
|
+ startTime: null,
|
|
|
|
+ endTime: null,
|
|
|
|
+ remark: null,
|
|
|
|
+ status: null,
|
|
|
|
+ createTime: null,
|
|
|
|
+ creatorId: null,
|
|
|
|
+ updateTime: null,
|
|
|
|
+ updaterId: null,
|
|
|
|
+ deleted: null,
|
|
|
|
+ version: null
|
|
|
|
+ };
|
|
|
|
+ proxy.resetForm("dayworkRef");
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/** 全屏缩放 */
|
|
|
|
+function handleScreen() {
|
|
|
|
+ const dom = document.querySelector('.list-container > .el-drawer__wrapper > .el-overlay')
|
|
|
|
+ isFullscreen.value = !isFullscreen.value
|
|
|
|
+ dom.style.position = isFullscreen.value ? 'fixed' : 'absolute'
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+/** 提交按钮 */
|
|
|
|
+function submitForm() {
|
|
|
|
+ proxy.$refs["dayworkRef"].validate(valid => {
|
|
|
|
+ if (valid) {
|
|
|
|
+ if (form.value.id != null) {
|
|
|
|
+ updateDaywork(form.value).then(response => {
|
|
|
|
+ proxy.$modal.msgSuccess("修改成功");
|
|
|
|
+ visible.value = false;
|
|
|
|
+ getList.value()
|
|
|
|
+ });
|
|
|
|
+ } else {
|
|
|
|
+ addDaywork(form.value).then(response => {
|
|
|
|
+ proxy.$modal.msgSuccess("新增成功");
|
|
|
|
+ visible.value = false;
|
|
|
|
+ getList.value()
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/** 查询表单信息 */
|
|
|
|
+function getForm() {
|
|
|
|
+ loading.value = true
|
|
|
|
+ getDaywork(form.value.id).then(response => {
|
|
|
|
+ loading.value = false
|
|
|
|
+ form.value = response.data
|
|
|
|
+ })
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/** 暴露给父组件的方法 */
|
|
|
|
+defineExpose({
|
|
|
|
+ open
|
|
|
|
+})
|
|
|
|
+</script>
|