浏览代码

Merge remote-tracking branch 'origin/release_v1.0.1' into release_v1.0.1

shudonghui 1 年之前
父节点
当前提交
e2e07c23ae

二进制
src/assets/imgs/menu-logo.png


+ 7 - 1
src/views/sop/components/dynamic-form-item/device-table/edit-column-dialog.vue

@@ -81,6 +81,12 @@ const props = defineProps({
   curRow: Object,
   isOutType: Boolean,
   tableData: Array,
+  sop: {
+    type: Object,
+    default() {
+      return {};
+    },
+  },
 });
 
 const deviceOptions = ref([]);
@@ -176,7 +182,7 @@ const deviceChange = (val, { option }) => {
   if (!props.isOutType) {
     formData.address = option.supplierName;
   } else {
-    formData.address = option.customName;
+    formData.address = props.sop?.customName || '';
   }
 };
 

+ 7 - 0
src/views/sop/components/dynamic-form-item/device-table/index.vue

@@ -48,6 +48,7 @@
       :isOutType="isOutType"
       @success="columnConfirm"
       :tableData="tableData"
+      :sop="sop"
     ></edit-column-dialog>
   </div>
 </template>
@@ -58,6 +59,12 @@ import EditColumnDialog from './edit-column-dialog.vue';
 const props = defineProps({
   config: { type: Object },
   modelValue: { type: Array },
+  sop: {
+    type: Object,
+    default() {
+      return {};
+    },
+  },
 });
 const emit = defineEmits(['update:modelValue', 'change']);
 

+ 7 - 0
src/views/sop/components/dynamic-form-item/index.vue

@@ -9,6 +9,7 @@
       v-model="valueData"
       :config="config"
       @change="emitChange"
+      :sop="sop"
     ></component>
   </t-form-item>
 </template>
@@ -32,6 +33,12 @@ import LABEL from './LABEL.vue';
 
 const props = defineProps({
   config: { type: Object },
+  sop: {
+    type: Object,
+    default() {
+      return {};
+    },
+  },
 });
 const emit = defineEmits(['change']);
 

+ 2 - 1
src/views/sop/sop-manage/device-out-in/add-device-dialog.vue

@@ -51,7 +51,8 @@
 import { computed, reactive, ref, watch } from 'vue';
 import { MessagePlugin } from 'tdesign-vue-next';
 import { deviceOutInSave } from '@/api/sop';
-import DeviceTable from '../../components/dynamic-form-item/device-table/index.vue';
+// import DeviceTable from '../../components/dynamic-form-item/device-table/index.vue';
+import DeviceTable from './device-table/index.vue';
 
 const emit = defineEmits(['update:visible', 'success']);
 const formRef = ref(null);

+ 198 - 0
src/views/sop/sop-manage/device-out-in/device-table/edit-column-dialog.vue

@@ -0,0 +1,198 @@
+<template>
+  <my-dialog
+    :visible="visible"
+    :header="title"
+    :width="700"
+    attach="body"
+    :closeOnOverlayClick="false"
+    @close="emit('update:visible', false)"
+    @opened="dialogOpened"
+  >
+    <t-form
+      ref="formRef"
+      :data="formData"
+      :rules="rules"
+      :labelWidth="120"
+      colon
+    >
+      <t-form-item label="设备编号" name="deviceNo">
+        <t-select
+          v-model="formData.deviceNo"
+          :options="deviceOptions"
+          @change="deviceChange"
+        >
+        </t-select>
+      </t-form-item>
+      <t-form-item v-if="!isOutType" label="运行状态" name="deviceStatus">
+        <t-select
+          v-model="formData.deviceStatus"
+          :options="dictToOptionList(RUNNING_STATUS)"
+        ></t-select>
+      </t-form-item>
+      <t-form-item v-if="!isOutType" label="总扫描量" name="scanCount">
+        <t-input-number
+          v-model="formData.scanCount"
+          theme="column"
+          :decimalPlaces="1"
+          :max="100000000"
+          :min="0"
+          style="width: 120px"
+        ></t-input-number>
+      </t-form-item>
+      <t-form-item
+        v-if="isOutType"
+        label="发往地"
+        name="addressArr"
+        required-mark
+      >
+        <select-area
+          v-model="formData.addressArr"
+          value-type="full"
+        ></select-area>
+      </t-form-item>
+
+      <t-form-item label="快递单拍照" name="basePhotoPath">
+        <my-upload
+          v-model="files"
+          :imgLength="1"
+          @change="imgChange"
+        ></my-upload>
+      </t-form-item>
+    </t-form>
+    <template #foot>
+      <t-button theme="default" @click="emit('update:visible', false)"
+        >取消</t-button
+      >
+      <t-button theme="primary" @click="save">保存</t-button>
+    </template>
+  </my-dialog>
+</template>
+<script setup name="EditColumnDialog">
+import { ref, computed, reactive } from 'vue';
+import { RUNNING_STATUS } from '@/config/constants';
+import { dictToOptionList } from '@/utils/tool';
+import { deviceCanOut, deviceCanIn } from '@/api/sop';
+
+const emit = defineEmits(['update:visible', 'success']);
+const props = defineProps({
+  visible: Boolean,
+  curRow: Object,
+  isOutType: Boolean,
+  tableData: Array,
+});
+
+const deviceOptions = ref([]);
+const formRef = ref(null);
+const files = ref([]);
+const formData = reactive({
+  key: '',
+  deviceNo: '',
+  supplierName: '',
+  deviceStatus: '',
+  scanCount: null,
+  location: '',
+  address: '',
+  addressArr: ['', '', ''],
+  basePhotoPath: '',
+});
+
+const title = computed(() => {
+  return (props.curRow?.key ? '编辑' : '新增') + '记录';
+});
+
+const rules = {
+  deviceNo: [
+    {
+      required: true,
+      message: '不能为空',
+      type: 'error',
+      trigger: 'change',
+    },
+  ],
+  deviceStatus: [
+    {
+      required: true,
+      message: '不能为空',
+      type: 'error',
+      trigger: 'change',
+    },
+  ],
+  // scanCount: [
+  //   {
+  //     required: true,
+  //     message: '不能为空',
+  //     type: 'error',
+  //     trigger: 'change',
+  //   },
+  // ],
+  addressArr: [
+    {
+      validator: () => {
+        if (formData.addressArr.some((item) => !item))
+          return { result: false, message: '发往地必选' };
+
+        return { result: true, type: 'success' };
+      },
+      type: 'error',
+      trigger: 'change',
+    },
+  ],
+  basePhotoPath: [
+    {
+      required: true,
+      message: '请上传图片',
+      type: 'error',
+      trigger: 'change',
+    },
+  ],
+};
+
+const getDeviceOptions = async () => {
+  const func = props.isOutType ? deviceCanOut : deviceCanIn;
+  const res = await func();
+  deviceOptions.value = res
+    .filter(
+      (item) =>
+        !(props.tableData || []).find((v) => v.deviceNo == item.deviceNo)
+    )
+    .map((item) => ({
+      ...item,
+      value: item.deviceNo,
+      label: item.deviceNo + '_' + item.deviceModel + '_' + item.supplierName,
+    }));
+};
+
+const imgChange = (fileRes) => {
+  formData.basePhotoPath = fileRes.length ? fileRes[0].url : '';
+};
+const deviceChange = (val, { option }) => {
+  formData.supplierName = option.supplierName;
+  formData.deviceStatus = option.deviceStatus;
+  formData.deviceBrand = option.deviceBrand;
+  formData.scanCount = option.scanCount;
+  formData.location = option.location;
+  if (!props.isOutType) {
+    formData.address = option.supplierName;
+  }
+};
+
+const dialogOpened = async () => {
+  for (let key in formData) {
+    formData[key] = props.curRow[key];
+  }
+  files.value = formData.basePhotoPath ? [{ url: formData.basePhotoPath }] : [];
+  await getDeviceOptions();
+};
+
+const save = async () => {
+  const valid = await formRef.value.validate();
+  if (valid !== true) return;
+  let data = {};
+  for (let key in formData) {
+    data[key] = formData[key];
+  }
+  // if (props.isOutType) data.address = data.addressArr.join('');
+  emit('update:visible', false);
+  emit('success', data);
+};
+</script>

+ 179 - 0
src/views/sop/sop-manage/device-out-in/device-table/index.vue

@@ -0,0 +1,179 @@
+<template>
+  <div>
+    <t-table
+      class="dynamic-table"
+      ref="tableRef"
+      row-key="key"
+      :columns="columns"
+      :data="tableData"
+      bordered
+      size="small"
+    >
+      <template v-if="!readonly" #operate="{ row, rowIndex }">
+        <div class="table-operations">
+          <t-link theme="primary" hover="color" @click="handleEdit(row)">
+            编辑
+          </t-link>
+          <t-link theme="primary" hover="color" @click="deleteRow(rowIndex)">
+            删除
+          </t-link>
+        </div>
+      </template>
+      <template #deviceStatus="{ row }">
+        <status-tag :value="row.deviceStatus" type="runningStatus"></status-tag>
+      </template>
+      <template #basePhotoPath="{ row }">
+        <t-image
+          v-if="row.basePhotoPath"
+          :src="row.basePhotoPath"
+          :style="{ width: '80px', height: '80px' }"
+        />
+      </template>
+    </t-table>
+    <t-button
+      v-if="!readonly"
+      class="m-t-10px"
+      theme="primary"
+      @click="handleAdd"
+    >
+      <template #icon><svg-icon name="add-circle" color="#fff" /></template>
+      添加
+    </t-button>
+
+    <!-- EditColumnDialog -->
+    <edit-column-dialog
+      v-if="!readonly"
+      v-model:visible="showEditColumnDialog"
+      :curRow="curRow"
+      :isOutType="isOutType"
+      @success="columnConfirm"
+      :tableData="tableData"
+    ></edit-column-dialog>
+  </div>
+</template>
+<script setup name="DEVICEOUTTABLE">
+import { computed, ref, watch } from 'vue';
+import EditColumnDialog from './edit-column-dialog.vue';
+
+const props = defineProps({
+  config: { type: Object },
+  modelValue: { type: Array },
+});
+const emit = defineEmits(['update:modelValue', 'change']);
+
+const tableData = ref([]);
+const showEditColumnDialog = ref(false);
+const curRow = ref(null);
+
+const isOutType = computed(() => {
+  return props.config.code === 'DEVICE_OUT_TABLE';
+});
+const readonly = computed(() => {
+  return !props.config.writable;
+});
+
+const columns = [
+  {
+    title: '序号',
+    colKey: 'key',
+    align: 'center',
+    width: 50,
+  },
+  {
+    title: '设备编号',
+    colKey: 'deviceNo',
+    width: 150,
+  },
+  {
+    title: '供应商',
+    colKey: 'supplierName',
+  },
+  {
+    title: '运行状态',
+    colKey: 'deviceStatus',
+    width: 105,
+  },
+  {
+    title: '总扫描量',
+    colKey: 'scanCount',
+    width: 80,
+  },
+  {
+    title: '当前所在地',
+    colKey: 'location',
+  },
+  {
+    title: '发往地',
+    colKey: 'address',
+  },
+  {
+    title: '快递单拍照',
+    colKey: 'basePhotoPath',
+    width: 98,
+  },
+  {
+    title: '操作',
+    colKey: 'operate',
+    width: 90,
+    align: 'center',
+  },
+];
+const resetKeys = () => {
+  tableData.value.forEach((item, index) => {
+    item.key = index + 1 + '';
+  });
+};
+
+const handleAdd = () => {
+  curRow.value = {
+    key: '',
+    deviceNo: '',
+    supplierName: '',
+    deviceStatus: '',
+    deviceBrand: '',
+    scanCount: '',
+    location: '',
+    address: '',
+    addressArr: ['', '', ''],
+    basePhotoPath: '',
+  };
+  showEditColumnDialog.value = true;
+};
+const handleEdit = (row) => {
+  curRow.value = row;
+  showEditColumnDialog.value = true;
+};
+const deleteRow = (row) => {
+  let index = tableData.value.findIndex((item) => item.key == row.key);
+  tableData.value.splice(index, 1);
+  emitChange();
+};
+
+const columnConfirm = (data) => {
+  if (data.key) {
+    const pos = tableData.value.findIndex((item) => item.key === data.key);
+    tableData.value.splice(pos, 1, data);
+  } else {
+    tableData.value.push(data);
+  }
+  emitChange();
+};
+
+const emitChange = () => {
+  resetKeys();
+  emit('update:modelValue', tableData.value);
+  emit('change', tableData.value);
+};
+
+watch(
+  () => props.modelValue,
+  (val, oldval) => {
+    if (val === oldval) return;
+    const vals = val || [];
+    tableData.value = vals;
+  },
+  {
+    immediate: true,
+  }
+);
+</script>

+ 1 - 0
src/views/sop/sop-manage/sop-step/index.vue

@@ -120,6 +120,7 @@
                   v-if="config.visable"
                   :config="config"
                   @change="itemValueChange"
+                  :sop="sop"
                 ></dynamic-form-item>
               </t-col>
             </t-row>

+ 6 - 2
src/views/sop/sop-monitor/delay-warning/flow-dialog.vue

@@ -45,7 +45,7 @@
               </t-col>
               <t-col :span="3">
                 <t-form-item label="节点负责人">
-                  {{ curRow.userName }}
+                  {{ curRow.createName }}
                 </t-form-item>
               </t-col>
               <t-col :span="3">
@@ -55,7 +55,7 @@
               </t-col>
               <t-col :span="3">
                 <t-form-item label="预警字段">
-                  {{ curRow.fieldObj }}
+                  {{ enumFilter(curRow.fieldObj) }}
                 </t-form-item>
               </t-col>
             </t-row>
@@ -167,6 +167,10 @@ const props = defineProps({
     type: String,
     default: 'new',
   },
+  enumFilter: {
+    type: Function,
+    default: () => {},
+  },
 });
 const emit = defineEmits(['update:visible', 'success']);
 

+ 2 - 1
src/views/sop/sop-monitor/delay-warning/index.vue

@@ -87,6 +87,7 @@
       :curRow="curRow"
       :type="viewType"
       @success="fetchData"
+      :enumFilter="enumFilter"
     ></delay-warn-flow-dialog>
   </div>
 </template>
@@ -163,7 +164,7 @@ const columns = [
   { colKey: 'code', title: '预警流水号', width: 200 },
   { colKey: 'warnTime', title: '预警时间', width: 180 },
   { colKey: 'sopNo', title: 'SOP流水号', width: 200 },
-  { colKey: 'userName', title: '节点负责人', width: 140 },
+  { colKey: 'createName', title: '节点负责人', width: 140 },
   { colKey: 'custom', title: '客户名称', width: 140 },
   { colKey: 'crmNo', title: '项目单号', width: 200 },
   { colKey: 'crmName', title: '项目名称', width: 200 },

+ 4 - 3
src/views/sop/sop-monitor/violation-registration/index.vue

@@ -49,8 +49,8 @@
       >
         <template #code="{ col, row }">
           <more-content
-              :content="row[col.colKey]"
-              @action="handleDetail(row)"
+            :content="row[col.colKey]"
+            @action="handleDetail(row)"
           ></more-content>
         </template>
         <template #type="{ col, row }">
@@ -136,6 +136,7 @@ const handleDetail = (row) => {
   showViolationFlowDialog.value = true;
 };
 const handleFollow = (row) => {
+  viewType.value = 'new';
   curRow.value = row;
   showViolationFlowDialog.value = true;
 };
@@ -183,7 +184,7 @@ const columns = [
     title: '违规类型',
     width: 130,
   },
-  { colKey: 'content', title: '违规情况',ellipsis: true, width: 200 },
+  { colKey: 'content', title: '违规情况', ellipsis: true, width: 200 },
   {
     colKey: 'status',
     title: '跟进状态',

+ 11 - 9
src/views/system/config-manage/customer-manage/edit-customer-dialog.vue

@@ -15,7 +15,7 @@
             <t-input v-model="formData.code" clearable />
           </t-form-item>
         </t-col>
-        <t-col :span="12">
+        <t-col :span="6">
           <t-form-item label="客户名称" name="name">
             <t-input v-model="formData.name" clearable />
           </t-form-item>
@@ -32,7 +32,7 @@
             </t-select>
           </t-form-item>
         </t-col>
-        <t-col :span="6">
+        <!-- <t-col :span="6">
           <t-form-item label="客户经理" name="managerId">
             <select-type-user
               v-model="formData.managerId"
@@ -40,7 +40,7 @@
             >
             </select-type-user>
           </t-form-item>
-        </t-col>
+        </t-col> -->
         <t-col :span="6">
           <t-form-item label="服务档位">
             <select-service-level
@@ -62,7 +62,7 @@
             />
           </t-form-item>
         </t-col>
-        <t-col :span="12">
+        <t-col :span="6">
           <t-form-item label="区域" name="province" required-mark>
             <select-area
               v-model="pca"
@@ -121,7 +121,7 @@ const { formData, isEdit } = useClearDialog(
     city: '',
     area: '',
     address: '',
-    managerId: null,
+    // managerId: null,
     levelId: null,
     peoperDay: 1,
     sync: true,
@@ -137,7 +137,9 @@ const { formData, isEdit } = useClearDialog(
 );
 
 const rules = {
-  code: [{ required: true, message: 'ID必填', type: 'error', trigger: 'change' }],
+  code: [
+    { required: true, message: 'ID必填', type: 'error', trigger: 'change' },
+  ],
   name: [
     { required: true, message: '姓名必填', type: 'error', trigger: 'change' },
     {
@@ -182,9 +184,9 @@ const rules = {
       trigger: 'change',
     },
   ],
-  managerId: [
-    { required: true, message: '经理必选', type: 'error', trigger: 'change' },
-  ],
+  // managerId: [
+  //   { required: true, message: '经理必选', type: 'error', trigger: 'change' },
+  // ],
 };
 
 const dialogOpened = () => {