Explorar el Código

[FE]:提交用户管理界面弹窗内容以及接口更新

xiayu3 %!s(int64=4) %!d(string=hace) años
padre
commit
bd1c28cc0c

+ 4 - 1
security-protection-platform/src/api/usermana/index.js

@ -66,8 +66,11 @@ const api = {
66 66
  // 审核用户照片
67 67
  auditEmployeePicture (params) {
68 68
    return $default.post('/sp/employeeManagement/auditEmployeePicture', params)
69
  },
70
  // 编辑用户信息
71
  editUserDetail(params) {
72
    return $default.post('/sp/employeeManagement/modifyEmployee', params)
69 73
  }
70
71 74
}
72 75
function nest (items, code = '-1', link = 'parentCode') {
73 76
  return items.filter(item => item[link] === code).map(item => ({ ...item, departments: nest(items, item.code) }))

+ 3 - 4
security-protection-platform/src/modules/system/devicemana/components/modal/addDeviceModal.vue

@ -23,7 +23,7 @@
23 23
      </t-form-item>
24 24
      <t-form-item label="图片上传:">
25 25
        <div style="display:flex;flex-direction:row">
26
          <t-upload ref="uploader" :format="['jpg','jpeg','png']" :show-uploaded="false" :before-upload="$_onUploadBeforeUpload" :action="action" :data="{pictureUrl:addDeviceModalForm.pictureUrl}" name="picture" multiple type="drag" style="width:180px;height:180px" @success="$_onUploadSuccess" @remove-file="$_onUploadRemoveFile" @error="$_onUploadError" @file-ext-error="$_onUploadFormatError" @file-exceeded-size="$_onUploadExceededSize">
26
          <t-upload ref="uploader" :format="['jpg','jpeg','png']" :show-uploaded="false" :before-upload="$_onUploadBeforeUpload" :action="action" :data="{pictureUrl:addDeviceModalForm.pictureUrl}" multiple type="drag" style="width:180px;height:180px" @success="$_onUploadSuccess" @remove-file="$_onUploadRemoveFile" @error="$_onUploadError" @file-ext-error="$_onUploadFormatError" @file-exceeded-size="$_onUploadExceededSize">
27 27
            <div style="width: 180px;height:180px;line-height: 180px">
28 28
              <t-icon icon="plus-outline" size="40"></t-icon>
29 29
            </div>
@ -187,10 +187,9 @@ export default {
187 187
      console.log(file)
188 188
    },
189 189
    $_onUploadSuccess (res, file) {
190
      this.imgUrl = res.data.data.toolPictureUrl
191
      this.addDeviceModalForm.pictureUrl = res.data.data.pictureUrl
190
      this.imgUrl = res.data.toolPictureUrl
191
      this.addDeviceModalForm.pictureUrl = res.data.pictureUrl
192 192
      // 因为演示用的上传服务器返回数据格式的原因,这里模拟添加 url
193
      console.log(file)
194 193
      this.uploadList.push(file)
195 194
    },
196 195
    $_onUploadRemoveFile () { },

+ 76 - 42
security-protection-platform/src/modules/usermana/components/modal/addUser.vue

@ -16,7 +16,7 @@
16 16
        </t-select>
17 17
      </t-form-item>
18 18
      <t-form-item v-if="addUserModal.apartments!==''" label="部门:" prop="organizeCode">
19
        <t-select-tree v-model="addUserModal.organizeCode" :node-data="departmentTypesList" node-key="id"></t-select-tree>
19
        <t-select-tree v-model="addUserModal.organizeCode" :node-data="departmentTypesList" node-value="code" node-key="code"></t-select-tree>
20 20
      </t-form-item>
21 21
      <t-form-item label="职务:" prop="mainJobPosition">
22 22
        <t-select v-model="addUserModal.mainJobPosition" placeholder="请选择职务" clearable>
@ -29,25 +29,28 @@
29 29
      <t-form-item label="手机:" prop="mainWirelessCall">
30 30
        <t-input v-model="addUserModal.mainWirelessCall" placeholder="请输入11位手机号"></t-input>
31 31
      </t-form-item>
32
      <t-form-item label="人脸图片:" prop="facePicture">
33
        <t-upload
34
          ref="uploader"
35
          :show-uploaded="true"
36
          :allowed-ext="['jpg','jpeg','png']"
37
          :max-size="2048"
38
          :before-upload="$_onUploadBeforeUpload"
39
          :data="{picture:'11d'}"
40
          multiple
41
          style="width:120px;height:160px;background-color:#FFFFFF;"
42
          type="drag"
43
          action="http://10.19.90.34:8018/sp/employeeManagement/uploadEmployeePicture"
44
          class="demo-upload-list"
45
        >
46
          <div class="picture-upload">
47
            <t-icon class="upload-icon" icon="plus-outline"></t-icon>
48
            <span style="color:rgba(0, 0, 0, 0.45)">上传照片</span>
49
          </div>
50
        </t-upload>
32
      <t-form-item label="人脸图片:" style="display:flex" prop="facePicture">
33
        <div style="display:flex">
34
          <t-upload
35
            ref="uploader"
36
            :show-uploaded="false"
37
            :allowed-ext="['jpg','jpeg','png']"
38
            :max-size="2048"
39
            :before-upload="$_onUploadBeforeUpload"
40
            multiple
41
            style="width:120px;height:160px;background-color:#FFFFFF;"
42
            type="drag"
43
            action="http://10.19.90.34:8018/sp/employeeManagement/uploadEmployeePicture"
44
            class="demo-upload-list"
45
            @success = "$_onUploadSuccess"
46
          >
47
            <div class="picture-upload">
48
              <t-icon class="upload-icon" icon="plus-outline"></t-icon>
49
              <span style="color:rgba(0, 0, 0, 0.45)">上传照片</span>
50
            </div>
51
          </t-upload>
52
          <img v-show="showPicture" :src="showPicture" style="width:120px;height:160px;margin-left:12px"/>
53
        </div>
51 54
        <span style="color:rgba(0, 0, 0, 0.45);font-size:12px">照片格式:jpg、png或bmp文件,且不超过2M</span>
52 55
      </t-form-item>
53 56
    </t-form>
@ -61,6 +64,7 @@
61 64
62 65
<script>
63 66
import sysapi from '@/api/usermana'
67
import formatDateTime from '@/utils/formatDateTime.js'
64 68
export default {
65 69
  props: {
66 70
    visible: {
@ -71,20 +75,27 @@ export default {
71 75
    companyList: {
72 76
      type: Array,
73 77
      default: () => []
78
    },
79
    // 回显数据列表
80
    editUserModal: {
81
      type: Object,
82
      default: () => []
74 83
    }
75 84
  },
76 85
  data() {
77 86
    // 手机号验证
78
    // const VALIDATEPASSCHECK = (rule, value, callback) => {
79
    //   if (value === '') {
80
    //     callback(new Error('请输入11位手机号'))
81
    //   } else if (value.length > 0 & value.length !== 11) {
82
    //     callback(new Error('手机号格式不正确'))
83
    //   } else {
84
    //     callback()
85
    //   }
86
    // }
87
    const VALIDATEPASSCHECK = (rule, value, callback) => {
88
      if (value === '') {
89
        callback(new Error('请输入11位手机号'))
90
      } else if (value.length > 0 & value.length !== 11) {
91
        callback(new Error('手机号需为11位'))
92
      } else {
93
        callback()
94
      }
95
    }
87 96
    return {
97
      // 按钮是否加载中
98
      loadingSubmit: false,
88 99
      // 是否为编辑状态
89 100
      isEdit: false,
90 101
      // 部门列表
@ -92,6 +103,8 @@ export default {
92 103
      // 职务列表
93 104
      uploadList: [],
94 105
      jobPoisitonList: [],
106
      // 回显图片
107
      showPicture: '',
95 108
      // 新增用户表单
96 109
      addUserModal: {
97 110
        name: '',
@ -121,10 +134,10 @@ export default {
121 134
          { required: true, message: '职务不能为空', trigger: 'change' }
122 135
        ],
123 136
        birthday: [
124
          { required: true, message: '年龄不能为空', trigger: 'blur' }
137
          { required: true, message: '年龄不能为空' }
125 138
        ],
126 139
        mainWirelessCall: [
127
          { required: true, message: '请输入11位手机号', trigger: 'blur' }
140
          { validator: VALIDATEPASSCHECK, required: true, trigger: 'blur' }
128 141
        ],
129 142
        facePicture: [
130 143
          { required: true, message: '图片不能为空', trigger: 'blur' }
@ -149,8 +162,15 @@ export default {
149 162
      this.addUserModal.organizeCode = ''
150 163
      // 查询部门列表
151 164
      this.queryCycleChildOrg(val)
165
    },
166
    editUserModal () {
167
      this.getCompanyList()
152 168
    }
153 169
  },
170
  created() {
171
    // console.log(this.editUserModal)
172
    // this.addUserModal.apartments = this.editUserModal.field4
173
  },
154 174
  mounted() {
155 175
    this.getJobPositionList()
156 176
  },
@ -166,14 +186,14 @@ export default {
166 186
            organizeCode: this.addUserModal.organizeCode, // 部门CODE
167 187
            mainWirelessCall: this.addUserModal.mainWirelessCall, // 手机号码
168 188
            mainJobPosition: this.addUserModal.mainJobPosition, // 职务
169
            field1: this.addUserModal.facePicture, // 照片标识
189
            field1: this.addUserModal.field1, // 照片标识
170 190
            field4: this.addUserModal.apartments, // 公司ID
171
            birthday: Math.round(new Date() / 1000) // 生日(时间戳)
191
            birthday: this.addUserModal.birthday // 生日(时间戳)
172 192
          }
173
          sysapi.creteEmployee({params: obj}).then(res => {
174
            console.log(res)
193
          sysapi.creteEmployee(obj).then(res => {
175 194
            if (res.data.success === true) {
176
              this.$Message.success('新增成功')
195
              this.$Message.success('提交成功')
196
              this.$refs['addUserModal'].resetFields()
177 197
            } else {
178 198
              console.log(res.data.fail.message)
179 199
              this.$Message.success(res.data.fail.message)
@ -188,6 +208,21 @@ export default {
188 208
      this.imgUrl = ''
189 209
      this.isVisibled = false
190 210
    },
211
    getCompanyList() {
212
      this.$nextTick(() => {
213
        this.addUserModal = {
214
          'name': this.editUserModal.employeeName, // 员工姓名
215
          'code': this.editUserModal.employeeCode, // 员工编号
216
          'organizeCode': this.editUserModal.organizationCode, // 部门CODE
217
          'mainWirelessCall': this.editUserModal.mainWirelessCall, // 手机号码
218
          'mainJobPosition': this.editUserModal.employeePosition, // 职务
219
          'field1': this.editUserModal.field1, // 照片标识
220
          'apartments': this.editUserModal.field4, // 公司ID
221
          'birthday': formatDateTime(new Date(this.editUserModal.birthday - 0)) // 生日(时间戳)
222
        }
223
        // this.isEdit = true
224
      })
225
    },
191 226
    // 查询职务列表
192 227
    async getJobPositionList() {
193 228
      const res = await sysapi.getJobPositionList()
@ -212,7 +247,7 @@ export default {
212 247
          if (item.pid === '-1') {
213 248
            delete item.pid
214 249
          }
215
          item.id = item.orgId
250
          // item.id = item.orgId
216 251
          data1.some((item1) => {
217 252
            if (item.pid === item1.id) {
218 253
              item.pid = item1.orgId
@ -237,7 +272,8 @@ export default {
237 272
            orgId: item.id + '',
238 273
            id: item.code,
239 274
            label: item.name,
240
            pid: item.parentCode
275
            pid: item.parentCode,
276
            code: item.code
241 277
          })
242 278
          this.nextDepartment(item.departments, arr)
243 279
        })
@ -257,11 +293,9 @@ export default {
257 293
      console.log(file)
258 294
    },
259 295
    $_onUploadSuccess (res, file) {
260
      this.imgUrl = res.data.data.toolPictureUrl
261
      this.addDeviceModalForm.pictureUrl = res.data.data.pictureUrl
262 296
      // 因为演示用的上传服务器返回数据格式的原因,这里模拟添加 url
263
      console.log(file)
264
      this.uploadList.push(file)
297
      this.showPicture = res.data.headerPictureUrl
298
      this.addUserModal.field1 = res.data.pictureUrl
265 299
    },
266 300
    $_onUploadRemoveFile () { },
267 301
    $_onUploadExceededSize () { },

+ 7 - 4
security-protection-platform/src/modules/usermana/index.vue

@ -52,7 +52,7 @@
52 52
          </t-table-column>
53 53
          <t-table-column label="操作">
54 54
            <template v-slot="{row}">
55
              <a href="javascript:;" style="color:#0089D4;" @click="editDeviceData(row.resourceToolId)">编辑</a>
55
              <a href="javascript:;" style="color:#0089D4;" @click="editDeviceData(row.id)">编辑</a>
56 56
              <a href="javascript:;" style="color:#0089D4;" @click="deleteUserData(row)">删除</a>
57 57
              <a v-if="row.field2!='5'" href="javascript:;" style="color:#0089D4;" @click="auditdata(row.id,row.companyName)">人脸审核</a>
58 58
            </template>
@ -64,7 +64,7 @@
64 64
        </t-pager>
65 65
      </div>
66 66
    </t-card>
67
    <add-user-modal :company-list="companyTypesList" :visible.sync="addDeviceModal"></add-user-modal>
67
    <add-user-modal :edit-user-modal="currentEditDevice" :company-list="companyTypesList" :visible.sync="addDeviceModal"></add-user-modal>
68 68
    <auditModal :auditshow.sync="auditshow" :auditid="auditid" :company-name="companyName" @refeshUserList="getUserList"></auditModal>
69 69
  </div>
70 70
</template>
@ -249,6 +249,7 @@ export default {
249 249
    },
250 250
    // 删除数据
251 251
    deleteUserData (row) {
252
      console.log(row)
252 253
      this.$Confirm.confirm({
253 254
        title: '正在准备删除...',
254 255
        content: '<p>确定要删除?</p><p>删除后将无法还原!</p>',
@ -307,10 +308,12 @@ export default {
307 308
    showAddDeviceModal () {
308 309
      this.addDeviceModal = true
309 310
    },
311
    // 编辑新增用户信息
310 312
    async editDeviceData (id) {
311
      const res = await sysapi.getDeviceInfo(id)
313
      const res = await sysapi.getOneEmployee({params: {employeeId: id}})
312 314
      if (res.status === 200) {
313
        this.currentEditDevice = res.data
315
        this.currentEditDevice = res.data.data
316
        console.log(this.currentEditDevice);
314 317
      } else {
315 318
        this.$Message.danger('设备数据获取失败!')
316 319
      }

+ 1 - 2
security-protection-platform/src/modules/videoSurveillance/index.vue

@ -126,7 +126,7 @@ export default {
126 126
          btn1.className = 'aidicon aidicon-piechart-outline'
127 127
          btn1.setAttribute('title', '视频回放')
128 128
          btn1.addEventListener('click', () => {
129
            this.handleReview(this.videoList[index].id)
129
            this.handleReview(this.videoList[index].resourceToolId)
130 130
          })
131 131
          item.appendChild(txt)
132 132
          item.appendChild(btn)
@ -170,7 +170,6 @@ export default {
170 170
      }
171 171
      if (res.status === 200) {
172 172
        this.replayList = res.data.data
173
        console.log(this.replayList)
174 173
      } else {
175 174
        this.$Message.danger('视频列表数据获取失败!')
176 175
      }