002201 2 سال پیش
والد
کامیت
d1b7e52517

+ 20 - 2
src/api/business/purchase/task.js

@@ -1,7 +1,7 @@
 import request from "@/utils/request";
 
 // 查询任务列表
-export function list(data) {
+export function LIST(data) {
   return request({
     url: "/pu/order/generate/list",
     method: "POST",
@@ -18,10 +18,28 @@ export function item(data) {
 }
 
 // 查询任务列表
-export function FirstDirect(data) {
+export function FIRSTDIRECT(data) {
   return request({
     url: "/pu/order/generate/manualAgreement",
     method: "POST",
     data: data,
   });
 }
+
+// 查询任务列表
+export function ADD(data) {
+  return request({
+    url: "/pu/order/create",
+    method: "POST",
+    data: data,
+  });
+}
+
+// 查询任务列表
+export function SHUTDOWN(data) {
+  return request({
+    url: `/pu/demand/item/summary/shutDown/${data}`,
+    method: "PUT",
+    data: data,
+  });
+}

+ 1 - 0
src/components/input-dialog/components/index.vue

@@ -54,6 +54,7 @@ export default {
             ...prop,
             ...queryParams,
           },
+          
           { pageNum, pageSize }
         );
         if (code === 200) {

+ 0 - 11
src/utils/init/page.js

@@ -1,11 +0,0 @@
-const pageSizes = [25, 50, 100];
-
-const layout = "total, prev, pager, next, sizes, jumper";
-
-const page = { pageNum: 1, pageSize: 25, total: 0 };
-
-export const initPageSizes = () => pageSizes;
-
-export const initLayout = () => layout;
-
-export const initPage = () => page;

+ 23 - 10
src/views/purchase/task/column.js

@@ -1,18 +1,26 @@
 export const TableColumns = [
   { key: "id", title: "主键" },
-  { key: "material", title: "物料", search: true },
-  { key: "materialName", title: "物料名称", search: true },
-  { key: "status", title: "状态", search: true },
-  { key: "materialDesc", title: "物料/物料描述", search: true },
+  { key: "material", title: "物料", search: true, type: "Input" },
+  { key: "materialName", title: "物料名称", search: true, type: "Input" },
+  {
+    key: "status",
+    title: "状态",
+    search: true,
+    type: "Select",
+    config: {
+      optionsName: "purchase_task_status",
+    },
+  },
+  { key: "materialDesc", title: "物料/物料描述", search: true, type: "Input" },
   { key: "manufacturer", title: "生产厂家" },
   { key: "manufacturerName", title: "生产厂家名称" },
   { key: "priceType", title: "价格类型" },
   { key: "buyer", title: "采购员" },
-  { key: "buyerName", title: "采购员名称", search: true },
+  { key: "buyerName", title: "采购员名称", search: true, type: "Input" },
   { key: "supplier", title: "建议供应商" },
   { key: "supplierName", title: "建议供应商名称" },
   { key: "puOrg", title: "采购组织" },
-  { key: "puOrgName", title: "采购组织名称", search: true },
+  { key: "puOrgName", title: "采购组织名称", search: true, type: "Input" },
   { key: "currency", title: "币种" },
   { key: "currencyName", title: "币种名称" },
   { key: "billYpe", title: "交易类型" },
@@ -22,14 +30,19 @@ export const TableColumns = [
   { key: "puUnit", title: "采购单位" },
   { key: "puUnitName", title: "采购单位名称" },
   { key: "puQty", title: "采购数量" },
-  { key: "demandDate", title: "需求时间", search: true },
+  { key: "demandDate", title: "需求时间", search: true, type: "Input" },
   { key: "projectName", title: "项目名称" },
   { key: "demandPersonal", title: "需求人" },
-  { key: "demandPersonalName", title: "需求人名称", search: true },
-  { key: "demandOrg", title: "需求组织", search: true },
+  {
+    key: "demandPersonalName",
+    title: "需求人名称",
+    search: true,
+    type: "Input",
+  },
+  { key: "demandOrg", title: "需求组织", search: true, type: "Input" },
   { key: "demandOrgName", title: "需求组织名称" },
   { key: "demandDept", title: "需求部门" },
-  { key: "demandDeptName", title: "需求部门名称", search: true },
+  { key: "demandDeptName", title: "需求部门名称", search: true, type: "Input" },
   { key: "isBack", title: "是否退回" },
   { key: "baskCause", title: "退回原因" },
   { key: "backDate", title: "退回日期" },

+ 169 - 30
src/views/purchase/task/first-direct/index.vue

@@ -1,6 +1,6 @@
 <script>
 import { TableColumns } from "./column";
-import { FirstDirect } from "@/api/business/purchase/task";
+import { FIRSTDIRECT, ADD } from "@/api/business/purchase/task";
 import { initColumns } from "@/utils/init";
 export default {
   name: "FirstDirectPurchaseDrawer",
@@ -28,7 +28,7 @@ export default {
     async fetchItem(prop) {
       try {
         this.loading = true;
-        const { code, msg, data } = await FirstDirect(prop);
+        const { code, msg, data } = await FIRSTDIRECT(prop);
         if (code === 200) {
           this.data = data;
           this.$notify.success({ title: msg });
@@ -45,8 +45,34 @@ export default {
     handleCancel() {
       this.setVisible(false);
     },
+    // 保存并新增
+    async handleSubmit() {
+      const params = this.data
+        .map((item) => ({
+          ...item,
+          orderPriceVos: item.orderPriceVos.filter(
+            (citem) => citem.purchaseQuantity
+          ),
+        }))
+        .filter((item) => item.orderPriceVos.length);
+      try {
+        const { code, msg } = await ADD(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);
+      }
+    },
+  },
+  created() {
+    console.log("initColumns(TableColumns)", initColumns(TableColumns));
   },
-  created() {},
   mounted() {},
   destroyed() {},
 };
@@ -78,6 +104,9 @@ export default {
         <h3>首次协议直采</h3>
         <div style="text-align: right">
           <el-button :size="size" @click="handleCancel">取 消</el-button>
+          <el-button :size="size" type="info" @click="handleSubmit">
+            新 增
+          </el-button>
         </div>
       </div>
       <div
@@ -107,46 +136,156 @@ export default {
           style="width: 100%"
         >
           <el-table-column
-            v-for="(column, index) in tableColumns"
-            :key="index"
-            :prop="column.key"
-            :label="column.title"
-            :width="column.width || 180"
-            :show-overflow-tooltip="column.showOverflowTooltip || true"
+            prop="supplier"
+            label="供应商"
+            width="125"
+            show-overflow-tooltip
+          ></el-table-column>
+          <el-table-column
+            prop="supplierName"
+            label="供应商名称"
+            width="125"
+            show-overflow-tooltip
+          ></el-table-column>
+          <el-table-column
+            prop="puOrg"
+            label="采购组织"
+            width="125"
+            show-overflow-tooltip
+          ></el-table-column>
+          <el-table-column
+            prop="puOrgName"
+            label="采购组织名称"
+            width="150"
+            show-overflow-tooltip
+          ></el-table-column>
+          <el-table-column
+            prop="customer"
+            label="客户"
+            show-overflow-tooltip
+          ></el-table-column>
+          <el-table-column
+            prop="customerName"
+            label="客户名称"
+            show-overflow-tooltip
+          ></el-table-column>
+          <el-table-column
+            prop="priceType"
+            label="价格类型"
+            show-overflow-tooltip
+          ></el-table-column>
+          <el-table-column
+            prop="isDistribution"
+            label="配送价"
+            show-overflow-tooltip
+          ></el-table-column>
+          <el-table-column
+            prop="effectiveDate"
+            label="价格生效日期"
+            width="150"
+            show-overflow-tooltip
+          ></el-table-column>
+          <el-table-column
+            prop="endDate"
+            label="价格失效日期"
+            width="150"
+            show-overflow-tooltip
+          ></el-table-column>
+          <el-table-column
+            prop="tax"
+            label="税率"
+            show-overflow-tooltip
+          ></el-table-column>
+          <el-table-column
+            prop="taxFreePrice"
+            label="无税单价"
+            show-overflow-tooltip
+          ></el-table-column>
+          <el-table-column
+            prop="taxPrice"
+            label="主含税单价"
+            width="125"
+            show-overflow-tooltip
+          ></el-table-column>
+          <el-table-column
+            prop="purchaseQuantity"
+            label="本次采购数量"
+            width="175"
+          >
+            <template slot-scope="scope">
+              <el-input-number
+                v-model="scope.row.purchaseQuantity"
+                :min="0"
+                :max="item.puQty - (item.executeQty || 0)"
+                size="mini"
+                controls-position="right"
+                style="width: 100%"
+              ></el-input-number>
+            </template>
+          </el-table-column>
+          <el-table-column
+            prop="arrivalDatePlan"
+            label="计划到货日期"
+            width="175"
+          >
+            <template slot-scope="scope">
+              <el-date-picker
+                v-model="scope.row.arrivalDatePlan"
+                size="mini"
+                style="width: 100%"
+              ></el-date-picker>
+            </template>
+          </el-table-column>
+          <el-table-column prop="note" label="备注" width="250">
+            <template slot-scope="scope">
+              <el-input
+                v-model="scope.row.note"
+                autosize
+                size="mini"
+                type="textarea"
+                style="width: 100%"
+              ></el-input>
+            </template>
+          </el-table-column>
+          <!-- <el-table-column
+            v-for="(cItem, cIndex) in tableColumns"
+            :key="cIndex"
+            :prop="cItem.key"
+            :label="cItem.title"
+            :width="cItem.width || 180"
+            :show-overflow-tooltip="cItem.showOverflowTooltip || true"
           >
             <template slot-scope="scope">
               <el-input-number
-                v-if="column.edit && column.editConfig.type === 'InputNumber'"
-                v-model="scope.row[column.key]"
-                :controls-position="column.editConfig.controlsPosition"
-                :min="column.editConfig.min"
-                :max="column.editConfig.max"
-                :size="column.editConfig.size || 'mini'"
-                :placeholder="column.editConfig.placeholder"
+                v-if="cItem.edit && cItem.editConfig.type === 'InputNumber'"
+                v-model="scope.row[cItem.key]"
+                :controls-position="cItem.editConfig.controlsPosition"
+                :min="cItem.editConfig.min"
+                :max="cItem.editConfig.max"
+                :size="cItem.editConfig.size || 'mini'"
+                :placeholder="cItem.editConfig.placeholder"
                 style="width: 90%"
               ></el-input-number>
               <el-date-picker
-                v-else-if="
-                  column.edit && column.editConfig.type === 'DatePicker'
-                "
-                v-model="scope.row[column.key]"
-                :type="column.editConfig.showType"
-                :picker-options="column.editConfig.pickerOptions"
-                :size="column.editConfig.size || 'mini'"
-                :placeholder="column.editConfig.placeholder"
+                v-else-if="cItem.edit && cItem.editConfig.type === 'DatePicker'"
+                v-model="scope.row[cItem.key]"
+                :type="cItem.editConfig.showType"
+                :picker-options="cItem.editConfig.pickerOptions"
+                :size="cItem.editConfig.size || 'mini'"
+                :placeholder="cItem.editConfig.placeholder"
                 style="width: 90%"
               ></el-date-picker>
               <el-input
-                v-else-if="column.edit && column.editConfig.type === 'Textarea'"
-                v-model="scope.row[column.key]"
+                v-else-if="cItem.edit && cItem.editConfig.type === 'Textarea'"
+                v-model="scope.row[cItem.key]"
                 type="textarea"
-                :autosize="column.editConfig.autosize || true"
-                :size="column.editConfig.size || 'mini'"
+                :autosize="cItem.editConfig.autosize || true"
+                :size="cItem.editConfig.size || 'mini'"
                 style="width: 90%"
               ></el-input>
-              <span v-else>{{ scope.row[column.key] }}</span>
+              <span v-else>{{ scope.row[cItem.key] }}</span>
             </template>
-          </el-table-column>
+          </el-table-column> -->
         </el-table>
       </div>
       <!-- <el-pagination

+ 77 - 6
src/views/purchase/task/index.vue

@@ -1,9 +1,17 @@
 <script>
 import { TableColumns, SearchColumns } from "./column";
-import { list } from "@/api/business/purchase/task";
-import { initPage, initLayout, initPageSizes, initParams } from "@/utils/init";
+import { LIST, SHUTDOWN } from "@/api/business/purchase/task";
+import {
+  initPage,
+  initLayout,
+  initPageSizes,
+  initParams,
+  initColumns,
+  initDicts,
+} from "@/utils/init";
 export default {
   name: "PuchaseTask",
+  dicts: initDicts(TableColumns),
   components: {
     SeeDrawer: () => import("./see/index.vue"),
     FirstDirectDrawer: () => import("./first-direct/index.vue"),
@@ -14,7 +22,7 @@ export default {
 
       loading: false,
 
-      searchColumns: SearchColumns,
+      searchColumns: initColumns(SearchColumns),
       params: {
         isAsc: "",
         reasonable: "",
@@ -41,7 +49,7 @@ export default {
       try {
         this.loading = true;
         const { pageNum, pageSize } = page;
-        const { code, msg, rows, total } = await list({
+        const { code, msg, rows, total } = await LIST({
           pageNum,
           pageSize,
           ...params,
@@ -79,10 +87,27 @@ export default {
       this.page.pageNum = prop;
       this.fetchList(this.params, this.page);
     },
-    //
+    // 选择行
     handleSelectionChange(prop) {
       this.selectData = prop;
     },
+    // 行删除
+    async handleShutDown(prop) {
+      try {
+        this.loading = true;
+        const { demandItemId } = prop;
+        const { code, msg } = await SHUTDOWN(demandItemId);
+        if (code === 200) {
+          this.$notify.success({ title: msg });
+        } else {
+          this.$notify.warning({ title: msg });
+        }
+      } catch (err) {
+        this.$notify.error({ title: "error", message: err });
+      } finally {
+        this.loading = false;
+      }
+    },
     // 打开查看drawer
     async handleOpenSeeDrawer(prop) {
       const { id } = prop;
@@ -119,12 +144,37 @@ export default {
           :sm="12"
           :xs="24"
         >
-          <el-form-item :prop="column.key" :label="column.title">
+          <el-form-item
+            v-if="column.type === 'Input'"
+            :prop="column.key"
+            :label="column.title"
+          >
             <el-input
               v-model="params[column.key]"
               :placeholder="column.placeholder"
             ></el-input>
           </el-form-item>
+          <el-form-item
+            v-if="column.type === 'Select'"
+            :prop="column.key"
+            :label="column.title"
+          >
+            <el-select
+              v-model="params[column.key]"
+              :disabled="column.disabled"
+              :clearable="column.clearable"
+              :placeholder="column.placeholder"
+              style="width: 100%"
+            >
+              <el-option
+                v-for="item in dict.type[column.config.optionsName]"
+                :key="item.value"
+                :label="item.label"
+                :value="item.value"
+              >
+              </el-option>
+            </el-select>
+          </el-form-item>
         </el-col>
       </el-row>
     </el-form>
@@ -140,6 +190,27 @@ export default {
       <el-col :span="18" style="text-align: right">
         <el-button
           :size="size"
+          :disabled="selectData.length !== 1"
+          @click="handleShutDown(selectData[0])"
+        >
+          分配
+        </el-button>
+        <el-button
+          :size="size"
+          :disabled="selectData.length !== 1"
+          @click="handleShutDown(selectData[0])"
+        >
+          退回需求
+        </el-button>
+        <el-button
+          :size="size"
+          :disabled="selectData.length !== 1"
+          @click="handleShutDown(selectData[0])"
+        >
+          行删除
+        </el-button>
+        <el-button
+          :size="size"
           :disabled="!selectData.length"
           @click="handleOpenFristDirectDrawer(selectData)"
         >