|
@@ -9,6 +9,7 @@
|
|
:closeOnOverlayClick="false"
|
|
:closeOnOverlayClick="false"
|
|
:close-btn="true"
|
|
:close-btn="true"
|
|
@close="visible = false"
|
|
@close="visible = false"
|
|
|
|
+ @confirm="confirm"
|
|
>
|
|
>
|
|
<t-collapse class="sop-step-mid" defaultExpandAll>
|
|
<t-collapse class="sop-step-mid" defaultExpandAll>
|
|
<t-collapse-panel disabled>
|
|
<t-collapse-panel disabled>
|
|
@@ -50,17 +51,59 @@
|
|
</t-form>
|
|
</t-form>
|
|
</t-collapse-panel>
|
|
</t-collapse-panel>
|
|
</t-collapse>
|
|
</t-collapse>
|
|
- <div class="btn-box mt-10px">
|
|
|
|
- <t-button @click="toCreateSop">创建sop</t-button>
|
|
|
|
|
|
+ <div class="pt-20px" style="border-top: 1px solid #f0f0f0">
|
|
|
|
+ <t-button @click="editProcessVar">编辑</t-button>
|
|
|
|
+ <t-button class="ml-10px" variant="outline" @click="saveProcessVar"
|
|
|
|
+ >保存</t-button
|
|
|
|
+ >
|
|
|
|
+ </div>
|
|
|
|
+ <div class="mt-10px">
|
|
|
|
+ <t-row :gutter="[0, 0]">
|
|
|
|
+ <t-col
|
|
|
|
+ :span="
|
|
|
|
+ fullWidthCodes.includes(config.code)
|
|
|
|
+ ? 12
|
|
|
|
+ : config.span < 6
|
|
|
|
+ ? 6
|
|
|
|
+ : config.span || 6
|
|
|
|
+ "
|
|
|
|
+ v-for="config in processVar"
|
|
|
|
+ :key="config.id"
|
|
|
|
+ >
|
|
|
|
+ <dynamic-form-item
|
|
|
|
+ v-if="config.visable"
|
|
|
|
+ :config="config"
|
|
|
|
+ @change="itemValueChange"
|
|
|
|
+ ></dynamic-form-item>
|
|
|
|
+ </t-col>
|
|
|
|
+ </t-row>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="btn-box pt-20px" style="border-top: 1px solid #f0f0f0">
|
|
|
|
+ <t-button @click="toCreateSop">新增sop</t-button>
|
|
</div>
|
|
</div>
|
|
<div class="mt-10px">
|
|
<div class="mt-10px">
|
|
<t-table
|
|
<t-table
|
|
size="small"
|
|
size="small"
|
|
row-key="index"
|
|
row-key="index"
|
|
:columns="columns"
|
|
:columns="columns"
|
|
- :data="sopList"
|
|
|
|
|
|
+ :data="tableData"
|
|
bordered
|
|
bordered
|
|
>
|
|
>
|
|
|
|
+ <template #serviceScope="{ row }">{{
|
|
|
|
+ SERVICE_RANGE[row.serviceScope]
|
|
|
|
+ }}</template>
|
|
|
|
+ <template #scanStartTime="{ row }">{{
|
|
|
|
+ dateFormat(row.scanStartTime, 'yyyy/MM/dd HH:mm')
|
|
|
|
+ }}</template>
|
|
|
|
+ <template #scanEndTime="{ row }">{{
|
|
|
|
+ dateFormat(row.scanEndTime, 'yyyy/MM/dd HH:mm')
|
|
|
|
+ }}</template>
|
|
|
|
+ <template #markPaperStartTime="{ row }">{{
|
|
|
|
+ dateFormat(row.markPaperStartTime, 'yyyy/MM/dd HH:mm')
|
|
|
|
+ }}</template>
|
|
|
|
+ <template #markPaperEndTime="{ row }">{{
|
|
|
|
+ dateFormat(row.markPaperEndTime, 'yyyy/MM/dd HH:mm')
|
|
|
|
+ }}</template>
|
|
<template #operate="{ row }">
|
|
<template #operate="{ row }">
|
|
<div class="table-operations" @click.stop>
|
|
<div class="table-operations" @click.stop>
|
|
<t-link theme="primary" hover="color" @click="allocation(row)">
|
|
<t-link theme="primary" hover="color" @click="allocation(row)">
|
|
@@ -69,8 +112,17 @@
|
|
<t-link theme="primary" hover="color" @click="editSopItem(row)">
|
|
<t-link theme="primary" hover="color" @click="editSopItem(row)">
|
|
编辑
|
|
编辑
|
|
</t-link>
|
|
</t-link>
|
|
- <t-link theme="primary" hover="color"> 发布 </t-link>
|
|
|
|
- <t-link theme="primary" hover="color"> 删除 </t-link>
|
|
|
|
|
|
+ <t-link
|
|
|
|
+ :theme="row.status === 'UN_PUBLISH' ? 'primary' : 'default'"
|
|
|
|
+ hover="color"
|
|
|
|
+ :disabled="row.status === 'PUBLISH'"
|
|
|
|
+ @click="publishSopItem(row)"
|
|
|
|
+ >
|
|
|
|
+ 发布
|
|
|
|
+ </t-link>
|
|
|
|
+ <t-link theme="primary" hover="color" @click="deleteSopItem(row)">
|
|
|
|
+ 删除
|
|
|
|
+ </t-link>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
</t-table>
|
|
</t-table>
|
|
@@ -90,10 +142,32 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script lang="ts" name="CreateSop" setup>
|
|
<script lang="ts" name="CreateSop" setup>
|
|
-import { computed, ref } from 'vue';
|
|
|
|
|
|
+import { computed, ref, watch } from 'vue';
|
|
import { useVModel } from '@vueuse/core';
|
|
import { useVModel } from '@vueuse/core';
|
|
import CreateSopItem from './create-sop-item.vue';
|
|
import CreateSopItem from './create-sop-item.vue';
|
|
import AllocationDialog from './allocation-dialog.vue';
|
|
import AllocationDialog from './allocation-dialog.vue';
|
|
|
|
+import useFetchTable from '@/hooks/useFetchTable';
|
|
|
|
+import {
|
|
|
|
+ getDispatchInfoApi,
|
|
|
|
+ getSubSopListApi,
|
|
|
|
+ saveProcessVarApi,
|
|
|
|
+ saveSubSopListApi,
|
|
|
|
+ subSopPublishApi,
|
|
|
|
+ subSopDeleteApi,
|
|
|
|
+} from '@/api/service-unit';
|
|
|
|
+import { SERVICE_RANGE } from '@/config/constants';
|
|
|
|
+import { dateFormat } from '@/utils/tool';
|
|
|
|
+import DynamicFormItem from '../../../sop/components/dynamic-form-item/index.vue';
|
|
|
|
+import { DialogPlugin, MessagePlugin } from 'tdesign-vue-next';
|
|
|
|
+import { cloneDeep } from 'lodash-es';
|
|
|
|
+const fullWidthCodes = ref([
|
|
|
|
+ 'TABLE',
|
|
|
|
+ 'FORM_GROUP_TITLE',
|
|
|
|
+ 'TEXTAREA',
|
|
|
|
+ 'ONLY_TITLE',
|
|
|
|
+ 'DEVICE_OUT_TABLE',
|
|
|
|
+ 'DEVICE_IN_TABLE',
|
|
|
|
+]);
|
|
const showAllocationDialog = ref(false);
|
|
const showAllocationDialog = ref(false);
|
|
const props = defineProps({
|
|
const props = defineProps({
|
|
modelValue: Boolean,
|
|
modelValue: Boolean,
|
|
@@ -106,34 +180,22 @@ const props = defineProps({
|
|
},
|
|
},
|
|
});
|
|
});
|
|
const emit = defineEmits(['update:modelValue', 'confirm']);
|
|
const emit = defineEmits(['update:modelValue', 'confirm']);
|
|
-const sopList = ref([
|
|
|
|
- {
|
|
|
|
- aaa: 'aaa',
|
|
|
|
- bbb: 'bbb',
|
|
|
|
- ccc: 'ccc',
|
|
|
|
- ddd: 'ddd',
|
|
|
|
- eee: 'eee',
|
|
|
|
- fff: 1714492800000,
|
|
|
|
- ggg: 1714586400000,
|
|
|
|
- hhh: 1716231780000,
|
|
|
|
- iii: 1717167600000,
|
|
|
|
- },
|
|
|
|
-]);
|
|
|
|
|
|
+
|
|
const visible = useVModel(props, 'modelValue', emit);
|
|
const visible = useVModel(props, 'modelValue', emit);
|
|
const title = computed(() => {
|
|
const title = computed(() => {
|
|
if (props.type === 'new') return '新增SOP';
|
|
if (props.type === 'new') return '新增SOP';
|
|
if (props.type === 'edit') return '编辑SOP';
|
|
if (props.type === 'edit') return '编辑SOP';
|
|
});
|
|
});
|
|
const columns = [
|
|
const columns = [
|
|
- { colKey: 'aaa', title: '科目名称' },
|
|
|
|
- { colKey: 'bbb', title: '考生人数' },
|
|
|
|
- { colKey: 'ccc', title: '联系人' },
|
|
|
|
- { colKey: 'ddd', title: '电话' },
|
|
|
|
- { colKey: 'eee', title: '服务范围' },
|
|
|
|
- { colKey: 'fff', title: '扫描开始时间' },
|
|
|
|
- { colKey: 'ggg', title: '扫描结束时间' },
|
|
|
|
- { colKey: 'hhh', title: '评卷开始时间' },
|
|
|
|
- { colKey: 'iii', title: '评卷结束时间' },
|
|
|
|
|
|
+ { colKey: 'courseName', title: '科目名称' },
|
|
|
|
+ { colKey: 'examStudentCount', title: '考生人数', width: 80 },
|
|
|
|
+ { colKey: 'contacts', title: '联系人', width: 100 },
|
|
|
|
+ { colKey: 'mobileNumber', title: '电话', width: 120 },
|
|
|
|
+ { colKey: 'serviceScope', title: '服务范围', width: 100 },
|
|
|
|
+ { colKey: 'scanStartTime', title: '扫描开始时间', width: 150 },
|
|
|
|
+ { colKey: 'scanEndTime', title: '扫描结束时间', width: 150 },
|
|
|
|
+ { colKey: 'markPaperStartTime', title: '评卷开始时间', width: 150 },
|
|
|
|
+ { colKey: 'markPaperEndTime', title: '评卷结束时间', width: 150 },
|
|
{
|
|
{
|
|
colKey: 'operate',
|
|
colKey: 'operate',
|
|
title: '管理',
|
|
title: '管理',
|
|
@@ -148,12 +210,46 @@ const toCreateSop = () => {
|
|
showCreateDialog.value = true;
|
|
showCreateDialog.value = true;
|
|
};
|
|
};
|
|
const addSopItem = (item) => {
|
|
const addSopItem = (item) => {
|
|
- sopList.value.push(item);
|
|
|
|
|
|
+ saveSubSopListApi({ ...item, crmNo: props.dispatchInfo.crmNo }).then(() => {
|
|
|
|
+ MessagePlugin.success(item.id ? '修改成功' : '新增成功');
|
|
|
|
+ fetchData();
|
|
|
|
+ });
|
|
};
|
|
};
|
|
const editSopItem = (row) => {
|
|
const editSopItem = (row) => {
|
|
curRow.value = row;
|
|
curRow.value = row;
|
|
showCreateDialog.value = true;
|
|
showCreateDialog.value = true;
|
|
};
|
|
};
|
|
|
|
+
|
|
|
|
+const publishSopItem = (row) => {
|
|
|
|
+ const confirmDia = DialogPlugin({
|
|
|
|
+ header: '发布SOP提示',
|
|
|
|
+ body: `您确定要发布当前派单的SOP吗?`,
|
|
|
|
+ confirmBtn: '确定',
|
|
|
|
+ cancelBtn: '取消',
|
|
|
|
+ onConfirm: async () => {
|
|
|
|
+ confirmDia.hide();
|
|
|
|
+ const res = await subSopPublishApi({ id: row.id }).catch(() => {});
|
|
|
|
+ if (!res) return;
|
|
|
|
+ MessagePlugin.success('发布成功');
|
|
|
|
+ fetchData();
|
|
|
|
+ },
|
|
|
|
+ });
|
|
|
|
+};
|
|
|
|
+const deleteSopItem = (row) => {
|
|
|
|
+ const confirmDia = DialogPlugin({
|
|
|
|
+ header: '删除SOP提示',
|
|
|
|
+ body: `您确定要删除当前派单的SOP吗?`,
|
|
|
|
+ confirmBtn: '确定',
|
|
|
|
+ cancelBtn: '取消',
|
|
|
|
+ onConfirm: async () => {
|
|
|
|
+ confirmDia.hide();
|
|
|
|
+ const res = await subSopDeleteApi({ id: row.id }).catch(() => {});
|
|
|
|
+ if (!res) return;
|
|
|
|
+ MessagePlugin.success('删除成功');
|
|
|
|
+ fetchData();
|
|
|
|
+ },
|
|
|
|
+ });
|
|
|
|
+};
|
|
const allocation = (row) => {
|
|
const allocation = (row) => {
|
|
curRow.value = row;
|
|
curRow.value = row;
|
|
showAllocationDialog.value = true;
|
|
showAllocationDialog.value = true;
|
|
@@ -161,4 +257,75 @@ const allocation = (row) => {
|
|
const stepConfirm = () => {
|
|
const stepConfirm = () => {
|
|
emit('confirm');
|
|
emit('confirm');
|
|
};
|
|
};
|
|
|
|
+
|
|
|
|
+const params = computed(() => ({ crmNo: props.dispatchInfo?.crmNo }));
|
|
|
|
+const {
|
|
|
|
+ loading: tableLoading,
|
|
|
|
+ pagination,
|
|
|
|
+ tableData,
|
|
|
|
+ search,
|
|
|
|
+ fetchData,
|
|
|
|
+ onChange,
|
|
|
|
+} = useFetchTable(
|
|
|
|
+ getSubSopListApi,
|
|
|
|
+ {
|
|
|
|
+ params,
|
|
|
|
+ },
|
|
|
|
+ false
|
|
|
|
+);
|
|
|
|
+const processVar = ref([]);
|
|
|
|
+const editProcessVar = () => {
|
|
|
|
+ processVar.value.forEach((item) => {
|
|
|
|
+ item.writable = true;
|
|
|
|
+ });
|
|
|
|
+};
|
|
|
|
+const saveProcessVar = () => {
|
|
|
|
+ let arr = cloneDeep(processVar.value);
|
|
|
|
+ arr.forEach((item) => {
|
|
|
|
+ item.writable = false;
|
|
|
|
+ item.value = JSON.stringify({
|
|
|
|
+ value: item.value || null,
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ saveProcessVarApi({
|
|
|
|
+ crmNo: props.dispatchInfo.crmNo,
|
|
|
|
+ processVar: JSON.stringify(arr),
|
|
|
|
+ }).then(() => {
|
|
|
|
+ MessagePlugin.success('保存成功');
|
|
|
|
+ processVar.value.forEach((item) => {
|
|
|
|
+ item.writable = false;
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+};
|
|
|
|
+watch(visible, (val) => {
|
|
|
|
+ val && whenOpen();
|
|
|
|
+});
|
|
|
|
+const getInfo = () => {
|
|
|
|
+ getDispatchInfoApi({ crmNo: props.dispatchInfo.crmNo }).then((res) => {
|
|
|
|
+ if (res) {
|
|
|
|
+ try {
|
|
|
|
+ processVar.value = JSON.parse(res.processVar).map((item) => {
|
|
|
|
+ item.value = item.value ? JSON.parse(item.value).value : null;
|
|
|
|
+ return item;
|
|
|
|
+ });
|
|
|
|
+ console.log('processVar.value', processVar.value);
|
|
|
|
+ } catch (e) {
|
|
|
|
+ console.error('processVar不是JSON');
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+};
|
|
|
|
+const whenOpen = () => {
|
|
|
|
+ fetchData();
|
|
|
|
+ getInfo();
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+const itemValueChange = ({ prop, value }) => {
|
|
|
|
+ let obj = processVar.value.find((item) => item.formId == prop);
|
|
|
|
+ obj.value = value;
|
|
|
|
+};
|
|
|
|
+const confirm = () => {
|
|
|
|
+ emit('confirm');
|
|
|
|
+ visible.value = false;
|
|
|
|
+};
|
|
</script>
|
|
</script>
|