|
@@ -42,13 +42,15 @@
|
|
|
</el-button>
|
|
|
</HcTooltip>
|
|
|
<HcTooltip keys="tentative_collect_monthly_print">
|
|
|
- <el-button hc-btn color="#567722" @click="print">
|
|
|
+ <el-button hc-btn color="#567722" :loading="printLoading" @click="printClick">
|
|
|
<HcIcon name="printer" />
|
|
|
<span>打印</span>
|
|
|
</el-button>
|
|
|
</HcTooltip>
|
|
|
<HcTooltip keys="tentative_collect_monthly_download">
|
|
|
- <el-button hc-btn color="#A16222">
|
|
|
+ <el-button
|
|
|
+ hc-btn color="#A16222" :loading="downLoading" @click="downClick"
|
|
|
+ >
|
|
|
<HcIcon name="download" />
|
|
|
<span>下载</span>
|
|
|
</el-button>
|
|
@@ -102,11 +104,11 @@ import { useAppStore } from '~src/store'
|
|
|
|
|
|
|
|
|
import queryApi from '~api/data-fill/query'
|
|
|
-import { calcDate, getArrValue } from 'js-fast-way'
|
|
|
+import { calcDate, downloadBlob, getArrValue, isString } from 'js-fast-way'
|
|
|
import { getDictionary } from '~api/other'
|
|
|
import samplingApi from '~api/tentative/material/sampling'
|
|
|
-import { editRemark, getMonthPage } from '~api/tentative/collect/month'
|
|
|
-import { isExactlyOneMonthApart } from '~uti/tools'
|
|
|
+import { downloadMonth, editRemark, getMonthPage, printMonth } from '~api/tentative/collect/month'
|
|
|
+import { toPdfPage } from '~uti/btn-auth'
|
|
|
|
|
|
const useAppState = useAppStore()
|
|
|
|
|
@@ -294,6 +296,7 @@ const getTableData = async () => {
|
|
|
name: ele.currentMonth.qualifiedTotal,
|
|
|
state: ele.currentMonth.unQualifiedTotal,
|
|
|
zip: ele.currentMonth.remarks,
|
|
|
+ recordId:ele.currentMonth.recordId,
|
|
|
|
|
|
}
|
|
|
let obj2 = {
|
|
@@ -302,6 +305,7 @@ const getTableData = async () => {
|
|
|
name: ele.totalMonth.qualifiedTotal,
|
|
|
state: ele.totalMonth.unQualifiedTotal,
|
|
|
zip: ele.totalMonth.remarks,
|
|
|
+ recordId:ele.totalMonth.recordId,
|
|
|
|
|
|
}
|
|
|
arr.push(obj1)
|
|
@@ -321,8 +325,13 @@ const getTableData = async () => {
|
|
|
//新增/编辑
|
|
|
const editorsNoteModal = ref(false)
|
|
|
const editorsNoteVal = ref('')
|
|
|
+const recordId = ref('')
|
|
|
const editorsNoteModalClick = (row) => {
|
|
|
+ console.log(row, 'row')
|
|
|
editorsNoteModal.value = true
|
|
|
+ recordId.value = row.recordId
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
//保存
|
|
@@ -331,35 +340,76 @@ const editorsNoteModalSave = async (id) => {
|
|
|
// editorsNoteModal.value = true
|
|
|
const { error, code, data, msg } = await editRemark({
|
|
|
contractId: contractId.value,
|
|
|
- recordId: id,
|
|
|
+ recordId: recordId.value,
|
|
|
remarks:editorsNoteVal.value,
|
|
|
|
|
|
})
|
|
|
//判断状态
|
|
|
if (!error && code === 200) {
|
|
|
- window.$message.success(msg)
|
|
|
+ window.$message.success('操作成功')
|
|
|
editorsNoteModal.value = false
|
|
|
+ getTableData()
|
|
|
}
|
|
|
}
|
|
|
const editorsNoteModalClose = () => {
|
|
|
editorsNoteModal.value = false
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-//左右拖动,改变树形结构宽度
|
|
|
-const leftWidth = ref(382)
|
|
|
-const onmousedown = () => {
|
|
|
- const leftNum = isCollapse.value ? 142 : 272
|
|
|
- document.onmousemove = (ve) => {
|
|
|
- let diffVal = ve.clientX - leftNum
|
|
|
- if (diffVal >= 310 && diffVal <= 900) {
|
|
|
- leftWidth.value = diffVal
|
|
|
- }
|
|
|
+const printLoading = ref(false)
|
|
|
+const printClick = async ()=>{
|
|
|
+ printLoading.value = true
|
|
|
+ if (!searchForm.value.type) {
|
|
|
+ window.$message.warning('请选择检查类别')
|
|
|
+ return
|
|
|
+ } else if (!searchForm.value.startTime || !searchForm.value.endTime) {
|
|
|
+ window.$message.warning('请选择开始时间和结束时间')
|
|
|
+ return
|
|
|
+ } else if (searchForm.value.ids) {
|
|
|
+ window.$message.warning('请选择试验检测项目名称')
|
|
|
+ return
|
|
|
}
|
|
|
- document.onmouseup = () => {
|
|
|
- document.onmousemove = null
|
|
|
- document.onmouseup = null
|
|
|
+ const { error, code, data } = await printMonth({
|
|
|
+ ...searchForm.value,
|
|
|
+ ids:'1635200237830144002',
|
|
|
+ contractId:contractId.value,
|
|
|
+ })
|
|
|
+ printLoading.value = false
|
|
|
+ //判断状态
|
|
|
+ const res = isString(data) ? data || '' : ''
|
|
|
+ if (!error && code === 200 && res) {
|
|
|
+ toPdfPage(res)
|
|
|
+ //window.open(res, '_blank')
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+const downLoading = ref(false)
|
|
|
+const downClick = async ()=>{
|
|
|
+ downLoading.value = true
|
|
|
+ if (!searchForm.value.type) {
|
|
|
+ window.$message.warning('请选择检查类别')
|
|
|
+ return
|
|
|
+ } else if (!searchForm.value.startTime || !searchForm.value.endTime) {
|
|
|
+ window.$message.warning('请选择开始时间和结束时间')
|
|
|
+ return
|
|
|
+ } else if (searchForm.value.ids) {
|
|
|
+ window.$message.warning('请选择试验检测项目名称')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ const { error, disposition, res } = await downloadMonth({
|
|
|
+ ...searchForm.value,
|
|
|
+ ids:'1635200237830144002',
|
|
|
+ contractId:contractId.value,
|
|
|
+ })
|
|
|
+ downLoading.value = false
|
|
|
+ //判断状态
|
|
|
+ if (!error) {
|
|
|
+ if (disposition) {
|
|
|
+ downloadBlob(res, disposition)
|
|
|
+ } else {
|
|
|
+ window.$message?.error('数据异常')
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
</script>
|
|
|
|