zhuguifei
2025-04-28 442928123f63ee497d766f9a7a14f0a6ee067e25
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
<template>
  <div>
    <!-- 操作按钮区域 -->
    <div class="table-operator">
      <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
      <a-button @click="batchDel" v-if="selectedRowKeys.length > 0" ghost type="primary" icon="delete"
        >批量删除
      </a-button>
    </div>
 
    <!-- table区域-begin -->
    <div>
      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px">
        <i class="anticon anticon-info-circle ant-alert-icon"></i>任务总数&nbsp;<a style="font-weight: 600">{{
          linkList.length
        }}</a
        >&nbsp;&nbsp;&nbsp;&nbsp;
 
        <i class="anticon anticon-info-circle ant-alert-icon"></i>已完成&nbsp;<a style="font-weight: 600">{{
           projectProgress[0]
        }}</a
        >&nbsp;&nbsp;&nbsp;&nbsp;
        已完成&nbsp;&nbsp;<a-progress style="width: 100px;" :percent="projectProgress[1]" size="small" status="active" />
 
      </div>
 
      <a-table
        bordered
        :scroll="{ x: 1500 }"
        :defaultExpandAllRows="true"
        :columns="columns"
        size="small"
        :pagination="false"
        :dataSource="dataSource"
        :loading="loading"
        :expandedRowKeys="expandedRowKeys"
        :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
        @expandedRowsChange="handleExpandedRowsChange"
        :rowClassName="getRowClassname"
      >
        <span slot="action" slot-scope="text, record">
          <a @click="handleEdit(record)">编辑</a>
 
          <a-divider type="vertical" />
          <a-dropdown>
            <a class="ant-dropdown-link"> 更多 <a-icon type="down" /> </a>
            <a-menu slot="overlay">
              <a-menu-item>
                <a href="javascript:;" @click="handleDetail(record)">详情</a>
              </a-menu-item>
              <a-menu-item>
                <a href="javascript:;" @click="handleAddSub(record)">添加下级</a>
              </a-menu-item>
              <a-menu-item>
                <a href="javascript:;" @click="handleDataRule(record)">数据规则</a>
              </a-menu-item>
 
              <a-menu-item>
                <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
                  <a>删除</a>
                </a-popconfirm>
              </a-menu-item>
            </a-menu>
          </a-dropdown>
        </span>
        <span slot="esContent8" slot-scope="text">
        <j-ellipsis :value="getDictText(text)" :length="8" />
      </span>
        <!-- 字符串超长截取省略号显示 -->
        <span slot="url" slot-scope="text">
          <j-ellipsis :value="text" :length="25" />
        </span>
        <!-- 字符串超长截取省略号显示-->
        <span slot="component" slot-scope="text">
          <j-ellipsis :value="text"  :length="10" />
        </span>
      </a-table>
    </div>
    <!-- table区域-end -->
 
    <link-modal ref="modalForm" :projectId="projectId" @ok="modalFormOk"></link-modal>
  </div>
</template>
 
<script>
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import LinkModal from '@views/pro/modules/linkModal'
import { initDictOptions, filterMultiDictText } from '@/components/dict/JDictSelectUtil'
 
export default {
  name: 'LinkListComponent',
  components: { LinkModal },
  mixins: [JeecgListMixin],
  props: {
    projectId: {
      type: String
    }
  },
   watch: {
      'dataSource': function (val) {
         this.$emit('success',val)
         this.getTreeList(val)
      }
    },
  data() {
    return {
       model: {
        /*  xmmc: '2132 注塑成型质量监测系统',
          xmbh: 'XLB-NO001',
          xmfzr: 'zhagnxiao',
          bgrq: '2022-01-01',
          xmmb: '该项目在已有模腔压力传感器基础上,开发一套完整的模腔运行时内部参数实时检测系统,可扩展和注塑机联动功能,实时监各质量参数,根据数据库模型辨别不良产品,给出自动分拣信号,并记录上传和保存报表。\n' +
            '1)第一阶段:完成竞品的分析,建立初步的软件架构,实现基于PC机的测试版软件; \n' +
            '2)第二阶段:基于测试版软件和模腔压力传感器完成相关测试,积累分析数据,建立数据分析模型,制定正式第一代基于工控机系统的方案;\n' +
            '3)第三阶段:完成2套基于工控机的完整模腔运行质量监测系统的设计和调试;',
          kssj: '2022-01-01',
          jssj: '2022-01-01',
          sysj: '100'*/
 
      },
      linkList:[],
      userDictOptions: [],
      expandAll:true, //默认展开所有行
      queryParam: {
        pro: this.projectId
      },
      labelCol: {
        xs: { span: 24 },
        sm: { span: 6 }
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 16 }
      },
      confirmLoading: false,
      columns: [
        {
          width: 200,
          title: '序号',
          dataIndex: 'sxh',
          key: 'sxh'
        },
        {
          width: 300,
          title: '项目环节',
          dataIndex: 'xmhj',
          key: 'xmhj',
        },
        {
          title: '起始时间',
          dataIndex: 'qssj',
          key: 'qssj'
        },
        {
          title: '预计完成时间',
          dataIndex: 'yjwcsj',
          key: 'yjwcsj'
        },
        {
          width: 80,
          title: '持续时间',
          dataIndex: 'cxsj',
          key: 'cxsj'
        },
        {
          title: '实际完成时间',
          dataIndex: 'sjwcsj',
          key: 'sjwcsj'
        },
        {
          title: '完成进度',
          dataIndex: 'wcjd',
          key: 'wcjd',
          customRender: (val) => {
            if (!val || val== 0 ) {
              return '未完成'
            } else {
              return '已完成'
            }
          }
        },
        {
          title: '资源名称',
          dataIndex: 'zymc',
          key: 'zymc',
          scopedSlots: { customRender: 'esContent8' },
 
        },
        {
          title: '排序',
          dataIndex: 'sortNo',
          key: 'sortNo'
        },
        {
          title: '操作',
          dataIndex: 'action',
          fixed: 'right',
          scopedSlots: { customRender: 'action' },
          align: 'center',
          width: 150
        }
      ],
      url: {
        list: 'pro/project/linkList',
        delete: 'pro/project/deleteLink',
        deleteBatch: 'pro/project/deleteLinkBatch'
      }
    }
  },
  methods: {
    getDictText(text) {
      return filterMultiDictText(this.userDictOptions['username'], text)
    },
    initDictConfig() {
      //初始化字典 - 性别
      initDictOptions('sys_user,realname,username').then((res) => {
        console.info(res)
        if (res.success) {
          this.$set(this.userDictOptions, 'username', res.result)
        }
      })
 
    },
    handleAdd() {
      this.$refs.modalForm.add()
      this.$refs.modalForm.title = '新增'
      this.$refs.modalForm.disableEdit = false
      this.$refs.modalForm.disableSubmit = false
    },
    handleEdit: function(record) {
      this.$refs.modalForm.edit(record)
      this.$refs.modalForm.title = '编辑'
      this.$refs.modalForm.disableEdit = true
      this.$refs.modalForm.disableSubmit = false
    },
    handleAddSub(record) {
      this.$refs.modalForm.title = '添加子菜单'
      this.$refs.modalForm.disableSubmit = false
      this.$refs.modalForm.disableEdit = true
      this.$refs.modalForm.edit({ 'pid': record.id, pro: this.projectId, leaf: true, menuType: 1 })
    },
    handleDataRule(record) {
      this.$message.error('开发中!')
    },
    handleExpandedRowsChange(expandedRows) {
      this.expandedRowKeys = expandedRows
    },
    getRowClassname(record){
      //已完成修改背景颜色
      if(record.wcjd == 1){
         return "row-custom-bg"
      }
    },
    getTreeList(data) {
      let result = []
      for (let i = 0; i < data.length; i++) {
        result.push(data[i])
        if (data[i].children) {
          const children1 = data[i].children
          for (let j = 0; j < children1.length; j++) {
            result.push(children1[j])
            if (children1[j].children) {
              const children2 = children1[j].children
              for (let k = 0; k < children2.length; k++) {
                result.push(children2[k])
 
                if (children2[k].children) {
                  const children3 = children2[k].children
                  for (let l = 0; l < children3.length; l++) {
                    result.push(children3[l])
 
                    if (children3[l].children) {
                      const children4 = children3[l].children
                      for (let m = 0; m < children4.length; m++) {
                        result.push(children4[m])
                      }
                    }
                  }
                }
 
              }
            }
          }
        }
      }
     this.linkList = result
    },
 
  },
  computed:{
    projectProgress() {
      let array = []
 
      let okList = this.linkList.filter((i) => i.wcjd === 1)
      let ok = okList.length
      array[0] = ok
      if (this.linkList.length > 0 && ok > 0) {
        let p = (ok / this.linkList.length) * 100.0
        array[1] = Number(p.toFixed(1))
      }else {
        array[1] = 0
      }
 
      return array
    },
  }
}
</script>
 
<style lang="less" scoped>
 
/deep/ .row-custom-bg{
  background: #f4f4f4;
  color: #bababa;
}
 
.ant-table-tbody > tr > td {
  padding: 0px 0px !important;
}
.ant-table-middle > .ant-table-content > .ant-table-scroll > .ant-table-body > table > .ant-table-tbody > tr > td {
  padding: 0px 0px !important;
}
.ant-table-tbody .ant-table-row .ant-table-row-level-0 {
  padding: 0px 0px;
  height: 30px;
}
</style>