From b39264b8ba63addc552699a8bff1c1c0a4773b44 Mon Sep 17 00:00:00 2001 From: zhanghl <253316343@qq.com> Date: 星期二, 22 四月 2025 14:24:15 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/dev' into dev --- src/views/basicData/event/index.vue | 538 +++++++++++++++++++++++++++++++++ src/api/basicData/calendar.js | 44 ++ src/api/basicData/event.js | 44 ++ src/views/basicData/calendar/index.vue | 295 ++++++++++++++++++ src/api/basicData/processRoute.js | 9 5 files changed, 930 insertions(+), 0 deletions(-) diff --git a/src/api/basicData/calendar.js b/src/api/basicData/calendar.js new file mode 100644 index 0000000..b566159 --- /dev/null +++ b/src/api/basicData/calendar.js @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 鏌ヨ鏃ュ巻绠$悊鍒楄〃 +export function listCalendar(query) { + return request({ + url: '/aps/calendar/list', + method: 'get', + params: query + }) +} + +// 鏌ヨ鏃ュ巻绠$悊璇︾粏 +export function getCalendar(id) { + return request({ + url: '/aps/calendar/' + id, + method: 'get' + }) +} + +// 鏂板鏃ュ巻绠$悊 +export function addCalendar(data) { + return request({ + url: '/aps/calendar', + method: 'post', + data: data + }) +} + +// 淇敼鏃ュ巻绠$悊 +export function updateCalendar(data) { + return request({ + url: '/aps/calendar', + method: 'put', + data: data + }) +} + +// 鍒犻櫎鏃ュ巻绠$悊 +export function delCalendar(id) { + return request({ + url: '/aps/calendar/' + id, + method: 'delete' + }) +} diff --git a/src/api/basicData/event.js b/src/api/basicData/event.js new file mode 100644 index 0000000..65acfce --- /dev/null +++ b/src/api/basicData/event.js @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 鏌ヨ浜嬩欢绠$悊鍒楄〃 +export function listEvent(query) { + return request({ + url: '/aps/event/list', + method: 'get', + params: query + }) +} + +// 鏌ヨ浜嬩欢绠$悊璇︾粏 +export function getEvent(id) { + return request({ + url: '/aps/event/' + id, + method: 'get' + }) +} + +// 鏂板浜嬩欢绠$悊 +export function addEvent(data) { + return request({ + url: '/aps/event', + method: 'post', + data: data + }) +} + +// 淇敼浜嬩欢绠$悊 +export function updateEvent(data) { + return request({ + url: '/aps/event', + method: 'put', + data: data + }) +} + +// 鍒犻櫎浜嬩欢绠$悊 +export function delEvent(id) { + return request({ + url: '/aps/event/' + id, + method: 'delete' + }) +} diff --git a/src/api/basicData/processRoute.js b/src/api/basicData/processRoute.js index c20baac..ef13cba 100644 --- a/src/api/basicData/processRoute.js +++ b/src/api/basicData/processRoute.js @@ -57,3 +57,12 @@ data: data }) } +//鑾峰彇宸ュ簭鍚嶇О鍒楄〃 +export function selectProcessNameList(data) { + return request({ + url: '/aps/processRoute/selectProcessNameList', + method: 'post', + data: data, + }) +} + diff --git a/src/views/basicData/calendar/index.vue b/src/views/basicData/calendar/index.vue new file mode 100644 index 0000000..bb3b016 --- /dev/null +++ b/src/views/basicData/calendar/index.vue @@ -0,0 +1,295 @@ +<template> + <div class="app-container"> + <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px"> + <el-form-item label="鎻忚堪" prop="description"> + <el-input + v-model="queryParams.description" + placeholder="璇疯緭鍏ユ弿杩�" + clearable + @keyup.enter="handleQuery" + /> + </el-form-item> + <el-form-item label="鏃ュ巻鐢熸晥鏃ユ湡" prop="effectiveDate"> + <el-date-picker clearable + v-model="queryParams.effectiveDate" + type="date" + value-format="YYYY-MM-DD" + placeholder="璇烽�夋嫨鏃ュ巻鐢熸晥鏃ユ湡"> + </el-date-picker> + </el-form-item> + <el-form-item label="澶辨晥鏃ユ湡" prop="expiringDate"> + <el-date-picker clearable + v-model="queryParams.expiringDate" + type="date" + value-format="YYYY-MM-DD" + placeholder="璇烽�夋嫨澶辨晥鏃ユ湡"> + </el-date-picker> + </el-form-item> + <el-form-item> + <el-button type="primary" icon="Search" @click="handleQuery">鎼滅储</el-button> + <el-button icon="Refresh" @click="resetQuery">閲嶇疆</el-button> + </el-form-item> + </el-form> + + <el-row :gutter="10" class="mb8"> + <el-col :span="1.5"> + <el-button + type="primary" + plain + icon="Plus" + @click="handleAdd" + v-hasPermi="['core:calendar:add']" + >鏂板</el-button> + </el-col> + <el-col :span="1.5"> + <el-button + type="success" + plain + icon="Edit" + :disabled="single" + @click="handleUpdate" + v-hasPermi="['core:calendar:edit']" + >淇敼</el-button> + </el-col> + <el-col :span="1.5"> + <el-button + type="danger" + plain + icon="Delete" + :disabled="multiple" + @click="handleDelete" + v-hasPermi="['core:calendar:remove']" + >鍒犻櫎</el-button> + </el-col> + <el-col :span="1.5"> + <el-button + type="warning" + plain + icon="Download" + @click="handleExport" + v-hasPermi="['core:calendar:export']" + >瀵煎嚭</el-button> + </el-col> + <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> + </el-row> + + <el-table v-loading="loading" :data="calendarList" @selection-change="handleSelectionChange"> + <el-table-column type="selection" width="55" align="center" /> + <el-table-column label="${comment}" align="center" prop="id" /> + <el-table-column label="鎻忚堪" align="center" prop="description" /> + <el-table-column label="绫诲瀷锛屽懆宸ヤ綔/鑺傚亣鏃�" align="center" prop="type" /> + <el-table-column label="鏃ュ巻鐢熸晥鏃ユ湡" align="center" prop="effectiveDate" width="180"> + <template #default="scope"> + <span>{{ parseTime(scope.row.effectiveDate, '{y}-{m}-{d}') }}</span> + </template> + </el-table-column> + <el-table-column label="澶辨晥鏃ユ湡" align="center" prop="expiringDate" width="180"> + <template #default="scope"> + <span>{{ parseTime(scope.row.expiringDate, '{y}-{m}-{d}') }}</span> + </template> + </el-table-column> + <el-table-column label="鏃ュ巻鍐呭" align="center" prop="content" /> + <el-table-column label="閫傜敤宸ュ巶" align="center" prop="applicableFactory" /> + <el-table-column label="閫傜敤杞﹂棿" align="center" prop="applicableWorkshop" /> + <el-table-column label="閫傜敤宸ュ簭" align="center" prop="applicableProcess" /> + <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width"> + <template #default="scope"> + <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['core:calendar:edit']">淇敼</el-button> + <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['core:calendar:remove']">鍒犻櫎</el-button> + </template> + </el-table-column> + </el-table> + + <pagination + v-show="total>0" + :total="total" + v-model:page="queryParams.pageNum" + v-model:limit="queryParams.pageSize" + @pagination="getList" + /> + + <!-- 娣诲姞鎴栦慨鏀规棩鍘嗙鐞嗗璇濇 --> + <el-dialog :title="title" v-model="open" width="500px" append-to-body> + <el-form ref="calendarRef" :model="form" :rules="rules" label-width="80px"> + <el-form-item label="鎻忚堪" prop="description"> + <el-input v-model="form.description" placeholder="璇疯緭鍏ユ弿杩�" /> + </el-form-item> + <el-form-item label="鏃ュ巻鐢熸晥鏃ユ湡" prop="effectiveDate"> + <el-date-picker clearable + v-model="form.effectiveDate" + type="date" + value-format="YYYY-MM-DD" + placeholder="璇烽�夋嫨鏃ュ巻鐢熸晥鏃ユ湡"> + </el-date-picker> + </el-form-item> + <el-form-item label="澶辨晥鏃ユ湡" prop="expiringDate"> + <el-date-picker clearable + v-model="form.expiringDate" + type="date" + value-format="YYYY-MM-DD" + placeholder="璇烽�夋嫨澶辨晥鏃ユ湡"> + </el-date-picker> + </el-form-item> + <el-form-item label="鏃ュ巻鍐呭" prop="content"> + <el-input v-model="form.content" type="textarea" placeholder="璇疯緭鍏ュ唴瀹�" /> + </el-form-item> + </el-form> + <template #footer> + <div class="dialog-footer"> + <el-button type="primary" @click="submitForm">纭� 瀹�</el-button> + <el-button @click="cancel">鍙� 娑�</el-button> + </div> + </template> + </el-dialog> + </div> +</template> + +<script setup name="Calendar"> +import { listCalendar, getCalendar, delCalendar, addCalendar, updateCalendar } from "@/api/core/calendar"; + +const { proxy } = getCurrentInstance(); + +const calendarList = ref([]); +const open = ref(false); +const loading = ref(true); +const showSearch = ref(true); +const ids = ref([]); +const single = ref(true); +const multiple = ref(true); +const total = ref(0); +const title = ref(""); + +const data = reactive({ + form: {}, + queryParams: { + pageNum: 1, + pageSize: 10, + description: null, + type: null, + effectiveDate: null, + expiringDate: null, + content: null, + applicableFactory: null, + applicableWorkshop: null, + applicableProcess: null, + }, + rules: { + } +}); + +const { queryParams, form, rules } = toRefs(data); + +/** 鏌ヨ鏃ュ巻绠$悊鍒楄〃 */ +function getList() { + loading.value = true; + listCalendar(queryParams.value).then(response => { + calendarList.value = response.rows; + total.value = response.total; + loading.value = false; + }); +} + +// 鍙栨秷鎸夐挳 +function cancel() { + open.value = false; + reset(); +} + +// 琛ㄥ崟閲嶇疆 +function reset() { + form.value = { + id: null, + description: null, + type: null, + effectiveDate: null, + expiringDate: null, + content: null, + applicableFactory: null, + applicableWorkshop: null, + applicableProcess: null, + createBy: null, + createTime: null, + updateBy: null, + updateTime: null + }; + proxy.resetForm("calendarRef"); +} + +/** 鎼滅储鎸夐挳鎿嶄綔 */ +function handleQuery() { + queryParams.value.pageNum = 1; + getList(); +} + +/** 閲嶇疆鎸夐挳鎿嶄綔 */ +function resetQuery() { + proxy.resetForm("queryRef"); + handleQuery(); +} + +// 澶氶�夋閫変腑鏁版嵁 +function handleSelectionChange(selection) { + ids.value = selection.map(item => item.id); + single.value = selection.length != 1; + multiple.value = !selection.length; +} + +/** 鏂板鎸夐挳鎿嶄綔 */ +function handleAdd() { + reset(); + open.value = true; + title.value = "娣诲姞鏃ュ巻绠$悊"; +} + +/** 淇敼鎸夐挳鎿嶄綔 */ +function handleUpdate(row) { + reset(); + const _id = row.id || ids.value + getCalendar(_id).then(response => { + form.value = response.data; + open.value = true; + title.value = "淇敼鏃ュ巻绠$悊"; + }); +} + +/** 鎻愪氦鎸夐挳 */ +function submitForm() { + proxy.$refs["calendarRef"].validate(valid => { + if (valid) { + if (form.value.id != null) { + updateCalendar(form.value).then(response => { + proxy.$modal.msgSuccess("淇敼鎴愬姛"); + open.value = false; + getList(); + }); + } else { + addCalendar(form.value).then(response => { + proxy.$modal.msgSuccess("鏂板鎴愬姛"); + open.value = false; + getList(); + }); + } + } + }); +} + +/** 鍒犻櫎鎸夐挳鎿嶄綔 */ +function handleDelete(row) { + const _ids = row.id || ids.value; + proxy.$modal.confirm('鏄惁纭鍒犻櫎鏃ュ巻绠$悊缂栧彿涓�"' + _ids + '"鐨勬暟鎹」锛�').then(function() { + return delCalendar(_ids); + }).then(() => { + getList(); + proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛"); + }).catch(() => {}); +} + +/** 瀵煎嚭鎸夐挳鎿嶄綔 */ +function handleExport() { + proxy.download('core/calendar/export', { + ...queryParams.value + }, `calendar_${new Date().getTime()}.xlsx`) +} + +getList(); +</script> diff --git a/src/views/basicData/event/index.vue b/src/views/basicData/event/index.vue new file mode 100644 index 0000000..061e383 --- /dev/null +++ b/src/views/basicData/event/index.vue @@ -0,0 +1,538 @@ +<template> + <div class="app-container"> + <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px"> + <el-form-item label="浜嬩欢鎻忚堪" prop="description"> + <el-input + v-model="queryParams.description" + placeholder="璇疯緭鍏ヤ簨浠舵弿杩�" + clearable + @keyup.enter="handleQuery" + /> + </el-form-item> +<!-- <el-form-item label="鎸佺画鏃堕暱" prop="duration">--> +<!-- <el-input--> +<!-- v-model="queryParams.duration"--> +<!-- placeholder="璇疯緭鍏ユ寔缁椂闀�"--> +<!-- clearable--> +<!-- @keyup.enter="handleQuery"--> +<!-- />--> +<!-- </el-form-item>--> +<!-- <el-form-item label="浜嬩欢寮�濮嬫棩鏈�" prop="startDate">--> +<!-- <el-date-picker clearable--> +<!-- v-model="queryParams.startDate"--> +<!-- type="date"--> +<!-- value-format="YYYY-MM-DD"--> +<!-- placeholder="璇烽�夋嫨浜嬩欢寮�濮嬫棩鏈�">--> +<!-- </el-date-picker>--> +<!-- </el-form-item>--> +<!-- <el-form-item label="浜嬩欢缁撴潫鏃ユ湡" prop="endDate">--> +<!-- <el-date-picker clearable--> +<!-- v-model="queryParams.endDate"--> +<!-- type="date"--> +<!-- value-format="YYYY-MM-DD"--> +<!-- placeholder="璇烽�夋嫨浜嬩欢缁撴潫鏃ユ湡">--> +<!-- </el-date-picker>--> +<!-- </el-form-item>--> +<!-- <el-form-item label="浜嬩欢寮�濮嬫椂闂�" prop="startTime">--> +<!-- <el-date-picker clearable--> +<!-- v-model="queryParams.startTime"--> +<!-- type="date"--> +<!-- value-format="YYYY-MM-DD"--> +<!-- placeholder="璇烽�夋嫨浜嬩欢寮�濮嬫椂闂�">--> +<!-- </el-date-picker>--> +<!-- </el-form-item>--> +<!-- <el-form-item label="浜嬩欢缁撴潫鏃堕棿" prop="endTime">--> +<!-- <el-date-picker clearable--> +<!-- v-model="queryParams.endTime"--> +<!-- type="date"--> +<!-- value-format="YYYY-MM-DD"--> +<!-- placeholder="璇烽�夋嫨浜嬩欢缁撴潫鏃堕棿">--> +<!-- </el-date-picker>--> +<!-- </el-form-item>--> + <el-form-item> + <el-button type="primary" icon="Search" @click="handleQuery">鎼滅储</el-button> + <el-button icon="Refresh" @click="resetQuery">閲嶇疆</el-button> + </el-form-item> + </el-form> + + <el-row :gutter="10" class="mb8"> + <el-col :span="1.5"> + <el-button + type="primary" + plain + icon="Plus" + @click="handleAdd" + v-hasPermi="['core:event:add']" + >鏂板</el-button> + </el-col> + <el-col :span="1.5"> + <el-button + type="success" + plain + icon="Edit" + :disabled="single" + @click="handleUpdate" + v-hasPermi="['core:event:edit']" + >淇敼</el-button> + </el-col> + <el-col :span="1.5"> + <el-button + type="danger" + plain + icon="Delete" + :disabled="multiple" + @click="handleDelete" + v-hasPermi="['core:event:remove']" + >鍒犻櫎</el-button> + </el-col> + <el-col :span="1.5"> + <el-button + type="warning" + plain + icon="Download" + @click="handleExport" + v-hasPermi="['core:event:export']" + >瀵煎嚭</el-button> + </el-col> + <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> + </el-row> + + <HxlhTable + style="width: 100%" + :columns="columns" + :data="eventList" + :loading="loading" + :height="height" + :page="page" + @changePageNo="changePageNo" + @changePageSize="changePageSize" + @on-checkbox="handleCheckboxChange" + > + + <template #buttons="{row}"> + <vxe-button mode="text" @click="handleUpdate(row)" v-hasPermi="['plant:edit']" >淇敼</vxe-button> + </template> + </HxlhTable> + + <!-- 娣诲姞鎴栦慨鏀逛簨浠剁鐞嗗璇濇 --> + <el-dialog :title="title" v-model="open" width="700px" append-to-body> + <el-form ref="eventRef" :model="form" :rules="rules" label-width="120px"> + <el-form-item label="浜嬩欢鎻忚堪" prop="description"> + <el-input v-model="form.description" placeholder="璇疯緭鍏ヤ簨浠舵弿杩�" /> + </el-form-item> + <el-form-item label="浜嬩欢寮�濮嬫棩鏈�" prop="startDate"> + <el-date-picker clearable + v-model="form.startDateTime" + type="datetime" + format="YYYY-MM-DD HH:mm" + date-format="YYYY-MM-DD" + time-format="hh:mm" + value-format="YYYY-MM-DD HH:mm" + placeholder="璇烽�夋嫨浜嬩欢寮�濮嬫棩鏈�"> + </el-date-picker> + </el-form-item> + <el-form-item label="浜嬩欢缁撴潫鏃ユ湡" prop="endDate"> + <el-date-picker clearable + v-model="form.endDateTime" + type="datetime" + format="YYYY-MM-DD HH:mm" + date-format="YYYY-MM-DD" + time-format="hh:mm" + value-format="YYYY-MM-DD HH:mm" + placeholder="璇烽�夋嫨浜嬩欢缁撴潫鏃ユ湡"> + </el-date-picker> + </el-form-item> + <el-form-item label="鎸佺画鏃堕暱" prop="duration"> + <el-input type="number" v-model="form.duration" placeholder="璇疯緭鍏ユ寔缁椂闀�" style="width: 150px" min="0"/> 灏忔椂 + </el-form-item> + <el-form-item label="閫傜敤宸ュ巶" prop="applicableFactory"> + <el-select v-model="form.applicableFactory" placeholder="璇烽�夋嫨閫傜敤宸ュ巶" @change="changePlant($event)"> + <el-option + v-for="plant in plantList" + :key="plant.id" + :label="plant.plantName" + :value="plant.plantCode"> + </el-option> + </el-select> + </el-form-item> + <el-form-item label="閫傜敤杞﹂棿" prop="applicableWorkshop"> + <el-select v-model="form.applicableWorkshop" placeholder="璇烽�夋嫨閫傜敤杞﹂棿" filterable> + <el-option + v-for="shop in shopList" + :key="shop.id" + :label="shop.shopName" + :value="shop.id"> + </el-option> + </el-select> + </el-form-item> + <el-form-item label="閫傜敤宸ュ簭" prop="applicableProcess"> + <el-select v-model="form.applicableProcess" placeholder="璇烽�夋嫨閫傜敤宸ュ簭" filterable> + <el-option + v-for="process in processList" + :key="process.id" + :label="process.processName" + :value="process.processName"> + </el-option> + </el-select> + </el-form-item> + <el-form-item label="閫傜敤鏃ュ巻" prop="applicableCalendar"> + <el-select v-model="form.applicableCalendar" placeholder="璇烽�夋嫨閫傜敤鏃ュ巻"> + <el-option label="Zone one" value="shanghai" /> + <el-option label="Zone two" value="beijing" /> + </el-select> + </el-form-item> + </el-form> + <template #footer> + <div class="dialog-footer"> + <el-button type="primary" @click="submitForm">纭� 瀹�</el-button> + <el-button @click="cancel">鍙� 娑�</el-button> + </div> + </template> + </el-dialog> + </div> +</template> + +<script setup name="Event"> +import { listEvent, getEvent, delEvent, addEvent, updateEvent } from "@/api/basicData/event"; +import { listAll_plant } from "@/api/basicData/plant"; +import { listAll_shop, listAps_shop } from "@/api/basicData/shop"; +import { selectProcessNameList } from "@/api/basicData/processRoute.js"; +import HxlhTable from '@/components/HxlhTable' +import axios from "axios"; + +const { proxy } = getCurrentInstance(); + +const eventList = ref([]); +const open = ref(false); +const loading = ref(true); +const showSearch = ref(true); +const ids = ref([]); +const single = ref(true); +const multiple = ref(true); +const total = ref(0); +const title = ref(""); +const plantList = ref([]); +const shopList = ref([]); +const allShopList = ref([]); +const processList = ref([]); + +const height = ref(document.documentElement.clientHeight - 230 + "px;") + +// 澶氶�夋閫変腑鏁版嵁 +const handleCheckboxChange = (data) => { + ids.value = data.records.map(item => item.id); + single.value = data.records.length !== 1; + multiple.value = !data.records.length; +}; + +// 鍒嗛〉灞炴�� +const page = ref({ + total: 0, + current: 1, + size: 10 +}); +// 琛ㄦ牸閰嶇疆 +const columns = ref([ + { type: 'checkbox', width: 60, align:"center"}, + { type: 'seq', title: '搴忓彿', width: 60, align: 'center' }, + { + title: '浜嬩欢鎻忚堪', + field: 'description', + width: 150, + align: 'center' + }, + { + title: '鎸佺画鏃堕暱', + field: 'duration', + width: 150, + align: 'center' + }, + { + title: '浜嬩欢寮�濮嬫棩鏈�', + field: 'startDate', + width: 150, + align: 'center' + }, + { + title: '浜嬩欢缁撴潫鏃ユ湡', + field: 'endDate', + width: 150, + align: 'center' + }, + { + title: '浜嬩欢寮�濮嬫椂闂�', + field: 'startTime', + width: 150, + align: 'center' + }, + { + title: '浜嬩欢缁撴潫鏃堕棿', + field: 'endTime', + width: 150, + align: 'center' + }, + { + title: '閫傜敤宸ュ巶', + field: 'applicableFactory', + width: 150, + align: 'center', + formatter: (({ cellValue, row, column }) => { + if (cellValue) { + for(let i=0;i<plantList.value.length;i++){ + if(cellValue===plantList.value[i].plantCode){ + return plantList.value[i].plantName + } + } + } + return ''; + }) + }, + { + title: '閫傜敤杞﹂棿', + field: 'applicableWorkshop', + width: 150, + align: 'center', + formatter: (({ cellValue, row, column }) => { + if (cellValue) { + for(let i=0;i<allShopList.value.length;i++){ + if(cellValue===allShopList.value[i].id){ + return allShopList.value[i].shopName + } + } + } + return ''; + }) + }, + { + title: '閫傜敤宸ュ簭', + field: 'applicableProcess', + width: 150, + align: 'center' + }, + { + title: '閫傜敤鏃ュ巻', + field: 'applicableCalendar', + width: 150, + align: 'center' + }, + { title: '鎿嶄綔', width: 100, fixed:"right", slots: { default: 'buttons' }, align: 'center' } +]); + +const data = reactive({ + form: {}, + queryParams: { + pageNum: 1, + pageSize: 10, + description: null, + duration: null, + startDate: null, + endDate: null, + startTime: null, + endTime: null, + applicableFactory: null, + applicableWorkshop: null, + applicableProcess: null, + applicableCalendar: null, + startDateTime: null, + endDateTime: null + }, + rules: { + description: [ + { required: true, message: "浜嬩欢鎻忚堪涓嶈兘涓虹┖", trigger: "blur" } + ], + duration: [ + { required: true, message: "鎸佺画鏃堕暱涓嶈兘涓虹┖", trigger: "blur" } + ], + startDateTime: [ + { required: true, message: "浜嬩欢寮�濮嬫棩鏈熶笉鑳戒负绌�", trigger: "blur" } + ], + endDateTime: [ + { required: true, message: "浜嬩欢缁撴潫鏃ユ湡涓嶈兘涓虹┖", trigger: "blur" } + ], + applicableFactory: [ + { required: true, message: "閫傜敤宸ュ巶涓嶈兘涓虹┖", trigger: "change" } + ], + applicableWorkshop: [ + { required: true, message: "閫傜敤杞﹂棿涓嶈兘涓虹┖", trigger: "change" } + ], + applicableProcess: [ + { required: true, message: "閫傜敤宸ュ簭涓嶈兘涓虹┖", trigger: "change" } + ], + applicableCalendar: [ + { required: true, message: "閫傜敤鏃ュ巻涓嶈兘涓虹┖", trigger: "change" } + ], + } +}); + +const { queryParams, form, rules } = toRefs(data); + +/** 鏌ヨ浜嬩欢绠$悊鍒楄〃 */ +function getList() { + axios.all([ + /** 鏌ヨ浜嬩欢鍒楄〃 **/ + listEvent(queryParams.value), + /** 鏌ヨ宸ュ巶鍒楄〃 */ + listAll_plant({}), + /** 鏌ヨ杞﹂棿鍒楄〃 */ + listAll_shop({}) + ]) + .then(axios.spread((response1, response2, response3) => { + eventList.value = response1.rows; + plantList.value = response2.data; + allShopList.value = response3.data; + total.value = response1.total; + loading.value = false; + })) + .catch(error => { + console.error('璇锋眰鍑洪敊:', error); + }); + + + loading.value = true; + listEvent(queryParams.value).then(response => { + + loading.value = false; + }); +} + +// 鍙栨秷鎸夐挳 +function cancel() { + open.value = false; + reset(); +} + +// 琛ㄥ崟閲嶇疆 +function reset() { + form.value = { + id: null, + description: null, + duration: null, + startDate: null, + endDate: null, + startTime: null, + endTime: null, + applicableFactory: null, + applicableWorkshop: null, + applicableProcess: null, + applicableCalendar: null, + createBy: null, + createTime: null, + updateBy: null, + updateTime: null, + startDateTime: null, + endDateTime: null + }; + proxy.resetForm("eventRef"); +} + +/** 鎼滅储鎸夐挳鎿嶄綔 */ +function handleQuery() { + queryParams.value.pageNum = 1; + getList(); +} + +/** 閲嶇疆鎸夐挳鎿嶄綔 */ +function resetQuery() { + proxy.resetForm("queryRef"); + handleQuery(); +} + +// 澶氶�夋閫変腑鏁版嵁 +function handleSelectionChange(selection) { + ids.value = selection.map(item => item.id); + single.value = selection.length != 1; + multiple.value = !selection.length; +} + +/** 鏂板鎸夐挳鎿嶄綔 */ +function handleAdd() { + reset(); + open.value = true; + title.value = "鏂板浜嬩欢"; +} + +/** 淇敼鎸夐挳鎿嶄綔 */ +function handleUpdate(row) { + reset(); + const _id = row.id || ids.value + getEvent(_id).then(response => { + form.value = response.data; + form.value.startDateTime = form.value.startDate + " " + form.value.startTime; + form.value.endDateTime = form.value.endDate + " " + form.value.endTime; + changePlant(form.value.applicableFactory); + open.value = true; + title.value = "淇敼浜嬩欢绠$悊"; + }); +} + +/** 鎻愪氦鎸夐挳 */ +function submitForm() { + proxy.$refs["eventRef"].validate(valid => { + if (valid) { + form.value.startDate = form.value.startDateTime.split(" ")[0]; + form.value.endDate = form.value.endDateTime.split(" ")[0]; + form.value.startTime = form.value.startDateTime.split(" ")[1]; + form.value.endTime = form.value.endDateTime.split(" ")[1]; + if (form.value.id != null) { + updateEvent(form.value).then(response => { + proxy.$modal.msgSuccess("淇敼鎴愬姛"); + open.value = false; + getList(); + }); + } else { + addEvent(form.value).then(response => { + proxy.$modal.msgSuccess("鏂板鎴愬姛"); + open.value = false; + getList(); + }); + } + } + }); +} + +/** 鍒犻櫎鎸夐挳鎿嶄綔 */ +function handleDelete(row) { + const _ids = row.id || ids.value; + proxy.$modal.confirm('鏄惁纭鍒犻櫎浜嬩欢绠$悊缂栧彿涓�"' + _ids + '"鐨勬暟鎹」锛�').then(function() { + return delEvent(_ids); + }).then(() => { + getList(); + proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛"); + }).catch(() => {}); +} + +/** 瀵煎嚭鎸夐挳鎿嶄綔 */ +function handleExport() { + proxy.download('/aps/event/export', { + ...queryParams.value + }, `event_${new Date().getTime()}.xlsx`) +} + +/** 閫夋嫨宸ュ巶鍚庝簨浠� 鍔犺浇杞﹂棿 鍜� 宸ュ簭 **/ +function changePlant(plant){ + listAps_shop({"plantCode": plant}).then(response => { + shopList.value = response.rows; + }) + selectProcessNameList({"orgCode": plant}).then(response => { + processList.value = response.rows; + }) +} + +function changePageNo(currentPage) { + queryParams.value.pageNum = currentPage; + page.value.current = currentPage; + getList(); +} + +function changePageSize(pageSize) { + page.value.current = 1; + queryParams.value.pageNum = 1; + queryParams.value.pageSize = pageSize; + getList(); +} + +/** 鍒濆鍖栨暟鎹� **/ +onMounted(()=>{}) + +getList(); +</script> -- Gitblit v1.9.3