Преглед на файлове

设备管理接口联调

刘洋 преди 1 година
родител
ревизия
fafd18ccde

+ 8 - 0
src/api/service-unit.js

@@ -147,6 +147,7 @@ export const saveProcessVarApi = (data) =>
   request({
     url: '/api/admin/tb/crm/detail/sop/var/save',
     data,
+    loading: true,
   });
 //创建/编辑派单明细sop接口
 export const saveSubSopListApi = (data) =>
@@ -159,10 +160,17 @@ export const subSopPublishApi = (params) =>
   request({
     url: '/api/admin/tb/crm/detail/sop/publish',
     params,
+    loading: true,
   });
 //删除
 export const subSopDeleteApi = (params) =>
   request({
     url: '/api/admin/tb/crm/detail/sop/delete',
     params,
+    loading: true,
+  });
+export const serviceScopeBindNewApi = (data) =>
+  request({
+    url: '/api/service/service/scope/bind',
+    data,
   });

+ 54 - 0
src/api/sop.js

@@ -211,3 +211,57 @@ export const metadataSaveApi = (formWidgetMetadataList) =>
     url: '/api/admin/sop/metadata/save',
     data: { formWidgetMetadataList },
   });
+
+/** v1.1.0 add */
+//设备签收登记列表查询接口
+export const deviceSignListApi = (params) =>
+  request({
+    url: '/api/admin/device/manage/sign/list',
+    params,
+  });
+//设备签收
+export const deviceSignHandleApi = (params) =>
+  request({
+    url: '/api/admin/device/manage/sign',
+    params,
+  });
+//设备未签收
+export const deviceNotSignHandleApi = (params) =>
+  request({
+    url: '/api/admin/device/manage/unsigned',
+    params,
+  });
+//设备签收编辑状态
+export const deviceSignStatusEdit = (params) =>
+  request({
+    url: '/api/admin/device/manage/sign/edit',
+    params,
+    loading: true,
+  });
+//设备去处登记列表查询接口
+export const deviceGotoListApi = (params) =>
+  request({
+    url: '/api/admin/device/manage/place/list',
+    params,
+  });
+//设备去处登记入库
+export const deviceGotoInHandleApi = (params) =>
+  request({
+    url: '/api/admin/device/manage/in',
+    params,
+    loading: true,
+  });
+//设备去处登记中转
+export const deviceGotoMiddleHandleApi = (params) =>
+  request({
+    url: '/api/admin/device/manage/transfer',
+    params,
+    loading: true,
+  });
+//设备去处登记编辑
+export const deviceGotoEditHandleApi = (data) =>
+  request({
+    url: '/api/admin/device/manage/place/edit',
+    data,
+    loading: true,
+  });

+ 5 - 3
src/components/common/device-manage-new/index.vue

@@ -9,6 +9,9 @@
     :closeOnOverlayClick="false"
     :close-btn="true"
     @close="emit('update:visible', false)"
+    @confirm="emit('update:visible', false)"
+    :cancel-btn="null"
+    confirmBtn="关闭"
   >
     <t-collapse class="sop-step-mid" defaultExpandAll>
       <t-collapse-panel disabled>
@@ -49,10 +52,10 @@
     <div class="mt-10px">
       <t-tabs v-model="curStep">
         <t-tab-panel value="设备签收登记" label="设备签收登记">
-          <Tab1 />
+          <Tab1 :sop="sop" />
         </t-tab-panel>
         <t-tab-panel value="设备去处登记" label="设备去处登记"
-          ><Tab2 />
+          ><Tab2 :sop="sop" />
         </t-tab-panel>
       </t-tabs>
     </div>
@@ -65,7 +68,6 @@ import Tab1 from './tab1.vue';
 import Tab2 from './tab2.vue';
 const props = defineProps({
   visible: Boolean,
-  type: String,
   sop: {
     type: Object,
     default() {

+ 77 - 29
src/components/common/device-manage-new/tab1.vue

@@ -7,13 +7,30 @@
     bordered
     class="mt-10px"
   >
-    <template #ddd="{ row }">
-      {{ RUNNING_STATUS[row.ddd] }}
+    <template #deviceStatus="{ row }">
+      {{ RUNNING_STATUS[row.deviceStatus] }}
+    </template>
+    <template #status="{ row }">
+      {{ DEVICE_SIGN_STATUS[row.status] }}
     </template>
     <template #operate="{ row }">
       <div class="table-operations" @click.stop>
+        <t-link
+          :theme="row.status == 'DELIVER' ? 'primary' : 'default'"
+          :disabled="row.status != 'DELIVER'"
+          hover="color"
+          @click="sign(row)"
+          >签收</t-link
+        >
+        <t-link
+          :theme="row.status === 'USING' ? 'primary' : 'default'"
+          :disabled="row.status !== 'USING'"
+          hover="color"
+          @click="notSign(row)"
+          >未签收</t-link
+        >
         <t-link theme="primary" hover="color" @click="editStatus(row)"
-          >编辑状态</t-link
+          >设备状态</t-link
         >
       </div>
     </template>
@@ -37,36 +54,78 @@
   </my-dialog>
 </template>
 <script name="DeviceManageNewTab1" setup>
-import { ref, reactive } from 'vue';
-import { RUNNING_STATUS } from '@/config/constants';
+import { ref, reactive, onMounted } from 'vue';
+import { RUNNING_STATUS, DEVICE_SIGN_STATUS } from '@/config/constants';
 import { dictToOptionList } from '@/utils/tool';
+import {
+  deviceSignListApi,
+  deviceSignHandleApi,
+  deviceNotSignHandleApi,
+  deviceSignStatusEdit,
+} from '@/api/sop';
+import { useRequest } from 'vue-request';
+
+const props = defineProps({
+  sop: {
+    type: Object,
+    default() {
+      return {};
+    },
+  },
+});
+
+const { data: tableData, run, loading } = useRequest(deviceSignListApi);
+const fetchData = () => {
+  run({ crmNo: props.sop.crmNo });
+};
+onMounted(() => {
+  fetchData();
+});
 
 const curRow = ref(null);
 
 const statusForm = ref();
 const showStatusDialog = ref(false);
-const statusParams = reactive({ aaa: '' });
+const statusParams = reactive({ deviceStatus: '' });
 const statusFields = ref([
   {
-    prop: 'aaa',
-    label: '选择状态',
+    prop: 'deviceStatus',
+    label: '选择状态',
     type: 'select',
-    labelWidth: 70,
+    labelWidth: 100,
     colSpan: 24,
     options: dictToOptionList(RUNNING_STATUS),
   },
 ]);
 const statusRules = ref({
-  aaa: [{ required: true, message: '请选择设备状态' }],
+  deviceStatus: [{ required: true, message: '请选择设备状态' }],
 });
 const statusConfirm = async () => {
   const formRef = statusForm.value.formRef;
   const valid = await formRef?.validate();
   if (valid !== true) return;
   //todo
+  deviceSignStatusEdit({
+    id: curRow.value.id,
+    deviceStatus: statusParams.deviceStatus,
+  }).then(() => {
+    showStatusDialog.value = false;
+    fetchData();
+  });
+};
+
+const sign = (row) => {
+  deviceSignHandleApi({ id: row.id }).then(() => {
+    fetchData();
+  });
+};
 
-  showStatusDialog.value = false;
+const notSign = (row) => {
+  deviceNotSignHandleApi({ id: row.id }).then(() => {
+    fetchData();
+  });
 };
+
 const editStatus = (row) => {
   curRow.value = row;
   showStatusDialog.value = true;
@@ -77,13 +136,13 @@ const columns = [
     title: '序号',
     width: 48,
   },
-  { colKey: 'aaa', title: '派单号' },
-  { colKey: 'bbb', title: '设备序列号' },
-  { colKey: 'ccc', title: '设备型号' },
-  { colKey: 'ddd', title: '状态', cell: 'ddd' },
-  { colKey: 'eee', title: '设备归属' },
-  { colKey: 'fff', title: '出库快递单号' },
-  { colKey: 'ggg', title: '签收状态' },
+  { colKey: 'crmNo', title: '派单号' },
+  { colKey: 'serialNo', title: '设备序列号' },
+  { colKey: 'model', title: '设备型号' },
+  { colKey: 'deviceStatus', title: '状态', cell: 'deviceStatus' },
+  { colKey: 'supplierName', title: '设备归属' },
+  { colKey: 'expressNo', title: '出库快递单号' },
+  { colKey: 'status', title: '签收状态', cell: 'status' },
   {
     title: '管理',
     colKey: 'operate',
@@ -91,16 +150,5 @@ const columns = [
     width: 180,
   },
 ];
-const tableData = ref([
-  {
-    aaa: 'aaa',
-    bbb: 'bbb',
-    ccc: 'ccc',
-    ddd: 'BREAK_DOWN',
-    eee: 'eee',
-    fff: 'fff',
-    ggg: 'ggg',
-  },
-]);
 </script>
 <style lang="less" scoped></style>

+ 285 - 130
src/components/common/device-manage-new/tab2.vue

@@ -7,17 +7,47 @@
     bordered
     class="mt-10px"
   >
-    <template #ccc="{ row }">
-      {{ RUNNING_STATUS[row.ccc] }}
+    <template #deviceStatus="{ row }">
+      {{ RUNNING_STATUS[row.deviceStatus] }}
     </template>
-    <template #fff="{ row }">
-      {{ DEVICE_USE_STATUS[row.fff] }}
+    <template #status="{ row }">
+      {{ DEVICE_SIGN_STATUS[row.status] }}
     </template>
     <template #operate="{ row }">
       <div class="table-operations" @click.stop>
-        <t-link theme="primary" hover="color" @click="enter(row)">入库</t-link>
-        <t-link theme="primary" hover="color" @click="middle(row)">中转</t-link>
-        <t-link theme="primary" hover="color" @click="edit(row)">编辑</t-link>
+        <t-link
+          :theme="
+            row.haveSign || ['TRANSFER', 'IN'].includes(row.status)
+              ? 'default'
+              : 'primary'
+          "
+          :disabled="row.haveSign || ['TRANSFER', 'IN'].includes(row.status)"
+          hover="color"
+          @click="enter(row)"
+          >入库</t-link
+        >
+        <t-link
+          :theme="
+            row.haveSign || ['TRANSFER', 'IN'].includes(row.status)
+              ? 'default'
+              : 'primary'
+          "
+          :disabled="row.haveSign || ['TRANSFER', 'IN'].includes(row.status)"
+          hover="color"
+          @click="middle(row)"
+          >中转</t-link
+        >
+        <t-link
+          :theme="
+            row.haveSign || ['USING'].includes(row.status)
+              ? 'default'
+              : 'primary'
+          "
+          :disabled="row.haveSign || ['USING'].includes(row.status)"
+          hover="color"
+          @click="edit(row)"
+          >编辑</t-link
+        >
       </div>
     </template>
   </t-table>
@@ -76,46 +106,84 @@
   </my-dialog>
 </template>
 <script name="DeviceManageNewTab2" setup>
-import { ref, computed } from 'vue';
-import { RUNNING_STATUS, DEVICE_USE_STATUS } from '@/config/constants';
+import { ref, computed, onMounted } from 'vue';
+import { RUNNING_STATUS, DEVICE_SIGN_STATUS } from '@/config/constants';
 import { dictToOptionList } from '@/utils/tool';
-import { cloneDeep } from 'lodash-es';
+import { cloneDeep, omit } from 'lodash-es';
+import {
+  deviceGotoListApi,
+  deviceGotoInHandleApi,
+  deviceGotoMiddleHandleApi,
+  deviceGotoEditHandleApi,
+} from '@/api/sop';
+import { useRequest } from 'vue-request';
+import { MessagePlugin } from 'tdesign-vue-next';
+
+const props = defineProps({
+  sop: {
+    type: Object,
+    default() {
+      return {};
+    },
+  },
+});
+const { data: tableData, run, loading } = useRequest(deviceGotoListApi);
+const fetchData = () => {
+  run({ crmNo: props.sop.crmNo });
+};
+onMounted(() => {
+  fetchData();
+});
 
 const curRow = ref(null);
 
 /**入库弹框 */
 const enterForm = ref();
 const showEnterDialog = ref(false);
-const initEnterParams = { aaa: '', bbb: '', ccc: '' };
+const initEnterParams = { inMode: 'MAIL', expressNo: '', remark: '' };
 const enterParams = ref(cloneDeep(initEnterParams));
-const enterFields = ref([
-  {
-    prop: 'aaa',
-    label: '入库方式',
-    type: 'select',
-    labelWidth: 80,
-    colSpan: 24,
-    options: [
-      { value: '邮寄', label: '邮寄' },
-      { value: '其它', label: '其它' },
+const enterFields = computed(() => {
+  return [
+    {
+      prop: 'inMode',
+      label: '入库方式:',
+      type: 'select',
+      labelWidth: 110,
+      colSpan: 24,
+      options: [
+        { value: 'MAIL', label: '邮寄' },
+        { value: 'OTHER', label: '其它' },
+      ],
+    },
+    enterParams.value.inMode === 'MAIL'
+      ? {
+          prop: 'expressNo',
+          label: '快递单号:',
+          labelWidth: 110,
+          colSpan: 24,
+        }
+      : null,
+    {
+      prop: 'remark',
+      label: '备注:',
+      labelWidth: 110,
+      colSpan: 24,
+    },
+  ];
+});
+const enterRules = computed(() => {
+  return {
+    inMode: [{ required: true, message: '请选择入库方式' }],
+    remark: [
+      { required: enterParams.value.inMode === 'OTHER', message: '请填写备注' },
     ],
-  },
-  {
-    prop: 'bbb',
-    label: '快递单号',
-    labelWidth: 80,
-    colSpan: 24,
-  },
-  {
-    prop: 'ccc',
-    label: '备注',
-    labelWidth: 80,
-    colSpan: 24,
-  },
-]);
-const enterRules = ref({
-  aaa: [{ required: true, message: '请选择入库方式' }],
-  bbb: [{ required: true, message: '请填写快递单号' }],
+    expressNo: [
+      {
+        required: enterParams.value.inMode === 'MAIL',
+        message: '请填写快递单号',
+      },
+    ],
+  };
 });
 const enter = (row) => {
   curRow.value = row;
@@ -126,52 +194,80 @@ const enterConfirm = async () => {
   const formRef = enterForm.value.formRef;
   const valid = await formRef?.validate();
   if (valid !== true) return;
-  //todo
-
-  showEnterDialog.value = false;
+  deviceGotoInHandleApi(
+    omit(
+      {
+        id: curRow.value.id,
+        inMode: enterParams.value.inMode,
+        expressNo: enterParams.value.expressNo,
+        remark: enterParams.value.remark,
+      },
+      enterParams.value.inMode === 'MAIL' ? '' : 'expressNo'
+    )
+  ).then(() => {
+    MessagePlugin.success('操作成功');
+    fetchData();
+    showEnterDialog.value = false;
+  });
 };
 /***********/
 
 /**中转弹框 */
 const middleForm = ref();
 const showMiddleDialog = ref(false);
-const initMiddleParams = { aaa: '', bbb: '', ccc: '', ddd: '' };
+const initMiddleParams = {
+  transferMode: 'MAIL',
+  expressNo: '',
+  remark: '',
+  receiveCrmNo: '',
+};
 const middleParams = ref(cloneDeep(initMiddleParams));
-const middleFields = ref([
-  {
-    prop: 'aaa',
-    label: '中转方式',
-    type: 'select',
-    labelWidth: 80,
-    colSpan: 24,
-    options: [
-      { value: '邮寄', label: '邮寄' },
-      { value: '其它', label: '其它' },
-    ],
-  },
-  {
-    prop: 'bbb',
-    label: '快递单号',
-    labelWidth: 80,
-    colSpan: 24,
-  },
-  {
-    prop: 'ccc',
-    label: '备注',
-    labelWidth: 80,
-    colSpan: 24,
-  },
-  {
-    prop: 'ddd',
-    label: '接收方单号',
-    labelWidth: 80,
-    colSpan: 24,
-  },
-]);
-const middleRules = ref({
-  aaa: [{ required: true, message: '请选择中转方式' }],
-  bbb: [{ required: true, message: '请填写快递单号' }],
-  ddd: [{ required: true, message: '请填写接收方单号' }],
+const middleFields = computed(() => {
+  return [
+    {
+      prop: 'transferMode',
+      label: '中转方式:',
+      type: 'select',
+      labelWidth: 110,
+      colSpan: 24,
+      options: [
+        { value: 'MAIL', label: '邮寄' },
+        { value: 'OTHER', label: '其它' },
+      ],
+    },
+    middleParams.value.transferMode === 'MAIL'
+      ? {
+          prop: 'expressNo',
+          label: '快递单号:',
+          labelWidth: 110,
+          colSpan: 24,
+        }
+      : null,
+    {
+      prop: 'remark',
+      label: '备注:',
+      labelWidth: 110,
+      colSpan: 24,
+    },
+    {
+      prop: 'receiveCrmNo',
+      label: '接收方单号:',
+      labelWidth: 110,
+      colSpan: 24,
+    },
+  ];
+});
+const middleRules = computed(() => {
+  let obj = {
+    transferMode: [{ required: true, message: '请选择中转方式' }],
+    receiveCrmNo: [{ required: true, message: '请填写接收方单号' }],
+  };
+  if (middleParams.value.transferMode === 'MAIL') {
+    obj.expressNo = [{ required: true, message: '请填写快递单号' }];
+  } else {
+    obj.remark = [{ required: true, message: '请填写备注' }];
+  }
+  return obj;
 });
 const middle = (row) => {
   curRow.value = row;
@@ -182,9 +278,22 @@ const middleConfirm = async () => {
   const formRef = middleForm.value.formRef;
   const valid = await formRef?.validate();
   if (valid !== true) return;
-  //todo
-
-  showMiddleDialog.value = false;
+  deviceGotoMiddleHandleApi(
+    omit(
+      {
+        id: curRow.value.id,
+        transferMode: middleParams.value.transferMode,
+        expressNo: middleParams.value.expressNo,
+        remark: middleParams.value.remark,
+        receiveCrmNo: middleParams.value.receiveCrmNo,
+      },
+      middleParams.value.transferMode === 'OTHER' ? 'expressNo' : ''
+    )
+  ).then(() => {
+    MessagePlugin.success('操作成功');
+    fetchData();
+    showMiddleDialog.value = false;
+  });
 };
 
 /***********/
@@ -192,76 +301,133 @@ const middleConfirm = async () => {
 /**编辑弹框 */
 const editForm = ref();
 const showEditDialog = ref(false);
-const initEditParams = { aaa: '', bbb: '', ccc: '', ddd: '', eee: '' };
+const initEditParams = {
+  transferStatus: '',
+  transferMode: '',
+  expressNo: '',
+  receiveCrmNo: '',
+  remark: '',
+};
 const editParams = ref(cloneDeep(initEditParams));
 const editFields = computed(() => {
   return [
     {
-      prop: 'aaa',
-      label: '使用状态',
+      prop: 'transferStatus',
+      label: '使用状态',
       type: 'select',
-      labelWidth: 90,
+      labelWidth: 110,
       colSpan: 24,
       options: [
-        { value: '中转', label: '中转' },
-        { value: '入库', label: '入库' },
+        { value: 'TRANSFER', label: '中转' },
+        { value: 'IN', label: '入库' },
       ],
     },
     {
-      prop: 'bbb',
-      label: '中转方式',
+      prop: 'transferMode',
+      label: '中转方式',
       type: 'select',
-      labelWidth: 90,
+      labelWidth: 110,
       colSpan: 24,
       options: [
-        { value: '邮寄', label: '邮寄' },
-        { value: '其它', label: '其它' },
+        { value: 'MAIL', label: '邮寄' },
+        { value: 'OTHER', label: '其它' },
       ],
     },
-    editParams.value.bbb === '邮寄'
+    editParams.value.transferMode === 'MAIL'
       ? {
-          prop: 'ccc',
-          label: '快递单号',
-          labelWidth: 90,
+          prop: 'expressNo',
+          label: '快递单号',
+          labelWidth: 110,
           colSpan: 24,
         }
       : null,
-    editParams.value.aaa === '中转'
+    editParams.value.transferStatus === 'TRANSFER'
       ? {
-          prop: 'ddd',
-          label: '接收方单号',
-          labelWidth: 90,
+          prop: 'receiveCrmNo',
+          label: '接收方单号',
+          labelWidth: 110,
           colSpan: 24,
         }
       : null,
-    editParams.value.bbb === '其它'
+    editParams.value.transferStatus === 'TRANSFER' ||
+    editParams.value.transferMode === 'OTHER'
       ? {
-          prop: 'eee',
-          label: '备注',
-          labelWidth: 90,
+          prop: 'remark',
+          label: '备注',
+          labelWidth: 110,
           colSpan: 24,
         }
       : null,
   ];
 });
-const editRules = ref({
-  aaa: [{ required: true, message: '请选择使用状态' }],
-  bbb: [{ required: true, message: '请选择中转方式' }],
-  ccc: [{ required: true, message: '请填写快递单号' }],
-  ddd: [{ required: true, message: '请填写接收方单号' }],
+const editRules = computed(() => {
+  return {
+    transferStatus: [{ required: true, message: '请选择使用状态' }],
+    transferMode: [{ required: true, message: '请选择中转方式' }],
+    expressNo: [{ required: true, message: '请填写快递单号' }],
+    receiveCrmNo: [{ required: true, message: '请填写接收方单号' }],
+    remark: [
+      {
+        required: editParams.value.transferMode === 'OTHER',
+        message: '请填写备注',
+      },
+    ],
+  };
 });
 const edit = (row) => {
   curRow.value = row;
-  editParams.value = cloneDeep(initEditParams);
+  editParams.value = {
+    transferStatus: row.status,
+    transferMode: row.transferMode,
+    expressNo: row.expressNo,
+    receiveCrmNo: row.receiveCrmNo,
+    remark: row.remark,
+  };
   showEditDialog.value = true;
 };
 const editConfirm = async () => {
   const formRef = editForm.value.formRef;
   const valid = await formRef?.validate();
   if (valid !== true) return;
-  //todo
-
-  showEditDialog.value = false;
+  deviceGotoEditHandleApi(
+    editParams.value.transferStatus === 'TRANSFER' &&
+      editParams.value.transferMode === 'MAIL'
+      ? {
+          id: curRow.value.id,
+          transferStatus: editParams.value.transferStatus,
+          transferMode: editParams.value.transferMode,
+          expressNo: editParams.value.expressNo,
+          remark: editParams.value.remark,
+          receiveCrmNo: editParams.value.receiveCrmNo,
+        }
+      : editParams.value.transferStatus === 'TRANSFER' &&
+        editParams.value.transferMode === 'OTHER'
+      ? {
+          id: curRow.value.id,
+          transferStatus: editParams.value.transferStatus,
+          transferMode: editParams.value.transferMode,
+          remark: editParams.value.remark,
+          receiveCrmNo: editParams.value.receiveCrmNo,
+        }
+      : editParams.value.transferStatus === 'IN' &&
+        editParams.value.transferMode === 'MAIL'
+      ? {
+          id: curRow.value.id,
+          transferStatus: editParams.value.transferStatus,
+          transferMode: editParams.value.transferMode,
+          expressNo: editParams.value.expressNo,
+        }
+      : {
+          id: curRow.value.id,
+          transferStatus: editParams.value.transferStatus,
+          transferMode: editParams.value.transferMode,
+          remark: editParams.value.remark,
+        }
+  ).then(() => {
+    MessagePlugin.success('操作成功');
+    fetchData();
+    showEditDialog.value = false;
+  });
 };
 /***********/
 
@@ -271,13 +437,13 @@ const columns = [
     title: '序号',
     width: 48,
   },
-  { colKey: 'aaa', title: '设备序列号' },
-  { colKey: 'bbb', title: '设备型号' },
-  { colKey: 'ccc', title: '状态', cell: 'ccc' },
-  { colKey: 'ddd', title: '设备归属' },
-  { colKey: 'eee', title: '运输方式' },
-  { colKey: 'fff', title: '使用状态', cell: 'fff' },
-  { colKey: 'ggg', title: '接收方单号' },
+  { colKey: 'serialNo', title: '设备序列号' },
+  { colKey: 'model', title: '设备型号' },
+  { colKey: 'deviceStatus', title: '状态', cell: 'deviceStatus' },
+  { colKey: 'supplierName', title: '设备归属' },
+  { colKey: 'transportMode', title: '运输方式' },
+  { colKey: 'status', title: '使用状态', cell: 'fff' },
+  { colKey: 'receiveCrmNo', title: '接收方单号' },
   {
     title: '管理',
     colKey: 'operate',
@@ -285,16 +451,5 @@ const columns = [
     width: 180,
   },
 ];
-const tableData = ref([
-  {
-    aaa: 'aaa',
-    bbb: 'bbb',
-    ccc: 'BREAK_DOWN',
-    ddd: 'ddd',
-    eee: 'eee',
-    fff: '1',
-    ggg: 'ggg',
-  },
-]);
 </script>
 <style lang="less" scoped></style>

+ 3 - 0
src/components/global/search-form/components/search-form-item.vue

@@ -121,6 +121,9 @@
       v-bind="attrs"
     />
   </template>
+  <template v-if="item.type == 'radio'">
+    <t-radio-group v-model="params[item.prop]"></t-radio-group>
+  </template>
 </template>
 
 <script setup name="SearchFormItem">

+ 12 - 0
src/config/constants.js

@@ -249,6 +249,18 @@ export const SERVICE_RANGE = {
   SCAN_MARK: '扫描+阅卷',
 };
 
+export const DEVICE_SIGN_STATUS = {
+  UN_DELIVER: '代发货',
+  DELIVER: '已发货',
+  USING: '使用中',
+  TRANSFER: '中转',
+  TRANSFER_SIGN: '中转已签收',
+  IN: '入库',
+  RECEIVE: '已签收',
+  CANCEL: '作废',
+  RETURN: '已返还',
+};
+
 export const DEVICE_USE_STATUS = {
   1: '入库',
   2: '中转',

+ 27 - 1
src/views/service-unit/dispatch/dispatch-manage/create-sop.vue

@@ -8,7 +8,9 @@
     :destroyOnClose="true"
     :closeOnOverlayClick="false"
     :close-btn="true"
+    :cancel-btn="null"
     @close="visible = false"
+    confirmBtn="关闭"
     @confirm="confirm"
   >
     <t-collapse class="sop-step-mid" defaultExpandAll>
@@ -79,7 +81,30 @@
       </t-row>
     </div>
     <div class="btn-box pt-20px" style="border-top: 1px solid #f0f0f0">
-      <t-button @click="toCreateSop">新增sop</t-button>
+      <t-space>
+        <t-button @click="toCreateSop">
+          <template #icon><svg-icon name="add-circle" color="#fff" /></template
+          >新增sop</t-button
+        >
+        <upload-button
+          upload-url="/api/admin/tb/crm/detail/sop/import"
+          :format="['xls', 'xlsx']"
+          :uploadData="{ crmNo: props.dispatchInfo.crmNo }"
+          @onSuccess="fetchData"
+        >
+          <t-button variant="outline">
+            <template #icon><svg-icon name="import" color="#262626" /></template
+            >批量导入
+          </t-button>
+        </upload-button>
+        <t-button
+          variant="outline"
+          @click="downloadImportTemplate('TEMPLATE_CRM_SOP_DETAIL')"
+        >
+          <template #icon><svg-icon name="export" color="#262626" /></template
+          >下载模板
+        </t-button>
+      </t-space>
     </div>
     <div class="mt-10px">
       <t-table
@@ -147,6 +172,7 @@ import { useVModel } from '@vueuse/core';
 import CreateSopItem from './create-sop-item.vue';
 import AllocationDialog from './allocation-dialog.vue';
 import useFetchTable from '@/hooks/useFetchTable';
+import { downloadImportTemplate } from '@/api/common';
 import {
   getDispatchInfoApi,
   getSubSopListApi,

+ 27 - 12
src/views/service-unit/dispatch/dispatch-manage/mult-delineation-dialog.vue

@@ -24,17 +24,21 @@
           </t-form-item>
         </t-col>
         <t-col :span="12">
-          <t-form-item label="大区经理" name="aaa">
-            <t-select v-model="formData.aaa">
-              <t-option value="1" label="按地域系统自动指定大区经理"></t-option>
-              <t-option value="2" label="直接指定大区经理"></t-option>
-            </t-select>
+          <t-form-item label="大区经理" name="leadType">
+            <t-radio-group
+              v-model="formData.leadType"
+              name="leadType"
+              :options="[
+                { value: 'BY_AREA', label: '按地域系统自动指定大区经理' },
+                { value: 'BY_PERSON', label: '直接指定大区经理' },
+              ]"
+            ></t-radio-group>
           </t-form-item>
         </t-col>
-        <t-col :span="12" v-if="formData.aaa == '2'">
-          <t-form-item label="大区经理" name="bbb">
+        <t-col :span="12" v-if="formData.leadType == 'BY_PERSON'">
+          <t-form-item label="大区经理" name="leadId">
             <select-type-user
-              v-model="formData.bbb"
+              v-model="formData.leadId"
               type="REGION_MANAGER"
             ></select-type-user>
           </t-form-item>
@@ -52,7 +56,8 @@
 <script setup name="MultDelineationDialog">
 import { ref, reactive } from 'vue';
 import { MessagePlugin } from 'tdesign-vue-next';
-import { serviceScopeBindBatchApi } from '@/api/service-unit';
+import { serviceScopeBindNewApi } from '@/api/service-unit';
+import { omit } from 'lodash-es';
 
 const emit = defineEmits(['update:visible', 'success']);
 const formRef = ref(null);
@@ -68,8 +73,8 @@ const props = defineProps({
 const formData = reactive({
   serviceUnitId: null,
   crmIdList: [],
-  aaa: '1',
-  bbb: '',
+  leadType: 'BY_AREA',
+  leadId: '',
 });
 const rules = {
   serviceUnitId: [
@@ -80,6 +85,14 @@ const rules = {
       trigger: 'change',
     },
   ],
+  leadId: [
+    {
+      required: true,
+      message: '未选择大区经理',
+      type: 'error',
+      trigger: 'change',
+    },
+  ],
 };
 
 const onOpened = () => {
@@ -92,7 +105,9 @@ const save = async () => {
   const valid = await formRef.value.validate();
   if (valid !== true) return;
 
-  const res = await serviceScopeBindBatchApi(formData).catch(() => {});
+  const res = await serviceScopeBindNewApi(
+    formData.leadType === 'BY_PERSON' ? formData : omit(formData, 'leadId')
+  ).catch(() => {});
   if (!res) return;
   MessagePlugin.success('操作成功');
   emit('update:visible', false);

+ 13 - 0
src/views/sop/sop-manage/office-sop/index.vue

@@ -187,6 +187,9 @@
                 编辑
               </t-link>
             </template>
+            <t-link theme="primary" hover="color" @click="toDeviceManage(row)"
+              >设备管理</t-link
+            >
           </div>
         </template>
       </my-table>
@@ -222,6 +225,10 @@
       v-model:visible="showAddViolationDialog"
       :sop="curSopData"
     ></add-violation-dialog>
+    <DeviceManageNew
+      v-model:visible="showDeviceManage"
+      :sop="curSopData"
+    ></DeviceManageNew>
   </div>
 </template>
 
@@ -243,6 +250,7 @@ import usePermission from '@/hooks/usePermission';
 import { cloneDeep } from 'lodash-es';
 import { CUSTOMER_TYPE, FLOW_STATUS } from '@/config/constants';
 import { dictToOptionList } from '@/utils/tool';
+import DeviceManageNew from '@/components/common/device-manage-new';
 const { perm } = usePermission();
 
 const appStore = useAppStore();
@@ -514,4 +522,9 @@ const createQualityIssueHandle = (row) => {
   };
   showQualityIssueDialog.value = true;
 };
+const showDeviceManage = ref(false);
+const toDeviceManage = (row) => {
+  curSopData.value = row;
+  showDeviceManage.value = true;
+};
 </script>