|
|
@@ -0,0 +1,435 @@
|
|
|
+<script setup lang="ts">
|
|
|
+import { ref, computed, withDefaults, onMounted } from "vue"
|
|
|
+import moment from "moment"
|
|
|
+import router from "@/router"
|
|
|
+import Rs from "@/core/services/RequestService"
|
|
|
+import { ElInput, ElSelect, ElRadioGroup } from "element-plus"
|
|
|
+import VbUpload from "@/components/Upload/VbUpload.vue"
|
|
|
+import ProcessDetail from "./__WarnProcessDetail.vue"
|
|
|
+const props = withDefaults(
|
|
|
+ defineProps<{
|
|
|
+ type?: number
|
|
|
+ columns?: any
|
|
|
+ }>(),
|
|
|
+ { type: 0 }
|
|
|
+)
|
|
|
+const tableUrl = computed(() => {
|
|
|
+ return props.type == 0 //政府账户
|
|
|
+ ? "sys/workOrderOrg/getHandingWorkOrderByOrgAdmin"
|
|
|
+ : props.type == 1 //督察账户
|
|
|
+ ? "sys/workOrderOrg/getHandingWorkOrderByOrgLaw"
|
|
|
+ : props.type == 2 //企业账户
|
|
|
+ ? "sys/workOrderCom/getHandingWorkOrderByCom"
|
|
|
+ : ""
|
|
|
+})
|
|
|
+const cols = ref([
|
|
|
+ {
|
|
|
+ name: "公司名称",
|
|
|
+ field: "company_name",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: "区域",
|
|
|
+ field: "org_name",
|
|
|
+ },
|
|
|
+
|
|
|
+ {
|
|
|
+ name: "报警类型",
|
|
|
+ field: "warn_type_name",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: "状态",
|
|
|
+ field: "work_order_stats_name",
|
|
|
+ },
|
|
|
+
|
|
|
+ {
|
|
|
+ name: "操作",
|
|
|
+ width: 150,
|
|
|
+ field: "action",
|
|
|
+ },
|
|
|
+])
|
|
|
+
|
|
|
+const size = ref<any>("default")
|
|
|
+const dySearchSelectStyle = { width: "180px" }
|
|
|
+const dateRange = ref<[Date, Date]>([moment(new Date()).add(-7, "d").toDate(), new Date()])
|
|
|
+const companyName = ref("")
|
|
|
+const warnType = ref("")
|
|
|
+const workOrderState = ref("")
|
|
|
+//const orgId = ref("0")
|
|
|
+//const monitoringType = ref("")
|
|
|
+//const abnormalState = ref("")
|
|
|
+const queryParams = ref<any>(
|
|
|
+ props.type == 0
|
|
|
+ ? {
|
|
|
+ query_start_time: moment(dateRange.value[0]).format("YYYYMMDD"),
|
|
|
+ query_end_time: moment(dateRange.value[1]).format("YYYYMMDD"),
|
|
|
+ }
|
|
|
+ : {}
|
|
|
+)
|
|
|
+const table = ref()
|
|
|
+
|
|
|
+const jump = function (v: any) {
|
|
|
+ console.log("jump", v)
|
|
|
+ router.push({
|
|
|
+ path: "/goLineData/oilFumeConcentration",
|
|
|
+ query: {
|
|
|
+ back: 1,
|
|
|
+ comName: v.company_name,
|
|
|
+ company_id: v.company_id,
|
|
|
+ },
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+function query() {
|
|
|
+ const params: any = {
|
|
|
+ //monitoring_type: monitoringType.value,
|
|
|
+ //org_id: orgId.value,
|
|
|
+ //abnormal_state: abnormalState.value,
|
|
|
+ company_name: companyName.value,
|
|
|
+ warn_type: warnType.value,
|
|
|
+ work_order_state: workOrderState.value,
|
|
|
+ }
|
|
|
+ if (props.type == 0) {
|
|
|
+ params.query_start_time = moment(dateRange.value[0]).format("YYYYMMDD")
|
|
|
+ params.query_end_time = moment(dateRange.value[1]).format("YYYYMMDD")
|
|
|
+ }
|
|
|
+ const keys = Object.keys(params)
|
|
|
+ keys.forEach((key) => {
|
|
|
+ if (params[key] == "" && params[key] !== 0) {
|
|
|
+ delete params[key]
|
|
|
+ }
|
|
|
+ })
|
|
|
+ queryParams.value = params
|
|
|
+}
|
|
|
+function reset() {
|
|
|
+ //orgId.value = "0"
|
|
|
+ //monitoringType.value = ""
|
|
|
+ //abnormalState.value = ""
|
|
|
+ companyName.value = ""
|
|
|
+ warnType.value = ""
|
|
|
+ workOrderState.value = ""
|
|
|
+ dateRange.value = [moment(new Date()).add(-7, "d").toDate(), new Date()]
|
|
|
+ query()
|
|
|
+}
|
|
|
+const modal = ref()
|
|
|
+const warnDetails = ref<any>({})
|
|
|
+const userList = ref<Array<any>>([])
|
|
|
+const operationType = ref<"D" | "A" | "T" | "R">("D")
|
|
|
+
|
|
|
+const title = computed(() => {
|
|
|
+ return operationType.value == "D"
|
|
|
+ ? "详情"
|
|
|
+ : operationType.value == "A"
|
|
|
+ ? "审核"
|
|
|
+ : operationType.value == "T"
|
|
|
+ ? "转交"
|
|
|
+ : operationType.value == "R"
|
|
|
+ ? "上报"
|
|
|
+ : ""
|
|
|
+})
|
|
|
+const auditFormData = ref<any>({
|
|
|
+ audit_state: "1",
|
|
|
+ content: "",
|
|
|
+})
|
|
|
+const transforFormData = ref<any>({
|
|
|
+ law_user_id: "",
|
|
|
+ content: "",
|
|
|
+})
|
|
|
+const reportFormData = ref({
|
|
|
+ picture_url: "",
|
|
|
+ content: "",
|
|
|
+})
|
|
|
+const formData = computed(() => {
|
|
|
+ return props.type == 0
|
|
|
+ ? operationType.value == "A"
|
|
|
+ ? auditFormData.value
|
|
|
+ : operationType.value == "T"
|
|
|
+ ? transforFormData.value
|
|
|
+ : {}
|
|
|
+ : reportFormData.value
|
|
|
+})
|
|
|
+const validatePic = (rule: any, value: any, callback: any) => {
|
|
|
+ if (!value) {
|
|
|
+ callback(new Error("请选择附件"))
|
|
|
+ } else {
|
|
|
+ callback()
|
|
|
+ }
|
|
|
+}
|
|
|
+const uploadEl = ref()
|
|
|
+const formItems: any = computed(() => {
|
|
|
+ return props.type == 0
|
|
|
+ ? operationType.value == "A"
|
|
|
+ ? [
|
|
|
+ {
|
|
|
+ label: "审核意见",
|
|
|
+ field: "audit_state",
|
|
|
+ required: true,
|
|
|
+ component: ElRadioGroup,
|
|
|
+ data: [
|
|
|
+ { label: "审核通过", value: "1" },
|
|
|
+ { label: "审核不通过", value: "2" },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "审核备注",
|
|
|
+ placeholder: "请输入备注",
|
|
|
+ field: "content",
|
|
|
+ required: true,
|
|
|
+ type: "textarea",
|
|
|
+ component: ElInput,
|
|
|
+ },
|
|
|
+ ]
|
|
|
+ : operationType.value == "T"
|
|
|
+ ? [
|
|
|
+ {
|
|
|
+ label: "转交人员",
|
|
|
+ field: "law_user_id",
|
|
|
+ placeholder: "请选择转交人员",
|
|
|
+ required: true,
|
|
|
+ component: ElSelect,
|
|
|
+ data: userList.value.map((v: any) => {
|
|
|
+ return {
|
|
|
+ label: v.name,
|
|
|
+ value: v.code,
|
|
|
+ }
|
|
|
+ }),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "转交备注",
|
|
|
+ placeholder: "请输入备注",
|
|
|
+ field: "content",
|
|
|
+ required: true,
|
|
|
+ type: "textarea",
|
|
|
+ component: ElInput,
|
|
|
+ },
|
|
|
+ ]
|
|
|
+ : []
|
|
|
+ : props.type == 1
|
|
|
+ ? operationType.value == "D"
|
|
|
+ ? []
|
|
|
+ : [
|
|
|
+ {
|
|
|
+ label: "上报备注",
|
|
|
+ placeholder: "请输入备注",
|
|
|
+ field: "content",
|
|
|
+ required: true,
|
|
|
+ type: "textarea",
|
|
|
+ component: ElInput,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "上传图片",
|
|
|
+ field: "picture_url",
|
|
|
+ component: VbUpload,
|
|
|
+ rules: [{ validator: validatePic, trigger: "change" }],
|
|
|
+ },
|
|
|
+ ]
|
|
|
+ : props.type == 2
|
|
|
+ ? operationType.value == "D"
|
|
|
+ ? []
|
|
|
+ : [
|
|
|
+ {
|
|
|
+ label: "申诉备注",
|
|
|
+ placeholder: "请输入备注",
|
|
|
+ field: "content",
|
|
|
+ required: true,
|
|
|
+ type: "textarea",
|
|
|
+ component: ElInput,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "申诉附件",
|
|
|
+ field: "picture_url",
|
|
|
+ component: "slot",
|
|
|
+ rules: [{ validator: validatePic, trigger: "change" }],
|
|
|
+ },
|
|
|
+ ]
|
|
|
+ : []
|
|
|
+})
|
|
|
+const currentId = ref("")
|
|
|
+function detail(row: any) {
|
|
|
+ operationType.value = "D"
|
|
|
+ queryDetail(row.work_order_id)
|
|
|
+}
|
|
|
+function audit(row: any) {
|
|
|
+ operationType.value = "A"
|
|
|
+ auditFormData.value.audit_state = "1"
|
|
|
+ auditFormData.value.content = ""
|
|
|
+ queryDetail(row.work_order_id)
|
|
|
+}
|
|
|
+function transfer(row: any) {
|
|
|
+ operationType.value = "T"
|
|
|
+ transforFormData.value.law_user_id = ""
|
|
|
+ transforFormData.value.content = ""
|
|
|
+ Rs.post("sys/workOrderOrg/getLawList", {
|
|
|
+ data: {
|
|
|
+ work_order_id: row.work_order_id,
|
|
|
+ },
|
|
|
+ }).then((res) => {
|
|
|
+ userList.value = res.data.list
|
|
|
+ queryDetail(row.work_order_id)
|
|
|
+ })
|
|
|
+}
|
|
|
+function report(row: any) {
|
|
|
+ operationType.value = "R"
|
|
|
+ reportFormData.value.picture_url = ""
|
|
|
+ reportFormData.value.content = ""
|
|
|
+ uploadEl.value?.clearFiles()
|
|
|
+ queryDetail(row.work_order_id)
|
|
|
+}
|
|
|
+function queryDetail(id: string) {
|
|
|
+ currentId.value = id
|
|
|
+ const url =
|
|
|
+ props.type == 0
|
|
|
+ ? "sys/workOrderOrg/getWorkOrderDetailByOrg"
|
|
|
+ : props.type == 1
|
|
|
+ ? "sys/workOrderOrg/getWorkOrderDetailByOrgLaw"
|
|
|
+ : props.type == 2
|
|
|
+ ? "sys/workOrderCom/getWorkOrderDetailByCom"
|
|
|
+ : ""
|
|
|
+ Rs.post(url, {
|
|
|
+ data: {
|
|
|
+ work_order_id: id,
|
|
|
+ },
|
|
|
+ }).then((res) => {
|
|
|
+ //console.log("WARN", res.data)
|
|
|
+ res.data.processInfoList.forEach((item: any) => {
|
|
|
+ if (item.picture_url != null) {
|
|
|
+ const picList = item.picture_url.split(",")
|
|
|
+ const picReall: Array<any> = [] //去除空的
|
|
|
+ picList.forEach((pic: string, index: number) => {
|
|
|
+ if (pic != "") {
|
|
|
+ pic = pic.substring(pic.indexOf("/api/file/"))
|
|
|
+ picReall.push({
|
|
|
+ uid: index,
|
|
|
+ name: "image.png",
|
|
|
+ status: "done",
|
|
|
+ url: pic,
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ item.fileList = picReall
|
|
|
+ } else {
|
|
|
+ item.fileList = []
|
|
|
+ }
|
|
|
+ })
|
|
|
+ warnDetails.value = res.data
|
|
|
+ modal.value.show()
|
|
|
+ })
|
|
|
+}
|
|
|
+function onSave() {
|
|
|
+ const url =
|
|
|
+ props.type == 0
|
|
|
+ ? operationType.value == "A"
|
|
|
+ ? "sys/workOrderOrg/auditByOrg"
|
|
|
+ : operationType.value == "T"
|
|
|
+ ? "sys/workOrderOrg/transferByOrg"
|
|
|
+ : ""
|
|
|
+ : props.type == 1
|
|
|
+ ? "sys/workOrderOrg/uploadByOrg"
|
|
|
+ : props.type == 2
|
|
|
+ ? "sys/workOrderCom/uploadByCom"
|
|
|
+ : ""
|
|
|
+ if (url) {
|
|
|
+ const data: any = Object.assign({ work_order_id: currentId.value }, formData.value)
|
|
|
+ console.log("DATA____", data)
|
|
|
+ Rs.post(url, { data: data }).then(() => {
|
|
|
+ table.value.search()
|
|
|
+ })
|
|
|
+ }
|
|
|
+}
|
|
|
+function init() {
|
|
|
+ if (props.type != 0 && props.type != 1) {
|
|
|
+ cols.value = props.columns
|
|
|
+ }
|
|
|
+}
|
|
|
+onMounted(init)
|
|
|
+</script>
|
|
|
+
|
|
|
+<template>
|
|
|
+ <VbDataTable
|
|
|
+ ref="table"
|
|
|
+ :header="cols"
|
|
|
+ :url="tableUrl"
|
|
|
+ method="post"
|
|
|
+ :query-params="queryParams"
|
|
|
+ :has-checkbox="false"
|
|
|
+ >
|
|
|
+ <template v-slot:table-tool="">
|
|
|
+ <el-form class="align-items-center" :inline="true">
|
|
|
+ <el-form-item class="mb-0 me-5 align-items-center" label="商户名称" v-if="props.type == 0 || props.type == 1">
|
|
|
+ <el-input
|
|
|
+ class=""
|
|
|
+ :style="dySearchSelectStyle"
|
|
|
+ v-model="companyName"
|
|
|
+ placeholder="请输入商户名称"
|
|
|
+ :size="size"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item v-if="props.type != 1" class="mb-0 me-5 align-items-center" label="日期">
|
|
|
+ <el-date-picker
|
|
|
+ v-model="dateRange"
|
|
|
+ type="daterange"
|
|
|
+ range-separator="~"
|
|
|
+ start-placeholder="开始时间"
|
|
|
+ end-placeholder="结束时间"
|
|
|
+ :size="size"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item class="mb-0 me-5 align-items-center" label="告警类型">
|
|
|
+ <DySelect
|
|
|
+ v-model="warnType"
|
|
|
+ :formatRemoteData="(v:any)=>{return v?.list}"
|
|
|
+ :url="'sys/dict/getExceedWarnType?type=1'"
|
|
|
+ :style="dySearchSelectStyle"
|
|
|
+ placeholder="请选择告警类型"
|
|
|
+ ></DySelect>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item class="mb-0 me-5 align-items-center" label="状态:">
|
|
|
+ <el-select v-model="workOrderState" placeholder="请选择状态" clearable>
|
|
|
+ <el-option value="0" label="待审核"></el-option>
|
|
|
+ <el-option value="1" label="待反馈"></el-option>
|
|
|
+ <el-option value="2" label="已转交"></el-option>
|
|
|
+ <el-option value="3" label="已完结"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item class="mb-0 me-0 align-items-center">
|
|
|
+ <el-button class="ms-3 mt-0 btn btn-sm btn-primary" @click="query">查询</el-button>
|
|
|
+ <el-button class="ms-3 mt-0 btn btn-sm btn-light-primary btn-outline" @click="reset">重置</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </template>
|
|
|
+ <template #company_name="{ row }" v-if="props.type == 0 || props.type == 1">
|
|
|
+ <span class="text-primary" @click="jump(row)" style="cursor: pointer">{{ row["company_name"] }}</span>
|
|
|
+ </template>
|
|
|
+ <template #action="{ row }">
|
|
|
+ <template v-if="props.type == 0">
|
|
|
+ <template v-if="row.work_order_stats == 0">
|
|
|
+ <span class="table-action" @click="audit(row)">审核</span>
|
|
|
+ <span class="table-action" @click="transfer(row)">转交</span>
|
|
|
+ </template>
|
|
|
+ <template v-else>
|
|
|
+ <span class="table-action" @click="detail(row)">详情</span>
|
|
|
+ </template>
|
|
|
+ </template>
|
|
|
+ <template v-else-if="props.type == 1">
|
|
|
+ <span class="table-action" @click="report(row)">上报</span>
|
|
|
+ </template>
|
|
|
+ <template v-else-if="props.type == 2">
|
|
|
+ <template v-if="row.work_order_stats == 0">
|
|
|
+ <span class="table-action" @click="detail(row)">详情</span>
|
|
|
+ </template>
|
|
|
+ <template v-else>
|
|
|
+ <span class="table-action" @click="detail(row)">详情</span>
|
|
|
+ <span class="table-action" @click="report(row)">上报</span>
|
|
|
+ </template>
|
|
|
+ </template>
|
|
|
+ </template>
|
|
|
+ </VbDataTable>
|
|
|
+ <VbModal v-model:modal="modal" :title="title" :form-data="formData" :form-items="formItems" @confirm="onSave">
|
|
|
+ <template #body>
|
|
|
+ <ProcessDetail :data="warnDetails"></ProcessDetail>
|
|
|
+ </template>
|
|
|
+ <template #picture_url_form>
|
|
|
+ <VbUpload ref="uploadEl" v-model="formData.picture_url"></VbUpload>
|
|
|
+ </template>
|
|
|
+ </VbModal>
|
|
|
+</template>
|