戴艳蓉 3 年之前
父節點
當前提交
09e7528e43
共有 2 個文件被更改,包括 232 次插入190 次删除
  1. 24 1
      src/views/goodStore/sort/addEdit.vue
  2. 208 189
      src/views/serviceParam/workCompany/index.vue

+ 24 - 1
src/views/goodStore/sort/addEdit.vue

@@ -140,18 +140,22 @@ export default {
   methods: {
     async initForm() {
       this.loading = true;
+      await this.resetForm();
       if (this.id === "003") {
         this.title = "添加分类";
         this.rulesThis = this.rules;
       } else if (this.id === "005") {
         this.title = "修改分类";
         this.rulesThis = this.rules;
+        await this.initData();
       } else {
         this.title = "分类详情";
         this.rulesThis = {};
+        await this.initData();
       }
-      await this.resetForm();
+
       await this.getAllSpecs();
+
       this.loading = false;
     },
 
@@ -185,6 +189,25 @@ export default {
         this.$message.warning(res.message);
       }
     },
+    async initData() {
+      const res = await asyncRequest.detail({ id: this.sitem.id });
+      if (res && res.code === 0 && res.data) {
+        console.log(res.data);
+        const { pid, id, cat_name, cat_desc, specs_id, fund_code } = res.data;
+        this.ruleForm = {
+          pid: pid || "",
+          id: id || "",
+          cat_name: cat_name || "",
+          specs_id: specs_id || [],
+          fund_code: fund_code || "",
+          cat_desc: cat_desc || "",
+        };
+      } else if (res && res.code >= 100 && res.code <= 104) {
+        await this.logout();
+      } else {
+        this.$message.warning(res.message);
+      }
+    },
     async submitForm() {
       await this.$refs.ruleForm.validate(async (valid) => {
         if (valid) {

+ 208 - 189
src/views/serviceParam/workCompany/index.vue

@@ -3,173 +3,207 @@
     <div
       v-if="powers && powers.length > 0 && powers.some((item) => item == '001')"
     >
-      <el-row style="padding: 10px 0 10px 0">
-        <el-col :span="6" style="width: 292px">
-          <period-date-picker
-            :type="1"
-            :width="'135px'"
-            :size="searchSize"
-            :start="parmValue.start"
-            :end="parmValue.end"
-            @timeReturned="handleTime"
-          />
-        </el-col>
-        <el-col :span="3" style="width: 160px; padding: 0 0 0 10px">
-          <el-select
-            v-model="parmValue.status"
-            filterable
-            clearable
-            :size="searchSize"
-            placeholder="业务企业状态"
-            style="width: 100%"
-          >
-            <el-option
-              v-for="item in statusOptions"
-              :key="'status' + item.id"
-              :label="item.label"
-              :value="item.id"
-            />
-          </el-select>
-        </el-col>
-
-        <el-col :span="3" style="width: 66px; float: right">
-          <el-button
-            type="primary"
-            :size="searchSize"
-            class="fr"
-            @click="searchList"
-          >
-            刷新
-          </el-button>
-        </el-col>
-        <el-col :span="3" style="width: 66px; float: right">
-          <el-button
-            type="warning"
-            class="fr"
-            :size="searchSize"
-            @click="restSearch"
-          >
-            重置
-          </el-button>
-        </el-col>
-      </el-row>
-      <el-row style="padding: 0 0 10px 0">
-        <el-col :span="8" style="width: 292px">
-          <el-input
-            :size="searchSize"
-            v-model="parmValue.company"
-            :maxlength="100"
-            placeholder="公司名称"
-          />
-        </el-col>
-        <el-col :span="8" style="width: 160px; padding: 0 0 0 10px">
-          <el-input
-            :size="searchSize"
-            v-model="parmValue.creater"
-            :maxlength="100"
-            placeholder="创建人"
-          />
-        </el-col>
-
-        <el-col :span="3" style="width: 66px; float: right">
-          <el-button
-            v-if="powers.some((item) => item == '003')"
-            :size="searchSize"
-            type="success"
-            class="fr"
-            @click="openModal('', '003')"
-          >
-            添加
-          </el-button>
-        </el-col>
-      </el-row>
-      <el-table
-        v-loading="false"
+      <ex-table
+        v-loading="loading"
+        :table="table"
         :data="tableData"
+        :columns="columns"
+        :page="pageInfo"
         :size="size"
-        border
-        style="width: 100%"
+        @page-curr-change="handlePageChange"
+        @page-size-change="handleSizeChange"
+        @screen-reset="
+          pageInfo.curr = 1;
+          parmValue.page = 1;
+          searchList();
+        "
+        @screen-submit="
+          pageInfo.curr = 1;
+          parmValue.page = 1;
+          searchList();
+        "
       >
-        <el-table-column prop="id" label="ID" width="100"> </el-table-column>
-        <el-table-column label="类型" width="100">
-          <template slot-scope="scope">
-            <el-tag
-              :size="tablebtnSize"
-              :type="scope.row.kh == 0 ? 'success' : ''"
-              v-text="
-                (statusOptions.find((item) => item.id == scope.row.kh) || {})
-                  .label || '--'
-              "
-            ></el-tag>
-          </template>
-        </el-table-column>
-        <el-table-column prop="name" label="名称"> </el-table-column>
-        <el-table-column prop="code" label="编码"> </el-table-column>
+        <template #table-header="{}">
+          <div style="width: 100%">
+            <el-row style="padding: 0 0 10px 80px">
+              <el-col :span="6" style="width: 303px">
+                <period-date-picker
+                  :type="1"
+                  :width="'135px'"
+                  :size="searchSize"
+                  :start="parmValue.start"
+                  :end="parmValue.end"
+                  @timeReturned="handleTime"
+                />
+              </el-col>
+              <el-col :span="4" style="width: 160px">
+                <el-select
+                  v-model="parmValue.status"
+                  filterable
+                  clearable
+                  :size="searchSize"
+                  placeholder="状态"
+                  style="width: 100%"
+                  @change="
+                    pageInfo.curr = 1;
+                    parmValue.page = 1;
+                    searchList();
+                  "
+                >
+                  <el-option
+                    v-for="item in statusList"
+                    :key="'status' + item.code"
+                    :label="item.name"
+                    :value="item.code"
+                  />
+                </el-select>
+              </el-col>
 
-        <el-table-column fixed="right" label="操作" width="50">
-          <template slot-scope="scope">
-            <el-tooltip
-              v-if="powers.some((item) => item == '007')"
-              effect="dark"
-              content="详情"
-              placement="top"
-            >
-              <i
-                class="el-icon-view tb-icon"
-                @click="openModal(scope.row.id, '007')"
-              ></i>
-            </el-tooltip>
-            <el-tooltip
-              v-if="powers.some((item) => item == '005')"
-              effect="dark"
-              content="修改"
-              placement="top"
-            >
-              <i
-                class="el-icon-edit tb-icon"
-                @click="openModal(scope.row.id, '005')"
-              ></i>
-            </el-tooltip>
-            <el-tooltip
-              v-if="
-                powers.some((item) => item == '004') && scope.row.status === '0'
-              "
-              effect="dark"
-              content="禁用"
-              placement="top"
-            >
-              <i
-                class="el-icon-video-pause tb-icon"
-                @click="statusConfirm(scope.row.id, scope.row.status)"
-              ></i>
-            </el-tooltip>
-            <el-tooltip
-              v-if="
-                powers.some((item) => item == '004') && scope.row.status === '1'
-              "
-              effect="dark"
-              content="启用"
-              placement="top"
-            >
-              <i
-                class="el-icon-video-play tb-icon"
-                @click="statusConfirm(scope.row.id, scope.row.status)"
-              ></i>
-            </el-tooltip>
-            <el-tooltip
-              v-if="powers.some((item) => item == '006')"
-              effect="dark"
-              content="删除"
-              placement="top"
-            >
-              <i
-                class="el-icon-delete tb-icon"
-                @click="deleteById(scope.row.id)"
-              ></i>
-            </el-tooltip>
-          </template>
-        </el-table-column>
-      </el-table>
+              <el-col
+                :span="3"
+                class="fr"
+                style="width: 66px; padding: 0 0 0 10px"
+              >
+                <el-button
+                  type="primary"
+                  :size="searchSize"
+                  @click="searchList"
+                >
+                  刷新
+                </el-button>
+              </el-col>
+              <el-col
+                :span="3"
+                class="fr"
+                style="width: 66px; padding: 0 0 0 10px"
+              >
+                <el-button
+                  type="warning"
+                  :size="searchSize"
+                  @click="restSearch"
+                >
+                  重置
+                </el-button>
+              </el-col>
+            </el-row>
+            <el-row>
+              <el-col :span="4" style="width: 373px">
+                <el-input
+                  :size="searchSize"
+                  v-model="parmValue.company"
+                  :maxlength="40"
+                  @blur="
+                    pageInfo.curr = 1;
+                    parmValue.page = 1;
+                    searchList();
+                  "
+                  placeholder="公司名称"
+                ></el-input>
+              </el-col>
+              <el-col :span="4" style="width: 170px; padding: 0 0 0 10px">
+                <el-input
+                  :size="searchSize"
+                  v-model="parmValue.creater"
+                  :maxlength="40"
+                  @change="
+                    pageInfo.curr = 1;
+                    parmValue.page = 1;
+                    searchList();
+                  "
+                  placeholder="创建人"
+                ></el-input>
+              </el-col>
+              <el-col
+                :span="3"
+                class="fr"
+                style="width: 66px; padding: 0 0 0 10px"
+                v-if="powers.some((item) => item == '003')"
+              >
+                <el-button
+                  :size="searchSize"
+                  type="success"
+                  style="float: right"
+                  @click="openModal({}, '003')"
+                >
+                  添加
+                </el-button>
+              </el-col>
+            </el-row>
+          </div></template
+        >
+        <template #status="{ scope }">
+          <el-tag
+            :size="tablebtnSize"
+            :type="scope.row.status == '1' ? 'warning' : ''"
+            v-text="
+              (statusOptions.find((item) => item.id == scope.row.status) || {})
+                .label || '--'
+            "
+          ></el-tag>
+        </template>
+
+        <template #operation="{ scope }">
+          <el-tooltip
+            v-if="powers.some((item) => item == '007')"
+            effect="dark"
+            content="详情"
+            placement="top"
+          >
+            <i
+              class="el-icon-view tb-icon"
+              @click="openModal(scope.row, '007')"
+            ></i>
+          </el-tooltip>
+          <el-tooltip
+            v-if="powers.some((item) => item == '005')"
+            effect="dark"
+            content="修改"
+            placement="top"
+          >
+            <i
+              class="el-icon-edit tb-icon"
+              @click="openModal(scope.row, '005')"
+            ></i>
+          </el-tooltip>
+          <el-tooltip
+            v-if="
+              powers.some((item) => item == '004') && scope.row.status === '0'
+            "
+            effect="dark"
+            content="禁用"
+            placement="top"
+          >
+            <i
+              class="el-icon-video-pause tb-icon"
+              @click="changeStatus(scope.row.id, scope.row.status)"
+            ></i>
+          </el-tooltip>
+          <el-tooltip
+            v-if="
+              powers.some((item) => item == '004') && scope.row.status === '1'
+            "
+            effect="dark"
+            content="启用"
+            placement="top"
+          >
+            <i
+              class="el-icon-video-play tb-icon"
+              @click="changeStatus(scope.row.id, scope.row.status)"
+            ></i>
+          </el-tooltip>
+          <el-tooltip
+            v-if="powers.some((item) => item == '006')"
+            effect="dark"
+            content="删除"
+            placement="top"
+          >
+            <i
+              class="el-icon-delete tb-icon"
+              @click="deleteById(scope.row.id)"
+            ></i>
+          </el-tooltip>
+        </template>
+      </ex-table>
       <add-edit
         :id="modelId"
         :show-model="showModel"
@@ -250,45 +284,30 @@ export default {
       // 表格 - 列参数
       columns: [
         {
-          prop: "wsm_code",
+          prop: "companyNo",
           label: "编号",
-          width: "170px",
-        },
-        {
-          prop: "name",
-          label: "仓库名称",
-        },
-        {
-          prop: "supplierNo",
-          label: "供应商编号",
-          width: "140px",
+          "max-width": "170px",
         },
+
         {
-          prop: "supplier_name",
-          label: "供应商公司",
-          "min-width": "140px",
+          prop: "company",
+          label: "公司名称",
         },
         {
           prop: "status",
           label: "状态",
-          width: "60px",
-          // sortable: true,
+          "max-width": "60px",
           _slot_: "status",
         },
         {
-          prop: "contactor_name",
+          prop: "creater",
           label: "负责人",
-          width: "70px",
-        },
-        {
-          prop: "mobile",
-          label: "负责人电话",
-          width: "100px",
         },
+
         {
           prop: "addtime",
           label: "创建时间",
-          width: "140px",
+          "max-width": "145px",
         },
         {
           prop: "",
@@ -301,8 +320,8 @@ export default {
       ],
       // 状态
       statusOptions: [
-        { id: "0", label: "用" },
-        { id: "1", label: "用" },
+        { id: "0", label: "用" },
+        { id: "1", label: "用" },
       ],
     };
   },