From 63390cd8a25c7dd32b9bd5bf4163122850c5cacd Mon Sep 17 00:00:00 2001 From: ljlong_2630 Date: Thu, 22 Feb 2024 17:36:37 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E6=B5=8B=E7=89=88=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/BasicForm/src/BasicForm.vue | 4 + .../Detail/src/DetailDeviceLedger.vue | 183 +++++++++++++++++- src/utils/dict.ts | 6 +- src/utils/disposition/defaultButtons.ts | 15 ++ src/utils/disposition/tabsList.ts | 32 +++ .../deviceAccounts/deviceAccounts.data.ts | 17 +- src/views/eam/device/deviceAccounts/index.vue | 5 +- src/views/eam/mold/moldAccounts/index.vue | 111 ++++++++--- .../mold/moldAccounts/moldAccounts.data.ts | 71 +++++++ src/views/system/dept/DeptForm.vue | 135 +++++++++++-- src/views/system/dept/index.vue | 20 +- 11 files changed, 533 insertions(+), 66 deletions(-) diff --git a/src/components/BasicForm/src/BasicForm.vue b/src/components/BasicForm/src/BasicForm.vue index 5dd561e..8cc85c7 100644 --- a/src/components/BasicForm/src/BasicForm.vue +++ b/src/components/BasicForm/src/BasicForm.vue @@ -115,6 +115,7 @@ import ButtonBase from '@/components/XButton/src/ButtonBase.vue' import TableForm from '@/components/TableForm/src/TableForm.vue' import TableFormCountPlan from '@/components/TableFormCountPlan/src/TableFormCountPlan.vue' import { DICT_TYPE, getStrDictOptions } from '@/utils/dict' +import { log } from 'console' const props = defineProps({ // 是否显示TableForm 新增/删除按钮 @@ -254,6 +255,9 @@ const formRef = ref() // 表单 Ref const formSchema = ref(props.formAllSchemas?.formSchema) const tableAllSchemas = ref(props.tableAllSchemas) const tableFormRules = ref(props.tableFormRules) +console.log(88,props.formAllSchemas); +console.log(11); + // 列表-按钮 const buttondata = [ diff --git a/src/components/Detail/src/DetailDeviceLedger.vue b/src/components/Detail/src/DetailDeviceLedger.vue index feda423..0d352d6 100644 --- a/src/components/Detail/src/DetailDeviceLedger.vue +++ b/src/components/Detail/src/DetailDeviceLedger.vue @@ -88,7 +88,27 @@ :pagination="{ total: tableObjectRef.total }" v-model:pageSize="tableObjectRef.pageSize" v-model:currentPage="tableObjectRef.currentPage" - /> + > + + + + + +
- +
+ + + + + + + 点击修改 + + + @@ -170,11 +218,6 @@ import * as defaultButtons from '@/utils/disposition/defaultButtons' import BasicForm from '@/components/BasicForm/src/BasicForm.vue' import TableHead from '@/components/TableHead/src/TableHead.vue' import DetailTable from '@/components/DetailTable/src/DetailTable.vue' -import { getCurrentInstance } from 'vue' -import { get } from 'http' -import { findIndex } from '@/utils' -const { proxy } = getCurrentInstance() -const changeFile = () => {} defineOptions({ name: 'Detail' }) @@ -191,6 +234,14 @@ const dialogTitle = ref() const dialogAllSchemasRef = ref() const dialogTableObjectRef = ref() const dialogTableMethodsRef = ref() +const dialogUploadTitle = ref() +const fileDialogUploadData = ref({ + filePathList: [] +}) +const dialogUploadVisible = ref(false) +const dialogUploadNumber = ref() +const dialogUploadBusiCode = ref() +const dialogFormKey = ref(0) const props = defineProps({ // 标签参数 @@ -348,9 +399,40 @@ const props = defineProps({ // 子表dialog相关信息 dialogAllSchemas: { type: Object, - required: true, + required: false, + default: null + }, + // 子表dialog校验信息 + dialogAllSchemasRules: { + type: Object, + required: false, + default: null + }, + dialogFormAllSchemas: { + type: Object, + required: false, + default: null + }, + dialogFormAllSchemasRules: { + type: Object, + required: false, + default: null + }, + diaLogApiUpdate: { + type: Function, + required: false, default: null }, + diaLogApiCreate: { + type: Function, + required: false, + default: null + }, + milestoneFuncCode: { + type: String, + required: false, + default: null + } }) const imageFormData = ref({ filePathList: [] @@ -622,7 +704,8 @@ const emit = defineEmits([ 'detailOpenForm', 'tableFormButton', 'openImage', - 'subTabsChick' + 'subTabsChick', + 'milestoneOpenForm' ]) /** 删除按钮操作 */ const handleDelete = async (id: number) => { @@ -758,6 +841,7 @@ const openDialog = async(row: any, titleName: any, titleValue: any) => { getListApi: props.dialogApiPage, // 分页接口 defaultParams: getDialogParams(row) }) + dialogVisible.value = true dialogAllSchemasRef.value = props.dialogAllSchemas dialogTableObjectRef.value = tableObject dialogTableMethodsRef.value = tableMethods @@ -765,8 +849,87 @@ const openDialog = async(row: any, titleName: any, titleValue: any) => { const { getList } = tableMethods await getList() updateKey.value += 1 - getList() // 刷新当前列 + // getList() // 刷新当前列 + setBeiJian() +} + +// 设置备件回显 +const setBeiJian = () => { + let isItemNUmbersTrue = false + isItemNUmbersTrue = dialogAllSchemasRef.value.tableColumns.some( + (item) => item.field == 'itemNumbers1' + ) + if (!isItemNUmbersTrue) return + dialogTableObjectRef.value.tableList.forEach((item) => { + if (item.itemNumbers?.length > 0) { + let str = '' + item.itemNumbers.forEach((element) => { + str += element.name + ':' + element.qty + ',' + }) + item.itemNumbers1 = str.substring(0, str.length - 1) + } + }) } + +// 列表-操作按钮 +const butttondata = [ + defaultButtons.mainListEditBtn(null), // 编辑 + defaultButtons.uploadFileBtn(null),//上传 +] + +// 列表-操作按钮事件 +const buttonMilestoneClick = async (val, row) => { + if (val == 'edit') { + // 编辑 + openDialogForm('update', row) + } else if (val == 'upload') { + openDialogUpload(row) + } +} + +function submitDialogForm(type, row) { + props.diaLogApiUpdate(row).then(res => { + console.log(res.code); + }) +} + +function openDialogUpload(row) { + dialogUploadVisible.value = true + getDialogUpload(row) +} + +/** 添加/修改操作 */ +const dialogFormRef = ref() +const openDialogForm = async (type: string, row?: number) => { + dialogFormRef.value.open(type, row) +} + +const getDialogUpload = (row) => { + dialogUploadNumber.value = row.number + dialogUploadBusiCode.value = row.milestoneStage + props.getImageApi({ + number: row.number, + funcCode: props.milestoneFuncCode + }) + .then((res) => { + fileDialogUploadData.value.filePathList = res + dialogFormKey.value += 1 + }) +} + +function dialogUploadFile() { + let data = { + number: dialogUploadNumber.value, + filePathList: fileDialogUploadData.value.filePathList.map((item) => item.url), + funcCode: props.milestoneFuncCode, + fileBusiType: dialogUploadBusiCode.value + } + props.uploadImage(data).then((res) => { + message.success('修改成功') + getImage() + }) +} +