戴艳蓉 пре 3 година
родитељ
комит
4167391af8

+ 2 - 2
src/apis/service/serviceParam/business/index.js

@@ -7,13 +7,13 @@ export default {
     // 组织新建
     zadd: (data, params) => http(api + "customercreate", data, "post", params),
     // 组织详情
-    zdetail: (data, params) => http(api + "customarinfo", data, "post", params),
+    zdetail: (data, params) => http(api + "customerselect", data, "post", params),
     // 组织更新
     zupdate: (data, params) => http(api + "customerupdate", data, "post", params),
     // 组织删除
     zdelete: (data, params) => http(api + "customerdelect", data, "post", params),
     // 组织状态
-    zstatus: (data, params) => http(api + "resultstatu", data, "post", params),
+    zstatus: (data, params) => http(api + "customerstatus", data, "post", params),
 
 
     // 企业新建

+ 70 - 40
src/views/goodStore/goodsCost/components/baseForm.vue

@@ -39,7 +39,7 @@
               <el-input
                 placeholder="商品名称"
                 maxlength="100"
-                :disabled="type === 'view'||type === 'editCoin'"
+                :disabled="type === 'view' || type === 'editCoin'"
                 v-model="ruleForm.good_name"
               ></el-input>
             </el-form-item>
@@ -50,7 +50,9 @@
               <search-work-company
                 :value="ruleForm.company_id"
                 :placeholder="'业务公司'"
-                :disabled="type === 'view' || type === 'editBase'||type === 'editCoin'"
+                :disabled="
+                  type === 'view' || type === 'editBase' || type === 'editCoin'
+                "
                 :size="'mini'"
                 :isDetail="type !== 'add'"
                 @searchChange="company_idsearchChange"
@@ -62,7 +64,7 @@
               <search-supplier
                 :value="ruleForm.supplierNo"
                 :placeholder="'供应商'"
-                :disabled="type === 'view' ||type === 'editCoin'"
+                :disabled="type === 'view' || type === 'editCoin'"
                 :size="'mini'"
                 :isDetail="type !== 'add'"
                 @searchChange="supplierNosearchChange"
@@ -75,7 +77,7 @@
                 v-model="ruleForm.is_auth"
                 filterable
                 clearable
-                :disabled="type === 'view'||type === 'editCoin'"
+                :disabled="type === 'view' || type === 'editCoin'"
                 style="width: 100%"
                 placeholder="销售权限"
               >
@@ -92,7 +94,7 @@
             <el-form-item label="商品品牌" prop="brandid">
               <search-brand
                 :value="ruleForm.brandid"
-                :disabled="type === 'view'||type === 'editCoin'"
+                :disabled="type === 'view' || type === 'editCoin'"
                 :size="'mini'"
                 :isDetail="type !== 'add'"
                 :names="brand_name"
@@ -105,7 +107,7 @@
             <el-form-item label="商品单位" prop="unit">
               <search-unit
                 :value="ruleForm.unit"
-                :disabled="type === 'view' ||type === 'editCoin'"
+                :disabled="type === 'view' || type === 'editCoin'"
                 :size="'mini'"
                 :isDetail="type !== 'add'"
                 :names="unit_name"
@@ -120,7 +122,7 @@
                 v-model="ruleForm.is_exclusive"
                 filterable
                 clearable
-                :disabled="type === 'view'||type === 'editCoin'"
+                :disabled="type === 'view' || type === 'editCoin'"
                 style="width: 100%"
                 placeholder="专属类型"
               >
@@ -139,7 +141,7 @@
               <el-input
                 placeholder="商品总重量"
                 v-model="ruleForm.weight"
-                :disabled="type === 'view'||type === 'editCoin'"
+                :disabled="type === 'view' || type === 'editCoin'"
                 type="number"
                 :min="0"
                 :max="9999999999.99"
@@ -155,7 +157,9 @@
                 v-model="ruleForm.is_stock"
                 filterable
                 clearable
-                :disabled="type === 'view' || type === 'editBase'||type === 'editCoin'"
+                :disabled="
+                  type === 'view' || type === 'editBase' || type === 'editCoin'
+                "
                 style="width: 100%"
                 placeholder="是否库存品"
               >
@@ -172,7 +176,9 @@
             <el-form-item label="税点" prop="tax">
               <search-tax
                 :value="ruleForm.tax"
-                :disabled="type === 'view' || type === 'editBase'||type === 'editCoin'"
+                :disabled="
+                  type === 'view' || type === 'editBase' || type === 'editCoin'
+                "
                 :size="'mini'"
                 :isDetail="type !== 'add'"
                 :placeholder="'税点'"
@@ -185,7 +191,9 @@
               <el-input
                 placeholder="贵金属重量"
                 v-model="ruleForm.noble_weight"
-                :disabled="type === 'view' || type === 'editBase'||type === 'editCoin'"
+                :disabled="
+                  type === 'view' || type === 'editBase' || type === 'editCoin'
+                "
                 type="number"
                 :min="0"
                 :max="9999999999.99"
@@ -199,7 +207,9 @@
             <el-form-item label="贵金属种类" prop="noble_metal">
               <search-metal-kind
                 :value="ruleForm.noble_metal"
-                :disabled="type === 'view' || type === 'editBase'||type === 'editCoin'"
+                :disabled="
+                  type === 'view' || type === 'editBase' || type === 'editCoin'
+                "
                 :size="'mini'"
                 :isDetail="type !== 'add'"
                 :placeholder="'贵金属种类'"
@@ -213,7 +223,9 @@
                 v-model="ruleForm.is_gold_price"
                 filterable
                 clearable
-                :disabled="type === 'view' || type === 'editBase'||type === 'editCoin'"
+                :disabled="
+                  type === 'view' || type === 'editBase' || type === 'editCoin'
+                "
                 style="width: 100%"
                 placeholder="启用实时金价"
               >
@@ -232,7 +244,7 @@
               <el-input
                 type="textarea"
                 :rows="4"
-                :disabled="type === 'view'||type === 'editCoin'"
+                :disabled="type === 'view' || type === 'editCoin'"
                 placeholder="售后说明"
                 v-model="ruleForm.after_sales"
               >
@@ -244,7 +256,7 @@
               <el-input
                 type="textarea"
                 :rows="4"
-                :disabled="type === 'view'||type === 'editCoin'"
+                :disabled="type === 'view' || type === 'editCoin'"
                 placeholder="商品备注"
                 v-model="ruleForm.good_remark"
               >
@@ -255,7 +267,7 @@
             <el-form-item label="工艺说明" prop="craft_desc">
               <el-input
                 type="textarea"
-                :disabled="type === 'view'||type === 'editCoin'"
+                :disabled="type === 'view' || type === 'editCoin'"
                 :rows="4"
                 placeholder="工艺说明"
                 v-model="ruleForm.craft_desc"
@@ -268,7 +280,9 @@
               <el-select
                 v-model="ruleForm.good_type"
                 filterable
-                :disabled="type === 'view' || type === 'editBase'||type === 'editCoin'"
+                :disabled="
+                  type === 'view' || type === 'editBase' || type === 'editCoin'
+                "
                 clearable
                 style="width: 100%"
                 placeholder="是否定制"
@@ -288,7 +302,7 @@
                 placeholder="定制起订量"
                 v-model="ruleForm.moq"
                 type="number"
-                :disabled="type === 'view'||type === 'editCoin'"
+                :disabled="type === 'view' || type === 'editCoin'"
                 :min="0"
                 :max="9999999999"
                 :step="0"
@@ -300,7 +314,7 @@
               <el-input
                 placeholder="定制工期"
                 v-model="ruleForm.customized"
-                :disabled="type === 'view'||type === 'editCoin'"
+                :disabled="type === 'view' || type === 'editCoin'"
                 type="number"
                 :min="0"
                 :max="9999999999"
@@ -332,7 +346,10 @@
         >
           <el-table-column prop="spec_value" label="规格类型" />
           <el-table-column prop="spec_value_value" label="规格值" />
-          <el-table-column fixed="right" v-if="type === 'add'||type === 'editBase'">
+          <el-table-column
+            fixed="right"
+            v-if="type === 'add' || type === 'editBase'"
+          >
             <template slot="header" slot-scope="scope">
               <span>操作</span>
               <el-tooltip
@@ -355,7 +372,10 @@
                 size="small"
                 >修改</el-button
               >
-              <el-button type="text" size="small" @click="openEdit('0', {})"
+              <el-button
+                type="text"
+                size="small"
+                @click="openDelete(scope.$index)"
                 >移除</el-button
               >
             </template>
@@ -386,7 +406,7 @@
             <el-form-item label="包装清单" prop="packing_list">
               <el-input
                 placeholder="包装清单"
-                :disabled="type === 'view'||type === 'editCoin'"
+                :disabled="type === 'view' || type === 'editCoin'"
                 v-model="ruleForm.packing_list"
                 maxlength="250"
               />
@@ -396,7 +416,7 @@
             <el-form-item label="包装方式" prop="packing_way">
               <el-input
                 placeholder="包装方式"
-                :disabled="type === 'view'||type === 'editCoin'"
+                :disabled="type === 'view' || type === 'editCoin'"
                 v-model="ruleForm.packing_way"
                 maxlength="250"
               />
@@ -406,7 +426,7 @@
             <el-form-item label="装箱规格" prop="packing_spec">
               <el-input
                 placeholder="装箱规格"
-                :disabled="type === 'view'||type === 'editCoin'"
+                :disabled="type === 'view' || type === 'editCoin'"
                 v-model="ruleForm.packing_spec"
                 maxlength="250"
               />
@@ -416,7 +436,7 @@
             <el-form-item label="装箱重量" prop="packing_weight">
               <el-input
                 placeholder="装箱重量"
-                :disabled="type === 'view'||type === 'editCoin'"
+                :disabled="type === 'view' || type === 'editCoin'"
                 v-model="ruleForm.packing_weight"
                 type="number"
                 :min="0"
@@ -431,7 +451,7 @@
             <el-form-item label="装箱尺寸" prop="packing_size">
               <el-input
                 placeholder="装箱尺寸"
-                :disabled="type === 'view'||type === 'editCoin'"
+                :disabled="type === 'view' || type === 'editCoin'"
                 v-model="ruleForm.packing_size"
                 maxlength="250"
               />
@@ -442,7 +462,7 @@
             <el-form-item label="商品条形码" prop="good_bar">
               <el-input
                 placeholder="物流时间"
-                :disabled="type === 'view'||type === 'editCoin'"
+                :disabled="type === 'view' || type === 'editCoin'"
                 v-model="ruleForm.good_bar"
                 type="number"
                 :min="0"
@@ -471,7 +491,7 @@
                 v-model="ruleForm.supply_area"
                 filterable
                 clearable
-                :disabled="type === 'view'||type === 'editCoin'"
+                :disabled="type === 'view' || type === 'editCoin'"
                 style="width: 100%"
                 placeholder="供货区域"
               >
@@ -490,7 +510,7 @@
                 :placeholder="'发货地'"
                 :value="ruleForm.delivery_place"
                 :is-detail="id !== 'add'"
-                :disabled="type === 'view'||type === 'editCoin'"
+                :disabled="type === 'view' || type === 'editCoin'"
                 :size="'mini'"
                 @selectChange="selectAreadelivery_place"
               />
@@ -503,7 +523,7 @@
                 :value="ruleForm.origin_place"
                 :size="'mini'"
                 :is-detail="id !== 'add'"
-                :disabled="type === 'view'||type === 'editCoin'"
+                :disabled="type === 'view' || type === 'editCoin'"
                 @selectChange="selectAreaorigin_place"
               />
             </el-form-item>
@@ -515,7 +535,7 @@
                 v-model="ruleForm.delivery_day"
                 type="number"
                 :min="0"
-                :disabled="type === 'view'||type === 'editCoin'"
+                :disabled="type === 'view' || type === 'editCoin'"
                 :max="9999999999"
                 :step="0"
               >
@@ -530,7 +550,7 @@
                 v-model="ruleForm.lead_time"
                 type="number"
                 :min="0"
-                :disabled="type === 'view'||type === 'editCoin'"
+                :disabled="type === 'view' || type === 'editCoin'"
                 :max="9999999999"
                 :step="0"
               >
@@ -545,7 +565,7 @@
                 v-model="ruleForm.sample_day"
                 type="number"
                 :min="0"
-                :disabled="type === 'view'||type === 'editCoin'"
+                :disabled="type === 'view' || type === 'editCoin'"
                 :max="9999999999"
                 :step="0"
               >
@@ -582,7 +602,7 @@
                 <i v-else class="el-icon-plus avatar-uploader-icon"></i>
                 <file-upload
                   class="Upload"
-                  :disabled="type === 'view'||type === 'editCoin'"
+                  :disabled="type === 'view' || type === 'editCoin'"
                   :accept="'.jpg,.png,.jpeg'"
                   :multiple="true"
                   :uploadcondition="beforeAvatarUpload"
@@ -636,7 +656,7 @@
                     <div class="img-show-li-div">
                       <img :src="img" class="img-show" alt="" />
                       <i
-                        v-if="type == 'add'||type==='editBase'"
+                        v-if="type == 'add' || type === 'editBase'"
                         class="el-icon-close"
                         @click="closeImg(iindex)"
                       ></i>
@@ -644,14 +664,17 @@
                   </li>
                   <li
                     class="img-show-li"
-                    v-if="ruleForm.good_info_img.length < 10 && (type == 'add'||type==='editBase')"
+                    v-if="
+                      ruleForm.good_info_img.length < 10 &&
+                      (type == 'add' || type === 'editBase')
+                    "
                   >
                     <div class="activity-upload">
                       <div class="btnupload" style="position: relative">
                         <i class="el-icon-plus avatar-uploader-icon"></i>
                         <file-upload
                           class="Upload"
-                          :disabled="type === 'view'||type === 'editCoin'"
+                          :disabled="type === 'view' || type === 'editCoin'"
                           :accept="'.jpg,.png,.jpeg'"
                           :multiple="true"
                           :uploadcondition="beforeAvatarUpload"
@@ -876,10 +899,11 @@
                       @click="openCostEdit(scope.$index, scope.row)"
                     ></i>
                   </el-tooltip>
-                  <el-tooltip effect="dark" content="禁/启用" placement="top">
+
+                  <el-tooltip effect="dark" content="删除" placement="top">
                     <i
-                      class="el-icon-video-pause tb-icon"
-                      @click="openCostEdit('')"
+                      class="el-icon-delete tb-icon"
+                      @click="openCostEditDelete(scope.$index)"
                     ></i>
                   </el-tooltip>
                 </template>
@@ -1013,6 +1037,12 @@ export default {
       this.costsitem = sitem;
       this.costshowModel = true;
     },
+    openDelete(index) {
+      this.spec_tableData.splice(index, 1);
+    },
+    openCostEditDelete(index) {
+      this.ladder_tableData.splice(index, 1);
+    },
     async submitForm() {
       await this.$refs.ruleForm.validate(async (valid) => {
         if (valid) {

+ 5 - 4
src/views/goodStore/goodsOnline/add.vue

@@ -143,9 +143,7 @@
                 width="110"
                 show-overflow-tooltip
               />
-              <el-table-column
-                fixed="right"
-              >
+              <el-table-column fixed="right">
                 <template slot="header" slot-scope="scope">
                   <span>操作</span>
                   <el-tooltip
@@ -171,7 +169,7 @@
                   <el-tooltip effect="dark" content="删除" placement="top">
                     <i
                       class="el-icon-delete tb-icon"
-                      @click="openEdit('0', {})"
+                      @click="openCostEditDelete(scope.$index)"
                     ></i>
                   </el-tooltip>
                 </template>
@@ -272,6 +270,9 @@ export default {
       this.costsitem = sitem;
       this.costshowModel = true;
     },
+    openCostEditDelete(index) {
+      this.tableData.splice(index, 1);
+    },
     resultList(e) {
       let list = JSON.parse(JSON.stringify(e));
       let oldList = JSON.parse(JSON.stringify(this.tableData));

+ 129 - 61
src/views/serviceParam/business/addEdit.vue

@@ -30,6 +30,7 @@
                   <el-select
                     v-model="ruleForm.region"
                     style="width: 100%"
+                    :disabled="isDetail == '007'"
                     placeholder="请选择组织/企业"
                   >
                     <el-option label="组织" value="0"></el-option>
@@ -49,20 +50,20 @@
               </el-col>
 
               <el-col :span="24" v-if="ruleForm.region === '0'">
-                <el-form-item label="组织名称:" prop="region">
+                <el-form-item label="组织名称:" prop="name">
                   <el-input
-                    v-model="ruleForm.companyName"
-                    :disabled="id == '007'"
+                    v-model="ruleForm.name"
+                    :disabled="isDetail == '007'"
                     placeholder="组织名称"
                     minlength="50"
                   />
                 </el-form-item>
               </el-col>
               <el-col :span="24" v-if="ruleForm.region === '1'">
-                <el-form-item label="企业名称:" prop="region">
+                <el-form-item label="企业名称:" prop="companyName">
                   <el-input
                     v-model="ruleForm.companyName"
-                    :disabled="id == '007'"
+                    :disabled="iisDetail == '007'"
                     placeholder="企业名称"
                     minlength="50"
                     ><template v-if="organName" slot="prepend">{{
@@ -79,50 +80,36 @@
                   style="width: 100%"
                 >
                   <el-table-column
-                    prop="spec_value"
+                    prop="contactor"
                     label="联系人"
-                    width="100"
+                    min-width="100"
                   />
                   <el-table-column
-                    prop="spec_value_value"
+                    prop="commobile"
                     label="联系电话"
-                    width="100"
+                    min-width="100"
                   />
                   <el-table-column
-                    prop="spec_value_value"
+                    prop="position"
                     label="职位"
-                    width="100"
+                    min-width="100"
                   />
                   <el-table-column
-                    prop="spec_value_value"
+                    prop="comdepart"
                     label="所在部门"
-                    width="100"
+                    min-width="100"
                   />
                   <el-table-column
-                    prop="spec_value_value"
+                    prop="wxaccount"
                     label="微信号"
-                    width="100"
-                  />
-                  <el-table-column
-                    prop="spec_value_value"
-                    label="qq"
-                    width="100"
-                  />
-                  <el-table-column
-                    prop="spec_value_value"
-                    label="邮箱"
-                    width="100"
+                    min-width="100"
                   />
                   <el-table-column
-                    prop="spec_value_value"
-                    label="拥有者"
-                    width="100"
-                  />
-                  <el-table-column
-                    prop="spec_value_value"
-                    label="公开情况"
-                    width="100"
+                    prop="qqaccount"
+                    label="qq号"
+                    min-width="100"
                   />
+                  <el-table-column prop="email" label="邮箱" min-width="100" />
                   <el-table-column fixed="right">
                     <template slot="header" slot-scope="scope">
                       <span>操作</span>
@@ -140,18 +127,22 @@
                       </el-tooltip>
                     </template>
                     <template slot-scope="scope">
-                      <el-button
-                        @click="openEdit(scope.$index, scope.row)"
-                        type="text"
-                        size="small"
-                        >修改</el-button
-                      >
-                      <el-button
-                        type="text"
-                        size="small"
-                        @click="openEdit('0', {})"
-                        >移除</el-button
+                      <el-tooltip effect="dark" content="修改" placement="top">
+                        <i
+                          class="el-icon-edit tb-icon"
+                          @click="openEdit(scope.$index, scope.row)"
+                        ></i>
+                      </el-tooltip>
+                      <el-tooltip
+                        effect="dark"
+                        content="禁/启用"
+                        placement="top"
                       >
+                        <i
+                          class="el-icon-delete tb-icon"
+                          @click="openDelete(scope.$index)"
+                        ></i>
+                      </el-tooltip>
                     </template>
                   </el-table-column>
                 </el-table>
@@ -164,13 +155,13 @@
               </el-col>
               <el-col :span="24" style="text-align: right">
                 <el-button
-                  v-if="id !== '007'"
+                  v-if="isDetail !== '007'"
                   type="primary"
                   @click="submitForm"
                   >保 存
                 </el-button>
                 <el-button @click="showModelThis = false">{{
-                  id == "007" ? "关 闭" : "取 消"
+                  isDetail == "007" ? "关 闭" : "取 消"
                 }}</el-button>
               </el-col>
             </el-row>
@@ -186,7 +177,7 @@ import asyncRequest from "@/apis/service/serviceParam/business";
 import contactModal from "./contactModal";
 export default {
   name: "goodsBack",
-  props: ["showModel", "isDetail", "id", "organ"],
+  props: ["showModel", "isDetail", "id", "organ", "kh"],
   mixins: [resToken],
   components: {
     contactModal,
@@ -202,6 +193,8 @@ export default {
       ruleForm: {},
       rulesThis: this.rules,
       organName: "",
+      tableData: [],
+      old_tableData: [],
       rules: {
         region: [
           {
@@ -243,6 +236,8 @@ export default {
   methods: {
     async initForm() {
       this.loading = true;
+      this.tableData = [];
+      this.old_tableData = [];
 
       await this.resetForm();
       if (this.isDetail === "003") {
@@ -277,6 +272,9 @@ export default {
       this.sitem = sitem;
       this.editModel = true;
     },
+    openDelete(index) {
+      this.tableData.splice(index, 1);
+    },
     async resetForm() {
       await this.$nextTick(() => {
         if (this.$refs.ruleForm) {
@@ -293,25 +291,44 @@ export default {
       });
     },
     async initData() {
-      const res = await asyncRequest.zdetail({ id: this.id });
-      if (res && res.code === 0) {
-        const { action_collect, share_user, to_user, to_group, action } =
-          res.data;
-        this.ruleForm.collect = action_collect.split(",");
-        this.ruleForm.userid = share_user.split(",");
-        this.ruleForm.touserid = to_user === "" ? [] : to_user.split(",");
-        this.ruleForm.togroupid = to_group === "" ? [] : to_group.split(",");
-        this.ruleForm.action = action;
-        await this.resetForm();
-      } else if (res && res.code >= 100 && res.code <= 104) {
+      let res = {};
+      console.log(this.kh);
+      if (this.kh + "" === "0") {
+        res = await asyncRequest.zdetail({ id: this.id });
+      } else {
+        res = await asyncRequest.qdetail({ id: this.id });
+      }
+      if (res.code === 0) {
+        const { pid, name, pname, companyName, parent, member } = res.data;
+        this.organName = pname;
+        this.ruleForm = {
+          id: this.id,
+          region: this.kh + "" || "0",
+          pid: parent || pid || "",
+          name: name || "",
+          companyName: companyName || "",
+        };
+        if (member && member.length > 0) {
+          this.old_tableData = JSON.parse(JSON.stringify(member));
+          this.tableData = JSON.parse(JSON.stringify(member));
+        } else {
+          this.old_tableData = [];
+          this.tableData = [];
+        }
+      } else if (res.code >= 100 && res.code <= 104) {
         await this.logout();
       } else {
-        this.select = "2";
         this.$message.warning(res.message);
       }
     },
     contactRefresh(e) {
       console.log(e);
+      const { index } = e;
+      if (index + "" === "-1") {
+        this.tableData.push(e);
+      } else {
+        this.tableData[parseInt(index)] = JSON.parse(JSON.stringify(e));
+      }
     },
     async submitForm() {
       await this.$refs.ruleForm.validate(async (valid) => {
@@ -332,11 +349,16 @@ export default {
               res = await asyncRequest.zupdate(zitem);
             }
           } else {
+            if (this.tableData.length === 0) {
+              this.$message.warning("至少填写一个联系人!");
+              this.loading = false;
+              return;
+            }
             let qitem = {
               id: id,
-              companyName: companyName,
+              companyName: this.organName + companyName,
               parent: pid === "0" ? "" : pid,
-              customer_member: [],
+              customer_member: this.getCustomer(),
             };
 
             if (this.isDetail === "003") {
@@ -367,6 +389,52 @@ export default {
         }
       });
     },
+    getCustomer() {
+      let list = JSON.parse(JSON.stringify(this.tableData));
+      let oldlist = JSON.parse(JSON.stringify(this.old_tableData));
+      let hasIDlist = [];
+      list.forEach((a) => {
+        if (a.id !== "") {
+          hasIDlist.push(a);
+        }
+      });
+      let newList = [];
+      let resList = [];
+      oldlist.forEach((a, ai) => {
+        let item = null;
+        let index = hasIDlist.findIndex((b) => a.id === b.id);
+        if (index === -1) {
+          item = JSON.parse(JSON.stringify(a));
+          item.is_del = "1";
+        } else {
+          item = JSON.parse(JSON.stringify(hasIDlist[index]));
+        }
+        newList.push(item);
+      });
+      list.forEach((b) => {
+        if (b.id === "") {
+          b.is_del = "0";
+          newList.push(b);
+        }
+      });
+      newList.forEach((a) => {
+        let m = {
+          id: a.id,
+          contactor: a.contactor,
+          position: a.position,
+          commobile: a.commobile,
+          comdepart: a.comdepart,
+          wxaccount: a.wxaccount,
+          qqaccount: a.qqaccount,
+          email: a.email,
+          is_del: a.is_del || "0",
+          status: a.status || "1",
+        };
+        resList.push(m);
+      });
+
+      return resList;
+    },
   },
 };
 </script>

+ 186 - 61
src/views/serviceParam/business/index.vue

@@ -16,63 +16,62 @@
               >/</span
             >
           </div>
-        </div>
-
-        <!-- <div v-for="(item, index) in titleList" :key="item.name + item.id">
-          <span>{{ item.name }}</span>
-          <span v-if="index + 1 !== titleList.length">/</span>
-        </div> -->
-      </el-row>
-      <el-row style="padding: 7px 0 10px 0">
-        <!-- <el-col :span="3" style="width: 95px" v-if="parmValue.itemid !== ''">
-          <el-button icon="el-icon-arrow-left" :size="searchSize"
-            >上一级</el-button
-          >
-        </el-col> -->
-        <el-col :span="3" style="width: 366px">
-          <el-input
-            v-model="parmValue.name"
-            :size="searchSize"
-            @blur="
-              pageInfo.curr = 1;
-              parmValue.page = 1;
-              searchList();
-            "
-            placeholder="组织/公司名称"
-            maxlength="250"
-          >
-            <el-button
-              slot="append"
-              icon="el-icon-search"
-              @click="
-                pageInfo.curr = 1;
-                parmValue.page = 1;
-                searchList();
-              "
-            ></el-button
-          ></el-input>
-        </el-col>
-
-        <el-col :span="3" style="width: 66px; float: right">
           <el-button
             :size="searchSize"
             type="primary"
-            style="float: right; margin-left: 5px"
+            style="float: right; margin: 4px 0 0 10px"
             @click="searchList"
           >
             刷新
           </el-button>
-        </el-col>
-        <el-col :span="4" style="width: 66px; float: right">
           <el-button
             type="warning"
             class="fr"
+            style="margin: 4px 0 0 10px"
             :size="searchSize"
             @click="restSearch"
           >
             重置
           </el-button>
+        </div>
+      </el-row>
+      <el-row style="padding: 7px 0 10px 0">
+        <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="3" style="width: 400px">
+          <el-input
+            v-model="sinput"
+            :size="searchSize"
+            @blur="searchList()"
+            placeholder="关键字"
+            maxlength="250"
+          >
+            <el-select
+              v-model="select"
+              slot="prepend"
+              style="width: 125px"
+              placeholder="关键字类型"
+            >
+              <el-option label="组织/公司名称" value="1"></el-option>
+              <el-option label="公司编号" value="2"></el-option>
+              <el-option label="创建人" value="3"></el-option>
+            </el-select>
+            <el-button
+              slot="append"
+              icon="el-icon-search"
+              @click="searchList()"
+            ></el-button
+          ></el-input>
         </el-col>
+
         <el-col
           :span="3"
           class="fr"
@@ -83,7 +82,7 @@
             :size="searchSize"
             type="success"
             style="float: right"
-            @click="openModal('add', '003')"
+            @click="openModal('add', '003', '0')"
           >
             添加
           </el-button>
@@ -117,23 +116,25 @@
           <template slot-scope="scope">
             <el-tag
               :size="tablebtnSize"
-              :type="scope.row.kh == 0 ? 'success' : ''"
+              :type="scope.row.status === '0' ? 'warning' : ''"
               v-text="
-                (statusOptions.find((item) => item.id == scope.row.kh) || {})
-                  .label || '--'
+                (
+                  statusOptions.find((item) => item.id == scope.row.status) ||
+                  {}
+                ).label || '--'
               "
             ></el-tag>
           </template>
         </el-table-column>
         <el-table-column
-          prop="code"
+          prop="creater"
           label="创建人"
           width="80"
           show-overflow-tooltip
         >
         </el-table-column>
         <el-table-column
-          prop="code"
+          prop="addtime"
           label="创建时间"
           width="145"
           show-overflow-tooltip
@@ -141,26 +142,53 @@
         </el-table-column>
         <el-table-column fixed="right" label="操作" width="150">
           <template slot-scope="scope">
+            <el-tooltip effect="dark" content="查看信息" placement="top">
+              <i
+                class="el-icon-view tb-icon"
+                @click="openModal(scope.row.id, '007', scope.row.kh)"
+              ></i>
+            </el-tooltip>
+            <el-tooltip effect="dark" content="编辑信息" placement="top">
+              <i
+                class="el-icon-edit tb-icon"
+                @click="openModal(scope.row.id, '007', scope.row.kh)"
+              ></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-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 === '0'
+              "
               effect="dark"
-              v-if="scope.row.kh === 1"
-              content="查看公司信息"
+              content="启用"
               placement="top"
             >
               <i
-                class="el-icon-view tb-icon"
-                @click="openModal(scope.row.id, '007')"
+                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"
-              v-if="scope.row.kh === 1"
-              content="编辑公司信息"
+              content="删除"
               placement="top"
             >
               <i
-                class="el-icon-edit tb-icon"
-                @click="openModal(scope.row.id, '007')"
+                class="el-icon-delete tb-icon"
+                @click="deleteItem(scope.row.id, scope.row.kh)"
               ></i>
             </el-tooltip>
             <el-tooltip
@@ -182,6 +210,7 @@
         :showModel="showModel"
         :id="modelId"
         :organ="titleList"
+        :kh="kh"
         :is-detail="isDetail"
         @refresh="searchList"
         @cancel="showModel = false"
@@ -220,6 +249,9 @@ export default {
   },
   data() {
     return {
+      kh: "",
+      select: "1",
+      sinput: "",
       // 状态
       statusOptions: [
         { id: "0", label: "禁用" },
@@ -237,6 +269,10 @@ export default {
       parmValue: {
         name: "",
         pid: "",
+        creater: "",
+        start: "",
+        end: "",
+        companyNo: "",
       },
       // 表格 - 数据
       tableData: [],
@@ -247,16 +283,28 @@ export default {
     this.searchList();
   },
   methods: {
-    openModal(id, type) {
+    openModal(id, type, kh) {
       this.modelId = id;
+      this.kh = kh;
       this.isDetail = type;
       this.showModel = true;
     },
     initTitleList() {
       this.titleList = [];
-      let model = { id: "0", name: "全部组织" };
+      let model = { id: "0", name: "全部一级组织" };
       this.titleList.push(model);
     },
+    // 时间
+    async handleTime(e) {
+      this.parmValue.start = e.startTime || "";
+      this.parmValue.end = e.endTime || "";
+      if (
+        (this.parmValue.start !== "" && this.parmValue.end !== "") ||
+        (this.parmValue.start === "" && this.parmValue.end === "")
+      ) {
+        await this.searchList();
+      }
+    },
     async changeBreadcrumb(index) {
       if (index + 1 === this.titleList.length) {
         return;
@@ -264,10 +312,6 @@ export default {
         this.parmValue.pid = this.titleList[index].id;
         this.titleList = this.titleList.slice(0, index + 1);
       }
-      // if (this.titleList.length === 1) {
-      //   this.titleList = [];
-      // }
-      this.parmValue.page = 1;
       await this.searchList();
     },
     restSearch() {
@@ -275,6 +319,10 @@ export default {
       this.parmValue = {
         name: "",
         pid: "",
+        creater: "",
+        start: "",
+        end: "",
+        companyNo: "",
       };
       this.searchList();
     },
@@ -284,8 +332,85 @@ export default {
       this.parmValue.name = "";
       this.searchList();
     },
+    /**
+     * 启用/禁用
+     * @param {String} id id
+     * @param {String} status 0-禁用 1-启用
+     * @param {String} tyep 0-组织 1-企业
+     */
+    async changeStatus(id, status, type) {
+      await this.$confirm(`确定要改为${status === "1" ? "禁用" : "启用"}?`, {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(async () => {
+          this.loading = true;
+          const model = {
+            id: id,
+            status: status === "1" ? "0" : "1",
+          };
+          let res = {};
+          if (type + "" === "0") {
+            res = await asyncRequest.zstatus(model);
+          } else {
+            res = await asyncRequest.qstatus(model);
+          }
+          if (res && res.code === 0) {
+            this.loading = false;
+            this.$notify.success({
+              title: "状态修改成功!",
+              message: "",
+            });
+            await this.searchList();
+          } else if (res && res.code >= 100 && res.code <= 104) {
+            await this.logout();
+          } else {
+            this.loading = false;
+            this.$message.warning(res.message);
+          }
+        })
+        .catch(() => {
+          console.log("取消");
+        });
+    },
+    async deleteItem(id, type) {
+      await this.$confirm("确定要删除?", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(async () => {
+          const model = {
+            id: id,
+          };
+          let res = {};
+          if (type + "" === "0") {
+            res = await asyncRequest.zdelete(model);
+          } else {
+            res = await asyncRequest.qdelete(model);
+          }
+          if (res && res.code === 0) {
+            this.$notify.success({
+              title: "删除成功",
+              message: "",
+            });
+            this.searchList();
+          } else if (res && res.code >= 100 && res.code <= 104) {
+            await this.logout();
+          } else {
+            this.$message.warning(res.message);
+          }
+        })
+        .catch(() => {
+          console.log("取消");
+        });
+    },
     async searchList() {
       this.loading = true;
+      this.parmValue.name = this.select === "1" ? this.sinput : "";
+      this.parmValue.companyNo = this.select === "2" ? this.sinput : "";
+      this.parmValue.creater = this.select === "3" ? this.sinput : "";
       const res = await asyncRequest.list(this.parmValue);
       if (res && res.code === 0 && res.data) {
         this.tableData = res.data;