Browse Source

feat:[试验管理][试验方法管理]关闭

lkf
HanLong 1 month ago
parent
commit
bf030e30ac
6 changed files with 114 additions and 42 deletions
  1. +9
    -0
      src/api/business/study/studyMethod.js
  2. +6
    -1
      src/lang/en/business/study/studyMethod.js
  3. +6
    -1
      src/lang/zh/business/study/studyMethod.js
  4. +47
    -31
      src/views/business/comps/template/mixins/templateMixin.js
  5. +44
    -7
      src/views/business/study/comp/syffList.vue
  6. +2
    -2
      vue.config.js

+ 9
- 0
src/api/business/study/studyMethod.js View File

@ -57,3 +57,12 @@ export function studyMethod_getReadAllMethodStatus(query) {
params: query params: query
}) })
} }
// 关闭方法
export function studyMethod_close(data) {
return request({
url: '/system/business/studyMethod/close',
method: 'post',
data: data
})
}

+ 6
- 1
src/lang/en/business/study/studyMethod.js View File

@ -17,5 +17,10 @@ export default {
qmsj: 'Date', qmsj: 'Date',
qmyy: 'Meaning of Signature', qmyy: 'Meaning of Signature',
remark: 'Comment', remark: 'Comment',
qyd:'Go Read'
qyd:'Go Read',
gb: 'Close',
sfgb: 'Closed',
s: 'Yes',
f: 'No',
qrgb: 'Confirm Close?',
} }

+ 6
- 1
src/lang/zh/business/study/studyMethod.js View File

@ -17,5 +17,10 @@ export default {
qmsj: '签名时间', qmsj: '签名时间',
qmyy: '签名意义', qmyy: '签名意义',
remark: '备注', remark: '备注',
qyd:'去阅读'
qyd:'去阅读',
gb: '关闭',
sfgb: '是否关闭',
s: '是',
f: '否',
qrgb: '确认关闭?',
} }

+ 47
- 31
src/views/business/comps/template/mixins/templateMixin.js View File

@ -360,7 +360,7 @@ export default {
} }
} }
} }
}, },
//统一处理blur事件,因为有效周期和过期日期是相关的,所以需要在有效周期失焦时更新过期日期 //统一处理blur事件,因为有效周期和过期日期是相关的,所以需要在有效周期失焦时更新过期日期
onHandleBlur(fields) { onHandleBlur(fields) {
@ -523,7 +523,7 @@ export default {
return; return;
} }
const targetStartVolUnit = targetSolutionConcentrationUnit.split("/")[1];//先按照预设目标溶液浓度的单位标准 const targetStartVolUnit = targetSolutionConcentrationUnit.split("/")[1];//先按照预设目标溶液浓度的单位标准
//将起始溶液浓度转换为和预设目标溶液浓度一样的单位再计算; //将起始溶液浓度转换为和预设目标溶液浓度一样的单位再计算;
const converStartCon = convertConcentration.convert(volume+subTargetStartSolution,targetSolutionConcentrationUnit) const converStartCon = convertConcentration.convert(volume+subTargetStartSolution,targetSolutionConcentrationUnit)
//将预设目标溶液体积转换为和预设目标溶液浓度单位的分母一样的单位再计算;如:预设目标溶液浓度单位为mg/mL,预设目标溶液体积单位为uL,则将预设目标溶液体积转换为mL //将预设目标溶液体积转换为和预设目标溶液浓度单位的分母一样的单位再计算;如:预设目标溶液浓度单位为mg/mL,预设目标溶液体积单位为uL,则将预设目标溶液体积转换为mL
@ -549,37 +549,53 @@ export default {
}, },
// 导出excel模板 // 导出excel模板
exportExcel(rows, title) { exportExcel(rows, title) {
let that = this
that.$modal.loading()
var tabelStr =
'<table border="1" class="html-tabel">' +
'<tr style="background:#eee;">'
this.$modal.loading()
// 生成表头
let tableHtml = '<table border="1" class="html-tabel">';
tableHtml += '<tr style="background:#eee;">';
rows.forEach(item => { rows.forEach(item => {
tabelStr = tabelStr + '<th style="text-align: center;">' + item + '</th>'
})
tabelStr = tabelStr + ' </tr><table>'
tableHtml += '<th style="text-align: center;">' + item + '</th>';
});
tableHtml += '</tr></table>'; // 正确闭合
// Worksheet 名称
const worksheet = title ? title : '导入模板';
// 完整的 HTML 模板(包含编码声明和 Excel 兼容命名空间)
const exportTemplate = `<!DOCTYPE html>
<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="UTF-8">
<!--[if gte mso 9]>
<xml>
<x:ExcelWorkbook>
<x:ExcelWorksheets>
<x:ExcelWorksheet>
<x:Name>${worksheet}</x:Name>
<x:WorksheetOptions>
<x:DisplayGridlines/>
</x:WorksheetOptions>
</x:ExcelWorksheet>
</x:ExcelWorksheets>
</x:ExcelWorkbook>
</xml>
<![endif]-->
</head>
<body>
${tableHtml}
</body>
</html>`;
// Worksheet名
var worksheet = title ? title : '导入模板'
var uri = 'data:application/vnd.ms-excel;base64,'
// 真正要导出(下载)的HTML模板
var exportTemplate = `<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns="http://www.w3.org/TR/REC-html40">
<head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet>
<x:Name>${worksheet}</x:Name>
<x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet>
</x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]-->
</head>
<body>
${tabelStr}
</body>
</html>`
var a = document.createElement('a')
a.download = worksheet + '.xls'
a.href = uri + window.btoa(unescape(encodeURIComponent(exportTemplate)))
a.click()
that.$modal.closeLoading()
// 使用 Blob 生成文件(指定 MIME 类型为 application/vnd.ms-excel)
const blob = new Blob([exportTemplate], { type: 'application/vnd.ms-excel;charset=utf-8' });
const link = document.createElement('a');
link.href = URL.createObjectURL(blob);
link.download = worksheet + '.xls';
link.click();
URL.revokeObjectURL(link.href); // 释放内存
this.$modal.closeLoading()
}, },
} }
} }

+ 44
- 7
src/views/business/study/comp/syffList.vue View File

@ -57,6 +57,12 @@
<span v-if="scope.row.zt === 0">{{ $t('page.business.study.studyMethod.weidu') }}</span> <span v-if="scope.row.zt === 0">{{ $t('page.business.study.studyMethod.weidu') }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column :label="$t('page.business.study.studyMethod.sfgb')" prop="status" align="center" width="100">
<template slot-scope="scope">
<span v-if="scope.row.status === 1">{{ $t('page.business.study.studyMethod.s') }}</span>
<span v-if="scope.row.status === 10">{{ $t('page.business.study.studyMethod.f') }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('form.operate')" align="left" fixed="right" width="200"> <el-table-column :label="$t('form.operate')" align="left" fixed="right" width="200">
<template slot-scope="scope"> <template slot-scope="scope">
<!-- 阅读 --> <!-- 阅读 -->
@ -65,6 +71,10 @@
<!-- 导出 --> <!-- 导出 -->
<el-button type="text" @click="showExport(scope.row)" v-hasPermi="['business:studyMethod:download']">{{ <el-button type="text" @click="showExport(scope.row)" v-hasPermi="['business:studyMethod:download']">{{
$t('page.business.study.studyMethod.daochu') }}</el-button> $t('page.business.study.studyMethod.daochu') }}</el-button>
<!-- 关闭 -->
<el-button type="text" @click="handleSign(scope.row, 'page.business.study.studyMethod.gb')"
v-if="scope.row.userId == id && scope.row.status == 10">{{
$t('page.business.study.studyMethod.gb') }}</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -76,15 +86,18 @@
<!-- 新增 --> <!-- 新增 -->
<Xz key="Xz" ref="Xz" @callback="search" /> <Xz key="Xz" ref="Xz" @callback="search" />
<!-- 详情 --> <!-- 详情 -->
<Xq key="Xq" ref="Xq" v-show="showDetail" @close="xqClose" />
<Xq key="Xq" ref="Xq" v-show="showDetail" @close="xqClose" />
<!-- 签名 -->
<Sign ref="refSign" @callback="doSign" />
</div> </div>
</template> </template>
<script> <script>
import { studyMethod_list } from '@/api/business/study/studyMethod'
import { studyMethod_list, studyMethod_close } from '@/api/business/study/studyMethod'
import Xz from "./syff/Xz"; import Xz from "./syff/Xz";
import Xq from "./syff/Xq"; import Xq from "./syff/Xq";
import Sign from "@/views/business/comps/common/sign";
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import moment from "moment"; import moment from "moment";
export default { export default {
@ -116,7 +129,7 @@ export default {
deep: true deep: true
} }
}, },
components: { Xz, Xq },
components: { Xz, Xq, Sign },
data() { data() {
return { return {
showDetail: false, showDetail: false,
@ -134,6 +147,9 @@ export default {
startDate: '', startDate: '',
endDate: '' endDate: ''
}, },
form: {
id: null,
},
loading: false, loading: false,
total: 0, total: 0,
list: [], list: [],
@ -142,7 +158,20 @@ export default {
}, },
created() { }, created() { },
methods: { methods: {
handleSign(row, qmyy) {
this.form.id = row.id
let title = this.$t(qmyy)
this.$refs.refSign.show(title, title, false, false, true, false)
},
doSign(val) {
let params = _.merge({}, this.form, val)
this.$modal.loading()
studyMethod_close(params).then(res => {
this.getList()
}).finally(() => {
this.$modal.closeLoading()
})
},
search() { search() {
this.searchForm.pageNum = 1 this.searchForm.pageNum = 1
this.getList() this.getList()
@ -170,9 +199,17 @@ export default {
this.$refs.Xz.show(this.study); this.$refs.Xz.show(this.study);
}, },
detail(row) { detail(row) {
this.showDetail = true
this.$emit('showDetail', this.showDetail)
this.$refs.Xq.show(row)
//
if (row.status == 1) {
this.$modal.confirm('该方法已关闭,无需阅读!').then(() => {
}).catch(() => { });
} else {
this.showDetail = true
this.$emit('showDetail', this.showDetail)
this.$refs.Xq.show(row)
}
}, },
showExport(row) { showExport(row) {
this.showDetail = true this.showDetail = true

+ 2
- 2
vue.config.js View File

@ -34,8 +34,8 @@ module.exports = {
proxy: { proxy: {
// detail: https://cli.vuejs.org/config/#devserver-proxy // detail: https://cli.vuejs.org/config/#devserver-proxy
[process.env.VUE_APP_BASE_API]: { [process.env.VUE_APP_BASE_API]: {
// target: `http://localhost:8080`,
target: `http://39.99.251.173:8080`,
target: `http://localhost:8080`,
// target: `http://39.99.251.173:8080`,
changeOrigin: true, changeOrigin: true,
pathRewrite: { pathRewrite: {
['^' + process.env.VUE_APP_BASE_API]: '' ['^' + process.env.VUE_APP_BASE_API]: ''

Loading…
Cancel
Save