文件名从 src/views/specialWorkSystem/approveProcessManagement/reportTypeSetting/index.vue 修改 |
| | |
| | | <el-table-column prop="createTime" label="创建时间" width="180" /> |
| | | <el-table-column prop="editor" label="最新编辑人" width="180" /> |
| | | <el-table-column prop="editeTime" label="最新编辑时间" /> |
| | | <el-table-column fixed="right" label="操作" width="180"> |
| | | <el-table-column fixed="right" label="操作" align="center" width="180"> |
| | | <template #default="scope"> |
| | | <el-button link type="primary" size="small" @click="editeRow(scope.$index,scope.row)">编辑</el-button> |
| | | <el-button link type="danger" size="small" @click="deleteRow(scope.$index)">删除</el-button> |
| | | <el-button link type="primary" size="small" :icon="Edit" @click="editeRow(scope.$index,scope.row)">编辑</el-button> |
| | | <el-button link type="danger" size="small" :icon="Delete" @click="deleteRow(scope.$index)">删除</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | |
| | | <el-input v-model="reportForm.editor" /> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="onSubmitAddForm(ruleFormRef)" size="default">确认</el-button> |
| | | <el-button type="primary" @click="onSubmitAddForm(ruleFormRef)" size="default" v-throttle>确认</el-button> |
| | | <el-button size="default" @click="dialogAddForm = false">取消</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | |
| | | import { initBackEndControlRoutes } from '/@/router/backEnd'; |
| | | import {useUserInfo} from "/@/stores/userInfo"; |
| | | import { Session } from '/@/utils/storage'; |
| | | import { Edit, Delete } from '@element-plus/icons-vue' |
| | | import { FormInstance, FormRules } from 'element-plus' |
| | | let global: any = { |
| | | homeChartOne: null, |
| | |
| | | } |
| | | ]) |
| | | const dialogAddForm = ref(false); |
| | | |
| | | // 判断新增修改参数 |
| | | const rowIndex = ref(-1) |
| | | |
| | | const reportForm = ref({ |
| | | type: '', |
| | | founder: '', |
| | |
| | | editor: '', |
| | | editeTime: '' |
| | | }) |
| | | |
| | | // 时间格式化 |
| | | const timeForm = { |
| | | hour12: false, |
| | | year: 'numeric', |
| | | month: '2-digit', |
| | | day: '2-digit', |
| | | hour: '2-digit', |
| | | minute: '2-digit', |
| | | second: '2-digit' |
| | | } |
| | | |
| | | // 新增记录 |
| | | const addReport = ()=>{ |
| | | dialogAddForm.value = true |
| | | }; |
| | | |
| | | const ruleFormRef = ref<FormInstance>() |
| | | const addRules = reactive<FormRules>({ |
| | | type:[{required: true, message: '该内容不能为空',trigger:'blur'}], |
| | | founder:[{required: true, message: '该内容不能为空',trigger:'blur'}], |
| | | editor:[{required: true, message: '该内容不能为空',trigger:'blur'}] |
| | | }) |
| | | |
| | | // 新增修改记录确认 |
| | | const onSubmitAddForm = async (formEl: FormInstance | undefined) => { |
| | | if (!formEl) return |
| | | await formEl.validate((valid, fields) => { |
| | | if (valid) { |
| | | if(rowIndex.value == -1){ |
| | | reportForm.value.createTime = new Date().toLocaleString() |
| | | reportForm.value.editeTime = new Date().toLocaleString() |
| | | tableData.push(reportForm.value) |
| | | reportForm.value.createTime = new Date().toLocaleString('zh', timeForm).replace(/\//g,'-') |
| | | reportForm.value.editeTime = new Date().toLocaleString('zh', timeForm).replace(/\//g,'-') |
| | | tableData.unshift(reportForm.value) |
| | | }else{ |
| | | reportForm.value.editeTime = new Date().toLocaleString('zh', timeForm).replace(/\//g,'-') |
| | | tableData[rowIndex.value] = reportForm.value |
| | | } |
| | | dialogAddForm.value = false |
| | |
| | | } |
| | | }) |
| | | } |
| | | |
| | | // 修改记录 |
| | | const editeRow = (index: number, row: User) =>{ |
| | | dialogAddForm.value = true |
| | | rowIndex.value = index |
| | | reportForm.value = JSON.parse(JSON.stringify(row)) |
| | | reportForm.value.editeTime = new Date().toLocaleString() |
| | | } |
| | | |
| | | // 删除记录 |
| | | const deleteRow = (index)=>{ |
| | | tableData.splice( index,1) |
| | | } |
| | | |
| | | // 弹窗关闭数据初始化 |
| | | const dialogColse = () =>{ |
| | | reportForm.value = { |
| | | type: '', |
| | |
| | | reportForm, |
| | | ruleFormRef, |
| | | addRules, |
| | | timeForm, |
| | | dialogColse, |
| | | editeRow, |
| | | deleteRow, |