From eef1ef0be935d4a3d8fc691b2666f41796b2d4a5 Mon Sep 17 00:00:00 2001 From: gaoshp <291585735@qq.com> Date: 星期一, 04 十一月 2024 19:57:08 +0800 Subject: [PATCH] 增加列表显示 --- src/views/console/workstation/Dialog.vue | 89 ++++++++++++++++++++++++++++++++------------ 1 files changed, 65 insertions(+), 24 deletions(-) diff --git a/src/views/console/workstation/Dialog.vue b/src/views/console/workstation/Dialog.vue index e5693f0..5e44b5f 100644 --- a/src/views/console/workstation/Dialog.vue +++ b/src/views/console/workstation/Dialog.vue @@ -1,14 +1,14 @@ <template> <el-dialog :title="titleMap[mode]" v-model="visible" :width="800" destroy-on-close @closed="$emit('closed')"> - <el-form :model="form" :rules="rules" :disabled="mode == 'show'" ref="dialogForm" label-width="120px" - label-position="center"> + <el-form v-if="visible" :model="form" :rules="rules" :disabled="mode == 'show'" ref="dialogForm" + label-width="120px" label-position="center"> <el-row> <el-col :span="24" style="padding:12px 0;"> 鍩虹淇℃伅 </el-col> <el-col :span="12"> <el-form-item label="宸ヤ綅缂栧彿" prop="code"> - <el-input style="width: 240px" :disabled="form.id" v-model="form.code" placeholder="宸ヤ綅缂栧彿" + <el-input style="width: 240px" :disabled="!!form.id" v-model="form.code" placeholder="宸ヤ綅缂栧彿" clearable></el-input> </el-form-item> </el-col> @@ -19,7 +19,7 @@ </el-col> <el-col :span="12"> <el-form-item label="宸ヤ綅绫诲瀷" prop="type"> - <el-select v-model="form.type" style="width: 240px" :disabled="form.id"> + <el-select v-model="form.type" style="width: 240px" :disabled="!!form.id"> <el-option v-for="item in options.types" :key="item.value" :label="item.label" :value="item.value" /> </el-select> @@ -41,13 +41,33 @@ <scUpload v-model="form.avatar" title="宸ヤ綅鍥剧墖"></scUpload> </el-form-item> </el-col> - <el-col :span="12"> + <el-col :span="12" v-show="!form.id"> <el-form-item label="鐢熶骇鏃ュ巻" prop="calendarCode"> <el-select v-model="form.calendarCode" style="width: 240px"> <el-option v-for="item in options.calendarList" :key="item.id" :label="item.name" - :value="item.id" /> + :value="item.code" /> </el-select> </el-form-item> + </el-col> + <!-- 淇敼鐨勬鏃ョ敓鏁� --> + <el-col :span="11" v-show="form.id"> + <el-form-item label="鐢熶骇鏃ュ巻" prop="calendarCode"> + <el-select v-model="form.calendarCodeWaiting" style="width: 240px"> + <el-option v-for="item in options.calendarList" :key="item.id" :label="item.name" + :value="item.code" /> + </el-select> + </el-form-item> + + </el-col> + <el-col :span="1" v-show="form.id"> + <div style="display: flex;align-items: center;height: 32px;margin-bottom: 18px;"> + <el-tooltip class="box-item" effect="dark" content="淇敼鍚庣殑鏃ュ巻娆℃棩鐢熸晥" placement="top-start"> + <el-icon> + <el-icon-warning-filled style="vertical-align: middle" /> + </el-icon> + </el-tooltip> + </div> + </el-col> <el-col :span="24" style="padding:12px 0;" v-if="form.type == 0"> 鏈哄櫒淇℃伅 @@ -55,8 +75,8 @@ <el-col :span="12" v-if="form.type == 0 && !form.id"> <el-form-item label="閫夋嫨鏈哄櫒" prop="linkWay"> <el-radio-group v-model="form.linkWay"> - <el-radio v-for="item in options.linkWays" :key="item.value" - :label="item.value">{{ item.label }}</el-radio> + <el-radio v-for="item in options.linkWays" :key="item.value" :label="item.value">{{ + item.label }}</el-radio> </el-radio-group> </el-form-item> </el-col> @@ -68,7 +88,8 @@ filterable> <el-option v-for="item in options.listnoband" :key="item.id" :label="item.machineName" :value="item.id"> - {{ `${item?.machineCode}-${item?.machineName}-${item?.brand}` }}</el-option> + {{ `${item?.machineCode}-${item?.machineName}${item?.brand ? '-' + item.brand : ''}` + }}</el-option> </el-select> <el-input v-if="form.id" :disabled="form.id" v-model="form.machineName"></el-input> </el-form-item> @@ -88,11 +109,11 @@ <el-form-item label="鍔犲伐灞炴��" prop="properties"> <el-select v-model="form.properties" style="width: 240px"> <el-option v-for="item in options.machining_type" :key="item.dictKey" - :label="item.dictValue" :value="item.dictKey" /> + :label="item.dictValue" :value="item.dictKey - 0" /> </el-select> </el-form-item> </el-col> - <el-col :span="12"> + <!-- <el-col :span="12"> <el-form-item label="绋嬪簭浼犺緭鏂瑰紡" prop="transmissionMethod"> <el-select v-model="form.transmissionMethod" style="width: 240px"> <el-option label="FTP" :value="1" /> @@ -107,7 +128,7 @@ :value="item.value" /> </el-select> </el-form-item> - </el-col> + </el-col> --> <el-col :span="12" v-if="form.ftpDirectoryType == 1"> <el-form-item label="鍏宠仈鐩綍" prop="directoryId"> <el-select v-model="form.directoryId" style="width: 240px"> @@ -116,10 +137,7 @@ </el-select> </el-form-item> </el-col> - <el-col :span="4"> - <!-- <el-form-item label="宸ヤ綔鍙�" prop="workbenchVOList"> --> - - <!-- </el-form-item> --> + <!-- <el-col :span="4"> <span>宸ヤ綔鍙�</span> </el-col> @@ -131,13 +149,16 @@ </li> </ul> <el-button style="margin-left: 50px;margin-top: 8px" @click="addWork">娣诲姞宸ヤ綔鍙�</el-button> - </el-col> + </el-col> --> <el-col :span="12"> <el-form-item label="鏁版嵁鏉冮檺" prop="createDept"> - <el-tree-select clearable @node-click="nodeClickTree" v-model="form.createDept" :data="tree" + <el-tree-select :props="{ + label: 'title', + id: 'id', + }" clearable @node-click="nodeClickTree" v-model="form.createDept" :data="tree" :check-on-click-node="true" style="width: 240px"> - <template #default="{ data: { title } }"> - {{ title }}</template> + <!-- <template #default="{ data: { title } }"> + {{ title }}</template> --> </el-tree-select> </el-form-item> </el-col> @@ -198,6 +219,7 @@ status: '', avatar: '', calendarCode: '', + calendarCodeWaiting: '', linkWay: '', machineId: '', machineCode: '', @@ -293,21 +315,25 @@ methods: { //鏄剧ず open(mode = 'add', params) { + this.isSaveing = false; this.mode = mode; this.visible = true; - + console.log('---------', params) if (params) { Object.keys(this.form).forEach(key => { this.form[key] = params[key] }) - this.$HTTP.get(`/api/blade-cps/workstation/get?workstationId=${params.id}`).then(res => { + + this.$HTTP.get(`/api/smis/workstation/get?workstationId=${params.id}`).then(res => { this.form = res?.data - this.$HTTP.get(`/api/blade-cps/workstation-workbench/listWorkbench?workstationId=${params.id}`).then(res => { + if (this.form.calendarCode && !this.form.calendarCodeWaiting) this.form.calendarCodeWaiting = this.form.calendarCode + this.$HTTP.get(`/api/smis/workstation-workbench/listWorkbench?workstationId=${params.id}`).then(res => { this.form.workbenchVOList = res?.data?.workstationList || [] }) }) } else { this.form.id = '' + this.form.workbenchVOList = [] Object.keys(this.form).forEach(key => { this.form[key] = '' }) @@ -316,10 +342,22 @@ }, //琛ㄥ崟鎻愪氦鏂规硶 submit() { + if (!this.form.workbenchVOList) { + this.form.workbenchVOList = [] + } + if (this.mode === 'add' && this.form.linkWay === 1) { + this.form.machineId + this.form.machineCode = this.form.code + this.form.machineName = this.form.name + } this.$refs.dialogForm.validate(async (valid) => { if (valid) { this.isSaveing = true; - var res = await this.$API.workstation.add.post(this.form); + try { + var res = await this.$API.workstation.add.post(this.form); + } catch (error) { + this.isSaveing = false; + } this.isSaveing = false; if (res.code == 200) { this.$emit('success', this.form, this.mode) @@ -375,6 +413,9 @@ }) }, addWork() { + if (!this.form.workbenchVOList) { + this.form.workbenchVOList = [] + } this.form.workbenchVOList.push({ sort: this.form.workbenchVOList.length + 1, name: '' -- Gitblit v1.9.3