Bläddra i källkod

feat: indent sku/供应商 增加审核人相关逻辑.

peter 3 veckor sedan
förälder
incheckning
c52efdec52

+ 12 - 0
src/api/user.js

@@ -43,4 +43,16 @@ export default {
       method: 'POST',
       data: params,
     }),
+  getAuditUser: (p) =>
+    request({
+      url: `/indent_checkusers/getList`,
+      method: 'GET',
+      params: p,
+    }),
+  setAuditUser: (p) =>
+    request({
+      url: `/indent_checkusers/addcheckuser`,
+      method: 'POST',
+      data: p,
+    }),
 }

+ 34 - 2
src/pages/indent-manage/indent/components/info.vue

@@ -1031,6 +1031,7 @@ import {
   ElNotification,
   ElMessage,
   ElIcon,
+  ElMessageBox,
 } from 'element-plus'
 import { CirclePlus, Close, CircleCloseFilled } from '@element-plus/icons-vue'
 import debounce from 'lodash.debounce'
@@ -1039,6 +1040,7 @@ import { $t } from '@/i18n/index'
 import imageUpload from '@/components/ImageUpload.vue'
 // 用来对oss的图片、视频等媒体数据的url进行匹配替换
 import { getVendorList, createQuote } from '@/api/indent'
+import userAPI from '@/api/user'
 
 defineComponent({
   name: 'EditInfo',
@@ -1329,6 +1331,22 @@ const changeVenderSelect = function (value: string | number, index: number) {
     }
   }
 }
+const auditUser = ref('')
+const getCurrentAuditUser = () => {
+  userAPI.getAuditUser().then((res: any) => {
+    // console.log(res, 'res')
+    if (
+      res.code === 1 &&
+      Array.isArray(res.result.data) &&
+      res.result.data.length
+    ) {
+      const temp = res.result.data.filter((i: any) => i.type === 1)
+      // console.log(temp, 'temp')
+      if (temp.length) auditUser.value = temp[0].email
+    }
+  })
+}
+getCurrentAuditUser()
 const createQuoteFunc = function () {
   const params = {
     file: '', // 疑似永远为空
@@ -1336,7 +1354,7 @@ const createQuoteFunc = function () {
   if (parentId) {
     params.parent_id = parentId
   }
-
+  let notiList: string[] = []
   let temp = cloneDeep(forms.value)
   temp = temp.map((item, index) => {
     const result = { ...item }
@@ -1361,12 +1379,26 @@ const createQuoteFunc = function () {
         return i.url.replace($mediaRegExp, '/')
       })
       .join(',')
+    if (result.vendor_id && result.vendor_name === result.vendor_id) {
+      notiList.push(result.vendor_name)
+    }
     return result
   })
 
   //  组装接口数据
   Object.assign(params, { lists: temp })
-
+  if (notiList.length) {
+    ElMessageBox.alert(
+      '您正在提交系统外供应商 ' +
+        notiList.map((i) => `[${i}]`).join(', ') +
+        '<br>本次操作已触发审核流程,审核人将会尽快处理,如有问题请联系:' +
+        `<a href="mailto:${auditUser.value}">${auditUser.value}</a>`,
+      '提示',
+      {
+        dangerouslyUseHTMLString: true,
+      },
+    )
+  }
   createQuote(params).then((response: any) => {
     if (response.code !== 1) return
 

+ 83 - 1
src/pages/indent-manage/product/list.vue

@@ -52,7 +52,7 @@
       </div>
     </el-form>
 
-    <div class="mb-2">
+    <div class="mb-2 flex justify-between">
       <el-button
         size="small"
         type="primary"
@@ -60,6 +60,37 @@
       >
         {{ $t('btn_add') }}
       </el-button>
+      <el-form inline>
+        <el-form-item label="审核人:">
+          <el-select
+            v-model="auditUser"
+            :loading="setAuditUserLoading"
+            class="min-w-[200px]"
+            filterable
+            placeholder="可搜索"
+            size="small"
+          >
+            <el-option
+              v-for="user in userList"
+              :key="user.id"
+              :value="user.id"
+              :label="`${user.name} (${user.username})`"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item>
+          <el-tooltip content="保存审核人">
+            <el-button
+              type="primary"
+              size="small"
+              :loading="setAuditUserLoading"
+              @click="setAuditUser"
+            >
+              保存
+            </el-button>
+          </el-tooltip>
+        </el-form-item>
+      </el-form>
     </div>
 
     <el-table
@@ -203,6 +234,8 @@ import {
   ElPagination,
   ElCascader,
   ElDialog,
+  ElTooltip,
+  ElMessage,
 } from 'element-plus'
 import compEdit from './components/edit.vue'
 import compRecord from './components/record.vue'
@@ -210,6 +243,8 @@ import compExamine from './components/examine.vue'
 import { $t } from '@/i18n/index'
 import { getProductList, deleteProduct } from '@/api/product.js'
 import { getCategoryTree } from '@/api/indent.js'
+import userAPI from '@/api/user'
+
 defineComponent({
   name: 'ComponentIndentProductList',
 })
@@ -404,6 +439,53 @@ const imgClick = (url: string) => {
 watch(bigImageVisible, () => {
   if (!bigImageVisible.value) currentBigImage.value = ''
 })
+const userList = ref([] as any[])
+const getUserListFunc = () => {
+  userAPI
+    .getUserList({
+      page: 1,
+      limit: 200,
+    })
+    .then((res: any) => {
+      if (res.code !== 1) {
+        return
+      }
+      userList.value =
+        res.result.data
+          .filter((i: any) => i.status === 1)
+          .sort((a: any, b: any) => a.name.localeCompare(b.name)) || []
+    })
+}
+getUserListFunc()
+const auditUser = ref('')
+const getCurrentAuditUser = () => {
+  userAPI.getAuditUser().then((res: any) => {
+    console.log(res, 'res')
+    if (
+      res.code === 1 &&
+      Array.isArray(res.result.data) &&
+      res.result.data.length
+    ) {
+      const temp = res.result.data.filter((i: any) => i.type === 2)
+      console.log(temp, 'temp')
+      if (temp.length) auditUser.value = temp[0].check_id
+    }
+  })
+}
+getCurrentAuditUser()
+const setAuditUserLoading = ref(false)
+const setAuditUser = () => {
+  setAuditUserLoading.value = true
+  userAPI
+    .setAuditUser({ check_id: auditUser.value, type: 2 })
+    .then((res: any) => {
+      console.log(res, 'res')
+      if (res.code === 1) {
+        ElMessage.success('设置成功')
+      }
+    })
+    .finally(() => (setAuditUserLoading.value = false))
+}
 </script>
 
 <style lang="scss" scoped>

+ 82 - 1
src/pages/indent-manage/supplier/list.vue

@@ -60,7 +60,7 @@
       </div>
     </el-form>
 
-    <div class="mb-2">
+    <div class="mb-2 flex justify-between">
       <el-button
         size="small"
         type="primary"
@@ -68,6 +68,37 @@
       >
         {{ $t('btn_add') }}
       </el-button>
+      <el-form inline>
+        <el-form-item label="审核人:">
+          <el-select
+            v-model="auditUser"
+            class="min-w-[200px]"
+            filterable
+            :loading="setAuditUserLoading"
+            placeholder="可搜索"
+            size="small"
+          >
+            <el-option
+              v-for="user in userList"
+              :key="user.id"
+              :value="user.id"
+              :label="`${user.name} (${user.username})`"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item>
+          <el-tooltip content="保存审核人">
+            <el-button
+              type="primary"
+              size="small"
+              :loading="setAuditUserLoading"
+              @click="setAuditUser"
+            >
+              保存
+            </el-button>
+          </el-tooltip>
+        </el-form-item>
+      </el-form>
     </div>
 
     <el-table
@@ -205,11 +236,14 @@ import {
   ElNotification,
   ElPagination,
   ElDialog,
+  ElTooltip,
+  ElMessage,
 } from 'element-plus'
 import compEdit from './components/edit.vue'
 import compRecord from './components/record.vue'
 import { $t } from '@/i18n/index'
 import { getSupplierList, deleteSupplier } from '@/api/supplier.js'
+import userAPI from '@/api/user'
 
 defineComponent({
   name: 'ComponentIndentSupplierList',
@@ -396,6 +430,53 @@ const imgClick = (url: string) => {
 watch(bigImageVisible, () => {
   if (!bigImageVisible.value) currentBigImage.value = ''
 })
+
+const userList = ref([] as any[])
+const getUserListFunc = () => {
+  userAPI
+    .getUserList({
+      page: 1,
+      limit: 200,
+    })
+    .then((res: any) => {
+      if (res.code !== 1) {
+        return
+      }
+      userList.value =
+        res.result.data
+          .filter((i: any) => i.status === 1)
+          .sort((a: any, b: any) => a.name.localeCompare(b.name)) || []
+    })
+}
+getUserListFunc()
+const auditUser = ref('')
+const getCurrentAuditUser = () => {
+  userAPI.getAuditUser().then((res: any) => {
+    console.log(res, 'res')
+    if (
+      res.code === 1 &&
+      Array.isArray(res.result.data) &&
+      res.result.data.length
+    ) {
+      const temp = res.result.data.filter((i: any) => i.type === 1)
+      if (temp.length) auditUser.value = temp[0].check_id
+    }
+  })
+}
+getCurrentAuditUser()
+const setAuditUserLoading = ref(false)
+const setAuditUser = () => {
+  setAuditUserLoading.value = true
+  userAPI
+    .setAuditUser({ check_id: auditUser.value, type: 1 })
+    .then((res: any) => {
+      console.log(res, 'res')
+      if (res.code === 1) {
+        ElMessage.success('设置成功')
+      }
+    })
+    .finally(() => (setAuditUserLoading.value = false))
+}
 </script>
 
 <style lang="scss" scoped>

+ 1 - 1
src/pages/indent-manage/user/index.vue

@@ -2,7 +2,7 @@
   <div
     class="page-indent-user-index max-w-[1600px] min-h-[100vh] mx-auto px-4 pt-2"
   >
-    <div class="text-xl mb-2 text-gray-6">用户管理</div>
+    <div class="text-xl mb-2 text-gray-500">用户管理</div>
     <div class="flex">
       <el-form
         v-model="form"