¶Ô±ÈÐÂÎļþ |
| | |
| | | <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" } |
| | | ], |
| | | startDate: [ |
| | | { required: true, message: "äºä»¶å¼å§æ¥æä¸è½ä¸ºç©º", trigger: "blur" } |
| | | ], |
| | | endDate: [ |
| | | { required: true, message: "äºä»¶ç»ææ¥æä¸è½ä¸ºç©º", trigger: "blur" } |
| | | ], |
| | | startTime: [ |
| | | { required: true, message: "äºä»¶å¼å§æ¶é´ä¸è½ä¸ºç©º", trigger: "blur" } |
| | | ], |
| | | endTime: [ |
| | | { 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> |