Prechádzať zdrojové kódy

联调详情跳转、新增接口

002390 2 rokov pred
rodič
commit
ca63b20c31

+ 17 - 15
src/api/business/purchase/purchase-order.js

@@ -1,7 +1,7 @@
 import request from "@/utils/request";
 
 // 采购订单修订列表
-const orderList = (data) => {
+const list = (data) => {
   return request({
     url: `/pu/order/list`,
     method: "post",
@@ -10,7 +10,7 @@ const orderList = (data) => {
 }
 
 // 采购订单详情
-const orderDetails = (id, params) => {
+const details = (id, params) => {
   return request({
     url: `/pu/order/${id}`,
     method: "get",
@@ -19,26 +19,28 @@ const orderDetails = (id, params) => {
 }
 
 // 采购订单修订创建
-const orderCreate = (data) => {
+const create = (data) => {
   return request({
-    url: `/pu/order/create`,
+    url: `/pu/order`,
     method: "post",
     data,
   });
 }
 
-// // 参照查询
-// const referQuery = (data) => {
-//   return request({
-//     url: `/refer/query`,
-//     method: "post",
-//     data,
-//   });
-// }
+// 采购订单编辑
+const edit = (data) => {
+  return request({
+    url: `/pu/order/item`,
+    method: "put",
+    data,
+  });
+}
+
 
 export default {
-  orderList,
-  orderDetails,
-  orderCreate,
+  list,
+  details,
+  create,
+  edit,
 
 }

+ 21 - 0
src/views/input-dialog/components/BALATYPE_PARAM.js

@@ -0,0 +1,21 @@
+// 结算方式
+export default [
+  {
+    key: "id",
+    title: "结算方式ID",
+    type: "Input",
+    search: true,
+  },
+  {
+    key: "code",
+    title: "编码",
+    type: "Input",
+    search: true,
+  },
+  {
+    key: "name",
+    title: "结算方式",
+    type: "Input",
+    search: true,
+  },
+];

+ 22 - 11
src/views/purchase/purchase-order/add/column.js

@@ -55,7 +55,18 @@ export const Columns = [
       },
     },
   },
-  { key: "finalType", title: "结算方式", type: "Input", },
+  {
+    key: "finalTypeName",
+    title: "结算方式",
+    type: "InputDialog",
+    config: {
+      componentName: "BALATYPE_PARAM",
+      dataMapping: {
+        finalType: "code",
+        finalTypeName: "name",
+      },
+    },
+  },
   {
     key: "currencyName",
     title: "币种",
@@ -124,16 +135,16 @@ export const Columns = [
   { key: "money", title: "价税合计", type: "Input", },
   { key: "originalMoney", title: "原始总金额", type: "Input", },
   { key: "notaxMoney", title: "无税金额", type: "Input", },
-  { 
+  {
     key: "status",
-     title: "单据状态",
-      type: "Select",
-      require: true,
-      config: {
-        optionsName: "sys_status", // 字典名
-      },
-      
-     },
+    title: "单据状态",
+    type: "Select",
+    require: true,
+    config: {
+      optionsName: "sys_status", // 字典名
+    },
+
+  },
   { key: "freezeCause", title: "冻结原因", type: "Checkbox", },
   { key: "isBack", title: "退货", type: "Input", type: "Checkbox", },
   { key: "isMarketing", title: "已协同生成销售订单", type: "Checkbox", },
@@ -211,7 +222,7 @@ export const Columns = [
   //   type: "Input",
   //   // type: "InputDialog",
   // },
-  { key: "supplierPersonalName", title: "供应商业务员名称",  type: "Input",},
+  { key: "supplierPersonalName", title: "供应商业务员名称", type: "Input", },
   { key: "isDeliver", title: "是否发货", type: "Input", },
   {
     key: "retReason",

+ 19 - 9
src/views/purchase/purchase-order/add/index.vue

@@ -3,13 +3,6 @@ import orderApi from "@/api/business/purchase/purchase-order";
 import { arr2obj } from "@/utils/data-transform";
 import { initColumns, initDicts, initRules, initParams } from "@/utils/init";
 import { Columns, TabColumns } from "./column";
-// import {
-//   initDicts,
-//   initRules,
-//   initParams,
-//   initComponents,
-// } from "@/utils/init";
-// import { initColumns, initTabColumns } from "./column";
 
 const NewColumns = initColumns(Columns);
 const NewTabColumns = TabColumns.map((element) => ({
@@ -77,8 +70,25 @@ export default {
       this.params = initParams(this.columns, "key", "value");
     },
     // 保存
-    handleSava() {
-      this.setVisible(false);
+    async handleSava() {
+      // this.setVisible(false);
+      console.log(this.params, 'params');
+      try {
+        const { code, msg } = await orderApi.create(this.params);
+        if (code === 200) {
+          this.$notify.success({ title: msg });
+          this.setVisible(false);
+        } else {
+          this.$notify.warning({ title: msg });
+        }
+      } catch (err) {
+        this.$notify.error({ title: "error", message: err });
+      } finally {
+        // this.setVisible(false);
+      }
+
+
+
     },
     // 保存并新增
     async handleSubmit() {

+ 2 - 6
src/views/purchase/purchase-order/edit/index.vue

@@ -1,10 +1,6 @@
 <script>
 import { Columns, TabColumns } from "../add/column";
-import {
-  edit,
-  item,
-  itemTableList,
-} from "@/api/business/purchase/purchase-contract";
+import orderApi from "@/api/business/purchase/purchase-order";
 import { initColumns, initDicts, initRules, initParams } from "@/utils/init";
 
 const NewColumns = initColumns(Columns);
@@ -60,7 +56,7 @@ export default {
     async fetchItem(prop) {
       try {
         this.loading = true;
-        const { code, msg, data } = await item(prop);
+        const { code, msg, data } = await orderApi.details(prop);
         if (code === 200) {
           this.params = data;
           this.$notify.success({ title: msg });

+ 75 - 39
src/views/purchase/purchase-order/index.vue

@@ -130,12 +130,12 @@ export default {
         first: [],
         second: [],
       },
-      detailsData: {}
+      checkedData: {}
     };
   },
   computed: {
     showSearchColumns() {
-      console.log(this.searchColumns,'this.searchColumns');
+      console.log(this.searchColumns, 'this.searchColumns');
       return this.isSimpleSearch
         ? this.searchColumns.slice(0, 4)
         : this.searchColumns;
@@ -150,16 +150,18 @@ export default {
   //     },
   //   },
   created() {
-    this.fetchTaskList();
+    this.fetchList(this.params, this.page);
     console.log("Vue", this);
   },
   methods: {
-    async fetchTaskList() {
-      this.loading = true;
+    async fetchList(params, page) {
       try {
-        const { code, msg, rows, total } = await orderApi.orderList({
-          ...this.page,
-          ...this.searchParams,
+        this.loading = true;
+        const { pageNum, pageSize } = page;
+        const { code, msg, rows, total } = await orderApi.list({
+          pageNum,
+          pageSize,
+          ...params,
         });
         if (code === 200) {
           this.page.total = total;
@@ -180,38 +182,57 @@ export default {
         title: this.isSimpleSearch ? "Simple Search" : "All Search",
       });
     },
-    handleSizeChange() { },
-    handleCurrentChange() { },
+    // 页大小变
+    handleSizeChange(prop) {
+      this.page.pageSize = prop;
+      this.fetchList(this.params, this.page);
+    },
+    // 当前页变
+    handleCurrentChange(prop) {
+      this.page.pageNum = prop;
+      this.fetchList(this.params, this.page);
+    },
+    // 刷新操作
+    handleRefreshList() {
+      this.fetchList(this.params, this.page);
+    },
+    // 查询操作
+    handleQueryList() {
+      this.fetchList(this.params, this.page);
+    },
+    // 重置操作
+    handleResetList() {
+      this.page = initPage();
+      this.params = initParams();
+      this.fetchList(this.params, this.page);
+    },
     handleTabClick() { },
+    // 新增
     handleOpenAddDrawer() {
       const { setVisible } = this.$refs.addDrawerFef;
       setVisible(true);
-      setTimeout(() => {
-        this.$notify.info("Open Add Drawer");
-      }, 250);
     },
-    handleOpenSeeDrawer() {
-      const { setVisible ,setParams} = this.$refs.seeDrawerFef;
-      setVisible(true);
-      setTimeout(() => {
-        setParams( this.detailsData)
-        this.$notify.info("Open See Drawer");
-      }, 250);
+    // 查看
+    async handleOpenSeeDrawer(row) {
+      const { id } = row;
+      const { setVisible, fetchItem } = this.$refs.seeDrawerFef;
+      await setVisible(true);
+      await fetchItem(id);
     },
-    handleOpenEditDrawer() {
-      const { setVisible } = this.$refs.editDrawerFef;
-      setVisible(true);
-      setTimeout(() => {
-        this.$notify.info("Open Edit Drawer");
-      }, 250);
+    // 编辑、修订
+    async handleOpenEditDrawer(row) {
+      const { id } = row;
+      const { setVisible, fetchItem } = this.$refs.editDrawerFef;
+      await setVisible(true);
+      await fetchItem(id);
     },
     // 获取子表信息
     async handleDetailsData(row) {
       console.log(row, '获取详情信息');
       try {
-        const { code, msg, data } = await orderApi.orderDetails(row.id);
+        const { code, msg, data } = await orderApi.details(row.id);
         if (code === 200) {
-          this.detailsData = data;
+          this.checkedData = data;
           // 物料信息:puOrderItemList   执行结果:puOrderExecuteList
           this.tabTableDatas.first = data.puOrderItemList;
           this.tabTableDatas.second = data.puOrderExecuteList;
@@ -225,12 +246,26 @@ export default {
         // this.loading = false;
       }
     },
-    // 重置操作
-    handleResetList() {
-      this.page = initPage();
-      this.params = initParams();
-      this.fetchList(this.params, this.page);
+    // 删除操作
+    async handleDeleteList(prop) {
+      try {
+        this.loading = true;
+        const { id } = prop;
+        console.log(id, 'id');
+        // const { code, msg } = await remove(id);
+        // if (code === 200) {
+        //   this.$notify.success({ title: msg });
+        //   this.fetchList(this.params, this.page);
+        // } else {
+        //   this.$notify.warning({ title: msg });
+        // }
+      } catch (err) {
+        this.$notify.error({ title: "error", message: err });
+      } finally {
+        this.loading = false;
+      }
     },
+
   },
 };
 </script>
@@ -252,8 +287,8 @@ export default {
             </el-col>
           </el-row>
         </el-col>
-        <el-col :span="3" :offset="1" style="text-align: right; padding-right: 40px">
-          <el-button type="primary" size="mini">搜索</el-button>
+        <el-col :span="4" style="text-align: right; padding-right: 40px">
+          <el-button type="primary" size="mini" @click="handleQueryList">搜索</el-button>
           <el-button size="mini" @click="handleResetList">重置</el-button>
         </el-col>
       </el-row>
@@ -275,7 +310,7 @@ export default {
         </el-button-group>
 
         <el-button-group style="margin-left: 10px">
-          <el-button size="mini">修订</el-button>
+          <!-- <el-button size="mini" :disabled="checkedData.status != '2'">修订</el-button> -->
           <el-button size="mini">退回</el-button>
         </el-button-group>
 
@@ -296,9 +331,10 @@ export default {
       </el-table-column>
       <el-table-column fixed="right" label="操作" width="120">
         <template slot-scope="scope">
-          <el-button @click="handleOpenSeeDrawer(scope.row)" type="text" size="small">查看</el-button>
-          <el-button type="text" size="small" @click="handleOpenEditDrawer(scope.row)">编辑</el-button>
-          <el-button type="text" size="small">删除</el-button>
+          <el-button @click.stop="handleOpenSeeDrawer(scope.row)" type="text" size="small">查看</el-button>
+          <el-button type="text" size="small" @click.stop="handleOpenEditDrawer(scope.row)">
+            {{ scope.row.status == '2' ? '修订' : '编辑' }}</el-button>
+          <el-button type="text" size="small" @click.stop="handleDeleteList(scope.row)">删除</el-button>
         </template>
       </el-table-column>
 

+ 7 - 10
src/views/purchase/purchase-order/see/index.vue

@@ -7,6 +7,7 @@ import {
   initParams,
 } from "@/utils/init";
 import { Columns, TabColumns } from "../add/column";
+import orderApi from "@/api/business/purchase/purchase-order";
 
 const NewColumns = initColumns(Columns, { disabled: true, readonly: true });
 const NewTabColumns = TabColumns.map((element) => ({
@@ -40,17 +41,11 @@ export default {
       this.visible = prop;
     },
 
-    setParams(val) {
-      console.log(val, 'val');
-
-      this.params = val;
-
-    },
-    //
+    //查询详情
     async fetchItem(prop) {
       try {
         this.loading = true;
-        const { code, msg, data } = await item(prop);
+        const { code, msg, data } = await orderApi.details(prop);
         if (code === 200) {
           this.params = data;
           this.$notify.success({ title: msg });
@@ -111,7 +106,8 @@ export default {
                   :value="item.value">
                 </el-option>
               </el-select>
-              <el-checkbox v-else-if="column.type === 'Checkbox'" v-model="params[column.key]" true-label="Y" false-label="N"></el-checkbox>
+              <el-checkbox v-else-if="column.type === 'Checkbox'" v-model="params[column.key]" true-label="Y"
+                false-label="N"></el-checkbox>
 
               <el-date-picker v-else-if="column.type === 'DatePicker'" v-model="params[column.key]"
                 :type="column.config.type" :placeholder="column.placeholder" :clearable="column.clearable"
@@ -165,7 +161,8 @@ export default {
                       <el-icon class="el-icon-thumb"></el-icon>
                     </template>
                   </el-input>
-                  <el-checkbox v-else-if="column.type === 'Checkbox'" v-model="params[column.key]" true-label="Y" false-label="N"></el-checkbox>
+                  <el-checkbox v-else-if="column.type === 'Checkbox'" v-model="params[column.key]" true-label="Y"
+                    false-label="N"></el-checkbox>
                 </template>
               </el-table-column>
               <!-- <el-table-column fixed="right" label="操作" width="120">

+ 2 - 2
vue.config.js

@@ -37,12 +37,12 @@ module.exports = {
       // detail: https://cli.vuejs.org/config/#devserver-proxy
       [process.env.VUE_APP_BASE_API]: {
         // target: `http://172.16.100.107:8080/drp-admin`, //测试
-        target: `http://test-sy.derom.com/drp-admin`, //测试
+        // target: `http://test-sy.derom.com/drp-admin`, //测试
         // target: `http://release-sy.derom.com/drp-admin`, //预发
         // target: `http://sy.derom.com/drp-admin`, //生产
         // target: `http://172.16.63.202:8000/drp-admin`, // D本地
         // target: `http://172.16.62.241:8000/drp-admin`, //笑寒本地
-        // target: `http://172.16.13.152:8000/drp-admin`, //豪哥本地
+        target: `http://172.16.13.152:8000/drp-admin`, //豪哥本地
         // target: `http://172.16.13.47:8000/drp-admin`, //石杨本地
         // target: `http://172.16.13.113:8000/drp-admin`, //DWT本地
         // target: `http://172.16.13.77:8000/drp-admin`, //TQ本地