@@ -255,6 +261,8 @@ import type { FormInstance, FormRules } from 'element-plus';
import Contactform from './components/contactform.vue';
import EngineeringChangeApplicationForm from './components/engineeringChangeApplicationForm.vue';
import Notice from './components/notice.vue';
+import { listContactTypeformtemplate } from '@/api/cory/contactformtemplate';
+import { addContactnotice, delContactnotice, listContactnotice } from '@/api/cory/contactnotice';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
// 获取用户 store
@@ -266,6 +274,9 @@ const { safety_inspection_violation_type, safety_inspection_check_type } = toRef
);
const teamOpt = ref([]);
const foremanOpt = ref([]);
+const thumbnailUrl = ref('');
+const tableData = ref([]);
+const total = ref(0);
const formRef = ref
();
const dialogVisible = ref(false);
@@ -275,7 +286,7 @@ const addSingle = ref(false);
const single = ref(true);
const ids = ref>([]);
-const projectTypeOptions = [
+const projectTypeOptions = ref([
{
value: '0',
label: '联系单'
@@ -296,11 +307,9 @@ const projectTypeOptions = [
value: '4',
label: '签证单'
}
-];
+]);
const initFormData = {
- id: undefined,
- projectId: currentProject.value?.id,
projectType: '',
projectName: '',
serialNumber: '',
@@ -333,8 +342,9 @@ const data = reactive>({
inspectionType: undefined,
inspectionStatus: undefined,
teamId: undefined,
+ type: undefined,
params: {},
- projectType: '0'
+ projectType: undefined
},
rules: {
projectName: [{ required: true, message: '请输入工程名称', trigger: 'blur' }],
@@ -349,9 +359,21 @@ const data = reactive>({
const { queryParams, form, rules } = toRefs(data);
const submitForm = () => {
- formRef.value?.validate((valid) => {
+ formRef.value?.validate(async (valid) => {
if (valid) {
+ let data = {
+ type: queryParams.value.type,
+ projectId: currentProject.value?.id,
+ detail: JSON.stringify(form.value)
+ };
console.log('提交表单:', form);
+ const res = await addContactnotice(data);
+ if (res.code == 200) {
+ proxy.$modal.msgSuccess('添加成功');
+ dialogVisible.value = false;
+ formRef.value.resetFields();
+ getList();
+ }
}
});
};
@@ -371,8 +393,35 @@ const changeForeman = (value: string | number) => {
const handleQuery = () => {};
const resetQuery = () => {};
-const getList = () => {};
-const handleDelete = () => {};
+const getList = async () => {
+ console.log(queryParams.value.projectType);
+
+ if (!queryParams.value.projectType) {
+ const res = await listContactTypeformtemplate(queryParams.value);
+ projectTypeOptions.value = res.data;
+ queryParams.value.projectType = res.data[0].name;
+ thumbnailUrl.value = res.data[0].thumbnail;
+ queryParams.value.type = res.data[0].id as string;
+ }
+ const res = await listContactnotice(queryParams.value);
+ res.rows = res.rows.map((item) => {
+ return {
+ ...item,
+ ...JSON.parse(item.detail)
+ };
+ });
+ tableData.value = res.rows;
+ total.value = res.total || 0;
+};
+const handleDelete = async (id?: string) => {
+ const _ids = id || ids.value;
+ await proxy?.$modal.confirm('是否确认删除识别记录编号为"' + _ids + '"的数据项?').finally();
+ const res = await delContactnotice(_ids);
+ if (res.code == 200) {
+ proxy.$modal.msgSuccess('删除成功');
+ getList();
+ }
+};
const handleUpdate = () => {};
/** 多选框选中数据 */
@@ -382,7 +431,18 @@ const handleSelectionChange = (selection: any) => {
multiple.value = !selection.length;
};
+const selectType = (value: string) => {
+ queryParams.value.projectType = value;
+ thumbnailUrl.value = projectTypeOptions.value.filter((item) => item.name == value)[0].thumbnail;
+ queryParams.value.type = projectTypeOptions.value.filter((item) => item.name == value)[0].id;
+ getList();
+};
+
const resetForm = () => {
formRef.value?.resetFields();
};
+
+onMounted(() => {
+ getList();
+});