Ver código fonte

合同材料

ZaiZai 10 meses atrás
pai
commit
f94fdd17f9

+ 1 - 1
public/version.json

@@ -1,3 +1,3 @@
 {
-  "value": "20240407180419"
+  "value": "20240423174714"
 }

+ 102 - 0
src/views/debit-pay/material/components/material/dataModal.vue

@@ -0,0 +1,102 @@
+<template>
+    <hc-new-dialog v-model="isShow" :title="`${dataId ? '编辑' : '新增'}材料调差单`" is-footer-center is-table widths="80rem" @close="modalClose">
+        1111111
+        <template #footer>
+            <el-button hc-btn @click="modalClose">取消</el-button>
+            <el-button :loading="saveLoaing" hc-btn type="primary" @click="modalSave">提交</el-button>
+            <el-button v-if="!dataId" :loading="saveLoaing" hc-btn type="primary" @click="modalSaveClose">提交并关闭</el-button>
+        </template>
+    </hc-new-dialog>
+</template>
+
+<script setup>
+import { ref, watch } from 'vue'
+import { useAppStore } from '~src/store'
+import { isNumberReg } from '~uti/tools'
+import mainApi from '~api/debit-pay/material/material'
+import { formValidate, getArrValue, isNullES } from 'js-fast-way'
+
+const props = defineProps({
+    ids: {
+        type: [String, Number],
+        default: '',
+    },
+})
+
+//事件
+const emit = defineEmits(['finish', 'close'])
+
+//初始变量
+const useAppState = useAppStore()
+const contractId = ref(useAppState.getContractId)
+const projectId = ref(useAppState.getProjectId)
+
+//双向绑定
+// eslint-disable-next-line no-undef
+const isShow = defineModel('modelValue', {
+    default: false,
+})
+
+//监听
+const dataId = ref(props.ids)
+watch(() => props.ids, (id) => {
+    dataId.value = id
+}, { deep: true })
+
+//监听
+watch(isShow, (val) => {
+    if (val) detailsModalShow()
+})
+
+//表单数据
+const baseForm = ref({})
+
+//处理数据
+const detailsModalShow = () => {
+    console.log(dataId.value)
+}
+
+//保存数据
+const saveLoaing = ref(false)
+const submitData = async () => {
+    //saveLoaing.value = true
+    if (dataId.value) {
+        return true
+    } else {
+        return true
+    }
+}
+
+//保存
+const isSubmit = ref(false)
+const modalSave = async () => {
+    const isValidate = await submitData()
+    if (isValidate) {
+        isSubmit.value = true
+        saveLoaing.value = false
+    }
+}
+
+//保存并关闭
+const modalSaveClose = async () => {
+    const isValidate = await submitData()
+    if (isValidate) {
+        saveLoaing.value = false
+        modalClose()
+        emit('finish')
+    }
+}
+
+//关闭弹窗
+const modalClose = () => {
+    isShow.value = false
+    emit('close')
+    if (isSubmit.value) {
+        emit('finish')
+    }
+}
+</script>
+
+<style lang="scss">
+
+</style>

+ 16 - 33
src/views/debit-pay/material/material.vue

@@ -20,14 +20,7 @@
             </template>
         </hc-table>
         <!-- 新增/编辑 -->
-        <hc-new-dialog v-model="isFormModal" :title="`${formModel.id ? '编辑' : '新增'}材料调差单`" is-footer-center is-table widths="80rem" @close="modalClose">
-            1111111
-            <template #footer>
-                <el-button hc-btn @click="modalClose">取消</el-button>
-                <el-button :loading="saveLoaing" hc-btn type="primary" @click="modalSave">提交</el-button>
-                <el-button v-if="!formModel.id" :loading="saveLoaing" hc-btn type="primary" @click="modalSaveClose">提交并关闭</el-button>
-            </template>
-        </hc-new-dialog>
+        <HcdataModal v-model="isFormModal" :ids="rowId" @finish="dataModalFinish" />
     </hc-card>
 </template>
 
@@ -37,6 +30,7 @@ import { useAppStore } from '~src/store'
 import { HcDelMsg } from 'hc-vue3-ui'
 import { getArrValue } from 'js-fast-way'
 import mainApi from '~api/debit-pay/material/material'
+import HcdataModal from './components/material/dataModal.vue'
 
 //初始化
 const store = useAppStore()
@@ -67,7 +61,7 @@ const tableData = ref([
 //获取表格数据
 const tableLoading = ref(false)
 const getTableData = async () => {
-    tableLoading.value = true
+    /*tableLoading.value = true
     const { error, code, data } = await mainApi.getAllMaterial({
         //...searchForm.value,
         projectId: projectId.value,
@@ -78,45 +72,34 @@ const getTableData = async () => {
         tableData.value = getArrValue(data)
     } else {
         tableData.value = []
-    }
+    }*/
 }
 
-//弹窗
-const isFormModal = ref(false)
-const formModel = ref({})
-
 //新增
+const isFormModal = ref(false)
+const rowId = ref('')
 const addFormModal = () => {
+    rowId.value = ''
     isFormModal.value = true
-    formModel.value = {}
-}
-
-//保存
-const saveLoaing = ref(false)
-const modalSave = async () => {
-
-}
-
-//关闭弹窗
-const modalClose = () => {
-    isFormModal.value = false
-}
-
-//保存并关闭
-const modalSaveClose = () => {
-
 }
 
 //材料名称被点击
 const rowTop = (row) => {
-
+    rowId.value = row.id
+    isFormModal.value = true
 }
 
 //编辑
 const rowEditClick = (row) => {
-
+    rowId.value = row.id
+    isFormModal.value = true
 }
 
+//数据弹窗完成
+const dataModalFinish = () => {
+    isFormModal.value = false
+    getTableData()
+}
 
 //删除
 const rowDelClick = (row) => {