shenqilong 1 год назад
Родитель
Сommit
c82dff4a1a

+ 332 - 316
src/views/platform/bpmn/bpmInstHis/list.vue

@@ -4,7 +4,6 @@
             <ibps-type-tree
                 :width="width"
                 :height="height"
-                title="事务分类"
                 :location="location"
                 category-key="FLOW_TYPE"
                 :has-permission="hasPermission"
@@ -12,7 +11,9 @@
                 @expand-collapse="handleExpandCollapse"
             />
         </div>
+        <template-list v-if="templateShow" :template-data="templateData" />
         <ibps-crud
+            v-else
             ref="crud"
             :style="{ marginLeft: width + 'px' }"
             :height="height"
@@ -32,6 +33,7 @@
             @column-link-click="handleLinkClick"
             @pagination-change="handlePaginationChange"
         >
+            <template slot="creator" slot-scope="scope">{{ scope.row.createBy | getUserName(userList) }}</template>
             <template slot="selectCont" slot-scope="scope">
                 <el-popover
                     :ref="'popover2-' + scope.row.id"
@@ -40,13 +42,11 @@
                     popper-class="popverClass"
                     trigger="click"
                     @show="getReportAndFile(scope.row)"
-                    @hide="refresh=false"
                 >
                     <div slot="reference" class="div_operation el-icon-s-order">查阅记录</div>
-                    <div v-loading="fileLoading">
-                        <div v-if="refresh" class="div_content">
-                            <!-- 获取所有输出报告-->
-                            <!-- <template v-if="record.report.length && record.report[0]">
+                    <div v-loading="fileLoading" class="div_content">
+                        <!-- 获取所有输出报告-->
+                        <!-- <template v-if="record.report.length && record.report[0]">
                             <div v-for="(item, index) in record.report" :key="index" class="content_item">
                                 <span style="cursor: pointer;" @click="openReport(item, record.bizKey)">
                                     <i class="el-icon-tickets" style="font-size: 18px;" />
@@ -55,90 +55,89 @@
                                 <br>
                             </div>
                         </template> -->
-                            <div v-if="record.file.length && snapshotId" class="content_item">
-                                <!-- <div class="sub_operation">快照</div> -->
-                                <ibps-attachment
-                                    v-model="snapshotId"
-                                    :download="hasRole"
-                                    readonly
-                                    multiple
-                                    upload-type="attachment"
-                                    store="id"
-                                    style="width: 100%;"
-                                />
-                            </div>
-                            <div v-if="record.file.length && fileId" class="content_item">
-                                <div class="sub_operation ibps-icon-folder-open-o">附件</div>
-                                <ibps-attachment
-                                    v-model="fileId"
-                                    :download="hasRole"
-                                    readonly
-                                    multiple
-                                    upload-type="attachment"
-                                    store="id"
-                                    style="width: 100%; height: 100%; max-height: 180px; overflow-y: auto;"
-                                />
-                            </div>
-                            <!-- <div v-if="(!record.report.length || !record.report[0]) && (!record.file.length || !fileId)">无报表及附件数据</div> -->
-                            <!-- 二级菜单,内审管审特有 -->
-                            <template v-if="specialType.hasOwnProperty(typeId)">
-                                <el-popover
-                                    :ref="'popover3-' + scope.row.id"
-                                    placement="left"
-                                    width="350"
-                                    popper-class="popverClass_sub"
-                                    trigger="click"
-                                >
-                                    <div slot="reference" class="sub_operation ibps-icon-folder-o">{{ specialBtn[typeId].label }}</div>
-                                    <div v-if="record.special && record.special.length" class="div_content">
-                                        <div v-for="(item, index) in record.special" :key="index" class="content_item">
-                                            <div class="sub_content">
-                                                <div class="title">{{ specialBtn[typeId].desc }}项{{ item.flag }}</div>
-                                                <div class="sub_item">
-                                                    <div class="desc">{{ specialBtn[typeId].desc }}前</div>
-                                                    <ibps-attachment
-                                                        v-model="item.beforeImprove"
-                                                        placeholder="请选择"
-                                                        :download="hasRole"
-                                                        :readonly="true"
-                                                        accept="*"
-                                                        :multiple="true"
-                                                        upload-type="attachment"
-                                                        store="id"
-                                                        media-type=""
-                                                        media=""
-                                                        style="width: 100%;"
-                                                    />
-                                                </div>
-                                                <div class="sub_item">
-                                                    <div class="desc">{{ specialBtn[typeId].desc }}后</div>
-                                                    <ibps-attachment
-                                                        v-model="item.afterImprove"
-                                                        placeholder="请选择"
-                                                        :download="hasRole"
-                                                        :readonly="true"
-                                                        accept="*"
-                                                        :multiple="true"
-                                                        upload-type="attachment"
-                                                        store="id"
-                                                        media-type=""
-                                                        media=""
-                                                        style="width: 100%;"
-                                                    />
-                                                </div>
-                                                <div class="content_item">
-                                                    <span style="cursor: pointer;" @click="openReport(specialBtn[typeId].path, item.id_)">
-                                                        <i class="el-icon-tickets" style="font-size: 14px;" />
-                                                        {{ specialBtn[typeId].name }}
-                                                    </span>
-                                                </div>
+                        <div v-if="record.file.length && snapshotId" class="content_item">
+                            <!-- <div class="sub_operation">快照</div> -->
+                            <ibps-attachment
+                                v-model="snapshotId"
+                                download
+                                readonly
+                                multiple
+                                upload-type="attachment"
+                                store="id"
+                                style="width: 100%;"
+                            />
+                        </div>
+                        <div v-if="record.file.length && fileId" class="content_item">
+                            <div class="sub_operation ibps-icon-folder-open-o">附件</div>
+                            <ibps-attachment
+                                v-model="fileId"
+                                download
+                                readonly
+                                multiple
+                                upload-type="attachment"
+                                store="id"
+                                style="width: 100%; height: 100%; max-height: 180px; overflow-y: auto;"
+                            />
+                        </div>
+                        <div v-if="!record.file.length || (!fileId && !snapshotId)">无快照及附件数据</div>
+                        <!-- 二级菜单,内审管审特有 -->
+                        <template v-if="specialType.hasOwnProperty(typeId)">
+                            <el-popover
+                                :ref="'popover3-' + scope.row.id"
+                                placement="left"
+                                width="350"
+                                popper-class="popverClass_sub"
+                                trigger="click"
+                            >
+                                <div slot="reference" class="sub_operation ibps-icon-folder-o">{{ specialBtn[typeId].label }}</div>
+                                <div v-if="record.special && record.special.length" class="div_content">
+                                    <div v-for="(item, index) in record.special" :key="index" class="content_item">
+                                        <div class="sub_content">
+                                            <div class="title">{{ specialBtn[typeId].desc }}项{{ item.flag }}</div>
+                                            <div class="sub_item">
+                                                <div class="desc">{{ specialBtn[typeId].desc }}前</div>
+                                                <ibps-attachment
+                                                    v-model="item.beforeImprove"
+                                                    placeholder="请选择"
+                                                    :download="true"
+                                                    :readonly="true"
+                                                    accept="*"
+                                                    :multiple="true"
+                                                    upload-type="attachment"
+                                                    store="id"
+                                                    media-type=""
+                                                    media=""
+                                                    style="width: 100%;"
+                                                />
+                                            </div>
+                                            <div class="sub_item">
+                                                <div class="desc">{{ specialBtn[typeId].desc }}后</div>
+                                                <ibps-attachment
+                                                    v-model="item.afterImprove"
+                                                    placeholder="请选择"
+                                                    :download="true"
+                                                    :readonly="true"
+                                                    accept="*"
+                                                    :multiple="true"
+                                                    upload-type="attachment"
+                                                    store="id"
+                                                    media-type=""
+                                                    media=""
+                                                    style="width: 100%;"
+                                                />
+                                            </div>
+                                            <div class="content_item">
+                                                <span style="cursor: pointer;" @click="openReport(specialBtn[typeId].path, item.id_)">
+                                                    <i class="el-icon-tickets" style="font-size: 14px;" />
+                                                    {{ specialBtn[typeId].path | getReportName }}
+                                                </span>
                                             </div>
                                         </div>
                                     </div>
-                                    <div v-else>无对应数据</div>
-                                </el-popover>
-                            </template>
-                        </div>
+                                </div>
+                                <div v-else>无对应数据</div>
+                            </el-popover>
+                        </template>
                     </div>
                 </el-popover>
             </template>
@@ -146,6 +145,9 @@
         <bpmn-formrender
             :visible="dialogFormVisible"
             :instance-id="instanceId"
+            :data-resultitem="dataResultitem"
+            :time-modification="timeModification"
+            :time-modificationbtn="timeModificationbtn"
             @close="visible => dialogFormVisible = visible"
         />
         <el-dialog
@@ -175,21 +177,26 @@ import ActionUtils from '@/utils/action'
 import IbpsTypeTree from '@/business/platform/cat/type/tree'
 import FixHeight from '@/mixins/height'
 import BpmnFormrender from '@/business/platform/bpmn/form/dialog'
-import curdPost from '@/business/platform/form/utils/custom/joinCURD.js'
 import IbpsAttachment from '@/business/platform/file/attachment/selector'
-import { specialType, specialBtn, specialParams, specialTable, stateTable, stateField, specialField } from './corresponding/index'
+import { specialType, specialBtn, specialParams, specialTable, specialField } from './corresponding/index'
+import TemplateList from './templateList'
 
 export default {
     components: {
         IbpsTypeTree,
         BpmnFormrender,
-        IbpsAttachment
+        IbpsAttachment,
+        TemplateList
     },
     filters: {
         // 截取报表名称
         getReportName (value) {
             // 通过/与.截取,eg: 43罗湖/L13-LHXBJY-QP-6.4-04 标准菌株管理程序/LHXBJY-QP-6.4-04-FQ-03 标准菌株鉴定验收记录表.rpx
             return value.slice(-value.split('').reverse().join('').indexOf('/'), -value.split('').reverse().join('').indexOf('.') - 1)
+        },
+        getUserName (v, list) {
+            const user = list.find(i => i.userId === v)
+            return user ? user.userName : ''
         }
     },
     mixins: [FixHeight],
@@ -200,32 +207,23 @@ export default {
         }
     },
     data () {
-        const { role = [], highRoles = [] } = this.$store.getters.userInfo || {}
-        const hasRole = role.some(item => highRoles.includes(item.alias))
-        const { userList = [] } = this.$store.getters
-        const selectOptions = [
-            {
-                value: 'end',
-                label: '已完成',
-                type: 'success'
-            },
-            {
-                value: 'manualend',
-                label: '已作废',
-                type: 'danger'
-            }
-        ]
+        const { first = '' } = this.$store.getters.level || {}
+        const { userList = [], deptList = [] } = this.$store.getters || {}
         return {
-            refresh: false, // 控制弹出窗的显示与隐藏 实现组件刷新作用
-            hasRole,
-            width: 210,
+            first,
+            userList,
+            deptList,
+            width: 360,
             selection: false,
             dialogFormVisible: false,
             // 编辑dialog需要使用
             instanceId: '',
+            dataResultitem: {},
+            timeModification: false,
+            timeModificationbtn: true,
             // 主键 如果主键不是pk需要传主键
             pkKey: 'id',
-            tableTitle: '',
+            tableTitle: '体系运行记录',
             typeId: '',
             srcUrl: '',
             fileId: '',
@@ -245,7 +243,12 @@ export default {
             loading: true,
             fileLoading: false,
             height: document.clientHeight,
-            reportAll: [],
+            reportAll: {
+                process: [],
+                template: []
+            },
+            templateShow: false,
+            templateData: {},
             listData: [],
             pagination: {},
             sorts: { END_TIME_: 'DESC' },
@@ -254,93 +257,77 @@ export default {
             specialType,
             specialBtn,
             listConfig: {
-                toolbars: [{ key: 'search' }],
+                toolbars: [
+                    { key: 'search' }
+                ],
                 searchForm: {
                     forms: [
-                        {
-                            prop: 'Q^subject_^SL',
-                            label: '关键字:',
-                            itemWidth: 330,
-                            placeholder: '可输入年份/部门/表单名称/事务说明/编制人模糊查询'
-                        },
-                        {
-                            prop: 'Q^proc_def_name_^SL',
-                            label: '表单名称:',
-                            itemWidth: 150,
-                            placeholder: '请输入'
-                        },
-                        {
-                            prop: ['Q^end_time_^DL', 'Q^end_time_^DG'],
-                            label: '完成/作废时间',
-                            fieldType: 'daterange',
-                            labelWidth: 100
-                        },
-                        {
-                            prop: 'Q^status_^S',
-                            label: '状态',
-                            fieldType: 'select',
-                            options: selectOptions,
-                            itemWidth: 100
-                        }
+                        // { prop: 'Q^subject_^SL', label: '关键字', itemWidth: 330, placeholder: '可输入年份/部门/表单名称/事务说明/编制人模糊查询' },
+                        { prop: 'dept', label: '部门', itemWidth: 150, placeholder: '请输入', labelWidth: 50 },
+                        { prop: 'tableName', label: '表单名称', itemWidth: 150, placeholder: '请输入', labelWidth: 70 },
+                        { prop: 'desc', label: '事务说明', itemWidth: 150, placeholder: '请输入', labelWidth: 70 },
+                        { prop: 'createBy', label: '编制人', itemWidth: 150, placeholder: '请输入', labelWidth: 60 },
+                        { prop: ['Q^end_time_^DL', 'Q^end_time_^DG'], label: '完成时间', fieldType: 'daterange', labelWidth: 70, itemWidth: 220 }
                     ]
                 },
                 // 表格字段配置
                 columns: [
-                    // { prop: 'subject', label: '任务标题', link: 'dialog', width: 250 },
-                    { prop: 'tYear', label: '年份', width: 60 },
-                    { prop: 'tDept', label: '部门', width: 90 },
-                    {
-                        prop: 'procDefName',
-                        label: '表单名称',
-                        sortable: 'custom',
-                        formatter: this.replaceFormName,
-                        width: 250
-                    },
-                    {
-                        prop: 'subject',
-                        label: '事务说明',
-                        formatter: this.getDesc,
-                        'min-width': 300
-                    },
-                    { prop: 'tUser', label: '编制人', width: 80 },
-                    {
-                        prop: 'status',
-                        label: '状态',
-                        width: 80,
-                        options: selectOptions
-                    },
-                    {
-                        prop: 'endTime',
-                        label: '完成/作废时间',
-                        sortable: 'custom',
-                        dateFormat: 'yyyy-MM-dd',
-                        width: 120
-                    }
+                    { prop: 'deptName', label: '部门', width: 85 },
+                    { prop: 'procDefName', label: '表单名称', formatter: this.replaceFormName, width: 220 },
+                    { prop: 'desc', label: '事务说明', 'min-width': 280 },
+                    { prop: 'endTime', label: '完成时间', sortable: 'custom', width: 135 },
+                    { prop: 'createBy', label: '编制人', width: 70, slotName: 'creator' }
                 ],
                 rowHandle: {
                     actions: [
-                        {
-                            key: 'detail',
-                            label: '详情'
-                        }
+                        // {
+                        //     key: 'detail',
+                        //     label: '详情',
+                        //     type: 'info'
+                        // }
                     ],
                     effect: 'display',
                     width: '100'
                 }
-            },
-            userList
+            }
+        }
+    },
+    watch: {
+        dialogFormVisible: {
+            handler: function (val, oldVal) {
+                if (val === false) {
+                    // console.log(val)
+
+                    ActionUtils.setFirstPagination(this.pagination)
+                    this.search()
+                }
+            }
+
         }
     },
     created () {
         this.loadData()
         this.getConfig()
-        const roleList = this.$store.getters.userInfo.role
-        // 系统管理角色添加删除按钮
-        const deleteRole = roleList.some(item => item.alias === 'xtgljs')
-        if (deleteRole) {
-            // 系统管理角色不做分类过滤,显示删除按钮
-            this.hasPermission = false
-            this.listConfig.toolbars.push({ key: 'remove' })
+        const { role = [] } = this.$store.getters.userInfo || {}
+        const roleList = ['xtgljs', 'xxglxzfzr', 'wjglzzc', 'syszr']
+        // 系统管理角色、信息管理负责人、检验科主任添加删除按钮
+        const hasRole = role.some(item => roleList.includes(item.alias))
+        this.listConfig.toolbars.push({
+            key: 'detail',
+            label: '详情',
+            type: 'info'
+        })
+        if (hasRole) {
+            // 系统管理角色不做分类过滤
+            // this.hasPermission = false
+            const btn = [
+                {
+                    key: 'remove',
+                    label: '删除',
+                    type: 'danger'
+                }
+            ]
+            this.listConfig.toolbars.push(...btn)
             this.selection = true
         }
     },
@@ -353,27 +340,39 @@ export default {
             return cellValue
         },
         // 截取事务说明字段内容
-        getDesc (row, column, cellValue, index) {
-            const hasDesc = cellValue.includes('#')
+        getDesc (str) {
+            const hasDesc = str.includes('#')
             if (!hasDesc) {
                 return ''
             }
-            return cellValue.split('#')[1]
+            return str.split('#')[1]
+        },
+        getInfo (val) {
+            const arr = val.split('#')
+            if (!arr[2]) {
+                return ''
+            }
+            const result = JSON.parse(`{${arr[2]}}`)
+            const depts = result.dept.split(',')
+            const deptNames = []
+            depts.forEach(item => {
+                const t = this.deptList.find(i => i.positionId === item)
+                deptNames.push(t ? t.positionName : result.dept)
+            })
+            result.deptName = deptNames.join(',')
+            return result
         },
         // 加载数据
         loadData () {
             this.loading = true
             queryClassify(this.getSearcFormData()).then((response) => {
-                const data = response.data && response.data.dataResult
-                data.forEach(item => {
-                    const temp = this.userList.find(i => item.createBy === i.userId)
-                    item.tYear = item.createTime.slice(0, 4)
-                    item.tDept = temp.groupName
-                    item.tUser = temp.userName
-                    if ((item.formKey === 'nsssjhbfj' || item.formKey === 'nsssjhx') && item.updateTime === item.endTime) {
-                        item.endTime = ''
-                    }
+                const { dataResult = [] } = response.data || {}
+                dataResult.forEach(item => {
+                    const temp = this.getInfo(item.subject)
+                    item.deptName = temp ? temp.deptName : ''
+                    item.desc = this.getDesc(item.subject)
                 })
+                response.data.dataResult = dataResult
                 ActionUtils.handleListData(this, response.data)
                 this.loading = false
             }).catch(() => {
@@ -382,11 +381,19 @@ export default {
         },
         // 获取所有流程的报表配置数据
         getConfig () {
-            const sql = 'select bao_biao_lu_jing_, fu_jian_nei_rong_, guan_lian_zi_duan, liu_cheng_xuan_ze, shi_fou_zi_biao_ from t_lcidglbdbb'
-            curdPost('sql', sql).then((res) => {
-                this.reportAll = res.variables && res.variables.data
-            }).catch(() => {
-                console.log('获取流程配置报表数据失败!')
+            const sql = `select * from t_lcidglbdbb`
+            this.$common.request('sql', sql).then((res) => {
+                const { data = [] } = res.variables || {}
+                data.forEach(i => {
+                    if (!i.gui_dang_lei_xing) {
+                        this.reportAll.process.push(i)
+                    } else {
+                        this.reportAll[i.gui_dang_lei_xing].push(i)
+                    }
+                })
+            }).catch(err => {
+                this.$message.error('获取流程配置报表数据失败!')
+                console.log(err)
             })
         },
         // 获取报表数据及附件数据
@@ -405,7 +412,7 @@ export default {
                 return
             }
             this.numbersClick()
-            const temp = this.reportAll.find(item => item.liu_cheng_xuan_ze === procDefKey)
+            const temp = this.reportAll.process.find(item => item.liu_cheng_xuan_ze === procDefKey)
             if (!temp) {
                 return
             }
@@ -417,31 +424,22 @@ export default {
                 special: [],
                 bizKey
             }
-            let typeIndex = 1
+            let typeIndex = ''
             // 特殊类型处理
             if (this.specialType.hasOwnProperty(this.typeId)) {
-                // 获取内审管审全局状态,根据此状态过滤报表显示
-                const sql = `select zhuang_tai_jie_di as state from ${stateTable[this.typeId]} where ${stateField[this.typeId]} = '${bizKey}'`
-                curdPost('sql', sql).then((res) => {
-                    const { data = [] } = res.variables || {}
-                    if (data.length) {
-                        console.log(data[0].state)
-                        this.specialType[this.typeId].forEach((item, index) => {
-                            // 判断当前流程在哪一步,以此决定报表展示
-                            if (data[0].state === item) {
-                                // 数组下标+2为当前报表文件排序
-                                typeIndex = index + 2
-                            }
-                        })
+                this.specialType[this.typeId].forEach((item, index) => {
+                    // 判断当前流程在哪一步,以此决定报表展示
+                    if (subject.includes(item)) {
+                        // 数组下标+2为当前报表文件排序
+                        typeIndex = index + 2
                     }
-                    console.log(typeIndex)
-                    this.record.report = this.record.report.slice(0, typeIndex)
-                }).catch(() => {
-                    console.log('获取管审内审全局状态数据失败!')
-                    this.record.report = this.record.report.slice(0, typeIndex)
                 })
                 this.getSpecicalFile(bizKey)
             }
+            // console.log(typeIndex)
+            if (typeIndex !== '') {
+                this.record.report = this.record.report.slice(0, typeIndex)
+            }
             // console.log(this.record)
             if (this.record.file.length && this.record.table.length) {
                 this.getAllFile(this.record)
@@ -460,31 +458,26 @@ export default {
                 resultList.push(this.getFile(sql, file[index], item))
                 requestOrder.push(index)
             })
-            // console.log(resultList)
             Promise.all(resultList).then(res => {
                 // console.log('所有附件ID:', res)
                 const sortedResults = requestOrder.map(index => res[index])
                 this.fileId = [...new Set(sortedResults.reduce((acc, cur) => acc.concat(cur.file), []))].join(',')
                 this.snapshotId = [...new Set(sortedResults.reduce((acc, cur) => acc.concat(cur.snapshot), []))].join(',')
-                // console.log({ 'snapshotId': this.snapshotId.split(','), 'fileId': this.fileId.split(',') })
-                this.refresh = true
                 this.fileLoading = false
             }).catch(err => {
                 this.fileLoading = false
-                this.refresh = true
                 console.log('error', err)
             })
         },
         // 获取单个请求中的文件
         getFile (sql, fileField, table) {
             return new Promise((resolve, reject) => {
-                curdPost('sql', sql).then(res => {
+                this.$common.request('sql', sql).then(res => {
                     const result = {
                         file: [],
                         snapshot: []
                     }
                     const fileList = fileField.split(',')
-                    // console.log(fileList)
                     let { data = [] } = res.variables || {}
                     data = data.filter(i => i)
                     // 若配置的附件字段中含创建时间,先将结果按时间升序排列
@@ -512,6 +505,7 @@ export default {
                             })
                         }
                     })
+                    // console.log(result)
                     resolve(result)
                 })
             })
@@ -531,7 +525,7 @@ export default {
         getSpecicalFile (id) {
             const sql = `select ${specialParams[this.typeId]} from ${specialTable[this.typeId]} where ${specialField[this.typeId]} = '${id}'`
             // console.log(sql)
-            curdPost('sql', sql).then(res => {
+            this.$common.request('sql', sql).then(res => {
                 const { data = [] } = res.variables || {}
                 if (data.length) {
                     this.record.special = data.filter(i => i.beforeImprove || i.afterImprove)
@@ -540,103 +534,85 @@ export default {
         },
         // 打开报表
         openReport (path, id) {
-            this.srcUrl = `${this.$reportPath.replace('show', 'pdf')}${path}&id_=${id}`
+            this.srcUrl = `${this.$reportPath.replace('show', 'pdf')}${path}&id_=${id}&org_=${this.first}`
             this.visible = true
-            // 系统管理角色、实验室主任、档案管理员、信息管理角色可下载打印
-            if (this.hasRole) {
-                return
-            }
-            setTimeout(() => {
-                const toolbarCover = document.createElement('div')
-                toolbarCover.classList.add('toolbar-cover')
-                toolbarCover.addEventListener('click', () => {
-                    confirm('无权操作,请联系管理员开放相关权限!', '提示')
-                })
-                document.querySelector('.js-custom-dialog').firstElementChild.children[1].appendChild(toolbarCover)
-            }, 1000)
-        },
-        getParenthesesStr (text) {
-            let result = ''
-            if (!text) return result
-            // 新数据年份、部门、发起人以{}包裹
-            const regex1 = /\{(.+?)\}/g
-            // 旧数据年份、部门、发起人以()包裹
-            const regex2 = /\((.+?)\)/g
-            const options1 = text.match(regex1)
-            const options2 = text.match(regex2)
-            const options = options1 && options1.length ? options1 : options2
-            if (options) {
-                const option = options[0]
-                if (option) {
-                    result = option.substring(1, option.length - 1)
-                }
-                if (options[1]) {
-                    const yersOption = options[1]
-                    if (yersOption) {
-                        result = result + '/' + yersOption.substring(1, yersOption.length - 1)
-                    }
-                }
-            }
-            return result.split('/')
         },
         // 获取格式化参数
         getSearcFormData () {
-            const params = this.$refs['crud'] ? this.$refs['crud'].getSearcFormData() : {}
-            if (this.$utils.isNotEmpty(this.typeId)) {
-                params['Q^TYPE_ID_^S'] = this.typeId
-            }
-            const formattedForm = {
-                arg: {
-                    relation: 'AND',
-                    parameters: []
-                }
-            }
-            if (this.$utils.isEmptyObject(params)) {
-                params['Q^status_^S'] = 'end,manualend'
-            }
-            Object.keys(params).forEach((v) => {
-                const val = params[v]
-                if (this.$utils.isNotEmpty(val)) {
-                    const key = v
-                    if (!Array.isArray(val)) {
-                        const valArr = val.split(',')
-                        if (valArr.length > 1) {
-                            const parameters = valArr.map((i) => ({
-                                key,
-                                value: i,
-                                param: this.$utils.guid()
-                            }))
-                            formattedForm.arg.parameters.push({
-                                relation: 'OR',
-                                parameters
-                            })
-                        } else {
-                            const o = {
+            const temp = this.$refs['crud'] ? this.$refs['crud'].getSearcFormData() : {}
+            const parameters = this.getParams(temp) || []
+            // console.log(parameters)
+            const creator = parameters.filter(i => i.key.includes('create_by_'))
+            const others = parameters.filter(i => !i.key.includes('create_by_'))
+            const params = {
+                parameters: [
+                    {
+                        relation: 'AND',
+                        parameters: [
+                            {
                                 relation: 'AND',
                                 parameters: [
                                     {
-                                        key,
-                                        value: val,
-                                        param: this.$utils.guid()
-                                    }
+                                        key: 'Q^status_^S',
+                                        value: 'end'
+                                    },
+                                    ...others
                                 ]
+                            },
+                            {
+                                relation: 'OR',
+                                parameters: creator
                             }
-                            formattedForm.arg.parameters.push(o)
+                        ]
+                    }
+                ],
+                requestPage: {
+                    pageNo: this.pagination.page || 1,
+                    limit: this.pagination.limit || 100
+                },
+                ...ActionUtils.formatParams(null, null, this.sorts)
+            }
+            if (this.$utils.isNotEmpty(this.typeId)) {
+                params.parameters[0].parameters[0].parameters.push({ key: 'Q^TYPE_ID_^S', value: this.typeId })
+            }
+            if (!creator.length) {
+                params.parameters[0].parameters[1].parameters = this.userList.map(i => ({ key: 'Q^create_by_^S', value: i.userId, param: this.$utils.guid() }))
+            }
+            return params
+        },
+        getParams (data) {
+            const result = []
+            const special = ['dept', 'tableName', 'desc', 'createBy']
+            Object.keys(data).forEach(key => {
+                if (special.includes(key)) {
+                    if (key === 'createBy') {
+                        // 转换用户ID
+                        const t = this.userList.filter(i => i.userName.includes(data[key]))
+                        if (!t.length) {
+                            result.push({ key: 'Q^create_by_^SL', value: data[key] })
                         }
-                    } else {
-                        const parameters = val.map((i) => ({
-                            key,
-                            value: i,
-                            param: this.$utils.guid()
-                        }))
-                        formattedForm.arg.parameters.push({
-                            relation: 'OR',
-                            parameters
+                        const res = t.map(i => i.userId)
+                        res.forEach(i => {
+                            result.push({ key: 'Q^create_by_^SL', value: i })
+                        })
+                    } else if (key === 'dept') {
+                        // 转换部门ID
+                        const t = this.deptList.filter(i => i.positionName.includes(data[key]))
+                        if (!t.length) {
+                            result.push({ key: 'Q^subject_^SL', value: data[key] })
+                        }
+                        const res = t.map(i => i.positionId)
+                        res.forEach(i => {
+                            result.push({ key: 'Q^subject_^SL', value: i })
                         })
+                    } else {
+                        result.push({ key: 'Q^subject_^SL', value: data[key] })
                     }
+                } else {
+                    result.push({ key, value: data[key] })
                 }
             })
-            return ActionUtils.formatParams(formattedForm, this.pagination, this.sorts)
+            return result.map(i => ({ ...i, param: this.$utils.guid() }))
         },
         // 处理分页事件
         handlePaginationChange (page) {
@@ -679,14 +655,16 @@ export default {
                         this.$message.warning('请选择数据!')
                         return
                     }
-                    if (data.length > 10) {
-                        this.$message.warning('单次最多只能删除十条!')
+                    if (data.length > 20) {
+                        this.$message.warning('单次最多只能删除十条!')
                         return
                     }
                     this.handleDelete(data, selection)
                     break
                 case 'detail': // 明细
                     ActionUtils.selectedRecord(selection).then((id) => {
+                        // console.log(this.timeModification)
+                        this.dataResultitem = data[0] || {}
                         this.handleEdit(id)
                         this.title = '信息'
                     }).catch(() => {})
@@ -718,19 +696,25 @@ export default {
                 // console.log(delList, formKeyArr)
                 const sql = `select a.bo_code_, b.key_ from ibps_form_bo a, ibps_form_def b where a.form_id_ = b.id_ and find_in_set(b.key_, '${formKeyArr.join(',')}')`
                 // 获取选中记录对应的数据表code
-                curdPost('sql', sql).then(res => {
+                this.$common.request('sql', sql).then(res => {
                     const result = res.variables && res.variables.data
                     const codeList = {}
                     result.forEach(m => {
                         codeList[m.key_] = m.bo_code_
                     })
-                    const req = `{"tableName":"ibps_bpm_inst_his","paramWhere":"{id_:'${selection.join(',')}'}"}`
+                    const deleteParams1 = {
+                        tableName: 'ibps_bpm_inst_his',
+                        paramWhere: { id_: selection.join(',') }
+                    }
                     // 删除选中记录
-                    curdPost('batchDelete', req).then(() => {
+                    this.$common.request('delete', deleteParams1).then(() => {
                         // 循环删除对应数据表数据
                         Object.keys(codeList).forEach(k => {
-                            const temp = `{"tableName":"t_${codeList[k]}","paramWhere":"{id_:'${delList[k].join(',')}'}"}`
-                            curdPost('batchDelete', temp)
+                            const deleteParams2 = {
+                                tableName: `t_${codeList[k]}`,
+                                paramWhere: { id_: delList[k].join(',') }
+                            }
+                            this.$common.request('delete', deleteParams2)
                         })
                         this.$message.success('删除成功!')
                         this.search()
@@ -741,12 +725,24 @@ export default {
             })
         },
         handleNodeClick (typeId, typeName) {
+            console.log(typeId, typeName)
+
             this.tableTitle = typeName.name
             this.typeId = typeId
-            this.loadData()
+            this.templateData = this.reportAll.template.find(i => i.fen_lei_id_ === typeId) || {}
+            console.log(this.templateData)
+
+            if (!this.templateData.templateid_) {
+                this.templateShow = false
+                this.loadData()
+            } else {
+                this.templateShow = true
+                this.templateData.typeId = typeId
+                this.templateData.typeName = typeName.name
+            }
         },
         handleExpandCollapse (isExpand) {
-            this.width = isExpand ? 230 : 30
+            this.width = isExpand ? this.width : 30
         },
         // 处理编辑
         handleEdit (id = '') {
@@ -757,6 +753,24 @@ export default {
 }
 </script>
 <style lang="scss" scoped>
+    .js-custom-dialog {
+        .el-dialog__body {
+            height: calc(100vh) !important;
+            margin: -9px !important;
+            padding: 0px !important;
+            overflow: hidden;
+        }
+        .el-dialog__header {
+            padding: 0px;
+        }
+        .el-dialog__headerbtn i {
+            font-size: 28px;
+            font-weight: bold;
+            background-color: #ffffff;
+            border-radius: 8px;
+            margin-top: -8px;
+        }
+    }
     .div_operation {
         cursor: pointer;
     }
@@ -793,7 +807,8 @@ export default {
         }
     }
     .content_item {
-        // max-height: 200px;
+        max-height: 200px;
+        overflow-y: auto;
         margin-bottom: 4px;
         &:first-child{
             .sub_content .title {
@@ -828,3 +843,4 @@ export default {
         }
     }
 </style>
+

+ 60 - 0
src/views/platform/bpmn/bpmInstHis/templateList.vue

@@ -0,0 +1,60 @@
+<template>
+    <div class="template-container">
+
+        <template-list
+            :template-id="templateId"
+            :dynamic-params="dynamicParams"
+            :filter-params="filterParams"
+            :type-name="typeName"
+            :type-id="typeId"
+            :route-handler="routeHandler"
+        />
+    </div>
+</template>
+
+<script>
+import TemplateList from '@/views/platform/data/dataTemplate/template-list.vue'
+export default {
+    components: {
+        TemplateList
+    },
+    props: {
+        templateData: {
+            type: Object,
+            default: () => {}
+        }
+    },
+    data () {
+        const { templateid_, guo_lv_can_shu_, typeName, typeId } = this.templateData
+        return {
+            typeName,
+            templateId: templateid_,
+            typeId,
+            filterParams: guo_lv_can_shu_ ? JSON.parse(guo_lv_can_shu_) : [],
+            dynamicParams: {},
+            routeHandler: false
+        }
+    },
+    watch: {
+        templateData (v) {
+            const { templateid_, guo_lv_can_shu_, typeName, typeId } = v
+            this.typeName = typeName
+            this.templateId = templateid_
+            this.typeId = typeId
+            this.filterParams = guo_lv_can_shu_ ? JSON.parse(guo_lv_can_shu_) : []
+        }
+    }
+    // methods: {
+
+    // }
+}
+</script>
+
+<style lang="scss" scoped>
+    .template-container{
+        ::v-deep .container-component{
+            margin-left: 358px;
+        }
+    }
+</style>
+

+ 17 - 57
src/views/platform/data/dataTemplate/template-list.vue

@@ -188,37 +188,30 @@ export default {
             const customBtn = buttons.filter(i => i.show_on_record === 'Y')
             return [...defaultBtn, ...customBtn]
         },
-        dealFilter (dataList) {
-            // 1.去除原过滤条件中的编制部门在其中
-            // 2.追加数据模板归档中的过滤条件
-            // 3.增加地点过滤(若为第一层级用户,则过滤出所有一二级地点数据;若为第二级用户,则过滤当前地点数据)
-            const levelFilter = this.getLevelFilter()
-            if (!dataList.length) {
-                // 无过滤条件时默认地点过滤
-                return [
-                    {
-                        label: '默认条件',
-                        key: this.$utils.guid(),
-                        type: 'condition',
-                        rights: [{ type: 'all' }],
-                        filter: {
-                            condition: 'AND',
-                            rules: [levelFilter]
-                        }
+        dealFilter (dataList = []) {
+            // 追加数据模板归档中的过滤条件
+            const initList = dataList.length ? dataList : [
+                {
+                    label: '默认条件',
+                    key: this.$utils.guid(),
+                    type: 'condition',
+                    rights: [{ type: 'all' }],
+                    filter: {
+                        condition: 'AND',
+                        rules: []
                     }
-                ]
-            }
-            const newDataList = dataList.map(data => {
-                const rules = data.filter.rules.filter(i => i.id !== 'find_in_set' && !i.value.includes('cscript.findPositionId'))
+                }
+            ]
+
+            const newDataList = initList.map(data => {
                 const newRules = [
                     ...this.filterParams.map(item => ({
                         id: item.field,
                         type: 'string',
                         input: 'text',
                         ...item
-                    })),
-                    ...rules,
-                    levelFilter
+                    }))
+
                 ]
                 // 关联关系固定为AND
                 return { ...data, filter: { ...data.filter, condition: 'AND', rules: newRules.filter(i => i) }}
@@ -236,39 +229,6 @@ export default {
                 }
             })
             return data
-        },
-        // 获取当前用户地点信息 equal-等于 in-在…之内
-        getLevelFilter () {
-            const { second = '' } = this.$store.getters.level
-            const { deptList = [] } = this.$store.getters
-            // 当参数中含有地点配置时,无需再额外处理
-            const hasLocationParams = this.filterParams.some(i => i.id === 'di_dian_' && i.value.includes('cscript.findPositionId'))
-            if (hasLocationParams) {
-                return undefined
-            }
-            if (second) {
-                return {
-                    field: 'di_dian_',
-                    id: 'di_dian_',
-                    input: 'text',
-                    label: '地点',
-                    operator: 'equal',
-                    source: 'fixed',
-                    type: 'string',
-                    value: second
-                }
-            }
-
-            return {
-                field: 'di_dian_',
-                id: 'di_dian_',
-                input: 'text',
-                label: '地点',
-                operator: 'in',
-                source: 'fixed',
-                type: 'string',
-                value: deptList.filter(i => i.depth * 1 >= 2).map(i => i.id)
-            }
         }
     }
 }