002201 2 jaren geleden
bovenliggende
commit
dc716229f2

+ 17 - 24
src/api/business/purchase/apply.js

@@ -8,50 +8,43 @@ export function LIST(params) {
   });
 }
 
-export function add(data) {
+export function ITEM(data) {
   return request({
-    url: "/pu/contract/add",
-    method: "POST",
-    data: data,
+    url: `/pu/priceApply/${data}`,
+    method: "GET",
   });
 }
 
-export function edit(data) {
+export function ADD(data) {
   return request({
-    url: "/pu/contract/edit",
+    url: "/pu/priceApply/add",
     method: "POST",
     data: data,
   });
 }
 
-export function remove(data) {
+export function EDIT(data) {
   return request({
-    url: `/pu/contract/${data}`,
-    method: "delete",
-  });
-}
-
-export function item(data) {
-  return request({
-    url: `/pu/contract/${data}`,
-    method: "GET",
+    url: "/pu/priceApply/edit",
+    method: "POST",
+    data: data,
   });
 }
 
-export function generateCode() {
+export function REMOVE(data) {
   return request({
-    url: "/pu/contract/generateNo",
-    method: "GET",
+    url: `/pu/priceApply/${data}`,
+    method: "delete",
   });
 }
 
 export function itemTableList(params, name) {
   let url = "";
-  if (name === "contractItemList") url = "/pu/contract/item/list";
-  if (name === "contractClauseList") url = "/pu/contract/clause/list";
-  if (name === "contractExpenseList") url = "/pu/contract/expense/list";
-  if (name === "contractAgreementList") url = "/pu/contract/agreement/list";
-  if (name === "contractApplyOrgList") url = "/pu/contract/org/list";
+  if (name === "priceApplyItemList") url = "/pu/priceApply/item/list";
+  if (name === "priceApplyClauseList") url = "/pu/priceApply/clause/list";
+  if (name === "priceApplyExpenseList") url = "/pu/priceApply/expense/list";
+  if (name === "priceApplyAgreementList") url = "/pu/priceApply/agreement/list";
+  if (name === "priceApplyApplyOrgList") url = "/pu/priceApply/org/list";
   return request({
     url: url,
     method: "GET",

+ 111 - 216
src/views/purchase/apply/add/index.vue

@@ -1,248 +1,143 @@
 <script>
-import { Columns, TabColumns } from "./column";
-import { add, generateCode } from "@/api/business/purchase/contract";
+import { TableColumns } from "../column";
+import { ITEM, ADD } from "@/api/business/purchase/apply";
 import { initColumns, initDicts, initRules, initParams } from "@/utils/init";
 
-const NewColumns = initColumns(Columns);
-const NewTabColumns = TabColumns.map((element) => ({
-  ...element,
-  tableColumns: initColumns(element.tableColumns),
-}));
-
 export default {
-  name: "AddDrawer",
-  dicts: initDicts(NewColumns),
-  components: {
-   
-  },
+  name: "AddDialog",
+  dicts: initDicts(TableColumns),
+  components: {},
   data() {
     return {
       size: "mini",
       visible: false,
       loading: false,
-      columns: NewColumns,
-      rules: initRules(NewColumns),
-      params: {
-        ...initParams(NewColumns),
-        contractItemList: [],
-        contractClauseList: [],
-        contractExpenseList: [],
-        contractAgreementList: [],
-        contractApplyOrgList: [],
-      },
-
-      tabColumns: NewTabColumns,
-      tabName: "contractItemList",
+      columns: TableColumns,
+      rules: initRules(TableColumns),
+      params: initParams(TableColumns),
     };
   },
   computed: {},
-  watch: {
-    "params.contractType": function (newProp) {
-      this.tabColumns = NewTabColumns.filter((element) =>
-        newProp === "1" ? element.key !== "contractItemList" : element
-      );
-      this.tabName = this.tabColumns[0].key;
-    },
-  },
+  watch: {},
   methods: {
-    beforeOpen() {
-      const { deptName, deptId, name, id, orgName, orgId } =
-        this.$store.state.user;
-      this.params.puOrg = orgId;
-      this.params.puOrgName = orgName;
-      this.params.buyer = id;
-      this.params.buyerName = name;
-      this.params.puDept = deptId;
-      this.params.puDeptName = deptName;
-      this.fetchCode();
+    //
+    open(prop) {
+      this.visible = true;
+      this.fetchItem(prop);
     },
-    setVisible(prop) {
-      this.visible = prop;
+    //
+    hide() {
+      this.visible = false;
+      this.params = initParams(this.columns);
     },
-    async fetchCode() {
+    //
+    async fetchItem(prop) {
       try {
         this.loading = true;
-        this.params.code = await generateCode();
+        this.params = prop;
+        // const { code, msg, data } = await FIRSTDIRECT(prop);
+        // if (code === 200) {
+        //   this.data = data;
+        //   this.$notify.success({ title: msg });
+        // } else {
+        //   this.$notify.warning({ title: msg });
+        // }
       } catch (err) {
         //
       } finally {
         this.loading = false;
       }
     },
-    addTableRow(prop) {
-      const arr = this.tabColumns.find(
-        (element) => element.key === this.tabName
-      ).tableColumns;
-      console.log("arr", arr);
-      prop.push(initParams(arr, "key", "value"));
-    },
-    delTableRow(prop, index) {
-      prop.splice(index, 1);
-    },
-    // 取消
-    handleCancel() {
-      this.setVisible(false);
-      this.params = initParams(this.columns, "key", "value");
-    },
-    // 保存
-    handleSava() {
-      this.setVisible(false);
-    },
-    // 保存并新增
-    async handleSubmit() {
-      try {
-        const createById = this.params.buyer;
-        const createByName = this.params.buyerName;
-        const updateById = this.$store.state.user.id;
-        const updateByName = this.$store.state.user.name;
-        const { code, msg } = await add({
-          createById,
-          createByName,
-          updateById,
-          updateByName,
-          ...this.params,
-        });
-        if (code === 200) {
-          this.$notify.success({ title: msg });
-          this.setVisible(false);
+    //
+    submit(prop) {
+      this.$refs[prop].validate(async (valid) => {
+        if (valid) {
+          try {
+            const { code, msg } = await ADD({
+              ...this.params,
+            });
+            if (code === 200) {
+              this.hide();
+              this.$notify.success({ title: msg });
+            } else {
+              this.$notify.warning({ title: msg });
+            }
+          } catch (err) {
+            //
+          } finally {
+            //
+          }
         } else {
-          this.$notify.warning({ title: msg });
+          return false;
         }
-      } catch (err) {
-        //
-      } finally {
-        // this.setVisible(false);
-      }
+      });
     },
   },
-  created() {
-    console.log("ADD CREATED");
-  },
-  mounted() { },
-  destroyed() { },
+  created() {},
+  mounted() {},
+  destroyed() {},
 };
 </script>
 <template>
-  <el-drawer direction="btt" size="100%" :with-header="false" :visible.sync="visible" @open="beforeOpen"
-    @close="$emit('close')">
-    <el-form v-loading="loading" :size="size" label-position="right" label-width="135px" :model="params" :rules="rules">
-      <el-card :body-style="{
-        padding: '20px',
-        display: 'flex',
-        'flex-wrap': 'wrap',
-      }" style="margin: 10px">
-        <div slot="header" style="
-            display: flex;
-            justify-content: space-between;
-            align-items: center;
-          ">
-          <h3>新增</h3>
-          <div style="text-align: right">
-            <el-button :size="size" @click="handleCancel">取 消</el-button>
-            <el-button :size="size" type="danger" @click="handleSava">保 存</el-button>
-            <el-button :size="size" type="info" @click="handleSubmit">
-              新 增
-            </el-button>
-          </div>
-        </div>
-        <el-row>
-          <el-col v-for="(column, index) in columns" :key="index" :span="column.span || 6">
-            <el-form-item :prop="column.key" :label="column.title">
-              <el-input v-if="column.type === 'Input'" v-model="params[column.key]" :placeholder="column.placeholder"
-                :clearable="column.clearable" :disabled="column.disabled" style="width: 100%"></el-input>
-              <dr-popover-select v-if="column.type === 'InputDialog'" v-model="params[column.key]"
-                :placeholder="column.placeholder" :clearable="column.clearable" :disabled="column.disabled"
-                :readonly="column.readonly" :title="column.title" :type="column.config.componentName"
-                :data-mapping="column.config.dataMapping" :source.sync="params">
-              </dr-popover-select>
-              <el-input v-if="column.type === 'Textarea'" v-model="params[column.key]" type="textarea"
-                :placeholder="column.placeholder" :clearable="column.clearable" :disabled="column.disabled"
-                style="width: 100%"></el-input>
-              <el-input-number v-if="column.type === 'InputNumber'" v-model="params[column.key]"
-                :controls-position="column.config.controlsPosition" :placeholder="column.placeholder"
-                :clearable="column.clearable" :disabled="column.disabled" style="width: 100%"></el-input-number>
-              <el-select v-if="column.type === 'Select'" v-model="params[column.key]" :placeholder="column.placeholder"
-                :clearable="column.clearable" :disabled="column.disabled" 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-select v-if="column.type === 'TagSelect'" v-model="params[column.key]" multiple clearable collapse-tags
-                :placeholder="column.placeholder" :clearable="column.clearable" :disabled="column.disabled"
-                style="width: 100%">
-                <template #prefix>
-                  <el-icon class="el-icon-view" style="cursor: pointer" @click.stop="$message.info(234)"></el-icon>
-                </template>
-                <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
-                </el-option>
-              </el-select>
-              <el-date-picker v-if="column.type === 'DatePicker'" v-model="params[column.key]" :type="column.config.type"
-                :placeholder="column.placeholder" :clearable="column.clearable" :disabled="column.disabled"
-                :picker-options="column.pickerOptions" style="width: 100%">
-              </el-date-picker>
-              <el-upload v-if="column.type === 'Upload'" :file-list="params[column.key]" :disabled="column.disabled" drag
-                action="https://sy.derom.com/document-center/fastdfs/upload" multiple>
-                <i class="el-icon-upload"></i>
-                <div class="el-upload__text">
-                  将文件拖到此处,或<em>点击上传</em>
-                </div>
-                <!-- <div class="el-upload__tip" slot="tip">
-                  只能上传jpg/png文件,且不超过500kb
-                </div> -->
-              </el-upload>
-            </el-form-item>
-          </el-col>
-        </el-row>
-      </el-card>
-      <el-card :body-style="{
-        padding: '20px',
-        display: 'flex',
-        'flex-wrap': 'wrap',
-        position: 'relative',
-      }" style="margin: 10px">
-        <el-tabs v-model="tabName" style="width: 100%">
-          <el-tab-pane v-for="(column, index) in tabColumns" :key="index" :label="column.title" :name="column.key">
-            <el-table :data="params[column.key]" style="width: 100%">
-              <el-table-column label="序号">
-                <template slot-scope="scope">
-                  {{ scope.$index + 1 }}
-                </template>
-              </el-table-column>
-              <el-table-column v-for="(cColumn, cIndex) in column.tableColumns" :key="cIndex" :prop="cColumn.key"
-                :label="cColumn.title" :width="cColumn.width">
-                <template slot-scope="scope">
-                  <span v-if="!cColumn.type">
-                    {{ scope.row[cColumn.key] }}</span>
-                  <el-input v-if="cColumn.type === 'Input'" v-model="scope.row[cColumn.key]"
-                    :placeholder="cColumn.placeholder" :clearable="cColumn.clearable" :disabled="cColumn.disabled"
-                    :size="size" style="width: 100%"></el-input>
-                  <dr-popover-select v-if="cColumn.type === 'InputDialog'" v-model="scope.row[cColumn.key]"
-                    :placeholder="cColumn.placeholder" :clearable="cColumn.clearable" :disabled="cColumn.disabled"
-                    :readonly="cColumn.readonly" :title="cColumn.title" :type="cColumn.config.componentName"
-                    :data-mapping="cColumn.config.dataMapping" :source.sync="scope.row" :size="size">
-                  </dr-popover-select>
-                  <el-input-number v-if="cColumn.type === 'InputNumber'" v-model="scope.row[cColumn.key]"
-                    :controls-position="cColumn.config.controlsPosition" :placeholder="cColumn.placeholder"
-                    :clearable="cColumn.clearable" :disabled="cColumn.disabled" :size="size"
-                    style="width: 100%"></el-input-number>
-                </template>
-              </el-table-column>
-              <el-table-column fixed="right" label="操作" width="120">
-                <template slot-scope="scope">
-                  <el-button @click.native.prevent="
-                    delTableRow(params[tabName], scope.$index)
-                    " type="text" size="small">
-                    删行
-                  </el-button>
-                </template>
-              </el-table-column>
-            </el-table>
-          </el-tab-pane>
-        </el-tabs>
-        <el-row style="position: absolute; top: 20px; right: 20px">
-          <el-button :size="size" @click="addTableRow(params[tabName])">增行</el-button>
-        </el-row>
-      </el-card>
+  <el-dialog :visible.sync="visible" title="新增" fullscreen @close="hide">
+    <el-form
+      ref="ruleForm"
+      v-loading="loading"
+      :size="size"
+      :rules="rules"
+      :model="params"
+      label-width="auto"
+      label-position="right"
+    >
+      <el-row :gutter="20" style="display: flex; flex-wrap: wrap">
+        <el-col
+          v-for="(column, index) in columns"
+          :key="index"
+          :span="column.span || 8"
+        >
+          <el-form-item :prop="column.key" :label="column.title">
+            <el-input
+              v-if="column.inputType === 'Input'"
+              v-model="params[column.key]"
+              :disabled="column.disabled"
+              :readonly="column.readonly"
+              :clearable="column.clearable"
+              :placeholder="column.placeholder"
+              style="width: 100%"
+            ></el-input>
+            <dr-popover-select
+              v-if="column.inputType === 'PopoverSelect'"
+              v-model="params[column.key]"
+              :source.sync="params"
+              :title="column.title"
+              :type="column.referName"
+              :disabled="column.disabled"
+              :readonly="column.readonly"
+              :clearable="column.clearable"
+              :placeholder="column.placeholder"
+              :data-mapping="column.dataMapping"
+              style="width: 100%"
+            >
+            </dr-popover-select>
+            <el-switch
+              v-if="column.inputType === 'Switch'"
+              v-model="params[column.key]"
+              active-value="1"
+              inactive-value="0"
+            >
+            </el-switch>
+            <file-upload
+              v-if="column.inputType === 'Upload'"
+              v-model="params[column.key]"
+              :file-type="column.fileType"
+            ></file-upload>
+          </el-form-item>
+        </el-col>
+      </el-row>
     </el-form>
-  </el-drawer>
+    <div style="text-align: right">
+      <el-button :size="size" @click="hide">取 消</el-button>
+      <el-button :size="size" @click="submit('ruleForm')">新 增</el-button>
+    </div>
+  </el-dialog>
 </template>

+ 152 - 26
src/views/purchase/apply/column.js

@@ -1,34 +1,159 @@
 export const TableColumns = [
-  { key: "id", title: "id" },
-  { key: "status", title: "单据状态" },
-  { key: "priceName", title: "价格名称" },
-  { key: "supplier", title: "供应商" },
+  { key: "priceName", title: "价格名称", inputType: "Input" },
   {
     key: "supplierName",
-    title: "供应商名称",
+    title: "供应商",
+    inputType: "PopoverSelect",
+    referName: "SUPPLIER_PARAM",
+    valueKey: "name",
+    dataMapping: {
+      supplier: "code",
+      supplierName: "name",
+    },
+    require: true,
+  },
+  {
+    key: "supplier",
+    title: "供应商编码",
+    inputType: "Input",
+    disabled: true,
+    readonly: true,
   },
-  { key: "puOrg", title: "采购组织" },
   {
     key: "puOrgName",
-    title: "采购组织名称",
-  },
-  { key: "currency", title: "币种" },
-  { key: "currencyName", title: "币种名称" },
-  { key: "explain", title: "价格合理性说明" },
-  { key: "buyer", title: "采购员" },
-  { key: "buyerName", title: "采购员名称" },
-  { key: "puDept", title: "采购部门" },
-  { key: "puDeptName", title: "采购部门名称" },
-  { key: "sourceType", title: "来源单据类型" },
-  { key: "source", title: "来源单据号" },
-  { key: "isEffective", title: "是否已推价格" },
-  { key: "effectiveDate", title: "生效日期" },
-  { key: "file", title: "附件" },
-  { key: "tenantId", title: "租户号" },
-  { key: "revision", title: "乐观锁" },
-  { key: "createByName", title: "创建人名称" },
-  { key: "updateByName", title: "更新人" },
-  { key: "delFlag", title: "删除标记" },
+    title: "采购组织",
+    inputType: "PopoverSelect",
+    referName: "ORG_PARAM",
+    valueKey: "name",
+    dataMapping: {
+      puOrg: "code",
+      puOrgName: "name",
+    },
+    require: true,
+  },
+  {
+    key: "puOrg",
+    title: "采购组织编码",
+    inputType: "Input",
+    disabled: true,
+    readonly: true,
+  },
+  {
+    key: "currencyName",
+    title: "币种",
+    inputType: "PopoverSelect",
+    referName: "CURRENCY_PARAM",
+    dataMapping: {
+      currency: "code",
+      currencyName: "name",
+    },
+    require: true,
+  },
+  {
+    key: "currency",
+    title: "币种编码",
+    inputType: "Input",
+    disabled: true,
+    readonly: true,
+  },
+  {
+    key: "explain",
+    title: "价格合理性说明",
+    inputType: "Input",
+    require: true,
+  },
+  {
+    key: "buyerName",
+    title: "采购员",
+    inputType: "PopoverSelect",
+    referName: "CONTACTS_PARAM",
+    dataMapping: {
+      buyer: "code",
+      buyerName: "name",
+    },
+    require: true,
+  },
+  {
+    key: "buyer",
+    title: "采购员编码",
+    inputType: "Input",
+    disabled: true,
+    readonly: true,
+  },
+  {
+    key: "puDeptName",
+    title: "采购部门",
+    inputType: "PopoverSelect",
+    referName: "CONTACTS_PARAM",
+    dataMapping: {
+      puDept: "code",
+      puDeptName: "name",
+    },
+    require: true,
+  },
+  {
+    key: "puDept",
+    title: "采购部门编码",
+    inputType: "Input",
+    disabled: true,
+    readonly: true,
+  },
+  {
+    key: "file",
+    title: "附件",
+    inputType: "Upload",
+    span: "24",
+    disabled: true,
+    readonly: true,
+    value: [],
+  },
+  {
+    key: "createByName",
+    title: "创建人",
+    inputType: "Input",
+    disabled: true,
+    readonly: true,
+  },
+  {
+    key: "source",
+    title: "来源单据号",
+    inputType: "Input",
+    disabled: true,
+    readonly: true,
+  },
+  {
+    key: "id",
+    title: "来源单据id",
+    inputType: "Input",
+    disabled: true,
+    readonly: true,
+  },
+  { key: "isEffective", title: "是否已推价格", inputType: "Switch" },
+  {
+    key: "effectiveDate",
+    title: "生效日期",
+    inputType: "Input",
+    disabled: true,
+    readonly: true,
+  },
+  {
+    key: "sourceType",
+    title: "来源单据类型",
+    inputType: "Input",
+    disabled: true,
+    readonly: true,
+  },
+  {
+    key: "status",
+    title: "单据状态",
+    inputType: "Input",
+    disabled: true,
+    readonly: true,
+  },
+  // { key: "tenantId", title: "租户号" },
+  // { key: "revision", title: "乐观锁" },
+  // { key: "updateByName", title: "更新人" },
+  // { key: "delFlag", title: "删除标记" },
 ];
 
 export const SearchColumns = [
@@ -37,7 +162,7 @@ export const SearchColumns = [
     title: "供应商",
     inputType: "PopoverSelect",
     referName: "SUPPLIER_PARAM",
-    valueKey: "code",
+    valueKey: "name",
     dataMapping: {
       supplier: "code",
       supplierName: "name",
@@ -48,6 +173,7 @@ export const SearchColumns = [
     title: "采购组织",
     inputType: "PopoverSelect",
     referName: "ORG_PARAM",
+    valueKey: "name",
     dataMapping: {
       puOrg: "code",
       puOrgName: "name",

+ 72 - 70
src/views/purchase/apply/index.vue

@@ -1,13 +1,13 @@
 <script>
 import { TableColumns, SearchColumns } from "./column";
-import { LIST, remove } from "@/api/business/purchase/apply";
+import { LIST, REMOVE } from "@/api/business/purchase/apply";
 import { initPage, initLayout, initPageSizes, initParams } from "@/utils/init";
 export default {
-  name: "PuchaseContract",
+  name: "PuchaseApply",
   components: {
-    // AddDrawer: () => import("./add/index.vue"),
-    // SeeDrawer: () => import("./see/index.vue"),
-    // EditDrawer: () => import("./edit/index.vue"),
+    AddDialog: () => import("./add/index.vue"),
+    SeeDialog: () => import("./see/index.vue"),
+    // Editdialog: () => import("./edit/index.vue"),
   },
   data() {
     return {
@@ -24,7 +24,7 @@ export default {
   },
   computed: {},
   created() {
-    this.handleQueryList(this.params, this.page);
+    this.queryList(this.params, this.page);
   },
   methods: {
     //
@@ -51,24 +51,24 @@ export default {
       }
     },
     // 查询操作
-    handleQueryList() {
-      this.fetchList(this.params, this.page);
+    queryList(prop, page) {
+      this.fetchList(prop, page);
     },
     // 重置操作
-    handleResetList(prop, page) {
+    resetList() {
       this.page = initPage();
       this.params = initParams(SearchColumns);
-      this.handleQueryList(prop, page);
+      this.queryList(this.params, this.page);
     },
     // 删除操作
-    async handleDeleteList(prop) {
+    async deleteItem(prop) {
       try {
         this.loading = true;
         const { id } = prop;
-        const { code, msg } = await remove(id);
+        const { code, msg } = await REMOVE(id);
         if (code === 200) {
           this.$notify.success({ title: msg });
-          this.handleQueryList(this.params, this.page);
+          this.queryList(this.params, this.page);
         } else {
           this.$notify.warning({ title: msg });
         }
@@ -79,32 +79,30 @@ export default {
       }
     },
     // 页大小变
-    handleSizeChange(prop) {
+    sizeChange(prop) {
       this.page.pageSize = prop;
-      this.handleQueryList(this.params, this.page);
+      this.queryList(this.params, this.page);
     },
     // 当前页变
-    handleCurrentChange(prop) {
+    currentChange(prop) {
       this.page.pageNum = prop;
-      this.handleQueryList(this.params, this.page);
+      this.queryList(this.params, this.page);
     },
-    // 打开新增drawer
-    handleOpenAddDrawer() {
-      console.log(this.$refs.AddDrawerFef);
-      const { setVisible } = this.$refs.AddDrawerFef;
-      setVisible(true);
+    // 打开新增dialog
+    async openAddDialog(prop) {
+      const { open } = this.$refs.AddDialog;
+      await open(prop);
     },
-    // 打开查看drawer
-    async handleOpenSeeDrawer(prop) {
+    // 打开查看dialog
+    async openSeeDialog(prop) {
       const { id } = prop;
-      const { setVisible, fetchItem } = this.$refs.SeeDrawerFef;
-      await setVisible(true);
-      await fetchItem(id);
+      const { open } = this.$refs.SeeDialog;
+      await open(id);
     },
-    // 打开编辑drawer
-    async handleOpenEditDrawer(prop) {
+    // 打开编辑dialog
+    async openEditDialog(prop) {
       const { id } = prop;
-      const { setVisible, fetchItem } = this.$refs.EditDrawerFef;
+      const { setVisible, fetchItem } = this.$refs.EditdialogFef;
       await setVisible(true);
       await fetchItem(id);
     },
@@ -118,61 +116,51 @@ export default {
     style="width: calc(100% - 24px); height: 100%; margin: 10px"
     :body-style="{ padding: 0 }"
   >
-    <!-- <see-drawer ref="SeeDrawerFef"></see-drawer> -->
-    <!-- <add-drawer ref="AddDrawerFef" @close="handleResetList"></add-drawer> -->
-    <!-- <edit-drawer ref="EditDrawerFef" @close="handleResetList"></edit-drawer> -->
+    <see-dialog ref="SeeDialog"></see-dialog>
+    <add-dialog ref="AddDialog" @submit-success="resetList"></add-dialog>
+    <!-- <edit-dialog ref="EditdialogFef" @close="resetList"></edit-dialog> -->
     <el-form
       :size="size"
       :model="params"
       label-width="75px"
       label-position="right"
+      style="padding: 20px 20px 0"
     >
-      <el-row :gutter="24" style="padding: 20px 20px">
+      <el-row :gutter="20" style="display: flex; flex-wrap: wrap">
         <el-col
           v-for="column in searchColumns"
           :key="column.title"
-          :xl="4"
-          :lg="6"
-          :md="8"
-          :sm="12"
-          :xs="24"
+          :span="column.span || 6"
         >
-          <el-form-item
-            v-if="column.inputType === 'PopoverSelect'"
-            :prop="column.key"
-            :label="column.title"
-          >
-            <dr-popover-select
+          <el-form-item :prop="column.key" :label="column.title">
+            <el-input
               v-model="params[column.key]"
-              :source.sync="params"
-              :title="column.title"
-              :type="column.referName"
-              :value-key="column.valueKey"
               :placeholder="column.placeholder"
-            >
-            </dr-popover-select>
+            ></el-input>
           </el-form-item>
         </el-col>
-        <el-col :xl="4" :lg="6" :md="8" :sm="12" :xs="24">
-          <el-button
-            circle
-            :size="size"
-            icon="el-icon-search"
-            @click="handleQueryList(params, page)"
-          ></el-button>
-          <el-button
-            circle
-            :size="size"
-            icon="el-icon-refresh"
-            @click="handleResetList(params, page)"
-          ></el-button>
+        <el-col :span="8">
+          <el-form-item label-width="0">
+            <el-button
+              circle
+              :size="size"
+              icon="el-icon-search"
+              @click="queryList(params, page)"
+            ></el-button>
+            <el-button
+              circle
+              :size="size"
+              icon="el-icon-refresh"
+              @click="resetList"
+            ></el-button>
+          </el-form-item>
         </el-col>
       </el-row>
     </el-form>
     <el-table
-      @row-dblclick="handleOpenSeeDrawer"
-      :data="tableData"
       :size="size"
+      :data="tableData"
+      @row-dblclick="openSeeDialog"
       style="width: 100%; margin: 20px 0 0 0"
     >
       <el-table-column
@@ -184,10 +172,24 @@ export default {
         :show-overflow-tooltip="column.showOverflowTooltip || true"
       >
       </el-table-column>
-      <el-table-column fixed="right" label="操作" width="120">
+      <el-table-column fixed="right" label="操作" width="200">
         <template slot-scope="scope">
           <el-button
-            @click.native.prevent="handleDeleteList(scope.row)"
+            @click.native.prevent="openAddDialog(scope.row)"
+            type="text"
+            size="small"
+          >
+            复 制
+          </el-button>
+          <el-button
+            @click.native.prevent="editItem(scope.row)"
+            type="text"
+            size="small"
+          >
+            编 辑
+          </el-button>
+          <el-button
+            @click.native.prevent="deleteItem(scope.row)"
             type="text"
             size="small"
           >
@@ -197,8 +199,8 @@ export default {
       </el-table-column>
     </el-table>
     <el-pagination
-      @size-change="handleSizeChange"
-      @current-change="handleCurrentChange"
+      @size-change="sizeChange"
+      @current-change="currentChange"
       :total="page.total"
       :page-sizes="pageSizes"
       :page-size="page.pageSize"

+ 37 - 281
src/views/purchase/apply/see/index.vue

@@ -1,61 +1,38 @@
 <script>
-import { Columns, TabColumns } from "../add/column";
-import { item, itemTableList } from "@/api/business/purchase/contract";
-import { initColumns, initDicts, initRules, initParams } from "@/utils/init";
-
-const NewColumns = initColumns(Columns, { disabled: true, readonly: true });
-const NewTabColumns = TabColumns.map((element) => ({
-  ...element,
-  tableColumns: initColumns(element.tableColumns, {
-    disabled: true,
-    readonly: true,
-  }),
-}));
+import { TableColumns } from "../column";
+import { initDicts, initParams } from "@/utils/init";
+import { ITEM } from "@/api/business/purchase/apply";
 
 export default {
-  name: "SeeDrawer",
-  dicts: initDicts(NewColumns),
+  name: "SeeDialog",
+  dicts: initDicts(TableColumns),
   data() {
     return {
+      size: "mini",
       visible: false,
       loading: false,
-      columns: NewColumns,
-      rules: initRules(NewColumns),
-      params: {
-        ...initParams(NewColumns),
-        contractItemList: [],
-        contractClauseList: [],
-        contractExpenseList: [],
-        contractAgreementList: [],
-        contractApplyOrgList: [],
-      },
-
-      tabColumns: NewTabColumns,
-      tabName: "contractItemList",
+      columns: TableColumns,
+      params: initParams(TableColumns),
     };
   },
   computed: {},
-  watch: {
-    "params.contractType": function (newProp) {
-      this.tabColumns = NewTabColumns.filter((element) =>
-        newProp === "1" ? element.key !== "contractItemList" : element
-      );
-      this.tabName = this.tabColumns[0].key;
-    },
-    tabName: function (newProp) {
-      const { id } = this.params;
-      this.fetchTable(id, newProp);
-    },
-  },
+  watch: {},
   methods: {
-    setVisible(prop) {
-      this.visible = prop;
+    //
+    open(prop) {
+      this.visible = true;
+      this.fetchItem(prop);
+    },
+    //
+    hide() {
+      this.visible = false;
+      this.params = initParams(Columns);
     },
-    // 查询详细
+    //
     async fetchItem(prop) {
       try {
         this.loading = true;
-        const { code, msg, data } = await item(prop);
+        const { code, msg, data } = await ITEM(prop);
         if (code === 200) {
           this.params = data;
           this.$notify.success({ title: msg });
@@ -68,33 +45,6 @@ export default {
         this.loading = false;
       }
     },
-    // 查询详情关联TABLE
-    async fetchTable(prop, name) {
-      try {
-        this.loading = true;
-        const { code, msg, rows } = await itemTableList({ id: prop }, name);
-        if (code === 200) {
-          this.params[name] = rows;
-          this.$notify.success({ title: msg });
-        } else {
-          this.$notify.warning({ title: msg });
-        }
-      } catch (err) {
-        //
-      } finally {
-        this.loading = false;
-      }
-    },
-    // 取消操作
-    handleCancel() {
-      this.setVisible(false);
-      this.params = initParams(Columns);
-    },
-    // 编辑操作
-    handleOpenEditDrawer(prop) {
-      this.setVisible(false);
-      this.$parent.$parent.handleOpenEditDrawer(prop);
-    },
   },
   created() {},
   mounted() {},
@@ -102,216 +52,22 @@ export default {
 };
 </script>
 <template>
-  <el-drawer
-    direction="btt"
-    size="100%"
-    :with-header="false"
-    :visible.sync="visible"
-    destroy-on-close
-  >
-    <el-form
-      v-loading="loading"
-      size="mini"
-      label-position="right"
-      label-width="135px"
-      :model="params"
-      :rules="rules"
-    >
-      <el-card
-        :body-style="{
-          padding: '20px',
-          display: 'flex',
-          'flex-wrap': 'wrap',
-        }"
-        style="margin: 10px"
-      >
-        <div
-          slot="header"
-          style="
-            display: flex;
-            justify-content: space-between;
-            align-items: center;
-          "
-        >
-          <h3>查看</h3>
-          <div style="text-align: right">
-            <el-button size="mini" @click="handleOpenEditDrawer(params)"
-              >编 辑</el-button
-            >
-            <el-button size="mini" @click="handleCancel">取 消</el-button>
-          </div>
-        </div>
-        <el-row>
-          <el-col
-            v-for="(column, index) in columns"
-            :key="index"
-            :span="column.span || 6"
-          >
-            <el-form-item :prop="column.key" :label="column.title">
-              <el-input
-                v-if="column.type === 'Textarea'"
-                v-model="params[column.key]"
-                type="textarea"
-                :placeholder="column.placeholder"
-                :clearable="column.clearable"
-                :disabled="column.disabled"
-                :readonly="column.readonly"
-                style="width: 100%"
-              ></el-input>
-              <el-input-number
-                v-else-if="column.type === 'InputNumber'"
-                v-model="params[column.key]"
-                :controls-position="column.config.controlsPosition"
-                :placeholder="column.placeholder"
-                :clearable="column.clearable"
-                :disabled="column.disabled"
-                :readonly="column.readonly"
-                style="width: 100%"
-              ></el-input-number>
-              <el-select
-                v-else-if="column.type === 'Select'"
-                v-model="params[column.key]"
-                :placeholder="column.placeholder"
-                :clearable="column.clearable"
-                :disabled="column.disabled"
-                :readonly="column.readonly"
-                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-date-picker
-                v-else-if="column.type === 'DatePicker'"
-                v-model="params[column.key]"
-                :type="column.config.type"
-                :placeholder="column.placeholder"
-                :clearable="column.clearable"
-                :disabled="column.disabled"
-                :readonly="column.readonly"
-                :picker-options="column.pickerOptions"
-                style="width: 100%"
-              >
-              </el-date-picker>
-              <el-upload
-                v-else-if="column.type === 'Upload'"
-                :file-list="params[column.key]"
-                :disabled="column.disabled"
-                :readonly="column.readonly"
-                drag
-                action="https://jsonplaceholder.typicode.com/posts/"
-                multiple
-              >
-                <i class="el-icon-upload"></i>
-                <div class="el-upload__text">
-                  将文件拖到此处,或<em>点击上传</em>
-                </div>
-                <div class="el-upload__tip" slot="tip">
-                  只能上传jpg/png文件,且不超过500kb
-                </div>
-              </el-upload>
-              <el-input
-                v-else
-                v-model="params[column.key]"
-                :placeholder="column.placeholder"
-                :clearable="column.clearable"
-                :disabled="column.disabled"
-                :readonly="column.readonly"
-                style="width: 100%"
-              ></el-input>
-            </el-form-item>
-          </el-col>
-        </el-row>
-      </el-card>
-      <el-card
-        :body-style="{
-          padding: '20px',
-          display: 'flex',
-          'flex-wrap': 'wrap',
-          position: 'relative',
-        }"
-        style="margin: 10px"
+  <el-dialog :visible.sync="visible" title="明细" @close="hide">
+    <el-descriptions :column="2" border>
+      <el-descriptions-item
+        v-if="params[column.key]"
+        v-for="(column, index) in columns"
+        :key="index"
+        :label="column.title"
       >
-        <el-tabs v-model="tabName" style="width: 100%">
-          <el-tab-pane
-            v-for="(column, index) in tabColumns"
-            :key="index"
-            :label="column.title"
-            :name="column.key"
-          >
-            <el-table :data="params[column.key]" style="width: 100%">
-              <el-table-column
-                v-for="(cColumn, cIndex) in column.tableColumns"
-                :key="cIndex"
-                :prop="cColumn.key"
-                :label="cColumn.title"
-                :width="cColumn.width"
-              >
-                <template slot-scope="scope">
-                  <el-tag v-if="cColumn.key === 'index'">
-                    {{ scope.$index + 1 }}
-                  </el-tag>
-                  <el-input
-                    v-if="cColumn.type === 'Input'"
-                    v-model="scope.row[cColumn.key]"
-                    :placeholder="cColumn.placeholder"
-                    :clearable="cColumn.clearable"
-                    :disabled="cColumn.disabled"
-                    size="mini"
-                    style="width: 100%"
-                  ></el-input>
-                  <el-input-number
-                    v-if="cColumn.type === 'InputNumber'"
-                    v-model="scope.row[cColumn.key]"
-                    :controls-position="cColumn.config.controlsPosition"
-                    :placeholder="cColumn.placeholder"
-                    :clearable="cColumn.clearable"
-                    :disabled="cColumn.disabled"
-                    size="mini"
-                    style="width: 100%"
-                  ></el-input-number>
-                  <el-input
-                    v-if="column.type === 'InputDialog'"
-                    v-model="params[column.key]"
-                    :placeholder="column.placeholder"
-                    :clearable="column.clearable"
-                    :disabled="column.disabled"
-                    :readonly="column.readonly"
-                    style="width: 100%; cursor: pointer"
-                    @click.native.stop="openAsyncInputDialog(column, params)"
-                  >
-                    <template #suffix>
-                      <el-icon class="el-icon-thumb"></el-icon>
-                    </template>
-                  </el-input>
-                </template>
-              </el-table-column>
-              <!-- <el-table-column fixed="right" label="操作" width="120">
-                <template slot-scope="scope">
-                  <el-button
-                    @click.native.prevent="
-                      delTableRow(params[tabName], scope.$index)
-                    "
-                    type="text"
-                    size="small"
-                  >
-                    删行
-                  </el-button>
-                </template>
-              </el-table-column> -->
-            </el-table>
-          </el-tab-pane>
-        </el-tabs>
-        <!-- <el-row style="position: absolute; top: 20px; right: 20px">
-          <el-button size="mini" @click="addTableRow(params[tabName])"
-            >增行</el-button
-          >
-        </el-row> -->
-      </el-card>
-    </el-form>
-  </el-drawer>
+        <dict-tag
+          v-if="column.inputType === 'Select'"
+          :size="size"
+          :value="params[column.key]"
+          :options="dict.type[column.referName]"
+        />
+        <span v-else>{{ params[column.key] }}</span>
+      </el-descriptions-item>
+    </el-descriptions>
+  </el-dialog>
 </template>

+ 18 - 18
src/views/purchase/contract/add/index.vue

@@ -29,7 +29,6 @@ export default {
         contractAgreementList: [],
         contractApplyOrgList: [],
       },
-
       tabColumns: TabColumns,
       tabName: "contractItemList",
     };
@@ -44,6 +43,7 @@ export default {
     },
   },
   methods: {
+    //
     open() {
       const {
         deptId: puDept,
@@ -62,11 +62,13 @@ export default {
       this.fetchCode();
       this.visible = true;
     },
+    //
     hide() {
       this.visible = false;
       this.params = initParams(this.columns);
       this.tabName = this.tabColumns[0].key;
     },
+    //
     async fetchCode() {
       try {
         this.loading = true;
@@ -78,21 +80,20 @@ export default {
         this.loading = false;
       }
     },
-    addRow(prop) {
-      const arr = this.tabColumns.find(
-        (element) => element.key === this.tabName
-      ).tableColumns;
-      prop.push(initParams(arr));
+    //
+    rowAdd(prop) {
+      const tab = this.tabColumns.find((element) => element.key === prop);
+      this.params[prop].push(initParams(tab.tableColumns));
     },
-    deleteRow(prop, index) {
+    //
+    rowDelete(prop, index) {
       prop.splice(index, 1);
     },
-    cancel() {
-      this.hide();
-    },
+    //
     sava() {
       this.visible = false;
     },
+    //
     submit(prop) {
       this.$refs[prop].validate(async (valid) => {
         if (valid) {
@@ -109,7 +110,7 @@ export default {
               ...this.params,
             });
             if (code === 200) {
-              this.cancel();
+              this.hide();
               this.$emit("submit-success");
               this.$notify.success({ title: msg });
             } else {
@@ -118,10 +119,9 @@ export default {
           } catch (err) {
             //
           } finally {
-            // this.hide();
+            //
           }
         } else {
-          console.log("error submit!!");
           return false;
         }
       });
@@ -143,11 +143,11 @@ export default {
       label-width="auto"
       label-position="right"
     >
-      <el-row>
+      <el-row :gutter="20" style="display: flex; flex-wrap: wrap">
         <el-col
           v-for="(column, index) in columns"
           :key="index"
-          :span="column.span || 8"
+          :span="column.span || 6"
         >
           <el-form-item :prop="column.key" :label="column.title">
             <el-input
@@ -300,14 +300,14 @@ export default {
               </el-table-column>
               <el-table-column fixed="right" label="操作" width="120">
                 <template slot="header" slot-scope="scope">
-                  <el-button :size="size" @click="addRow(params[tabName])">
+                  <el-button :size="size" @click="rowAdd(params[tabName])">
                     增 行
                   </el-button>
                 </template>
                 <template slot-scope="scope">
                   <el-button
                     @click.native.prevent="
-                      deleteRow(params[tabName], scope.$index)
+                      rowDelete(params[tabName], scope.$index)
                     "
                     type="text"
                     size="small"
@@ -321,7 +321,7 @@ export default {
         </el-tabs>
       </el-form-item>
       <el-form-item label-width="0" style="text-align: right">
-        <el-button :size="size" @click="cancel">取 消</el-button>
+        <el-button :size="size" @click="hide">取 消</el-button>
         <el-button :size="size" @click="sava">保 存</el-button>
         <el-button :size="size" @click="submit('ruleForm')"> 新 增 </el-button>
       </el-form-item>

+ 2 - 1
src/views/purchase/contract/column.js

@@ -231,6 +231,7 @@ export const Columns = [
     inputType: "Input",
     require: true,
   },
+  { key: "enquiryCode", title: "询价单号", inputType: "Input" },
   {
     key: "contractContent",
     title: "合同主要内容",
@@ -239,7 +240,7 @@ export const Columns = [
     span: 24,
   },
   { key: "refusalReasons", title: "拒绝理由", inputType: "Input", span: 24 },
-  { key: "enquiryCode", title: "询价单号", inputType: "Input" },
+
   {
     key: "externalFile",
     title: "对外附件",

+ 44 - 33
src/views/purchase/contract/edit/index.vue

@@ -47,15 +47,18 @@ export default {
     },
   },
   methods: {
+    //
     open(prop) {
       this.visible = true;
       this.fetchItem(prop);
     },
+    //
     hide() {
       this.visible = false;
       this.params = initParams(Columns);
       this.tabName = this.tabColumns[0].key;
     },
+    //
     async fetchItem(prop) {
       try {
         this.loading = true;
@@ -74,6 +77,7 @@ export default {
         this.loading = false;
       }
     },
+    //
     async fetchTable(prop, name) {
       try {
         this.loading = true;
@@ -90,13 +94,13 @@ export default {
         this.loading = false;
       }
     },
-    addRow(prop) {
-      const arr = this.tabColumns.find(
-        (element) => element.key === prop
-      ).tableColumns;
-      this.params[prop].push(initParams(arr));
+    //
+    rowAdd(prop) {
+      const tab = this.tabColumns.find((element) => element.key === prop);
+      this.params[prop].push(initParams(tab.tableColumns));
     },
-    async deleteRow(prop, { row: { id }, $index }) {
+    //
+    async rowDelete(prop, { row: { id }, $index }) {
       try {
         this.loading = true;
         const { code, msg } = await TABLEROMOVE(id, prop);
@@ -112,31 +116,38 @@ export default {
         this.loading = false;
       }
     },
-    async submit() {
-      try {
-        const createById = this.params.buyer;
-        const createByName = this.params.buyerName;
-        const updateById = this.$store.state.user.id;
-        const updateByName = this.$store.state.user.name;
-        const { code, msg } = await EDIT({
-          createById,
-          createByName,
-          updateById,
-          updateByName,
-          ...this.params,
-        });
-        if (code === 200) {
-          this.hide();
-          this.$emit("submit-success");
-          this.$notify.success({ title: msg });
+    //
+    submit(prop) {
+      this.$refs[prop].validate(async (valid) => {
+        if (valid) {
+          try {
+            const createById = this.params.buyer;
+            const createByName = this.params.buyerName;
+            const updateById = this.$store.state.user.id;
+            const updateByName = this.$store.state.user.name;
+            const { code, msg } = await EDIT({
+              createById,
+              createByName,
+              updateById,
+              updateByName,
+              ...this.params,
+            });
+            if (code === 200) {
+              this.hide();
+              this.$emit("submit-success");
+              this.$notify.success({ title: msg });
+            } else {
+              this.$notify.warning({ title: msg });
+            }
+          } catch (err) {
+            //
+          } finally {
+            //
+          }
         } else {
-          this.$notify.warning({ title: msg });
+          return false;
         }
-      } catch (err) {
-        //
-      } finally {
-        // this.setVisible(false);
-      }
+      });
     },
   },
   created() {},
@@ -155,11 +166,11 @@ export default {
       label-width="auto"
       label-position="right"
     >
-      <el-row>
+      <el-row :gutter="20" style="display: flex; flex-wrap: wrap">
         <el-col
           v-for="(column, index) in columns"
           :key="index"
-          :span="column.span || 8"
+          :span="column.span || 6"
         >
           <el-form-item :prop="column.key" :label="column.title">
             <el-input
@@ -317,13 +328,13 @@ export default {
               </el-table-column>
               <el-table-column fixed="right" label="操作" width="120">
                 <template slot="header" slot-scope="scope">
-                  <el-button :size="size" @click="addRow(tabName)">
+                  <el-button :size="size" @click="rowAdd(tabName)">
                     增 行
                   </el-button>
                 </template>
                 <template slot-scope="scope">
                   <el-button
-                    @click.native.prevent="deleteRow(tabName, scope)"
+                    @click.native.prevent="rowDelete(tabName, scope)"
                     type="text"
                     size="small"
                   >

+ 22 - 23
src/views/purchase/contract/index.vue

@@ -1,7 +1,7 @@
 <script>
-import { Columns as TableColumns, SearchColumns } from "./column";
 import { LIST, REMOVE } from "@/api/business/purchase/contract";
-import { initPage, initLayout, initPageSizes, initParams } from "@/utils/init";
+import { Columns as TableColumns, SearchColumns } from "./column";
+import { initPage, initParams, initLayout, initPageSizes } from "@/utils/init";
 export default {
   name: "PuchaseContract",
   components: {
@@ -123,16 +123,13 @@ export default {
       :model="params"
       label-width="75px"
       label-position="right"
+      style="padding: 20px 20px 0"
     >
-      <el-row :gutter="24" style="padding: 20px 20px">
+      <el-row :gutter="20" style="display: flex; flex-wrap: wrap">
         <el-col
           v-for="column in searchColumns"
           :key="column.title"
-          :xl="4"
-          :lg="6"
-          :md="8"
-          :sm="12"
-          :xs="24"
+          :span="column.span || 6"
         >
           <el-form-item :prop="column.key" :label="column.title">
             <el-input
@@ -141,19 +138,21 @@ export default {
             ></el-input>
           </el-form-item>
         </el-col>
-        <el-col :xl="4" :lg="6" :md="8" :sm="12" :xs="24">
-          <el-button
-            circle
-            :size="size"
-            icon="el-icon-search"
-            @click="queryList(params, page)"
-          ></el-button>
-          <el-button
-            circle
-            :size="size"
-            icon="el-icon-refresh"
-            @click="resetList"
-          ></el-button>
+        <el-col :span="8">
+          <el-form-item label-width="0">
+            <el-button
+              circle
+              :size="size"
+              icon="el-icon-search"
+              @click="queryList(params, page)"
+            ></el-button>
+            <el-button
+              circle
+              :size="size"
+              icon="el-icon-refresh"
+              @click="resetList"
+            ></el-button>
+          </el-form-item>
         </el-col>
       </el-row>
     </el-form>
@@ -163,9 +162,9 @@ export default {
       </el-col>
     </el-row>
     <el-table
-      @row-dblclick="openSeeDialog"
-      :data="tableData"
       :size="size"
+      :data="tableData"
+      @row-dblclick="openSeeDialog"
       style="width: 100%; margin: 20px 0 0 0"
     >
       <el-table-column

+ 6 - 6
src/views/purchase/contract/see/index.vue

@@ -34,15 +34,18 @@ export default {
   computed: {},
   watch: {},
   methods: {
+    //
     open(prop) {
       this.visible = true;
       this.fetchItem(prop);
     },
+    //
     hide() {
       this.visible = false;
       this.params = initParams(Columns);
       this.tabName = this.tabColumns[0].key;
     },
+    //
     async fetchItem(prop) {
       try {
         this.loading = true;
@@ -61,10 +64,11 @@ export default {
         this.loading = false;
       }
     },
+    //
     async fetchTable(prop, name) {
       try {
         this.loading = true;
-        const { code, msg, rows } = await TABLELIST({ id: prop }, name);
+        const { code, msg, rows } = await TABLELIST({ contractId: prop }, name);
         if (code === 200) {
           this.params[name] = rows;
           this.$notify.success({ title: msg });
@@ -77,11 +81,7 @@ export default {
         this.loading = false;
       }
     },
-    // 编辑操作
-    // handleOpenEditDrawer(prop) {
-    //   this.setVisible(false);
-    //   this.$parent.$parent.handleOpenEditDrawer(prop);
-    // },
+    //
     setFileList(prop) {
       return prop.split(",").map((file) => ({
         url: file,

+ 1 - 1
src/views/purchase/task/column.js

@@ -1,5 +1,5 @@
 export const TableColumns = [
-  { key: "demandCode", title: "采购需求单号" },
+  { key: "code", title: "订单生成单号", width: 250 },
   { key: "materialCode", title: "物料编码" },
   { key: "materialName", title: "物料名称" },
   // { key: "material", title: "物料" },

+ 18 - 13
src/views/purchase/task/first-direct/index.vue

@@ -10,7 +10,6 @@ export default {
       size: "mini",
       visible: false,
       loading: false,
-
       tableColumns: initColumns(TableColumns),
       data: [],
     };
@@ -18,11 +17,17 @@ export default {
   computed: {},
   watch: {},
   methods: {
-    setVisible(prop) {
-      this.visible = prop;
+    //
+    open(prop) {
+      this.visible = true;
+      this.fetchItem(prop);
+    },
+    //
+    hide() {
+      this.visible = false;
     },
-    // 查询详细
-    async beforeOpenDoSome(prop) {
+    //
+    async fetchItem(prop) {
       try {
         this.loading = true;
         const { code, msg, data } = await FIRSTDIRECT(prop);
@@ -38,12 +43,8 @@ export default {
         this.loading = false;
       }
     },
-    // 取消
-    handleCancel() {
-      this.setVisible(false);
-    },
-    // 保存并新增
-    async handleSubmit() {
+    //
+    async submit() {
       const params = this.data
         .map((item) => ({
           ...item,
@@ -55,15 +56,15 @@ export default {
       try {
         const { code, msg } = await ADD(params);
         if (code === 200) {
+          this.hide();
           this.$notify.success({ title: msg });
-          this.setVisible(false);
         } else {
           this.$notify.warning({ title: msg });
         }
       } catch (err) {
         //
       } finally {
-        // this.setVisible(false);
+        //
       }
     },
   },
@@ -143,6 +144,10 @@ export default {
           </template>
         </el-table-column>
       </el-table>
+      <div slot="footer" style="text-align: right; margin-top: 10px">
+        <el-button :size="size" @click="hide">取 消</el-button>
+        <el-button :size="size" @click="submit">更 新</el-button>
+      </div>
     </div>
     <!-- <el-pagination
       @size-change="handleSizeChange"

+ 127 - 128
src/views/purchase/task/index.vue

@@ -1,16 +1,17 @@
+el-col
 <script>
 import { TableColumns, SearchColumns } from "./column";
-import { LIST, SHUTDOWN, EXPORT } from "@/api/business/purchase/task";
+import { LIST, SHUTDOWN } from "@/api/business/purchase/task";
 import {
   initPage,
+  initDicts,
   initLayout,
-  initPageSizes,
   initParams,
-  initDicts,
+  initPageSizes,
 } from "@/utils/init";
 export default {
   name: "PuchaseTask",
-  dicts: initDicts(TableColumns),
+  dicts: [...initDicts(TableColumns), ...initDicts(SearchColumns)],
   components: {
     SeeDialog: () => import("./see/index.vue"),
     FirstDirectDialog: () => import("./first-direct/index.vue"),
@@ -20,16 +21,12 @@ export default {
   data() {
     return {
       size: "mini",
-
       loading: false,
-
       searchColumns: SearchColumns,
       params: initParams(SearchColumns),
-
       tableData: [],
       selectData: [],
       tableColumns: TableColumns,
-
       page: initPage(),
       layout: initLayout(),
       pageSizes: initPageSizes(),
@@ -38,7 +35,7 @@ export default {
   computed: {},
   watch: {},
   created() {
-    this.handleQueryList(this.params, this.page);
+    this.queryList(this.params, this.page);
   },
   methods: {
     //
@@ -64,41 +61,41 @@ export default {
       }
     },
     // 查询操作
-    handleQueryList(prop, page) {
+    queryList(prop, page) {
       const { date } = prop;
       prop.endDate = date[1];
       prop.startDate = date[0];
       this.fetchList({ ...prop, date: undefined }, page);
     },
     // 重置操作
-    handleResetList() {
+    resetList() {
       this.page = initPage();
       this.params = initParams(SearchColumns);
-      this.handleQueryList(this.params, this.page);
+      this.queryList(this.params, this.page);
     },
     // 页大小变
-    handleSizeChange(prop) {
+    sizeChange(prop) {
       this.page.pageSize = prop;
-      this.handleQueryList(this.params, this.page);
+      this.queryList(this.params, this.page);
     },
     // 当前页变
-    handleCurrentChange(prop) {
+    currentChange(prop) {
       this.page.pageNum = prop;
-      this.handleQueryList(this.params, this.page);
+      this.queryList(this.params, this.page);
     },
     // 选择行
-    handleSelectionChange(prop) {
+    selectionChange(prop) {
       this.selectData = prop;
     },
     // 行关闭
-    async handleShutDown(prop) {
+    async shutDown(prop) {
       try {
         this.loading = true;
         const { demandItemId } = prop;
         const { code, msg } = await SHUTDOWN(demandItemId);
         if (code === 200) {
           this.$notify.success({ title: msg });
-          await this.handleQueryList(this.params, this.page);
+          await this.queryList(this.params, this.page);
         } else {
           this.$notify.warning({ title: msg });
         }
@@ -109,20 +106,20 @@ export default {
       }
     },
     // 退回需求
-    async handleDocumentsReturn(prop) {
+    async openDocumentsReturnDialog(prop) {
       const { setVisible, beforeOpenDoSome } = this.$refs.DocReturnDialog;
       await setVisible(true);
       await beforeOpenDoSome(prop);
     },
     // 转派
-    async handleModifyBuyer(prop) {
+    async openModifyBuyerDialog(prop) {
       const { id } = prop;
       const { setVisible, beforeOpenDoSome } = this.$refs.ModifyBuyerDialog;
       await setVisible(true);
       await beforeOpenDoSome(id);
     },
     // 导出
-    async handleExport(prop, page) {
+    async useExport(prop, page) {
       const { pageNum, pageSize } = page;
       this.download(
         "pu/order/generate/export",
@@ -131,17 +128,15 @@ export default {
       );
     },
     // 打开查看drawer
-    async handleOpenSeeDrawer(prop) {
+    async openSeeDialog(prop) {
       const { id } = prop;
-      const { setVisible, beforeOpenDoSome } = this.$refs.SeeDialog;
-      await setVisible(true);
-      await beforeOpenDoSome(id);
+      const { open } = this.$refs.SeeDialog;
+      await open(id);
     },
     // 打开首次直采drawer
-    async handleOpenFristDirectDrawer(prop) {
-      const { setVisible, beforeOpenDoSome } = this.$refs.FirstDirectDialog;
-      await setVisible(true);
-      await beforeOpenDoSome(prop);
+    async openFristDirectDialog(prop) {
+      const { open } = this.$refs.FirstDirectDialog;
+      await open(prop);
     },
   },
 };
@@ -159,131 +154,135 @@ export default {
     <modify-buyer-dialog ref="ModifyBuyerDialog"></modify-buyer-dialog>
     <el-form
       :size="size"
-      :inline="true"
       :model="params"
-      label-width="75px"
+      label-width="auto"
       label-position="right"
       style="padding: 20px 20px 0"
     >
-      <el-form-item
-        v-for="column in searchColumns"
-        :key="column.title"
-        :prop="column.key"
-        :label="column.title"
-      >
-        <el-input
-          v-if="column.inputType === 'Input'"
-          v-model="params[column.key]"
-          :disabled="column.disabled"
-          :clearable="column.clearable"
-          :placeholder="column.placeholder"
-          style="width: 100%"
-        ></el-input>
-        <el-select
-          v-if="column.inputType === '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.referName]"
-            :key="item.value"
-            :label="item.label"
-            :value="item.value"
-          >
-          </el-option>
-        </el-select>
-        <el-date-picker
-          v-if="column.inputType === 'DatePicker'"
-          v-model="params[column.key]"
-          :type="column.type"
-          :placeholder="column.placeholder"
-          :value-format="column.valueFormat"
-          :unlink-panels="column.unlinkPanels"
-          :picker-options="column.pickerOptions"
-          :range-separator="column.rangeSeparator"
-          :end-placeholder="column.endPlaceholder"
-          :start-placeholder="column.startPlaceholder"
-          style="width: 100%"
-        >
-        </el-date-picker>
-        <dr-popover-select
-          v-if="column.inputType === 'PopoverSelect'"
-          v-model="params[column.key]"
-          :size="size"
-          :source.sync="params"
-          :title="column.title"
-          :type="column.referName"
-          :multiple="column.multiple"
-          :readonly="column.readonly"
-          :value-key="column.valueKey"
-          :placeholder="column.placeholder"
-          :data-mapping="column.dataMapping"
-          :query-params="column.queryParams(params)"
+      <el-row :gutter="20" style="display: flex; flex-wrap: wrap">
+        <el-col
+          v-for="column in searchColumns"
+          :key="column.title"
+          :span="column.span || 6"
         >
-        </dr-popover-select>
-        <dr-popover-tree-select
-          v-if="column.inputType === 'PopoverTreeSelect'"
-          v-model="params[column.key]"
-          :source.sync="params"
-          :title="column.title"
-          :type="column.referName"
-          :multiple="column.multiple"
-          :show-key="column.showKey"
-          :value-key="column.valueKey"
-          :placeholder="column.placeholder"
-          :data-mapping="column.dataMapping"
-          :query-params="column.queryParams(params)"
-        >
-        </dr-popover-tree-select>
-      </el-form-item>
-      <el-form-item>
-        <el-button
-          circle
-          :size="size"
-          icon="el-icon-search"
-          @click="handleQueryList(params, page)"
-        ></el-button>
-        <el-button
-          circle
-          :size="size"
-          icon="el-icon-refresh"
-          @click="handleResetList"
-        ></el-button>
-      </el-form-item>
+          <el-form-item :prop="column.key" :label="column.title">
+            <el-input
+              v-if="column.inputType === 'Input'"
+              v-model="params[column.key]"
+              :disabled="column.disabled"
+              :clearable="column.clearable"
+              :placeholder="column.placeholder"
+              style="width: 100%"
+            ></el-input>
+            <el-select
+              v-if="column.inputType === '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.referName]"
+                :key="item.value"
+                :label="item.label"
+                :value="item.value"
+              >
+              </el-option>
+            </el-select>
+            <el-date-picker
+              v-if="column.inputType === 'DatePicker'"
+              v-model="params[column.key]"
+              :type="column.type"
+              :placeholder="column.placeholder"
+              :value-format="column.valueFormat"
+              :unlink-panels="column.unlinkPanels"
+              :picker-options="column.pickerOptions"
+              :range-separator="column.rangeSeparator"
+              :end-placeholder="column.endPlaceholder"
+              :start-placeholder="column.startPlaceholder"
+              style="width: 100%"
+            >
+            </el-date-picker>
+            <dr-popover-select
+              v-if="column.inputType === 'PopoverSelect'"
+              v-model="params[column.key]"
+              :size="size"
+              :source.sync="params"
+              :title="column.title"
+              :type="column.referName"
+              :multiple="column.multiple"
+              :readonly="column.readonly"
+              :value-key="column.valueKey"
+              :placeholder="column.placeholder"
+              :data-mapping="column.dataMapping"
+              :query-params="column.queryParams(params)"
+            >
+            </dr-popover-select>
+            <dr-popover-tree-select
+              v-if="column.inputType === 'PopoverTreeSelect'"
+              v-model="params[column.key]"
+              :source.sync="params"
+              :title="column.title"
+              :type="column.referName"
+              :multiple="column.multiple"
+              :show-key="column.showKey"
+              :value-key="column.valueKey"
+              :placeholder="column.placeholder"
+              :data-mapping="column.dataMapping"
+              :query-params="column.queryParams(params)"
+            >
+            </dr-popover-tree-select>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label-width="0">
+            <el-button
+              circle
+              :size="size"
+              icon="el-icon-search"
+              @click="queryList(params, page)"
+            ></el-button>
+            <el-button
+              circle
+              :size="size"
+              icon="el-icon-refresh"
+              @click="resetList"
+            ></el-button>
+          </el-form-item>
+        </el-col>
+      </el-row>
     </el-form>
     <el-row :gutter="24" style="padding: 0 20px">
       <el-col :span="24">
-        <el-button :size="size" @click="handleExport(params, page)">
+        <el-button :size="size" @click="useExport(params, page)">
           导 出
         </el-button>
         <el-button
           :size="size"
           :disabled="selectData.length !== 1"
-          @click="handleModifyBuyer(selectData[0])"
+          @click="openModifyBuyerDialog(selectData[0])"
         >
           转 派
         </el-button>
         <el-button
           :size="size"
           :disabled="!selectData.length"
-          @click="handleDocumentsReturn(selectData)"
+          @click="openDocumentsReturnDialog(selectData)"
         >
           退回需求
         </el-button>
         <!-- <el-button
           :size="size"
           :disabled="selectData.length !== 1"
-          @click="handleShutDown(selectData[0])"
+          @click="shutDown(selectData[0])"
         >
           行关闭
         </el-button> -->
         <el-button
           :size="size"
           :disabled="!selectData.length"
-          @click="handleOpenFristDirectDrawer(selectData)"
+          @click="openFristDirectDialog(selectData)"
         >
           协议直采
         </el-button>
@@ -293,8 +292,8 @@ export default {
       :data="tableData"
       size="mini"
       style="width: 100%; margin: 20px 0 0 0"
-      @row-dblclick="handleOpenSeeDrawer"
-      @selection-change="handleSelectionChange"
+      @row-dblclick="openSeeDialog"
+      @selection-change="selectionChange"
     >
       <el-table-column fixed width="55" align="center" type="selection">
       </el-table-column>
@@ -318,8 +317,8 @@ export default {
       </el-table-column>
     </el-table>
     <el-pagination
-      @size-change="handleSizeChange"
-      @current-change="handleCurrentChange"
+      @size-change="sizeChange"
+      @current-change="currentChange"
       :total="page.total"
       :page-sizes="pageSizes"
       :page-size="page.pageSize"

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

@@ -19,11 +19,17 @@ export default {
   computed: {},
   watch: {},
   methods: {
-    setVisible(prop) {
-      this.visible = prop;
+    //
+    open(prop) {
+      this.visible = true;
+      this.fetchItem(prop);
+    },
+    //
+    hide() {
+      this.visible = false;
     },
     // 查询详细
-    async beforeOpenDoSome(prop) {
+    async fetchItem(prop) {
       try {
         this.loading = true;
         const { code, msg, data } = await ITEM(prop);
@@ -46,10 +52,7 @@ export default {
 };
 </script>
 <template>
-  <el-dialog
-    :visible.sync="visible"
-    title="明细"
-  >
+  <el-dialog :visible.sync="visible" title="明细">
     <el-descriptions :column="2" border>
       <el-descriptions-item
         v-if="params[column.key]"