Browse Source

项目计划变更报备

刘洋 1 year ago
parent
commit
e65a4f2444

+ 5 - 1
src/App.vue

@@ -9,10 +9,14 @@ import { globalConfig } from '@/config/global';
 import enUs from 'tdesign-vue-next/es/locale/en_US';
 import zhCn from 'tdesign-vue-next/es/locale/zh_CN';
 import { ref } from 'vue';
-import { useAppStore } from './store';
+import { useAppStore, useUserStore } from './store';
 const appStore = useAppStore();
+const userStore = useUserStore();
 // const lang = ref(appStore.language === 'zh_CN' ? cn : en);
 const config = ref(
   Object.assign(appStore.language === 'zh_CN' ? zhCn : enUs, globalConfig)
 );
+if (userStore.user) {
+  appStore.getFlowParams();
+}
 </script>

+ 13 - 0
src/api/sop.js

@@ -94,6 +94,19 @@ export const deviceCanIn = (params) =>
     params,
   });
 
+//设备出入库,提交
+export const deviceOutInSave = (data) =>
+  request({
+    url: '/api/admin/device/in/out/submit',
+    data,
+  });
+
+export const planChangeList = (params) =>
+  request({
+    url: '/api/admin/project/exchange/list',
+    params,
+  });
+
 //获取流程部署信息接口
 export const getFlowDeployment = () =>
   request({

+ 1 - 4
src/components/global/my-upload/index.vue

@@ -13,7 +13,6 @@
     :before-upload="handleBeforeUpload"
     :request-method="upload"
     @fail="handleFail"
-    @change="change"
   >
   </t-upload>
 </template>
@@ -79,12 +78,10 @@ const upload = async (files) => {
 
   const res = await uploadFiles(formData, md5).catch(() => {});
   if (res) {
+    emit('change', res);
     return { status: 'success', response: res };
   } else {
     return { status: 'fail', error: '上传失败' };
   }
 };
-const change = (fileList) => {
-  emit('change', fileList);
-};
 </script>

+ 10 - 0
src/config/constants.js

@@ -182,3 +182,13 @@ export const VIOLATION_FLOW_STATUS = {
   CLOSE: '关闭',
   RESTART: '重启',
 };
+//项目计划变更-变更类型
+export const PLAN_CHANGE_TYPE = {
+  PLAN: '关键信息及计划变更',
+  CANCEL: '项目取消',
+};
+//流程状态
+export const FLOW_CHECK_STATUS = {
+  UN_APPROVE: '待审核',
+  APPROVE: '已审核',
+};

+ 1 - 1
src/store/modules/app.js

@@ -26,7 +26,7 @@ const useAppStore = defineStore('app', {
     },
     async getFlowParams() {
       let res = await getFlowDeployment();
-      console.log('res:', res);
+      this.flowParams = res;
     },
   },
 });

+ 3 - 1
src/views/login/index.vue

@@ -82,11 +82,12 @@
 import { ref, reactive, computed, watch } from 'vue';
 import { DesktopIcon, LockOnIcon, RollbackIcon } from 'tdesign-icons-vue-next';
 import { useRoute, useRouter } from 'vue-router';
-import { useUserStore } from '@/store';
+import { useUserStore, useAppStore } from '@/store';
 import { MessagePlugin } from 'tdesign-vue-next';
 import { getBase64 } from '@/utils/crypto';
 import ForgetPwd from './forget-pwd.vue';
 
+const appStore = useAppStore();
 const forgetStatus = ref(false);
 const form = ref(null);
 
@@ -120,6 +121,7 @@ const loginHandle = () => {
         type: 'ACCOUNT',
       });
       await userStore.requestUserMenu();
+      await appStore.getFlowParams();
       if (redirect) {
         router.push(redirect);
       } else {

+ 28 - 6
src/views/sop/sop-manage/device-out-in/add-device-dialog.vue

@@ -18,7 +18,11 @@
         </t-col>
         <t-col :span="6">
           <t-form-item label="设备出入库时间">
-            <t-date-picker v-model="formData.b" style="width: 100%" />
+            <t-date-picker
+              v-model="formData.inOutTime"
+              style="width: 100%"
+              valueType="time-stamp"
+            />
           </t-form-item>
         </t-col>
         <t-col :span="12">
@@ -84,7 +88,10 @@
                   ></select-area>
                 </template>
                 <template #basePhotoPath="{ row }">
-                  <my-upload :imgLength="1"></my-upload>
+                  <my-upload
+                    :imgLength="1"
+                    @change="imgChange($event, row)"
+                  ></my-upload>
                 </template>
               </t-table>
               <t-button theme="primary" class="m-t-15px" @click="createOneRow">
@@ -106,11 +113,13 @@
 </template>
 <script setup name="AddDeviceDialog">
 import { ref, watch } from 'vue';
-import { cloneDeep } from 'lodash';
-import { Icon, MessagePlugin } from 'tdesign-icons-vue-next';
+import { cloneDeep, omit } from 'lodash';
+import { Icon } from 'tdesign-icons-vue-next';
 import useOptions from '@/hooks/useOptions';
 import { RUNNING_STATUS } from '@/config/constants';
 import { dictToOptionList } from '@/utils/tool';
+import { MessagePlugin } from 'tdesign-vue-next';
+import { deviceOutInSave } from '@/api/sop';
 
 const { options: deviceOutOptions } = useOptions('deviceCanOut');
 const { options: deviceInOptions } = useOptions('deviceCanIn');
@@ -188,7 +197,9 @@ const resetKeys = () => {
     item.key = index + 1 + '';
   });
 };
-
+const imgChange = (obj, row) => {
+  row.basePhotoPath = obj.url;
+};
 const createOneRow = () => {
   tableData.value.push({
     deviceNo: '',
@@ -228,7 +239,18 @@ const save = () => {
   if (!validate()) {
     return;
   }
-  emit('success');
+  let deviceInOutFormList = tableData.value.map((item) => {
+    item.address = item.address.join('');
+    return { ...omit(item, 'key') };
+  });
+  deviceOutInSave({
+    inOutType: formData.inOutType,
+    inOutTime: formData.inOutTime,
+    deviceInOutFormList,
+  }).then(() => {
+    MessagePlugin.success('操作成功');
+    emit('success');
+  });
 };
 </script>
 <style lang="less" scoped>

+ 19 - 9
src/views/sop/sop-manage/device-out-in/index.vue

@@ -1,5 +1,16 @@
 <template>
   <div class="office-sop flex flex-col h-full">
+    <div class="page-action">
+      <t-space size="small">
+        <t-button theme="primary" @click="showAddDeviceDialog = true">
+          <template #icon><svg-icon name="add-circle" color="#fff" /></template>
+          新增</t-button
+        >
+        <t-button theme="default" :disabled="!selectedRowKeys.length"
+          >作废</t-button
+        >
+      </t-space>
+    </div>
     <SearchForm :fields="fields" :params="params">
       <template #service="{ item, params }">
         <select-service-unit v-model="params[item.prop]"></select-service-unit>
@@ -10,14 +21,6 @@
     </SearchForm>
 
     <div class="flex-1 page-wrap">
-      <div class="btn-group">
-        <t-button theme="success" @click="showAddDeviceDialog = true"
-          >新增</t-button
-        >
-        <t-button theme="danger" :disabled="!selectedRowKeys.length"
-          >作废</t-button
-        >
-      </div>
       <t-table
         size="small"
         row-key="id"
@@ -38,7 +41,10 @@
       >
       </t-table>
     </div>
-    <AddDeviceDialog v-model:visible="showAddDeviceDialog"></AddDeviceDialog>
+    <AddDeviceDialog
+      v-model:visible="showAddDeviceDialog"
+      @success="addSuccess"
+    ></AddDeviceDialog>
   </div>
 </template>
 
@@ -145,6 +151,10 @@ const {
   search,
   onChange,
 } = useFetchTable(deviceOutInSearch, { params: transParams });
+const addSuccess = () => {
+  showAddDeviceDialog.value = false;
+  search();
+};
 </script>
 
 <style></style>

+ 93 - 56
src/views/sop/sop-manage/project-change-report/index.vue

@@ -1,13 +1,25 @@
 <template>
   <div class="office-sop flex flex-col h-full">
-    <SearchForm :fields="fields" :params="params"></SearchForm>
-
-    <div class="flex-1 page-wrap">
-      <div class="btn-group">
-        <t-button theme="success" :disabled="!selectedRowKeys.length"
+    <!-- <div class="page-action">
+      <t-space size="small">
+        <t-button theme="default" :disabled="!selectedRowKeys.length"
           >作废</t-button
         >
-      </div>
+      </t-space>
+    </div> -->
+    <SearchForm :fields="fields" :params="params">
+      <template #service="{ item, params }">
+        <select-service-unit v-model="params[item.prop]"></select-service-unit>
+      </template>
+      <template #user="{ 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"
         row-key="id"
@@ -31,115 +43,140 @@
 </template>
 
 <script setup lang="jsx" name="ProjectChangeReport">
-import { ref, reactive } from 'vue';
-import { getTableData } from '@/api/test';
+import { ref, reactive, computed } from 'vue';
 import useFetchTable from '@/hooks/useFetchTable';
+import { dictToOptionList } from '@/utils/tool';
+import { omit } from 'lodash';
+import { planChangeList } from '@/api/sop';
+import {
+  PLAN_CHANGE_TYPE,
+  CUSTOMER_TYPE,
+  FLOW_CHECK_STATUS,
+} from '@/config/constants';
 const selectedRowKeys = ref([]);
 const selectChange = (value, { selectedRowData }) => {
   selectedRowKeys.value = value;
 };
 const columns = [
-  {
-    colKey: 'row-select',
-    type: 'multiple',
-    width: 50,
-    fixed: 'left',
-  },
-  { colKey: 'a', title: '变更申请编号', minWidth: 120 },
-  { colKey: 'b', title: '服务单元', minWidth: 80 },
-  { colKey: 'c', title: '客户类型', width: 100 },
-  { colKey: 'd', title: '客户名称', minWidth: 80 },
-  { colKey: 'e', title: '项目单号' },
-  { colKey: 'f', title: '项目名称' },
-  { colKey: 'g', title: '变更原因' },
-  { colKey: 'h', title: '变更类型' },
-  { colKey: 'i', title: '变更字段(多行)', minWidth: 120 },
-  { colKey: 'j', title: '变更后内容(多行)', minWidth: 130 },
-  { colKey: 'k', title: '提交人' },
-  { colKey: 'l', title: '提交时间', width: 140 },
-  { colKey: 'm', title: '流程状态' },
-  { colKey: 'n', title: '当前节点' },
-  { colKey: 'o', title: '节点负责人' },
+  // {
+  //   colKey: 'row-select',
+  //   type: 'multiple',
+  //   width: 50,
+  //   fixed: 'left',
+  // },
+  { colKey: 'code', title: '变更申请编号', minWidth: 120 },
+  { colKey: 'serviceName', title: '服务单元', minWidth: 80 },
+  { colKey: 'customTypeStr', title: '客户类型', width: 100 },
+  { colKey: 'customName', title: '客户名称', minWidth: 80 },
+  { colKey: 'crmNo', title: '项目单号' },
+  { colKey: 'crmName', title: '项目名称' },
+  { colKey: 'reason', title: '变更原因' },
+  { colKey: 'exchangeTypeStr', title: '变更类型' },
+  { colKey: 'createRealName', title: '提交人' },
+  { colKey: 'createTime', title: '提交时间', width: 140 },
+  { colKey: 'projectExchangeFlowStatusStr', title: '流程状态' },
+  { colKey: 'approveUsersName', title: '处理人' },
+  { colKey: 'flowTime', title: '处理时间' },
 ];
 const fields = ref([
   {
-    prop: 'a',
+    prop: 'serviceId',
     label: '服务单元',
     type: 'select',
     labelWidth: 100,
-    colSpan: 4,
+    colSpan: 4.5,
+    cell: 'service',
   },
   {
-    prop: 'b',
+    prop: 'createUserId',
     label: '提交人',
     type: 'select',
     labelWidth: 100,
-    colSpan: 4,
+    colSpan: 4.5,
+    cell: 'user',
   },
   {
-    prop: 'c',
+    prop: 'type',
     label: '变更类型',
     type: 'select',
     labelWidth: 100,
-    colSpan: 4,
+    colSpan: 4.5,
+    options: dictToOptionList(PLAN_CHANGE_TYPE),
   },
   {
-    prop: 'd',
+    prop: 'customType',
     label: '客户类型',
     type: 'select',
     labelWidth: 100,
-    colSpan: 4,
+    colSpan: 4.5,
+    options: dictToOptionList(CUSTOMER_TYPE),
   },
   {
-    prop: 'e',
+    prop: 'flowStatus',
     label: '流程状态',
     type: 'select',
     labelWidth: 100,
-    colSpan: 4,
+    colSpan: 4.5,
+    options: dictToOptionList(FLOW_CHECK_STATUS),
   },
   {
     type: 'buttons',
     colSpan: 2,
-    children: [{ type: 'button', text: '查询' }],
+    children: [
+      {
+        type: 'button',
+        text: '查询',
+        onClick: () => {
+          search();
+        },
+      },
+    ],
   },
   {
-    prop: 'f',
+    prop: 'customName',
     label: '客户名称',
     labelWidth: 100,
-    colSpan: 4,
+    colSpan: 4.5,
   },
   {
-    prop: 'g',
+    prop: 'exchangeNo',
     label: '变更申请编号',
     labelWidth: 100,
-    colSpan: 4,
+    colSpan: 4.5,
   },
   {
-    prop: 'h',
+    prop: 'time',
     label: '提交时间',
     type: 'daterange',
     labelWidth: 100,
-    colSpan: 8,
+    colSpan: 9,
   },
 ]);
 const params = reactive({
-  a: '',
-  b: '',
-  c: '',
-  d: '',
-  e: '',
-  f: '',
-  g: '',
-  h: [],
+  serviceId: '',
+  createUserId: '',
+  type: '',
+  customType: '',
+  flowStatus: '',
+  customName: '',
+  exchangeNo: '',
+  time: [],
+});
+const transParams = computed(() => {
+  return {
+    ...omit(params, 'time'),
+    startTime: params.time[0],
+    endTime: params.time[1],
+  };
 });
 
 const {
   loading: tableLoading,
   pagination,
   tableData,
-  fetchData,
+  search,
   onChange,
-} = useFetchTable(getTableData);
+} = useFetchTable(planChangeList, { params: transParams });
 </script>
 
 <style></style>