From 1ca46431ab9faea036ec8b2ae54b20b720f7bad6 Mon Sep 17 00:00:00 2001
From: Admin <978517621@qq.com>
Date: Mon, 25 Jul 2022 18:29:48 +0800
Subject: [PATCH] 添加修改页面
---
src/views/specialWorkSystem/afterWorkManagement/workTicketCheck/index.vue | 222 ++++++++++++++++++++++++++-----------------------------
1 files changed, 105 insertions(+), 117 deletions(-)
diff --git a/src/views/specialWorkSystem/afterWorkManagement/workTicketCheck/index.vue b/src/views/specialWorkSystem/afterWorkManagement/workTicketCheck/index.vue
index 92fe993..dc12704 100644
--- a/src/views/specialWorkSystem/afterWorkManagement/workTicketCheck/index.vue
+++ b/src/views/specialWorkSystem/afterWorkManagement/workTicketCheck/index.vue
@@ -181,125 +181,113 @@
interface type {
}
- // export default defineComponent({
- // name: 'workCheckinRecord',
- // setup() {
- const userInfo = useUserInfo()
- const { userInfos } = storeToRefs(userInfo);
- const state = reactive<stateType>({});
- const currentPage = ref(1)
- const pageSize = ref(10)
- const chosenIndex = ref(-1)
- const handleSizeChange = (val: number) => {
- console.log(`${val} items per page`)
- }
- const handleCurrentChange = (val: number) => {
- console.log(`current page: ${val}`)
- }
- const tableData = reactive(
- [
- {
- id: '11011',
- cardName: '动火作业证',
- checkTime: '2021-04-22 15:21:31',
- worker: '吴海涛',
- result: '合格',
- remark: '没意见'
- },
- {
- id: '11012',
- cardName: '动火作业证',
- checkTime: '2021-04-22 15:21:31',
- worker: '吴沈峰',
- result: '合格',
- remark: '有点意见'
- },
- ]
- )
- const addRef = ref<FormInstance>()
- const addRules = reactive<FormRules>({
- id:[{required: true, message: '该内容不能为空',trigger:'blur'}],
- cardName:[{required: true, message: '该内容不能为空',trigger:'blur'}],
- worker:[{required: true, message: '该内容不能为空',trigger:'blur'}],
- result:[{required: true, message: '该内容不能为空',trigger:'blur'}],
- checkTime:[{required: true, message: '该内容不能为空',trigger:'blur'}]
- })
- const dialogDetails = ref(false)
- const dialogAddRecord = ref(false)
- const deleteDialog = ref(false)
- const addRecord = ref({})
- const details = ref({})
- const viewRecord = (row) =>{
- details.value = JSON.parse(JSON.stringify(row))
- dialogDetails.value = true
- }
- const deleteRecord = (index) =>{
- chosenIndex.value = index
- deleteDialog.value = true
- }
- const conFirmDelete = ()=> {
- tableData.splice(chosenIndex.value,1)
- deleteDialog.value = false
- }
- const confirmAddRecord = async (formEl: FormInstance | undefined) =>{
- if (!formEl) return
- await formEl.validate((valid, fields) => {
- if (valid) {
- if(chosenIndex.value == -1){
- tableData.push(addRecord.value)
- }else{
- tableData[chosenIndex.value] = addRecord.value
- }
- dialogAddRecord.value =false
- } else {
- console.log('error submit!', fields)
- }
- })
+ const userInfo = useUserInfo()
+ const { userInfos } = storeToRefs(userInfo);
+ // 分页
+ const currentPage = ref(1)
+ const pageSize = ref(10)
+
+ // 判断编辑和新增
+ const chosenIndex = ref(-1)
+
+ const handleSizeChange = (val: number) => {
+ console.log(`${val} items per page`)
+ }
+ const handleCurrentChange = (val: number) => {
+ console.log(`current page: ${val}`)
+ }
+ const tableData = reactive(
+ [
+ {
+ id: '11011',
+ cardName: '动火作业证',
+ checkTime: '2021-04-22 15:21:31',
+ worker: '吴海涛',
+ result: '合格',
+ remark: '没意见'
+ },
+ {
+ id: '11012',
+ cardName: '动火作业证',
+ checkTime: '2021-04-22 15:21:31',
+ worker: '吴沈峰',
+ result: '合格',
+ remark: '有点意见'
+ },
+ ]
+ )
+ const addRef = ref<FormInstance>()
+ const addRules = reactive<FormRules>({
+ id:[{required: true, message: '该内容不能为空',trigger:'blur'}],
+ cardName:[{required: true, message: '该内容不能为空',trigger:'blur'}],
+ worker:[{required: true, message: '该内容不能为空',trigger:'blur'}],
+ result:[{required: true, message: '该内容不能为空',trigger:'blur'}],
+ checkTime:[{required: true, message: '该内容不能为空',trigger:'blur'}]
+ })
+
+ const dialogDetails = ref(false)
+ const dialogAddRecord = ref(false)
+ const deleteDialog = ref(false)
+ const addRecord = ref({})
+ const details = ref({})
+
+ // 查看记录
+ const viewRecord = (row) =>{
+ details.value = JSON.parse(JSON.stringify(row))
+ dialogDetails.value = true
+ }
+
+ // 删除记录
+ const deleteRecord = (index) =>{
+ chosenIndex.value = index
+ deleteDialog.value = true
+ }
+
+ // 弹窗确认删除记录
+ const conFirmDelete = ()=> {
+ tableData.splice(chosenIndex.value,1)
+ deleteDialog.value = false
+ }
+
+ // 弹窗确认新增记录
+ const confirmAddRecord = async (formEl: FormInstance | undefined) =>{
+ if (!formEl) return
+ await formEl.validate((valid, fields) => {
+ if (valid) {
+ if(chosenIndex.value == -1){
+ tableData.push(addRecord.value)
+ }else{
+ tableData[chosenIndex.value] = addRecord.value
+ }
+ dialogAddRecord.value =false
+ } else {
+ console.log('error submit!', fields)
}
- const closeAdd =()=>{
- addRecord.value={}
- chosenIndex.value = -1
- }
- const indexClear = ()=>{
- chosenIndex.value = -1
- }
- const editRecord =(index, row)=>{
- dialogAddRecord.value = true
- chosenIndex.value = index
- addRecord.value = JSON.parse(JSON.stringify(row))
- }
- // 折线图
- const renderMenu = async (value: string) => {
- Session.set('projectId',value)
- userInfos.value.projectId = value
- await initBackEndControlRoutes();
- };
- // return {
- // renderMenu,
- // multipleTableRef,
- // tableData,
- // currentPage,
- // pageSize,
- // dialogDetails,
- // details,
- // deleteDialog,
- // dialogAddRecord,
- // viewRecord,
- // deleteRecord,
- // handleSizeChange,
- // handleCurrentChange,
- // Plus,
- // Edit,
- // Delete,
- // Search,
- // Download,
- // handleSelectionChange,
- // Refresh,
- // ...toRefs(state),
- // };
- // },
- // });
+ })
+
+ }
+ // 新增弹窗关闭时的数据初始化处理
+ const closeAdd =()=>{
+ addRecord.value={}
+ chosenIndex.value = -1
+ }
+ const indexClear = ()=>{
+ chosenIndex.value = -1
+ }
+
+ // 修改编辑记录
+ const editRecord =(index, row)=>{
+ dialogAddRecord.value = true
+ chosenIndex.value = index
+ addRecord.value = JSON.parse(JSON.stringify(row))
+ }
+ // 折线图
+ const renderMenu = async (value: string) => {
+ Session.set('projectId',value)
+ userInfos.value.projectId = value
+ await initBackEndControlRoutes();
+ };
</script>
<style scoped lang="scss">
--
Gitblit v1.9.2