jinlin
2024-01-29 7a0c5479c363a10f573aa15a54dc8130eabd47ff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
<template>
  <zt-dialog ref="dialog" column="2" @confirm="formSubmit">
    <!--    <div class="fa-card-a fa-box-a" style="height: calc(100vh - 130px)">-->
    <el-form ref="dataForm" style="padding: 0" :inline="true" :disabled="dataForm.disabled" :model="dataForm"
             label-width="120px"
             class="projectAuto">
      <div class="DManageForm">
        <el-form-item label-width="80px" label="项目编号" prop="code" style="width: 99%;margin-bottom:-5px" readonly>
          <span>{{dataForm.code}}</span>
        </el-form-item>
      </div>
      <div style="border: 1px solid rgba(0,0,0,.2)">
        <div class="el-flex el-border-bottom">
          <div class="DWidth DAlign DHold">
            委托单位
          </div>
          <div class="DSTOld-1-Form">
            <!-- 单位名称 -->
            <zt-form-item class="marginTopAndMarginBottom" label="单位名称" prop="entrustUnitName" style="width: 49%"
                          rules="required">
              <el-input v-model="dataForm.entrustUnitName" placeholder="请输入单位名称"></el-input>
            </zt-form-item>
            <!-- 联系人 -->
            <zt-form-item class="marginTopAndMarginBottom" label="联系人" prop="entrustUnitContact" style="width: 49%"
                          rules="required">
              <el-input v-model="dataForm.entrustUnitContact" placeholder="请输入联系人"></el-input>
            </zt-form-item>
 
            <!-- 详细地址 -->
            <zt-form-item label="详细地址" prop="entrustUnitAddress" style="width: 49%" rules="required">
              <el-input v-model="dataForm.entrustUnitAddress" placeholder="请输入详细地址"></el-input>
            </zt-form-item>
            <!-- 联系方式 -->
            <zt-form-item label="联系方式" prop="entrustUnitContWay" style="width: 49%" rules="required">
              <el-input v-model="dataForm.entrustUnitContWay" placeholder="请输入联系方式"></el-input>
            </zt-form-item>
          </div>
        </div>
        <div class="el-flex el-border-bottom">
          <div class="DWidth DAlign DHold">
            开发单位
          </div>
          <div class="DSTOld-1-Form">
            <!-- 单位名称 -->
            <zt-form-item class="marginTopAndMarginBottom" label="单位名称" prop="developUnitName" style="width: 49%"
                          rules="required">
              <el-input v-model="dataForm.developUnitName" placeholder="请输入单位名称"></el-input>
            </zt-form-item>
            <!-- 联系人 -->
            <zt-form-item class="marginTopAndMarginBottom" label="联系人" prop="developUnitContact" style="width: 49%"
                          rules="required">
              <el-input v-model="dataForm.developUnitContact" placeholder="请输入联系人"></el-input>
            </zt-form-item>
            <!-- 详细地址 -->
            <zt-form-item label="详细地址" prop="developUnitAddress" style="width: 49%" rules="required">
              <el-input v-model="dataForm.developUnitAddress" placeholder="请输入详细地址"></el-input>
            </zt-form-item>
            <!-- 联系方式 -->
            <zt-form-item label="联系方式" prop="developUnitContWay" style="width: 49%" rules="required">
              <el-input v-model="dataForm.developUnitContWay" placeholder="请输入联系方式"></el-input>
            </zt-form-item>
          </div>
        </div>
        <div class="el-flex el-border-bottom">
          <div class="DWidth-Unt DAlign DHold">
            被测件信息
          </div>
          <div class="DSTOld-1-Form">
            <!-- 单位名称 -->
            <zt-form-item class="marginTopAndMarginBottom" label="软件名称" prop="softwareName" style="width: 49%"
                          rules="required">
              <el-input v-model="dataForm.softwareName" placeholder="请输入软件名称"></el-input>
            </zt-form-item>
            <!-- 联系人 -->
            <zt-form-item class="marginTopAndMarginBottom" label="软件标识" prop="softwareIdentity" style="width: 49%"
                          rules="required">
              <el-input v-model="dataForm.softwareIdentity" placeholder="请输入软件标识"></el-input>
            </zt-form-item>
            <!-- 详细地址 -->
            <zt-form-item label="密级" prop="secretClass" style="width: 49%" rules="required">
              <zt-dict v-model="dataForm.secretClass" dict="secret_class"></zt-dict>
            </zt-form-item>
            <!--          <zt-form-item label="保密级别" prop="secretClass"  style="width: 25%">-->
            <!--            <zt-dict v-model="dataForm.secretClass" dict="secret_class" placeholder="保密级别" style="width:200px"></zt-dict>-->
            <!--          </zt-form-item>-->
            <!-- 联系方式 -->
            <zt-form-item label="关键等级" prop="criticalLevel" style="width: 49%" rules="required">
              <zt-dict v-model="dataForm.criticalLevel" dict="critical_level"></zt-dict>
            </zt-form-item>
            <div class="el-flex" style="height: 40px;border-top:1px solid rgba(0,0,0,.2)">
              <div class="DWidth DAlign DHold">
                软件类型
              </div>
              <div style="width: calc(100% - 120px);">
                <zt-dict v-model="dataForm.softwareType" :radio="true" dict="software_type" clearable></zt-dict>
              </div>
            </div>
          </div>
        </div>
        <div class="el-flex ">
          <div class="DWidth DAlign DHold">
            项目责任人
          </div>
          <div class="DSTOld-1-Form">
            <zt-form-item class="marginTopAndMarginBottom" label-width="120px" label="所属部门" prop="bizDeptId"
                          style="width: 48%" rules="required">
              <zt-select @input="changeDept" v-model="dataForm.bizDeptId" :datas="bizDeptList" placeholder="所属部门"/>
            </zt-form-item>
            <!-- 是否签署合同 -->
            <zt-form-item label-width="120px" label="是否签署合同" prop="isContract" style="width: 48%" rules="required">
              <zt-dict v-model="dataForm.isContract" dict="is_or_not"></zt-dict>
            </zt-form-item>
            <!-- 项目负责人 -->
            <zt-form-item class="marginTopAndMarginBottom" label-width="120px" label="项目负责人" prop="projectLeader"
                          style="width: 48%" rules="required">
              <zt-select v-model="dataForm.projectLeader" :datas="projectLeaderList" placeholder="项目负责人"/>
            </zt-form-item>
            <!-- 项目测试人员 -->
            <zt-form-item class="marginTopAndMarginBottom" label-width="120px" label="项目测试人员" prop="projectTesters"
                          style="width: 48%" rules="required">
              <!--                <el-input v-model="dataForm.projectTesters" placeholder="请输入项目测试人员"></el-input>-->
              <zt-select v-model="dataForm.projectTesters" :datas="projectTestersList" :multiple="true"
                         :clearable="true" placeholder="项目测试人员"/>
            </zt-form-item>
            <!-- 项目审核人 -->
            <zt-form-item label-width="120px" label="项目审核人" prop="projectReviewer" style="width: 48%" rules="required">
              <!--                <el-input v-model="dataForm.projectReviewer" placeholder="请输入项目审核人"></el-input>-->
              <zt-select v-model="dataForm.projectReviewer" :datas="projectReviewerList" :multiple="true"
                         :clearable="true" placeholder="项目审核人"/>
            </zt-form-item>
            <zt-form-item label-width="120px" label="项目配置人" prop="projectConfiger" style="width: 48%" rules="required">
              <!--                <el-input v-model="dataForm.projectReviewer" placeholder="请输入项目审核人"></el-input>-->
              <zt-select v-model="dataForm.projectConfiger" :datas="projectConfigerList" :multiple="true"
                         :clearable="true" placeholder="项目配置人"/>
            </zt-form-item>
          </div>
        </div>
      </div>
    </el-form>
  </zt-dialog>
</template>
 
<script>
  export default {
    data() {
      return {
        dataForm: {
          id: '',
          entrustUnitName: '',
          entrustUnitAddress: '',
          entrustUnitContact: '',
          entrustUnitContWay: '',
          developUnitName: '',
          developUnitAddress: '',
          developUnitContact: '',
          developUnitContWay: '',
          softwareType: '',
          softwareName: '',
          code: '',
          softwareIdentity: '',
          secretClass: '',
          criticalLevel: '',
          testLevel: '',
          projectLeader: '',
          projectTesters: '',
          projectReviewer: '',
          projectConfiger: '',
          bizDeptId: '',
          isContract: '',
        },
        projectLeaderList: [],
        projectTestersList: [],
        projectReviewerList: [],
        projectConfigerList: [],
        bizDeptList: [],
        bizDeptIdList: [],
      }
    },
    methods: {
      init() {
        this.getInfo()
        this.getbizDept()
      },
      // 获取信息
      async getInfo() {
        console.log(this.dataForm.id, "async getInfo()")
        if (this.dataForm.id == undefined) {
          return
        }
        let res = await this.$http.get(`/project/Project/${this.dataForm.id}`)
        if (res.success) {
          this.dataForm = {
            ...this.dataForm,
            ...res.data
          }
          await this.getUserList()
        }
        console.log(this.dataForm, "async getInfo() dataForm")
      },
      changeDept(selected) {
        console.log(selected, 'selected')
        this.dataForm.projectLeader = ''
        this.dataForm.projectTesters = []
        this.dataForm.projectReviewer = []
        this.dataForm.projectConfiger = []
        this.getUserList()
      },
      async getUserList() {
        let res = await this.$http.get(`/project/Project/getUsersLists?deptId=${this.dataForm.bizDeptId}`)
        if (res.success) {
          this.projectLeaderList = res.data.zrr
          this.projectTestersList = res.data.csry
          this.projectReviewerList = res.data.shry
          this.projectConfigerList = res.data.pzry
        }
        console.log(this.dataForm, 'this.dataForm')
      },
      async getbizDept() {
        let res = await this.$http.get(`/sys/dept/getList`)
        if (res.success) {
          this.bizDeptList = res.data;
        }
        console.log(this.bizDeptList, "getbizDept")
      },
      // 表单提交
      async formSubmit() {
        if (this.dataForm.secretClass > localStorage.getItem('userSecretClass')) {
          this.$alert("当前项目设置的密级高于当前用户的密级,请重新设置")
          return
        }
        if (this.dataForm && this.dataForm.projectTesters instanceof Array) {
          this.dataForm.projectTesters = this.dataForm.projectTesters.join(',')
        }
        if (this.dataForm && this.dataForm.projectReviewer instanceof Array) {
          this.dataForm.projectReviewer = this.dataForm.projectReviewer.join(',')
        }
        if (this.dataForm && this.dataForm.projectConfiger instanceof Array) {
          this.dataForm.projectConfiger = this.dataForm.projectConfiger.join(',')
        }
        let res = await this.$http[!this.dataForm.id ? 'post' : 'put']('/project/Project/', this.dataForm)
        if (res.success) {
          await this.$tip.success()
          this.$refs.dialog.close()
          this.$emit('refreshDataList')
        } else {
          if (this.dataForm && this.dataForm.projectTesters instanceof Array) {
            this.dataForm.projectTesters = this.dataForm.projectTesters.split(',')
            console.log(this.dataForm.projectTesters)
          }
          if (this.dataForm && this.dataForm.projectReviewer instanceof Array) {
            this.dataForm.projectReviewer = this.dataForm.projectReviewer.split(',')
            console.log(this.dataForm.projectReviewer)
          }
          if (this.dataForm && this.dataForm.projectConfiger instanceof Array) {
            this.dataForm.projectConfiger = this.dataForm.projectConfiger.split(',')
            console.log(this.dataForm.projectConfiger)
          }
        }
      }
    }
  }
</script>
<style>
  .projectAuto {
    width: 70%;
  }
 
  .el-flex {
    display: flex;
    align-items: center;
  }
 
  .DWidth {
    width: 100px;
  }
 
  .DWidth-Unt {
    width: 100px;
  }
 
  .DAlign {
    text-align: center;
  }
 
  .DSTOld-1-Form,
  .DSTOld-1-Form {
    border-left: 1px solid rgba(0, 0, 0, .2);
    width: 100%;
  }
 
  .el-border-left {
    border-left: 1px solid rgba(0, 0, 0, .2);
  }
 
  .DOldForm {
    width: 100%;
  }
 
  .el-border-top-and-bottom {
    border-top: 1px solid rgba(0, 0, 0, .2);
    border-bottom: 1px solid rgba(0, 0, 0, .2);
  }
 
  .DSTOld-1-Form {
    border-left: 1px solid rgba(0, 0, 0, .2);
    width: 100%;
  }
 
  .DSTOld-1-Form > .el-form-item > .el-form-item__content {
    width: calc(100% - 120px);
  }
 
  .DManageForm > .el-form-item > .el-form-item__content {
    width: calc(100% - 120px);
  }
 
  .el-border-bottom {
    border-bottom: 1px solid rgba(0, 0, 0, .2);
  }
 
  .zt .el-table.el-software th {
    background: transparent;
  }
 
  .zt .el-table.el-software th > .cell {
    font-weight: 500;
  }
 
  .DHold {
    font-weight: 600;
  }
 
  .zt .el-table.el-software {
    font-size: 14px;
  }
 
  .projectAuto .marginTopAndMarginBottom {
    margin-top: 10px !important;
    margin-bottom: 0 !important;
  }
 
  .projectAuto .marginTopAndMarginBottom2 {
    margin-top: -10px !important;
    margin-bottom: 10px !important;
  }
</style>