Przeglądaj źródła

检测档案排序修改

cfort 2 lat temu
rodzic
commit
10c33af035

+ 96 - 47
src/views/platform/bpmn/bpmInstHis/record/component/testingRecord.vue

@@ -4,20 +4,48 @@
         <div class="search-box">
             <template v-for="(item, index) in searchList">
                 <span class="label">{{ item.label }}</span>
-                <el-input v-if="item.value !== 'sampleTime'" v-model="searchParam[item.value]" class="input" size="mini" placeholder="请输入内容" clearable @keyup.enter.native="search" @change="search"></el-input>
-                <el-date-picker v-else v-model="searchParam[item.value]" type="daterange" value-format="yyyy-MM-dd" size="mini" unlink-panels range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" style="width: 220px" @change="search"></el-date-picker>
+                <el-input
+                    v-if="item.value !== 'sampleTime'"
+                    v-model="searchParam[item.value]"
+                    class="input"
+                    size="mini"
+                    placeholder="请输入内容"
+                    clearable
+                    @keyup.enter.native="search"
+                    @change="search"
+                />
+                <el-date-picker
+                    v-else
+                    v-model="searchParam[item.value]"
+                    type="daterange"
+                    value-format="yyyy-MM-dd"
+                    size="mini"
+                    unlink-panels
+                    range-separator="-"
+                    start-placeholder="开始日期"
+                    end-placeholder="结束日期"
+                    style="width: 220px"
+                    @change="search"
+                />
             </template>
             <el-button class="btn" type="primary" @click="search"> <i class="ibps-icon-search"></i>查询 </el-button>
         </div>
         <div class="table-container">
-            <el-table :data="tableData" :stripe="true" style="width: 100%" height="75vh" border max-height="100%" header-cell-class-name="table-header" @sort-change="sortChange">
+            <el-table
+                :data="tableData"
+                :stripe="true"
+                style="width: 100%"
+                height="75vh"
+                border
+                max-height="100%"
+                header-cell-class-name="table-header"
+                @sort-change="sortChange"
+            >
                 <!-- <el-table-column type="selection" width="55"></el-table-column> -->
-                <el-table-column prop="he_tong_bian_hao_" label="合同编号" sortable width="100">
-                </el-table-column>
-                <el-table-column prop="wei_tuo_bian_hao_" label="委托单号" sortable width="110">
-                </el-table-column>
+                <el-table-column prop="he_tong_bian_hao_" label="合同编号" sortable width="110"></el-table-column>
+                <el-table-column prop="wei_tuo_bian_hao_" label="委托单号" sortable width="110"></el-table-column>
                 <el-table-column prop="bao_gao_bian_hao_" label="报告编号" sortable width="120"></el-table-column>
-                <el-table-column prop="run_qian_lu_jing_" label="版本号" sortable width="100"></el-table-column>
+                <el-table-column prop="run_qian_lu_jing_" label="版本号" width="100"></el-table-column>
                 <!-- <el-table-column prop="wei_tuo_fang_" label="委托单位"></el-table-column> -->
                 <!-- <el-table-column prop="wan_cheng_shi_jia" label="委托日期" width="100"></el-table-column> -->
                 <el-table-column prop="yang_pin_bian_hao" label="样品编号" sortable width="120"></el-table-column>
@@ -27,8 +55,7 @@
                 <el-table-column label="检测时间" width="100">
                     <template slot-scope="scope">{{ getTestTime(scope.row) }}</template>
                 </el-table-column>
-                <el-table-column prop="gai_zhang_jian_pd" label="检测项目"></el-table-column>
-
+                <el-table-column prop="gai_zhang_jian_pd" label="检测项目" minWidth="200"></el-table-column>
                 <el-table-column label="操作" align="left" width="100">
                     <template slot-scope="scope">
                         <el-popover placement="left" width="200" trigger="click">
@@ -37,7 +64,7 @@
                                 <!-- 检测记录 -->
                                 <div v-if="item.key === 'testing'">
                                     <el-popover placement="left" width="200" trigger="click">
-                                        <div class="operate-item" slot="reference" @click="getTesting(scope.row)"><i class="el-icon-s-order"></i> {{ item.name }}</div>
+                                        <div slot="reference" class="operate-item" @click="getTesting(scope.row)"><i class="el-icon-s-order"></i> {{ item.name }}</div>
                                         <div class="three-item">
                                             <div v-for="i in testingList" :key="i.id" class="operate-item" @click="consult(i)">
                                                 {{ i.projectName }}
@@ -47,7 +74,7 @@
                                 </div>
                                 <div v-else-if="item.key === 'file'">
                                     <el-popover placement="left" width="300" trigger="click">
-                                        <div class="operate-item" slot="reference" @click="getFile(scope.row, item.field)"><i class="el-icon-s-order"></i> {{ item.name }}</div>
+                                        <div slot="reference" class="operate-item" @click="getFile(scope.row, item.field)"><i class="el-icon-s-order"></i> {{ item.name }}</div>
                                         <div class="three-item">
                                             <div v-for="i in fileList" :key="i.id" class="operate-item">
                                                 <span @click="preview(i)"><i class="el-icon-tickets"></i>{{ i.fileName }}.{{ i.ext }}</span>
@@ -63,13 +90,35 @@
                 </el-table-column>
             </el-table>
         </div>
-        <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" :top="'3vh'" :width="'90%'" class="js-custom-dialog" append-to-body :fullscreen="false" :visible.sync="visible">
+        <el-dialog
+            :close-on-click-modal="false"
+            :close-on-press-escape="false"
+            :top="'3vh'"
+            :width="'90%'"
+            class="js-custom-dialog"
+            append-to-body
+            :fullscreen="false"
+            :visible.sync="visible"
+        >
             <iframe :src="srcUrl" :height="'100%'" :width="'100%'" frameborder="0" scrolling="no" />
         </el-dialog>
         <div class="pagination">
-            <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page.sync="currentPage" :page-sizes="[10, 20, 50, 100]" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper" :total="total"> </el-pagination>
+            <el-pagination
+                :current-page.sync="currentPage"
+                :page-sizes="[10, 20, 50, 100]"
+                :page-size="pageSize"
+                layout="total, sizes, prev, pager, next, jumper"
+                :total="total"
+                @size-change="handleSizeChange"
+                @current-change="handleCurrentChange"
+            ></el-pagination>
         </div>
-        <image-viewer v-if="fileType === 'image'" :z-index="zIndex" :url-list="[fileUrl]" :on-close="() => (fileType = '')" />
+        <image-viewer
+            v-if="fileType === 'image'"
+            :z-index="zIndex"
+            :url-list="[fileUrl]"
+            :on-close="() => fileType = ''"
+        />
     </div>
 </template>
 
@@ -102,7 +151,7 @@ const searchList = [
         value: 'sampleTime'
     }
 ]
-let reportList = [
+const reportList = [
     // {
     //     name: '合同',
     //     key: 'he_tong_id_',
@@ -153,11 +202,11 @@ const testingPath = {
 const imageType = ['jpg', 'jpeg', 'bmp', 'png', 'gif']
 export default {
     filters: {
-        getID(v, arr) {
-            let result = arr.find((item) => item.id_ === v)
+        getID (v, arr) {
+            const result = arr.find((item) => item.id_ === v)
             return result ? result.name_ : v
         },
-        getYear(v) {
+        getYear (v) {
             return v ? v.slice(0, 4) : ''
         }
     },
@@ -170,7 +219,7 @@ export default {
             default: () => {}
         }
     },
-    data() {
+    data () {
         return {
             searchList,
             reportList,
@@ -204,18 +253,18 @@ export default {
             params: ''
         }
     },
-    created() {
+    created () {
         this.loadData()
     },
-    beforeDestroy() {
+    beforeDestroy () {
         this.fileType = ''
     },
     methods: {
         // 请求表格数据函数
-        loadData() {
+        loadData () {
             console.log(this.searchParam.sampleTime)
             this.tableData = []
-            let params = {
+            const params = {
                 zhuang_tai_: "'已完成','待发放'",
                 bao_gao_lei_bie_: this.info.type,
                 bao_gao_bian_hao_: this.searchParam.report,
@@ -227,17 +276,17 @@ export default {
                 sort: this.prop,
                 limit: this.pageSize,
                 pageNo: this.currentPage,
-                order : this.order
+                order: this.order
             }
             selectDetectionFile(params).then((res) => {
-                let data = res.data
-                let { dataResult,pageResult} = data
-                console.log(pageResult)
+                const data = res.data
+                const { dataResult, pageResult } = data
+                // console.log(pageResult)
                 this.tableData = dataResult
                 this.total = pageResult.totalCount
             })
         },
-        getTestTime({ jian_ce_kai_shi_s, jian_ce_jie_shu_s }) {
+        getTestTime ({ jian_ce_kai_shi_s, jian_ce_jie_shu_s }) {
             const start = jian_ce_kai_shi_s ? jian_ce_kai_shi_s.slice(0, 10) : ''
             const end = jian_ce_jie_shu_s ? jian_ce_jie_shu_s.slice(0, 10) : ''
             if (!start && !end) {
@@ -249,7 +298,7 @@ export default {
             return `${start}至${end}`
         },
         // 获取检测项目数据
-        getTesting(row) {
+        getTesting (row) {
             const { wei_tuo_id_, yang_pin_bian_hao, xiu_gai_bao_gao_b } = row
             this.testingList = []
             const sql = `select b.id_ as id, a.defkey_ as number, a.jian_ce_xiang_mu_ as projectName, max(b.create_time_) from t_mjjcnlfw a, t_lhjczb b where a.id_ = b.jian_ce_xiang_mu_ and b.wei_tuo_id_ = '${wei_tuo_id_}' and b.yang_pin_bian_hao = '${yang_pin_bian_hao}' and find_in_set(b.jian_ce_xiang_mu_, '${xiu_gai_bao_gao_b}') group by b.jian_ce_xiang_mu_`
@@ -259,12 +308,12 @@ export default {
             })
         },
         // 获取附件信息,报告表【bao_gao_pdf_, suo_you_yuan_shi_, fu_jian_yi_】字段
-        getFile(row, key) {
+        getFile (row, key) {
             let files = ''
             if (key.includes(',')) {
                 // 多字段
-                let a = row.suo_you_yuan_shi_ ? row.suo_you_yuan_shi_.split(',') : []
-                let b = row.fu_jian_yi_ ? row.fu_jian_yi_.split(',') : []
+                const a = row.suo_you_yuan_shi_ ? row.suo_you_yuan_shi_.split(',') : []
+                const b = row.fu_jian_yi_ ? row.fu_jian_yi_.split(',') : []
                 files = a.concat(b).join(',')
             } else {
                 files = row[key]
@@ -275,31 +324,31 @@ export default {
                 this.fileList = res.variables && res.variables.data
             })
         },
-        consult(data) {
+        consult (data) {
             this.alertReport(testingPath[data.number], data.id)
         },
-        timeFormat(time) {
+        timeFormat (time) {
             return new Date(time.getTime() + 28800000).toJSON().slice(0, 10)
         },
         // 组装查询SQL
-        search() {
+        search () {
             this.loadData()
         },
-        handleSizeChange(value) {
+        handleSizeChange (value) {
             this.currentPage = 1
             this.pageSize = value
             this.loadData()
         },
-        handleCurrentChange(value) {
+        handleCurrentChange (value) {
             this.currentPage = value
             this.loadData()
         },
-        alertReport(path, id) {
+        alertReport (path, id) {
             this.srcUrl = `${this.$reportPash.replace('show', 'pdf')}${path}&id_=${id}`
             this.visible = true
         },
         // 文件预览
-        preview(file) {
+        preview (file) {
             if (imageType.includes(file.ext)) {
                 this.zIndex = PopupManager.getZIndex()
                 this.fileUrl = previewFile(file.id)
@@ -310,7 +359,7 @@ export default {
                 this.fileType = ''
             }
         },
-        getOption(file) {
+        getOption (file) {
             this.fileOption.user.id = this.$store.getters.userId
             this.fileOption.user.name = this.$store.getters.name
             this.fileOption.url = BASE_API() + SYSTEM_URL() + `/file/download?attachmentId=${file.id}`
@@ -319,17 +368,17 @@ export default {
             this.fileOption.fileType = file.ext
             console.log(this.fileOption)
         },
-        openWindow() {
-            let routeData = this.$router.resolve({
+        openWindow () {
+            const routeData = this.$router.resolve({
                 path: '/fileView',
                 query: this.fileOption
             })
             window.open(routeData.href)
         },
-        download(file) {
+        download (file) {
             downloadFile(file)
         },
-        sortChange(params) {
+        sortChange (params) {
             console.log(params)
             const { prop, order } = params
             this.prop = prop
@@ -338,7 +387,7 @@ export default {
                     this.order = 'desc'
                     break
                 case 'ascending':
-                    this.order = 'desc'
+                    this.order = 'asc'
                     break
                 default:
                     this.prop = ''
@@ -395,7 +444,7 @@ export default {
     }
     .el-table__header .table-header {
         color: #000;
-        font-size: 14px;
+        font-size: 12px;
         padding: 6px 6px;
         background: #a7d6f8 !important;
     }