Przeglądaj źródła

添加团队人员暂存

NULL1222 1 dzień temu
rodzic
commit
93288f99a4

+ 136 - 0
src/bgj/workOrderManage/modules/addTeam.vue

@@ -0,0 +1,136 @@
+<template>
+  <div>
+    <el-button type="primary" size="small" @click="dialogFormVisible = true">{{
+      $t(`添加`)
+    }}</el-button>
+    <el-dialog
+      append-to-body
+      :title="$t(`添加团队人员`)"
+      :visible.sync="dialogFormVisible"
+      width="900px"
+    >
+      <el-input
+        style="width: 200px"
+        :placeholder="$t('搜索')"
+        :suffix-icon="
+          condition ? (condition.length > 0 ? '' : '') : 'el-icon-search'
+        "
+        v-model="condition"
+        @keyup.native.enter="getLeaderList()"
+        @clear="getLeaderList"
+        size="small"
+        class="input-with-select inline-16 layout_search__panel"
+        clearable
+      >
+      </el-input>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import selectTable from "@/components/selectTable/index";
+export default {
+  props: ["data"],
+  components: { selectTable },
+  data() {
+    return {
+      dialogFormVisible: false,
+      classList: [],
+      disabledId: [],
+      tableList: [],
+      tablecols: [],
+      result: [],
+      condition: "",
+      leaderList: [],
+    };
+  },
+  methods: {
+    // async onSubmit(data) {
+    //     let res = await this.$api.requested({
+    //         id: 20220927090106,
+    //         content: {
+    //             itemtype: 1, //1=总部 2=本地
+    //             itemclassids: [data.itemclassid],
+    //             itemid: this.data.data.sc_itemid,
+    //             itemno: this.data.data.code,
+    //         },
+    //     });
+    //     this.tool.showMessage(res, () => {
+    //         this.$emit("onSuccess");
+    //         this.getClassList();
+    //     });
+    // },
+    async getLeaderList() {
+      let res = await this.$api.requested({
+        id: 2026052109150402,
+        content: {
+          pageNumber: 1,
+          pageSize: 100,
+          where: {
+            condition: "",
+          },
+        },
+      });
+      this.leaderList = res.data;
+      console.log("this.leaderList", this.leaderList);
+    },
+    // async getClassList() {
+    //     let res = await this.$api.requested({
+    //         id: "20230325141103",
+    //         content: {
+    //             sa_brandid: 0,
+    //             itemid: this.$route.query.id,
+    //             where: {
+    //                 istool: this.data.data.istool ? 1 : 0,
+    //                 condition: this.condition,
+    //             },
+    //         },
+    //     });
+    //     console.log(res.data);
+    //     res.data = res.data.map((item, index) => {
+    //         return {
+    //             itemclassname: item.brandname,
+    //             itemclassid: index + 1,
+    //             subdep: item.ttemclass,
+    //         };
+    //     });
+    //     this.classList = this.createDeep(res.data);
+    //     console.log(this.classList);
+    // },
+    // createDeep(data) {
+    //     let arr = [];
+    //     function createNodes(node, first) {
+    //         let elNode = {
+    //             itemclassname: node.itemclassfullname
+    //                 ? node.itemclassfullname
+    //                 : node.itemclassname,
+    //             itemclassid: node.itemclassid,
+    //             itemclassnum: node.itemclassnum,
+    //             children: [],
+    //             disabled: first ? false : true,
+    //         };
+    //         if (node.subdep && node.subdep.length > 0) {
+    //             for (let index = 0; index < node.subdep.length; index++) {
+    //                 elNode.children.push(createNodes(node.subdep[index]));
+    //             }
+    //         }
+    //         return elNode;
+    //     }
+
+    //     data.forEach((item) => {
+    //         this.disabledId.push(item.itemclassid);
+    //         arr.push(createNodes(item, true));
+    //     });
+    //     return arr;
+    // },
+  },
+  created() {
+    this.getLeaderList();
+  },
+};
+</script>
+<style scoped>
+/deep/.el-dialog__body {
+  padding-bottom: 0 !important;
+}
+</style>

+ 18 - 8
src/bgj/workOrderManage/modules/detail.vue

@@ -24,9 +24,8 @@
           size="mini"
           type="primary"
           class="inline-16"
+          >{{ $t(`暂 停`) }}</el-button
         >
-          {{ $t(`暂 停`) }}
-        </el-button>
         <el-button
           v-if="
             mainData.status === '暂停' && tool.checkAuth($route.name, 'turnOn')
@@ -35,9 +34,8 @@
           size="mini"
           type="primary"
           class="inline-16"
+          >{{ $t(`启 用`) }}</el-button
         >
-          {{ $t(`启 用`) }}
-        </el-button>
         <Del
           v-if="
             mainData.status !== '已完成' &&
@@ -61,9 +59,8 @@
           size="mini"
           type="primary"
           class="inline-16"
+          >{{ $t(`审批通过`) }}</el-button
         >
-          {{ $t(`审批通过`) }}
-        </el-button>
       </template>
       <div slot="slot0">
         <base-info v-if="detailInfo" :detailInfo="detailInfo"></base-info>
@@ -75,7 +72,18 @@
         <material :data="mainData"></material>
       </div>
       <div slot="slot3">
-        <team :data="mainData"></team>
+        <team :data="mainData">
+          <template v-slot:addTeam="scope">
+            <!-- v-if="(mainData.status === '待开始'||mainData.status === '进行中'||mainData.status === '暂停')&& tool.checkAuth($route.name, 'editTeam')" -->
+            <addTeam
+              :data="scope.data"
+              @onSuccess="
+                $refs.saleClass.listData();
+                queryMainData($route.query.id);
+              "
+            />
+          </template>
+        </team>
       </div>
       <div slot="slot4">
         <applicationInfo :data="mainData"></applicationInfo>
@@ -92,6 +100,7 @@ import Reject from "../components/reject";
 import material from "./material";
 import team from "./team";
 import applicationInfo from "./applicationInfo";
+import addTeam from "./addTeam";
 export default {
   name: "detail",
   data() {
@@ -111,6 +120,7 @@ export default {
     team,
     applicationInfo,
     Reject,
+    addTeam,
   },
   methods: {
     async queryMainData() {
@@ -372,7 +382,7 @@ export default {
               done();
             }
           },
-        }
+        },
       ).catch(() => {});
     },
     onStop(value) {

+ 104 - 14
src/bgj/workOrderManage/modules/team.vue

@@ -1,4 +1,3 @@
-
 <template>
   <div>
     <div style="display: flex; align-items: center">
@@ -12,9 +11,8 @@
         @keyup.native.enter="listData((params.content.pageNumber = 1))"
         @clear="clearData"
         clearable
-      >
-      </el-input>
-      <slot name="addProduct"></slot>
+      ></el-input>
+      <slot name="addTeam"></slot>
     </div>
     <div style="margin-top: 15px">
       <el-table
@@ -38,9 +36,8 @@
               effect="dark"
               style="margin-left: 10px"
               size="small"
+              >负责人</el-tag
             >
-              负责人
-            </el-tag>
           </template>
         </el-table-column>
         <el-table-column
@@ -49,9 +46,9 @@
           show-overflow-tooltip
           min-width="140"
         >
-          <template slot-scope="scope">
-            {{ scope.row.phonenumber || "--" }}
-          </template>
+          <template slot-scope="scope">{{
+            scope.row.phonenumber || "--"
+          }}</template>
         </el-table-column>
         <el-table-column
           :label="$t('职务')"
@@ -59,8 +56,22 @@
           show-overflow-tooltip
           min-width="120"
         >
+          <template slot-scope="scope">{{
+            scope.row.position || "--"
+          }}</template>
+        </el-table-column>
+        <el-table-column :label="$t('操作')" width="160">
           <template slot-scope="scope">
-            {{ scope.row.position || "--" }}
+            <el-button
+              type="text"
+              size="mini"
+              @click="onLeader(scope)"
+              v-if="!scope.row.isLeader"
+              >{{ $t("设为负责人") }}</el-button
+            >
+            <el-button type="text" size="mini" @click="onDelete(scope)">{{
+              $t("删除")
+            }}</el-button>
           </template>
         </el-table-column>
       </el-table>
@@ -75,8 +86,7 @@
         :page-size="params.content.pageSize"
         layout="total, prev, pager, next, jumper"
         :total="total"
-      >
-      </el-pagination>
+      ></el-pagination>
     </div>
   </div>
 </template>
@@ -156,11 +166,91 @@ export default {
     queryClick() {
       this.listData();
     },
+    onLeader(data) {
+      console.log("data", data);
+      this.$confirm(
+        this.$t("是否确定将") +
+          data.name +
+          "_" +
+          data.position +
+          this.$t("设为当前工单的负责人") +
+          "?",
+        this.$t("提示"),
+        {
+          confirmButtonText: this.$t("确定"),
+          cancelButtonText: this.$t("取消"),
+          type: "warning",
+        },
+      )
+        .then(async () => {
+          this.deleteLoading = true;
+          const res = await this.$api.requested({
+            id: "2026061111061302",
+            content: {
+              sc_workorderid: this.$route.query.id,
+              userid: data.userid,
+            },
+          });
+          this.deleteLoading = false;
+          if (res.code === 0) {
+            this.$message.error(res.data[0].errmsg);
+          } else {
+            this.$message({
+              message: this.$t("操作成功"),
+              type: "success",
+            });
+            this.$store.dispatch("changeDetailDrawer", false);
+          }
+        })
+        .catch(() => {
+          this.$message({
+            type: "info",
+            message: this.$t("已取消操作"),
+          });
+        });
+    },
+    onDelete(data) {
+      console.log("data", data);
+      this.$confirm(
+        this.$t("是否确定删除") + data.name + "_" + data.position + "?",
+        this.$t("提示"),
+        {
+          confirmButtonText: this.$t("确定"),
+          cancelButtonText: this.$t("取消"),
+          type: "warning",
+        },
+      )
+        .then(async () => {
+          this.deleteLoading = true;
+          const res = await this.$api.requested({
+            id: "2026061111051002",
+            content: {
+              sc_workorderid: this.$route.query.id,
+              userids: [data.userid],
+            },
+          });
+          this.deleteLoading = false;
+          if (res.code === 0) {
+            this.$message.error(res.data[0].errmsg);
+          } else {
+            this.$message({
+              message: this.$t("删除成功"),
+              type: "success",
+            });
+            this.$store.dispatch("changeDetailDrawer", false);
+          }
+        })
+        .catch(() => {
+          this.$message({
+            type: "info",
+            message: this.$t("已取消删除"),
+          });
+        });
+    },
   },
   created() {
     this.listData();
   },
 };
 </script>
-<style scoped>
-</style>
+<style scoped></style>