|
@@ -1,6 +1,25 @@
|
|
|
<template>
|
|
|
<div class="violation-registration flex flex-col h-full">
|
|
|
- <SearchForm :fields="fields" :params="params"></SearchForm>
|
|
|
+ <SearchForm :fields="fields" :params="params">
|
|
|
+ <template #service="{ item, params }">
|
|
|
+ <select-service-unit
|
|
|
+ v-model="params[item.prop]"
|
|
|
+ clearable
|
|
|
+ ></select-service-unit>
|
|
|
+ </template>
|
|
|
+ <template #user="{ item, params }">
|
|
|
+ <select-filter-user
|
|
|
+ v-model="params[item.prop]"
|
|
|
+ clearable
|
|
|
+ ></select-filter-user>
|
|
|
+ </template>
|
|
|
+ <template #creator="{ item, params }">
|
|
|
+ <select-filter-user
|
|
|
+ v-model="params[item.prop]"
|
|
|
+ clearable
|
|
|
+ ></select-filter-user>
|
|
|
+ </template>
|
|
|
+ </SearchForm>
|
|
|
<div class="flex-1 page-wrap">
|
|
|
<t-table
|
|
|
size="small"
|
|
@@ -21,24 +40,75 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="jsx" name="ViolationRegistration">
|
|
|
-import { reactive, ref } from 'vue';
|
|
|
-import { getTableData } from '@/api/test';
|
|
|
-import useFetchTable from '@/hooks/useFetchTable';
|
|
|
+import { reactive, ref, computed } from 'vue';
|
|
|
+import { getViolationList, closeViolation, restartViolation } from '@/api/sop';
|
|
|
|
|
|
-const rowData = ref({});
|
|
|
+import useFetchTable from '@/hooks/useFetchTable';
|
|
|
+import { dictToOptionList } from '@/utils/tool';
|
|
|
+import { VIOLATION_TYPE, VIOLATION_FLOW_STATUS } from '@/config/constants';
|
|
|
+import { omit } from 'lodash';
|
|
|
+import { DialogPlugin, MessagePlugin } from 'tdesign-vue-next';
|
|
|
|
|
|
+const showFlowDialog = ref(false);
|
|
|
+const curRow = ref(null);
|
|
|
+const editSuccess = () => {
|
|
|
+ MessagePlugin.success('操作成功');
|
|
|
+ showFlowDialog.value = false;
|
|
|
+};
|
|
|
+const restartHandler = (row) => {
|
|
|
+ const confirmDia = DialogPlugin({
|
|
|
+ header: '操作提示',
|
|
|
+ body: `您确定要重启当前预警信息吗?`,
|
|
|
+ confirmBtn: '确定',
|
|
|
+ cancelBtn: '取消',
|
|
|
+ onConfirm: () => {
|
|
|
+ restartViolation(row.id).then(() => {
|
|
|
+ confirmDia.hide();
|
|
|
+ MessagePlugin.success('操作成功');
|
|
|
+ fetchData();
|
|
|
+ });
|
|
|
+ },
|
|
|
+ });
|
|
|
+};
|
|
|
+const closeHandler = (row) => {
|
|
|
+ const confirmDia = DialogPlugin({
|
|
|
+ header: '操作提示',
|
|
|
+ body: `您确定要关闭当前预警信息吗?`,
|
|
|
+ confirmBtn: '确定',
|
|
|
+ cancelBtn: '取消',
|
|
|
+ onConfirm: () => {
|
|
|
+ closeViolation(row.id).then(() => {
|
|
|
+ confirmDia.hide();
|
|
|
+ MessagePlugin.success('操作成功');
|
|
|
+ fetchData();
|
|
|
+ });
|
|
|
+ },
|
|
|
+ });
|
|
|
+};
|
|
|
const columns = [
|
|
|
- { colKey: 'a', title: '违规流水号' },
|
|
|
- { colKey: 'b', title: 'SOP流水号' },
|
|
|
- { colKey: 'c', title: '节点负责人' },
|
|
|
- { colKey: 'd', title: '客户名称' },
|
|
|
- { colKey: 'e', title: '项目单号' },
|
|
|
- { colKey: 'f', title: '项目名称' },
|
|
|
- { colKey: 'g', title: '违规类型' },
|
|
|
- { colKey: 'h', title: '违规情况' },
|
|
|
- { colKey: 'i', title: '跟进状态' },
|
|
|
- { colKey: 'j', title: '登记时间' },
|
|
|
- { colKey: 'k', title: '登记人' },
|
|
|
+ // { colKey: 'a', title: '违规流水号' },
|
|
|
+ { colKey: 'sopNo', title: 'SOP流水号' },
|
|
|
+ { colKey: 'userName', title: '节点负责人' },
|
|
|
+ { colKey: 'custom', title: '客户名称' },
|
|
|
+ { colKey: 'crmNo', title: '项目单号' },
|
|
|
+ { colKey: 'crmName', title: '项目名称' },
|
|
|
+ {
|
|
|
+ colKey: 'type',
|
|
|
+ title: '违规类型',
|
|
|
+ cell: (h, { row }) => {
|
|
|
+ return <span>{VIOLATION_TYPE[row.type] || row.type}</span>;
|
|
|
+ },
|
|
|
+ },
|
|
|
+ { colKey: 'content', title: '违规情况' },
|
|
|
+ {
|
|
|
+ colKey: 'status',
|
|
|
+ title: '跟进状态',
|
|
|
+ cell: (h, { row }) => {
|
|
|
+ return <span>{VIOLATION_FLOW_STATUS[row.status] || row.status}</span>;
|
|
|
+ },
|
|
|
+ },
|
|
|
+ { colKey: 'createTime', title: '登记时间' },
|
|
|
+ { colKey: 'createName', title: '登记人' },
|
|
|
{
|
|
|
title: '操作',
|
|
|
colKey: 'operate',
|
|
@@ -47,33 +117,42 @@ const columns = [
|
|
|
cell: (h, { row }) => {
|
|
|
return (
|
|
|
<div class="table-operations">
|
|
|
- <t-link
|
|
|
- theme="primary"
|
|
|
- hover="color"
|
|
|
- onClick={(e) => {
|
|
|
- e.stopPropagation();
|
|
|
- }}
|
|
|
- >
|
|
|
- 跟进
|
|
|
- </t-link>
|
|
|
- <t-link
|
|
|
- theme="primary"
|
|
|
- hover="color"
|
|
|
- onClick={(e) => {
|
|
|
- e.stopPropagation();
|
|
|
- }}
|
|
|
- >
|
|
|
- 重启
|
|
|
- </t-link>
|
|
|
- <t-link
|
|
|
- theme="primary"
|
|
|
- hover="color"
|
|
|
- onClick={(e) => {
|
|
|
- e.stopPropagation();
|
|
|
- }}
|
|
|
- >
|
|
|
- 关闭
|
|
|
- </t-link>
|
|
|
+ {row.status === 'NOT_START' ? (
|
|
|
+ <t-link
|
|
|
+ theme="primary"
|
|
|
+ hover="color"
|
|
|
+ onClick={(e) => {
|
|
|
+ e.stopPropagation();
|
|
|
+ curRow.value = row;
|
|
|
+ showFlowDialog.value = true;
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ 跟进
|
|
|
+ </t-link>
|
|
|
+ ) : null}
|
|
|
+ {row.status === 'CLOSE' ? (
|
|
|
+ <t-link
|
|
|
+ theme="primary"
|
|
|
+ hover="color"
|
|
|
+ onClick={(e) => {
|
|
|
+ e.stopPropagation();
|
|
|
+ restartHandler(row);
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ 重启
|
|
|
+ </t-link>
|
|
|
+ ) : (
|
|
|
+ <t-link
|
|
|
+ theme="primary"
|
|
|
+ hover="color"
|
|
|
+ onClick={(e) => {
|
|
|
+ e.stopPropagation();
|
|
|
+ closeHandler(row);
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ 关闭
|
|
|
+ </t-link>
|
|
|
+ )}
|
|
|
</div>
|
|
|
);
|
|
|
},
|
|
@@ -82,32 +161,42 @@ const columns = [
|
|
|
|
|
|
const fields = ref([
|
|
|
{
|
|
|
- prop: 'a',
|
|
|
+ prop: 'serviceId',
|
|
|
label: '服务单元',
|
|
|
type: 'select',
|
|
|
labelWidth: 100,
|
|
|
colSpan: 4.5,
|
|
|
+ cell: 'service',
|
|
|
},
|
|
|
{
|
|
|
- prop: 'b',
|
|
|
+ prop: 'type',
|
|
|
label: '违规类型',
|
|
|
type: 'select',
|
|
|
labelWidth: 100,
|
|
|
+ options: dictToOptionList(VIOLATION_TYPE),
|
|
|
colSpan: 4.5,
|
|
|
+ attrs: {
|
|
|
+ clearable: true,
|
|
|
+ },
|
|
|
},
|
|
|
{
|
|
|
- prop: 'c',
|
|
|
+ prop: 'status',
|
|
|
label: '跟进状态',
|
|
|
type: 'select',
|
|
|
labelWidth: 100,
|
|
|
+ options: dictToOptionList(VIOLATION_FLOW_STATUS),
|
|
|
colSpan: 4.5,
|
|
|
+ attrs: {
|
|
|
+ clearable: true,
|
|
|
+ },
|
|
|
},
|
|
|
{
|
|
|
- prop: 'd',
|
|
|
+ prop: 'userId',
|
|
|
label: '节点负责人',
|
|
|
type: 'select',
|
|
|
labelWidth: 100,
|
|
|
colSpan: 4.5,
|
|
|
+ cell: 'user',
|
|
|
},
|
|
|
{
|
|
|
type: 'buttons',
|
|
@@ -116,31 +205,33 @@ const fields = ref([
|
|
|
{
|
|
|
type: 'button',
|
|
|
text: '查询',
|
|
|
+ onClick: () => {
|
|
|
+ search();
|
|
|
+ },
|
|
|
},
|
|
|
],
|
|
|
},
|
|
|
{
|
|
|
- prop: 'e',
|
|
|
+ prop: 'custom',
|
|
|
label: '客户名称',
|
|
|
- type: 'select',
|
|
|
labelWidth: 100,
|
|
|
colSpan: 4.5,
|
|
|
},
|
|
|
-
|
|
|
{
|
|
|
- prop: 'f',
|
|
|
+ prop: 'sopNo',
|
|
|
label: 'SOP流水号',
|
|
|
labelWidth: 100,
|
|
|
colSpan: 4.5,
|
|
|
},
|
|
|
{
|
|
|
- prop: 'g',
|
|
|
+ prop: 'createId',
|
|
|
label: '登记人',
|
|
|
labelWidth: 100,
|
|
|
colSpan: 4.5,
|
|
|
+ cell: 'creator',
|
|
|
},
|
|
|
{
|
|
|
- prop: 'h',
|
|
|
+ prop: 'time',
|
|
|
label: '预警时间',
|
|
|
type: 'daterange',
|
|
|
labelWidth: 100,
|
|
@@ -148,25 +239,26 @@ const fields = ref([
|
|
|
},
|
|
|
]);
|
|
|
const params = reactive({
|
|
|
- a: '',
|
|
|
- b: '',
|
|
|
- c: '',
|
|
|
- d: '',
|
|
|
- e: '',
|
|
|
- f: '',
|
|
|
- g: '',
|
|
|
- h: [],
|
|
|
+ serviceId: '',
|
|
|
+ type: '',
|
|
|
+ status: '',
|
|
|
+ userId: '',
|
|
|
+ custom: '',
|
|
|
+ sopNo: '',
|
|
|
+ createId: '',
|
|
|
+ time: [],
|
|
|
});
|
|
|
-
|
|
|
-const {
|
|
|
- loading: tableLoading,
|
|
|
- pagination,
|
|
|
- tableData,
|
|
|
- fetchData,
|
|
|
- onChange,
|
|
|
-} = useFetchTable(getTableData);
|
|
|
-
|
|
|
-const refresh = async () => {};
|
|
|
+const transParams = computed(() => {
|
|
|
+ return {
|
|
|
+ ...omit(params, 'time'),
|
|
|
+ startTime: params.time[0],
|
|
|
+ endTime: params.time[1],
|
|
|
+ };
|
|
|
+});
|
|
|
+const { loading, pagination, tableData, onChange, fetchData, search } =
|
|
|
+ useFetchTable(getViolationList, {
|
|
|
+ params: transParams,
|
|
|
+ });
|
|
|
</script>
|
|
|
|
|
|
<style></style>
|