소스 검색

信息配置部分完善

wandequan 2 년 전
부모
커밋
1e2eab50ad

+ 8 - 3
src/api/infoConfig/api.js

@@ -33,7 +33,7 @@ const getInfoList = (param) => {
 }
 // 获取人员名单
 const getPersonList = (param) => {
-    return get('/information/security_person');
+    return get('/information/security_person?' + splicingParam(param));
 }
 
 // 获取安保人员信息配置
@@ -62,9 +62,13 @@ const getSecurityInfoConfigurationHistory = (param) => {
 const uploadImage = (param) => {
     return postFile('/information/upload_pictures', param)
 }
-// 上传图片
+// 添加人员
+const addPerson = (param) => {
+    return post('/information/staff', param)
+}
+// 删除人员
 const delPerson = (param) => {
-    return del('/information/del_staff', param)
+    return del('/information/staff', param)
 }
 
 
@@ -83,5 +87,6 @@ export default {
     addSecurityInfoConfiguration,
     getSecurityInfoConfigurationHistory,
     uploadImage,
+    addPerson,
     delPerson,
 }

+ 74 - 26
src/views/systemManagement/infoConfiguration/dialog/createPeople.vue

@@ -16,8 +16,9 @@
       >
         <el-form-item label="人员类别:">
           <el-select
-            v-model="form.personnelCategoryIndex"
+            v-model="personnelCategoryIndex"
             placeholder="请选择"
+            disabled
           >
             <el-option
               v-for="item in personnelCategory"
@@ -40,12 +41,13 @@
             v-model="form.staff_list"
             multiple
             placeholder="请选择"
+            value-key="id"
           >
             <el-option
               v-for="item in peopleArr"
               :key="item.id"
               :label="item.name"
-              :value="item.id"
+              :value="item"
             >
             </el-option>
           </el-select>
@@ -58,7 +60,7 @@
           >
           </el-date-picker> 至
           <el-date-picker
-            v-model="form.duty_time.start_time"
+            v-model="form.duty_time.stop_time"
             type="datetime"
             placeholder="选择日期时间"
           >
@@ -97,6 +99,9 @@
 import api from "@/api/infoConfig/api";
 export default {
   props: {
+    itemInfo: {
+      type: Object,
+    },
     update: {
       type: Function,
     },
@@ -106,8 +111,7 @@ export default {
       value: "",
       dialogVisible: false,
       form: {
-        name: "",
-        personnel_type: "",
+        personnel_type: "1",
         responsibility_range: "",
         staff_list: [],
         duty_time: {
@@ -116,19 +120,11 @@ export default {
         },
         remark: "",
       },
-
+      personnelCategoryIndex: "1",
       personnelCategory: [
         {
           value: "1",
-          label: "保洁",
-        },
-        {
-          value: "2",
-          label: "前台",
-        },
-        {
-          value: "3",
-          label: "安防",
+          label: "驻地物业",
         },
       ],
       peopleArr: [],
@@ -140,14 +136,66 @@ export default {
   methods: {
     getPersonList() {
       api
-        .getPersonList()
+        .getPersonList({ type_id: 1 })
         .then((result) => {
+          // "access": null,
+          // "account": null,
+          // "address": null,
+          // "car_number": null,
+          // "card_number": null,
+          // "company_id": null,
+          // "company_name": null,
+          // "create_time": null,
+          // "dept_id": null,
+          // "dept_name": null,
+          // "duty": null,
+          // "email": null,
+          // "floor": null,
+          // "function_type": null,
+          // "hiredate": null,
+          // "hr_number": null,
+          // "id": 3,
+          // "id_card": null,
+          // "impower_time": null,
+          // "in_out": null,
+          // "is_del": 0,
+          // "issue_status": null,
+          // "name": "\u5f20\u707f",
+          // "operate_status": null,
+          // "phone": "010-68799999-6688",
+          // "physics_card": null,
+          // "role": null,
+          // "room_number": null,
+          // "site_number": "0399",
+          // "status": 0,
+          // "type": 1,
+          // "update_time": null,
+          // "work_address": null,
+          // "zy_number": null
           this.peopleArr = result.data.data;
         })
         .catch((err) => {});
     },
     sure() {
       let that = this;
+      let form = JSON.parse(JSON.stringify(this.form));
+      form.duty_time.start_time = this.$dayjs(form.duty_time.start_time).format(
+        "YYYY-MM-DD HH:mm:ss"
+      );
+      form.duty_time.stop_time = this.$dayjs(form.duty_time.stop_time).format(
+        "YYYY-MM-DD HH:mm:ss"
+      );
+      form.duty_time = JSON.stringify(form.duty_time);
+      form.staff_list = JSON.stringify(
+        form.staff_list.map(function (item) {
+          return {
+            id: item.id,
+            details: item,
+          };
+        })
+      );
+      form.id = this.itemInfo.data.id;
+      // console.log(form); 
       const loading = this.$loading({
         lock: true,
         text: "新建中,请稍后!",
@@ -155,15 +203,15 @@ export default {
         background: "rgba(0, 0, 0, 0.7)",
         customClass: "systemConfigLoading",
       });
-      setTimeout(() => {
-        loading.close();
-        this.update();
-        this.$message.success("添加成功!");
-        this.dialogVisible = false;
-      }, 1000);
-      return;
+      // setTimeout(() => {
+      //   loading.close();
+      //   this.update();
+      //   this.$message.success("添加成功!");
+      //   this.dialogVisible = false;
+      // }, 1000);
+      // return;
       api
-        .updateSecurityInfoConfiguration(this.form)
+        .addPerson(form)
         .then((result) => {
           loading.close();
           if (result.data.code == 0) {
@@ -179,8 +227,8 @@ export default {
         });
 
       // setTimeout(() => {
-      loading.close();
-      that.dialogVisible = true;
+      // loading.close();
+      // that.dialogVisible = true;
       // }, 2000);
     },
     close() {

+ 56 - 77
src/views/systemManagement/infoConfiguration/dialog/createUpdatePeople.vue

@@ -15,7 +15,7 @@
     >
       <el-form-item label="人员类别:">
         <el-select
-          v-model="form.personnel_type"
+          v-model="personnelCategoryIndex"
           placeholder="请选择"
           disabled
         >
@@ -38,25 +38,10 @@
       <el-form-item label="人员名单:">
         <el-input
           placeholder="请输入内容"
-          v-model="form.name"
+          v-model="form.staff_details.name"
           disabled
         >
         </el-input>
-
-        <!-- <el-select
-          v-model="form.staff_list"
-          multiple
-          placeholder="请选择"
-          disabled
-        >
-          <el-option
-            v-for="item in peopleArr"
-            :key="item.value"
-            :label="item.label"
-            :value="item.value"
-          >
-          </el-option>
-        </el-select> -->
       </el-form-item>
       <el-form-item label="值班日期:">
         <el-date-picker
@@ -66,7 +51,7 @@
         >
         </el-date-picker> 至
         <el-date-picker
-          v-model="form.duty_time.start_time"
+          v-model="form.duty_time.stop_time"
           type="datetime"
           placeholder="选择日期时间"
         >
@@ -80,7 +65,7 @@
           type="textarea"
           :rows="2"
           placeholder="请输入内容"
-          v-model="form.beizhu"
+          v-model="form.remark"
         >
         </el-input>
       </el-form-item>
@@ -101,57 +86,37 @@
   </el-dialog>
 </template>
 <script>
+import api from "@/api/infoConfig/api";
 export default {
   props: {
+    itemInfo: {
+      type: Object,
+    },
     editData: {
       type: Object,
     },
+    update: {
+      type: Function,
+    },
   },
   data() {
     return {
       value: "",
       dialogVisible: false,
       form: {
-        name: "",
-        personnel_type: "",
-        responsibility_range: "",
-        staff_list: [],
         duty_time: {
           start_time: "",
           stop_time: "",
         },
-        remark: "",
+        staff_details: {
+          name: "",
+        },
       },
+      personnelCategoryIndex: "1",
       personnelCategory: [
         {
           value: "1",
-          label: "保洁",
-        },
-        {
-          value: "2",
-          label: "前台",
-        },
-        {
-          value: "3",
-          label: "安防",
-        },
-      ],
-      peopleArr: [
-        {
-          value: "1",
-          label: "张三",
-        },
-        {
-          value: "2",
-          label: "李四",
-        },
-        {
-          value: "3",
-          label: "王五",
-        },
-        {
-          value: "4",
-          label: "张柳",
+          label: "驻地物业",
         },
       ],
     };
@@ -159,46 +124,60 @@ export default {
   methods: {
     sure() {
       let that = this;
+      let form = JSON.parse(JSON.stringify(this.form));
+      form.duty_time.start_time = this.$dayjs(form.duty_time.start_time).format(
+        "YYYY-MM-DD HH:mm:ss"
+      );
+      form.duty_time.stop_time = this.$dayjs(form.duty_time.stop_time).format(
+        "YYYY-MM-DD HH:mm:ss"
+      );
+      form.duty_time = JSON.stringify(form.duty_time);
+      form.staff_list = JSON.stringify([
+        {
+          id: form.staff_details.id,
+          details: form.staff_details,
+        },
+      ]);
+      form.id = this.itemInfo.data.id; 
       const loading = this.$loading({
         lock: true,
-        text: "更新中,请稍后!",
+        text: "修改中,请稍后!",
         spinner: "el-icon-loading",
         background: "rgba(0, 0, 0, 0.7)",
         customClass: "systemConfigLoading",
       });
-      setTimeout(() => {
-        loading.close();
-        that.dialogVisible = false;
-        this.$message({
-          type: "success",
-          message: "更新成功",
+      api
+        .addPerson(form)
+        .then((result) => {
+          loading.close();
+          if (result.data.code == 0) {
+            this.update();
+            this.$message.success("修改成功!");
+            this.dialogVisible = false;
+          } else {
+            this.$message.error("修改失败!");
+          }
+        })
+        .catch((err) => {
+          this.$message.error("修改失败!");
         });
-      }, 2000);
     },
     close() {
-      this.form = {};
-      this.dialogVisible = false;
-    },
-  },
-  watch: {
-    editData(newVal) {
-      let form = {
-        name: "",
-        personnel_type: "",
-        responsibility_range: "",
-        staff_list: [],
+      this.form = {
         duty_time: {
           start_time: "",
           stop_time: "",
         },
-        remark: "",
+        staff_details: {
+          name: "",
+        },
       };
-      this.form = newVal;
-      this.form.personnel_type = "3";
-      this.form.duty_time = eval("(" + this.form.duty_time + ")");
-      this.form.duty_time.start_time = new Date(this.form.duty_time.start_time);
-      this.form.duty_time.stop_time = new Date(this.form.duty_time.stop_time);
-      debugger;
+      this.dialogVisible = false;
+    },
+  },
+  watch: {
+    editData(newVal) {
+      this.form = JSON.parse(JSON.stringify(newVal));
     },
   },
 };

+ 42 - 37
src/views/systemManagement/infoConfiguration/dialog/historyPeople.vue

@@ -32,23 +32,23 @@
               label="序号"
             >
             </el-table-column>
-            <el-table-column
-              prop="name"
-              label="姓名"
-            >
+            <el-table-column label="姓名">
+              <template slot-scope="scope">
+                <span>{{scope.row.staff_details.name}}</span>
+              </template>
             </el-table-column>
-            <el-table-column
-              prop="job_number"
-              label="工号"
-            >
+            <el-table-column label="工号">
+              <template slot-scope="scope">
+                <span>{{scope.row.staff_details.site_number}}</span>
+              </template>
             </el-table-column>
-            <el-table-column
-              prop="phone_number"
-              label="联系方式"
-            >
+            <el-table-column label="联系方式">
+              <template slot-scope="scope">
+                <span>{{scope.row.staff_details.phone}}</span>
+              </template>
             </el-table-column>
             <el-table-column
-              prop="territory"
+              prop="responsibility_range"
               label="职责范围"
             >
             </el-table-column>
@@ -64,17 +64,21 @@
                 ></el-image>
               </template>
             </el-table-column>
-            <el-table-column
-              prop="status"
-              label="状态"
-            >
+            <el-table-column label="状态">
+              <template slot-scope="scope">
+                <span v-if="scope.row.staff_details.status == 0">正常</span>
+                <span v-if="scope.row.staff_details.status == 1">离职</span>
+                <span v-if="scope.row.staff_details.status == 2">暂时冻结</span>
+              </template>
             </el-table-column>
             <el-table-column
               label="值班日期"
               width="360"
             >
               <template slot-scope="scope">
-                {{$dayjs(scope.row.date.start).format("YYYY-MM-DD HH:mm:ss")}} 至 {{$dayjs(scope.row.date.stop).format("YYYY-MM-DD HH:mm:ss")}}
+                <span v-if="scope.row.duty_time">
+                  {{$dayjs(scope.row.duty_time.start_time).format("YYYY-MM-DD HH:mm:ss").replace("-","年").replace("-","月").replace(" ","日 ")}} 至 {{$dayjs(scope.row.duty_time.stop_time).format("YYYY-MM-DD HH:mm:ss").replace("-","年").replace("-","月").replace(" ","日 ")}}
+                </span>
               </template>
             </el-table-column>
           </el-table>
@@ -154,29 +158,30 @@ export default {
     };
   },
   mounted() {
-    this.getHistroyPeople();
+    // this.getHistroyPeople();
   },
   methods: {
     getHistroyPeople() {
-      const loading = this.$loading({
-        lock: true,
-        text: "更新中,请稍后!",
-        spinner: "el-icon-loading",
-        background: "rgba(0, 0, 0, 0.7)",
-        customClass: "systemConfigLoading",
-      });
-      setTimeout(() => {
-        loading.close();
-      }, 1000);
+      api
+        .getSecurityInfoConfigurationHistory({
+          id: this.itemInfo.data.id,
+        })
+        .then((result) => {
+          let list = result.data.data;
+          list.map(function (item) {
+            item.data = item.data.map(function name(params) {
+              params.staff_details = JSON.parse(params.staff_details);
+              params.photo =
+                "https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png";
+              return params;
+            });
+
+            return item;
+          });
 
-      // api
-      //   .getSecurityInfoConfigurationHistory({
-      //     id: this.itemInfo.data.id,
-      //   })
-      //   .then((result) => {
-      //     this.list = result.data.data;
-      //   })
-      //   .catch((err) => {});
+          this.list = list;
+        })
+        .catch((err) => {});
     },
     close() {
       this.dialogVisible = false;

+ 24 - 20
src/views/systemManagement/infoConfiguration/securitystaffInfo.vue

@@ -36,20 +36,20 @@
           label="序号"
         >
         </el-table-column>
-        <el-table-column
-          prop="name"
-          label="姓名"
-        >
+        <el-table-column label="姓名">
+          <template slot-scope="scope">
+            <span>{{scope.row.staff_details.name}}</span>
+          </template>
         </el-table-column>
-        <el-table-column
-          prop="work_number"
-          label="工号"
-        >
+        <el-table-column label="工号">
+          <template slot-scope="scope">
+            <span>{{scope.row.staff_details.site_number}}</span>
+          </template>
         </el-table-column>
-        <el-table-column
-          prop="phone"
-          label="联系方式"
-        >
+        <el-table-column label="联系方式">
+          <template slot-scope="scope">
+            <span>{{scope.row.staff_details.phone}}</span>
+          </template>
         </el-table-column>
         <el-table-column
           prop="responsibility_range"
@@ -67,11 +67,10 @@
         </el-table-column>
         <el-table-column label="状态">
           <template slot-scope="scope">
-            <span v-if="scope.row.status == 1">正常</span>
-            <span v-if="scope.row.status == 2">离职</span>
-            <span v-if="scope.row.status == 3">暂时冻结</span>
+            <span v-if="scope.row.staff_details.status == 0">正常</span>
+            <span v-if="scope.row.staff_details.status == 1">离职</span>
+            <span v-if="scope.row.staff_details.status == 2">暂时冻结</span>
           </template>
-          x
         </el-table-column>
         <el-table-column
           label="值班日期"
@@ -88,7 +87,7 @@
               size="small"
             >编辑</el-button> -->
             <span v-if="scope.row.duty_time">
-              {{$dayjs(scope.row.duty_time.start_time).format("YYYY-MM-DD HH:mm:ss").replace("-","年").replace("-","月").replace(" ","日 ")}} 至 {{$dayjs(scope.row.duty_time.end_time).format("YYYY-MM-DD HH:mm:ss").replace("-","年").replace("-","月").replace(" ","日 ")}}
+              {{$dayjs(scope.row.duty_time.start_time).format("YYYY-MM-DD HH:mm:ss").replace("-","年").replace("-","月").replace(" ","日 ")}} 至 {{$dayjs(scope.row.duty_time.stop_time).format("YYYY-MM-DD HH:mm:ss").replace("-","年").replace("-","月").replace(" ","日 ")}}
             </span>
 
           </template>
@@ -121,12 +120,14 @@
     <createPeople
       ref="createPeople"
       v-bind="{
+        itemInfo:itemInfo,
         update:getListAfterUpdate
       }"
     ></createPeople>
     <createUpdatePeople
       ref="createUpdatePeople"
       v-bind="{
+        itemInfo:itemInfo,
         editData:editData,
         update:getListAfterUpdate
       }"
@@ -212,8 +213,7 @@ export default {
           });
           api
             .delPerson({
-              id: this.itemInfo.data.id,
-              staff: data.id,
+              id: data.id,
             })
             .then((result) => {
               loading.close();
@@ -311,13 +311,17 @@ export default {
               // "status": "1",
               // "type": 1,
               // "work_number": "0399"
-              let tableData = result.data.data.staff_list;
+              let tableData = result.data.data;
               this.tableData = tableData.map((item) => {
                 // item.photo = "/api" + item.photo;
                 item.photo =
                   "https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png";
+
+                item.staff_details = JSON.parse(item.staff_details);
                 return item;
               });
+              // console.log(result.data.data);
+              // debugger;
               that.paginationData.total = tableData.length;
               resolve();
             } else {

+ 0 - 1
src/views/systemManagement/messageConfiguration/commonMessage.vue

@@ -238,7 +238,6 @@ export default {
   },
   watch: {
     selectedMessage(val) {
-      debugger;
       this.disabled = true;
       this.getMessaageDetail();
     },