同步6/16
This commit is contained in:
@@ -39,11 +39,19 @@
|
||||
is-range
|
||||
range-separator="到"
|
||||
start-placeholder="开始时间"
|
||||
format="HH:mm"
|
||||
value-format="HH:mm:00"
|
||||
end-placeholder="结束时间"
|
||||
style="width: 100%"
|
||||
/>
|
||||
<el-button v-if="taskTime.length > 1" icon="Minus" circle style="margin-left: 10px" @click="removeTaskTime(index)"></el-button>
|
||||
<el-button v-if="taskTime.length === index + 1" icon="Plus" circle style="margin-left: 10px" @click="addTaskTime"></el-button>
|
||||
<!-- <el-button v-if="taskTime.length > 1" icon="Minus" circle style="margin-left: 10px" @click="removeTaskTime(index)"></el-button>
|
||||
<el-button
|
||||
v-if="taskTime.length === index + 1 && taskTime.length <= 8"
|
||||
icon="Plus"
|
||||
circle
|
||||
style="margin-left: 10px"
|
||||
@click="addTaskTime"
|
||||
></el-button> -->
|
||||
</div>
|
||||
</el-form-item>
|
||||
|
||||
@@ -52,12 +60,6 @@
|
||||
<el-option v-for="item in com_inspection_remind_tiime" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="巡检设置">
|
||||
<el-radio-group v-model="form.inspectSetting">
|
||||
<el-radio label="必须拍照" value="1" />
|
||||
<el-radio label="允许跳检" value="0" />
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="计划路线">
|
||||
<el-select @change="handlChangeMap" v-model="form.routeIds" placeholder="请选择" style="width: 100%">
|
||||
<el-option v-for="item in planlist" :key="item.value" :label="item.routeName" :value="item.id" />
|
||||
@@ -75,15 +77,13 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
// TODO 巡检计划 添加
|
||||
import { listRoute } from '@/api/system/InspectionRoute';
|
||||
import PageHeader from '@/components/Pageheader/index.vue';
|
||||
import { numToWeek } from '@/utils/time';
|
||||
import { Delete } from '@element-plus/icons-vue';
|
||||
import { ref } from 'vue';
|
||||
import AMapLoader from '@amap/amap-jsapi-loader';
|
||||
import { addPlan, getPlan, updatePlan } from '@/api/system/InspectionPlan';
|
||||
import { getVillageByIdAPI } from '@/api/system/community';
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
const { com_inspection_remind_tiime } = toRefs<any>(proxy?.useDict('com_inspection_remind_tiime'));
|
||||
|
||||
@@ -98,7 +98,7 @@ const form = ref({
|
||||
executeDay: '', // 执行周期具体的周几
|
||||
remindTime: '', // 提醒时间
|
||||
routeIds: '', // 计划路线id
|
||||
inspectSetting: '1' // 巡检设置
|
||||
inspectSetting: 0 // 巡检设置
|
||||
});
|
||||
const rules = ref({
|
||||
planName: [{ required: true, message: '请输入巡检计划名称', trigger: 'blur' }],
|
||||
@@ -108,16 +108,6 @@ const rules = ref({
|
||||
// 初始化 taskTime,确保至少有一个时间段
|
||||
const taskTime = ref<[string, string][]>([['', '']]);
|
||||
|
||||
// 新增时间段
|
||||
function addTaskTime() {
|
||||
taskTime.value.push(['', '']);
|
||||
}
|
||||
|
||||
// 删除时间段
|
||||
function removeTaskTime(index: number) {
|
||||
taskTime.value.splice(index, 1);
|
||||
}
|
||||
|
||||
// 选择周几
|
||||
const checkoutWeek = ref([]);
|
||||
function checkoutWeekFun(val: number) {
|
||||
@@ -129,13 +119,6 @@ function checkoutWeekFun(val: number) {
|
||||
}
|
||||
}
|
||||
|
||||
// 任务时间
|
||||
const options = ref([
|
||||
{
|
||||
value: '09:00-11:00; 13:00-15:00',
|
||||
label: '09:00-11:00; 13:00-15:00'
|
||||
}
|
||||
]);
|
||||
// 提醒时间
|
||||
|
||||
// 巡检计划id
|
||||
@@ -158,7 +141,7 @@ async function init() {
|
||||
executeDay: res.data.executeDay, // 执行周期具体的周几
|
||||
remindTime: res.data.remindTime, // 提醒时间
|
||||
routeIds: res.data.routeIds, // 计划路线id
|
||||
inspectSetting: String(res.data.inspectSetting) // 巡检设置
|
||||
inspectSetting: res.data.inspectSetting // 巡检设置
|
||||
};
|
||||
checkoutWeek.value = res.data.executeDay
|
||||
.split(',')
|
||||
@@ -245,11 +228,14 @@ function handlChangeMap(val) {
|
||||
}
|
||||
}
|
||||
}
|
||||
const aloaderkey = import.meta.env.VITE_GCJ02_KEY_GD;
|
||||
const VITE_GCJ02_JS_CODE_GD = import.meta.env.VITE_GCJ02_JS_CODE_GD;
|
||||
|
||||
onMounted(async () => {
|
||||
await nextTick();
|
||||
window._AMapSecurityConfig = { securityJsCode: '09534b3534d8da53968529a9ce164118' };
|
||||
window._AMapSecurityConfig = { securityJsCode: VITE_GCJ02_JS_CODE_GD };
|
||||
AMapLoader.load({
|
||||
key: '8e302fe1be5f4db62bc734db23dca149',
|
||||
key: aloaderkey,
|
||||
version: '2.0',
|
||||
plugins: ['AMap.Scale', 'AMap.Marker']
|
||||
}).then(async (AMap) => {
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
active-value="0"
|
||||
inactive-value="1"
|
||||
></el-switch>
|
||||
<!-- 0关闭 1开启 -->
|
||||
<!-- 1关闭 0开启 -->
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="110" align="center" fixed="right" class-name="small-padding fixed-width">
|
||||
@@ -148,17 +148,21 @@ const { queryParams, form, rules } = toRefs(data);
|
||||
/** 查询巡检计划列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true;
|
||||
const res = await listPlan(queryParams.value);
|
||||
planList.value = res.rows;
|
||||
planList.value.forEach((item) => {
|
||||
item.routeNames = item.routeList.map((item) => item.routeName).join(',');
|
||||
item.executeDayNames = item.executeDay
|
||||
.split(',')
|
||||
.sort((a, b) => Number(a) - Number(b))
|
||||
.map((item) => Number(item));
|
||||
});
|
||||
total.value = res.total;
|
||||
loading.value = false;
|
||||
listPlan(queryParams.value)
|
||||
.then((res) => {
|
||||
planList.value = res.rows;
|
||||
planList.value.forEach((item) => {
|
||||
item.routeNames = item.routeList.map((item) => item.routeName).join(',');
|
||||
item.executeDayNames = item.executeDay
|
||||
.split(',')
|
||||
.sort((a, b) => Number(a) - Number(b))
|
||||
.map((item) => Number(item));
|
||||
});
|
||||
total.value = res.total;
|
||||
})
|
||||
.finally(() => {
|
||||
loading.value = false;
|
||||
});
|
||||
};
|
||||
|
||||
/** 取消按钮 */
|
||||
@@ -202,10 +206,12 @@ const handleAdd = () => {
|
||||
|
||||
/** 修改按钮操作 */
|
||||
const handleUpdate = async (row?: PlanVO) => {
|
||||
const _ids = row?.id || ids.value[0];
|
||||
|
||||
router.push({
|
||||
path: '/inspection/editPlan',
|
||||
query: {
|
||||
id: row.id
|
||||
id: _ids
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -216,22 +222,6 @@ function handleChangeStatus(id: string, status: string) {
|
||||
getList();
|
||||
});
|
||||
}
|
||||
/** 提交按钮 */
|
||||
const submitForm = () => {
|
||||
planFormRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
buttonLoading.value = true;
|
||||
if (form.value.id) {
|
||||
await updatePlan(form.value).finally(() => (buttonLoading.value = false));
|
||||
} else {
|
||||
await addPlan(form.value).finally(() => (buttonLoading.value = false));
|
||||
}
|
||||
proxy?.$modal.msgSuccess('操作成功');
|
||||
dialog.visible = false;
|
||||
await getList();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (row?: PlanVO) => {
|
||||
|
||||
Reference in New Issue
Block a user