lipenghui преди 5 месеца
родител
ревизия
a0769a5429

+ 3 - 0
src/api/supplier/base/index.ts

@@ -158,5 +158,8 @@ export const Api = {
 
   getAll: async () =>{
     return await request.get({ url: `/supplier/base/all` })
+  },
+  changeStatus: async (id: number, status: number) => {
+    return await request.post({ url: `/supplier/base/status/`+id+`/`+status })
   }
 }

+ 11 - 0
src/hooks/web/useMessage.ts

@@ -71,6 +71,17 @@ export const useMessage = () => {
         }
       )
     },
+    delClose(content?: string, tip?: string) {
+      return ElMessageBox.confirm(
+        content ? content : t('common.delMessage'),
+        tip ? tip : t('common.confirmTitle'),
+        {
+          confirmButtonText: t('common.ok'),
+          cancelButtonText: t('common.cancel'),
+          type: 'warning'
+        }
+      )
+    },
     // 导出窗体
     exportConfirm(content?: string, tip?: string) {
       return ElMessageBox.confirm(

+ 8 - 6
src/views/supplier/base/form/SupplierInfoForm.vue

@@ -271,12 +271,14 @@ const submitForm = async () => {
     const data = formData as unknown as SupplierVO
     if (!supplierid.id){
       await Api.create(data).then(res => {
-        const param = {id: res}
-        emit('sendParam', param);
-        message.success(t('common.createSuccess'))
-      }).catch(()=>{
-        debugger
-        message.error(t('common.createFail'))
+        debugger;
+        if (res.code ===0) {
+          const param = {id: res}
+          emit('sendParam', param);
+          message.success(t('common.createSuccess'))
+        } else {
+          message.error(res.msg)
+        }
       })
     } else {
       await Api.update(data)

+ 96 - 19
src/views/supplier/base/index.vue

@@ -80,7 +80,7 @@
           class="!w-240px"
         />
       </el-form-item>
-      <el-form-item label="状态:" prop="status">
+      <el-form-item label="状态" prop="status">
         <el-select
           v-model="queryParams.status"
           placeholder="状态"
@@ -170,24 +170,69 @@
       />
       <el-table-column label="操作" align="center" min-width="120px">
         <template #default="scope">
-          <el-button link type="primary" @click="openDetail(scope.row.id)"> 详情 </el-button>
-          <el-button
-            link
-            type="primary"
-            @click="openForm('update', scope.row.id)"
+          <div class="flex items-center justify-center">
+          <el-button link type="primary" @click="openDetail(scope.row.id)"><Icon icon="ep:view" />详情 </el-button>
+          <el-dropdown
+            @command="(command) => handleCommand(command, scope.row)"
+            v-hasPermi="[
+                    'system:user:delete',
+                    'system:user:update-password',
+                    'system:permission:assign-user-role'
+                  ]"
           >
-            编辑
-          </el-button>
-          <el-button
-            v-if="scope.row.auditStatus === 0"
-            link type="primary" @click="handleSubmit(scope.row)"> 提交审核 </el-button>
-          <el-button
-            link
-            type="danger"
-            @click="handleDelete(scope.row.id)"
-          >
-            删除
-          </el-button>
+            <el-button type="primary" link><Icon icon="ep:d-arrow-right" /> 更多</el-button>
+            <template #dropdown>
+              <el-dropdown-menu>
+                <el-dropdown-item
+                  command="handleUpdate"
+                >
+                  <Icon icon="ep:edit" />编辑
+                </el-dropdown-item>
+                <el-dropdown-item
+                  command="handleDelete"
+                >
+                  <Icon icon="ep:delete" />删除
+                </el-dropdown-item>
+                <el-dropdown-item
+                  v-if="scope.row.status === 0"
+                  command="handleSubmit"
+                >
+                  <Icon icon="ep:circle-check" />提交审核
+                </el-dropdown-item>
+                <el-dropdown-item
+                  v-if="scope.row.status != 3"
+                  command="handleClose"
+                >
+                  <Icon icon="ep:close" />关闭
+                </el-dropdown-item>
+              </el-dropdown-menu>
+            </template>
+          </el-dropdown>
+          </div>
+<!--          <el-button-->
+<!--            link-->
+<!--            type="primary"-->
+<!--            @click="openForm('update', scope.row.id)"-->
+<!--          >-->
+<!--            编辑-->
+<!--          </el-button>-->
+<!--          <el-button-->
+<!--            v-if="scope.row.auditStatus === 0"-->
+<!--            link type="primary" @click="handleSubmit(scope.row)"> 提交审核 </el-button>-->
+<!--          <el-button-->
+<!--            link-->
+<!--            type="danger"-->
+<!--            @click="handleDelete(scope.row.id)"-->
+<!--          >-->
+<!--            删除-->
+<!--          </el-button>-->
+<!--          <el-button-->
+<!--            link-->
+<!--            type="danger"-->
+<!--            @click="handleClose(scope.row.id)"-->
+<!--          >-->
+<!--            关闭-->
+<!--          </el-button>-->
         </template>
       </el-table-column>
     </el-table>
@@ -213,6 +258,9 @@ import {DICT_TYPE, getIntDictOptions} from "@/utils/dict";
 import { useRoute, useRouter } from 'vue-router'
 import { watch } from 'vue'
 import * as ContractApi from "@/api/crm/contract";
+import {checkPermi} from "@/utils/permission";
+import * as UserApi from "@/api/system/user";
+import {SupplierApi} from "@/api/erp/purchase/supplier";
 
 const route = useRoute()
 const router = useRouter() // 路由对象
@@ -251,6 +299,24 @@ const queryParams = reactive({
 })
 const queryFormRef = ref() // 搜索的表单
 const exportLoading = ref(false) // 导出的加载中
+const handleCommand = (command: string, row: SupplierVO) => {
+  switch (command) {
+    case 'handleDelete':
+      handleDelete(row.id)
+      break
+    case 'handleUpdate':
+      openForm('update', row.id)
+      break
+    case 'handleSubmit':
+      handleSubmit(row)
+      break
+    case 'handleClose':
+      handleClose(row.id)
+      break
+    default:
+      break
+  }
+}
 /** 查看供应商详情 */
 const openDetail = (id: number) => {
   push({ name: 'SupplierDetailInfo', params: { id } })
@@ -302,7 +368,18 @@ const handleDelete = async (id: number) => {
     await getList()
   } catch {}
 }
-
+/** 供应商关闭按钮操作 */
+const handleClose = async (id: number) => {
+  try {
+    // 关闭的二次确认
+    await message.confirm(`您确定关闭该供应商吗?`)
+    // 发起删除
+    await Api.changeStatus(id, 3)
+    message.success(t('关闭成功'))
+    // 刷新列表
+    await getList()
+  } catch {}
+}
 /** 提交审核按钮操作 */
 const handleSubmit = async (row: SupplierVO) => {
   try {

+ 1 - 1
src/views/supplier/certificate/CertificateForm.vue

@@ -94,7 +94,7 @@ const submitForm = async () => {
     const data = formData.value as unknown as CertificateVO
     // const supplier = data.supplierId
     if (!props.supplierId.receivedParam){
-      message.error("请先保存供应商");
+      message.error("请先保存供应商基本信息");
       return
     }
     data.supplierId = props.supplierId.receivedParam

+ 1 - 1
src/views/supplier/connect/ConnectRecordForm.vue

@@ -107,7 +107,7 @@ const submitForm = async () => {
   try {
     const data = formData.value as unknown as ConnectRecordVO
     if (!props.supplierId.receivedParam){
-      message.error("请先保存供应商");
+      message.error("请先保存供应商基本信息");
       return
     }
     data.supplierId = props.supplierId.receivedParam

+ 1 - 1
src/views/supplier/contact/ContactForm.vue

@@ -122,7 +122,7 @@ const submitForm = async () => {
   try {
     const data = formData.value as unknown as ContactVO
     if (!props.supplierId.receivedParam){
-      message.error("请先保存供应商");
+      message.error("请先保存供应商基本信息");
       return
     }
     data.supplierId = props.supplierId.receivedParam

+ 1 - 1
src/views/supplier/coreproduct/CoreProductForm.vue

@@ -105,7 +105,7 @@ const submitForm = async () => {
   try {
     const data = formData.value as unknown as CoreProductVO
     if (!props.supplierId.receivedParam){
-      message.error("请先保存供应商");
+      message.error("请先保存供应商基本信息");
       return
     }
     data.supplierId = props.supplierId.receivedParam