From 8bf1c8f0a5681df03b35ff7762e2946574188ebb Mon Sep 17 00:00:00 2001 From: gaoluyang <2820782392@qq.com> Date: 星期二, 25 二月 2025 14:51:48 +0800 Subject: [PATCH] 抽样信息搬迁 --- src/views/business/productSamplingInfo/components/addQuarterItem.vue | 290 ++++++++++++++++ src/api/business/productSamplingInfo.js | 101 +++++ src/views/business/productSamplingInfo/index.vue | 647 +++++++++++++++++++++++++++++++++++ 3 files changed, 1,038 insertions(+), 0 deletions(-) diff --git a/src/api/business/productSamplingInfo.js b/src/api/business/productSamplingInfo.js new file mode 100644 index 0000000..b954bfe --- /dev/null +++ b/src/api/business/productSamplingInfo.js @@ -0,0 +1,101 @@ +// 鎶芥牱淇℃伅璇︽儏椤甸潰鐩稿叧鎺ュ彛 +import request from '@/utils/request' + +// 鎶芥牱淇℃伅-瀛e害鏌ヨ +export function getQuarterPage(query) { + return request({ + url: '/finishProductSpotCheck/getQuarterPage', + method: 'get', + params: query + }) +} +// 鎶芥牱淇℃伅-骞村害鏌ヨ +export function getSpotCheckYearPage(query) { + return request({ + url: '/finishProductSpotCheck/getSpotCheckYearPage', + method: 'get', + params: query + }) +} +// 鍒犻櫎瀛e害鎶芥 +export function deleteQuarter(query) { + return request({ + url: '/finishProductSpotCheck/deleteQuarter', + method: 'delete', + params: query + }) +} +// 鐢熸垚瀛e害鎶ュ憡 +export function finalReportQuarter(query) { + return request({ + url: '/finishProductSpotCheck/finalReportQuarter', + method: 'get', + params: query, + responseType: "blob" + }) +} +// 鐢熸垚骞村害鎶ュ憡 +export function finalReportSpotCheckYear(query) { + return request({ + url: '/finishProductSpotCheck/finalReportSpotCheckYear', + method: 'get', + params: query, + responseType: "blob" + }) +} +// 鍒犻櫎骞村害鎶芥 +export function deleteSpotCheckYear(query) { + return request({ + url: '/finishProductSpotCheck/deleteSpotCheckYear', + method: 'delete', + params: query, + }) +} +// 骞村害鎶芥鏌ョ湅璇︽儏 +export function getSpotCheckYear(query) { + return request({ + url: '/finishProductSpotCheck/getSpotCheckYear', + method: 'get', + params: query, + }) +} +// 鎻愪氦骞村害鎶芥牱 +export function addSpotCheckYear(query) { + return request({ + url: '/finishProductSpotCheck/addSpotCheckYear', + method: 'post', + data: query, + }) +} +// 缂栬緫骞村害鎶芥牱 +export function updateSpotCheckYear(query) { + return request({ + url: '/finishProductSpotCheck/updateSpotCheckYear', + method: 'post', + data: query, + }) +} +// 瀛e害鎶芥鏌ョ湅璇︽儏 +export function getQuarter(query) { + return request({ + url: '/finishProductSpotCheck/getQuarter', + method: 'get', + params: query, + }) +} +// 鎻愪氦瀛e害鎶芥牱 +export function addQuarter(query) { + return request({ + url: '/finishProductSpotCheck/addQuarter', + method: 'post', + data : query, + }) +} +// 缂栬緫瀛e害妫�楠� +export function updateQuarterOnOrder(query) { + return request({ + url: '/finishProductSpotCheck/updateQuarterOnOrder', + method: 'post', + data : query, + }) +} diff --git a/src/views/business/productSamplingInfo/components/addQuarterItem.vue b/src/views/business/productSamplingInfo/components/addQuarterItem.vue new file mode 100644 index 0000000..765ed43 --- /dev/null +++ b/src/views/business/productSamplingInfo/components/addQuarterItem.vue @@ -0,0 +1,290 @@ +<template> + <div> + <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" :visible.sync="quarterSampleDia" title="瀛e害鎶芥牱" width="90%" @close="quarterSampleDia = false"> + <div style="display: flex;align-items: center;justify-content: space-between;margin-bottom: 10px"> + <div style="width: 30%;display: flex;align-items: center;" > + <span style="width: 50px">缂栧彿锛�</span> + <el-input v-model="quarterSampleForm.quarterNo" :disabled="operationType !== 'add'" size="small"></el-input> + </div> + <div v-if="operationType === 'add'"> + <el-button size="small" type="primary" @click="addQuarter">娣诲姞</el-button> + <el-button size="small" type="danger" @click="clearTable">娓呯┖</el-button> + </div> + </div> + <div> + <el-table v-loading="tableLoading" :data="quarterItems" border height="400" style="width: 100%"> + <el-table-column label="浜у搧绫诲瀷" prop="productType" width="200"> + <template slot-scope="{row}"> + <template> + <el-input v-model="row.productType" size="small"/> + </template> + </template> + </el-table-column> + <el-table-column label="璐d换浜�" prop="dutyUser" width="100"></el-table-column> + <el-table-column label="鍨嬪彿" prop="productModel" width="120"> + <template slot-scope="{row}"> + <template> + <el-input v-model="row.productModel" size="small" :disabled="operationType === 'view'"/> + </template> + </template> + </el-table-column> + <el-table-column label="鎶芥牱鏁伴噺" min-width="340" prop="spotCheckNumber"> + <template slot-scope="{row}"> + <template> + <el-input v-model="row.spotCheckNumber" size="small" :disabled="operationType === 'view'"/> + </template> + </template> + </el-table-column> + <el-table-column v-if="operationType === 'add'" label="鏁伴噺" min-width="120" prop="number"> + <template slot-scope="{row}"> + <template> + <el-input v-model="row.number" size="small" :disabled="operationType === 'view'"/> + </template> + </template> + </el-table-column> + <el-table-column v-if="operationType !== 'add'" label="鎶芥牱鏃堕棿" prop="spotCheckTime" width="160"> + <template slot-scope="{row}"> + <template> + <el-date-picker v-model="row.spotCheckTime" + format="yyyy-MM-dd" + :disabled="operationType === 'view'" + placeholder="閫夋嫨鏃ユ湡" + size="small" + clearable + style="width:100%" + type="date" + value-format="yyyy-MM-dd"> + </el-date-picker> + </template> + </template> + </el-table-column> + <el-table-column v-if="operationType !== 'add'" label="璇曟牱缁撹" prop="result" width="130"> + <template v-slot="scope"> + <el-select v-model="scope.row.result" placeholder="璇烽�夋嫨" size="small" clearable :disabled="operationType === 'view'"> + <el-option label="鍚堟牸" value="鍚堟牸"></el-option> + <el-option label="涓嶅悎鏍�" value="涓嶅悎鏍�"></el-option> + </el-select> + </template> + </el-table-column> + <el-table-column v-if="operationType !== 'add'" label="鍙栨牱浜哄憳" prop="samplingUser" width="120"> + <template slot-scope="{row}"> + <template> + <el-input v-model="row.samplingUser" size="small" :disabled="operationType === 'view'"/> + </template> + </template> + </el-table-column> + <el-table-column label="澶囨敞" prop="itemRemark" width="200"> + <template slot-scope="{row}"> + <template> + <el-input v-model="row.itemRemark" size="small" :disabled="operationType === 'view'"/> + </template> + </template> + </el-table-column> + <el-table-column v-if="operationType !== 'view'" fixed="right" label="鎿嶄綔" width="100"> + <template slot-scope="scope"> + <el-button size="small" style="color: #f56c6c" type="text" @click="deleteScope(scope.$index)">鍒犻櫎</el-button> + </template> + </el-table-column> + </el-table> + </div> + <div style="display: flex;align-items: center;margin: 10px 0"> + <span style="width: 70px">澶囨敞锛�</span> + <el-input v-model="quarterSampleForm.remark" :disabled="operationType === 'view'" size="small" style="width: 43%" type="textarea"></el-input> + </div> + <div v-if="operationType !== 'add'"> + <el-form ref="form" :model="editForm" label-width="70px"> + <el-col :span="12"> + <el-form-item label="缂栧埗浜猴細"> + <el-select v-model="editForm.writeUser" :disabled="operationType !=='edit'" placeholder="璇烽�夋嫨" size="small" style="width: 100%"> + <el-option v-for="item in userList" :key="item.id" :label="item.name" :value="item.id"></el-option> + </el-select> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="浼氱浜猴細"> + <el-select v-model="editForm.countersignUser" :disabled="operationType !=='edit'" multiple placeholder="璇烽�夋嫨" size="small" style="width: 100%"> + <el-option v-for="item in userList" :key="item.id" :label="item.name" :value="item.id"></el-option> + </el-select> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="瀹℃牳浜猴細"> + <el-select v-model="editForm.examineUser" :disabled="operationType !=='edit'" placeholder="璇烽�夋嫨" size="small" style="width: 100%"> + <el-option v-for="item in userList" :key="item.id" :label="item.name" :value="item.id"></el-option> + </el-select> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鎵瑰噯浜猴細"> + <el-select v-model="editForm.ratifyUser" :disabled="operationType !=='edit'" placeholder="璇烽�夋嫨" size="small" style="width: 100%"> + <el-option v-for="item in userList" :key="item.id" :label="item.name" :value="item.id"></el-option> + </el-select> + </el-form-item> + </el-col> + </el-form> + </div> + <span slot="footer" class="dialog-footer"> + <el-button @click="quarterSampleDia = false">鍙� 娑�</el-button> + <el-button v-if="operationType === 'add'" @click="quarterSampleDia = false">淇� 瀛�</el-button> + <el-button v-if="operationType !== 'add' && operationType !== 'view'" type="primary" @click="handleSample">纭� 瀹�</el-button> + </span> + </el-dialog> + </div> +</template> + +<script> +import {addQuarter, getQuarter, updateQuarterOnOrder} from "@/api/business/productSamplingInfo"; +import {selectUserCondition} from "@/api/performance/class"; + +export default { + name: "addQuarterItem", + // import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢� + components: {}, + data() { + // 杩欓噷瀛樻斁鏁版嵁 + return { + tableLoading: false, + quarterSampleDia: false, // 瀛e害鎶芥牱寮规 + quarterSampleForm: { + quarterNo: '', // 缂栧彿 + }, + quarterItems: [], + quarterTemItems: [], + operationType: '', + editForm: { + quarterId: '', + writeUser: '', // 缂栧埗浜� + countersignUser: [], // 浼氱浜� + examineUser: '', // 瀹℃牳浜� + ratifyUser: '', // 鎵瑰噯浜� + }, + userList: [], + quarterRow: {}, + } + }, + mounted() { + this.getUserList() + }, + // 鏂规硶闆嗗悎 + methods: { + openDia (quarterTemItems, type) { + this.quarterSampleDia = true + this.operationType = type + if (type === 'add') { + if (quarterTemItems.length > 0) { + this.quarterItems = quarterTemItems + } + this.quarterSampleForm.quarterNo = getCurrentMonthTwoDigits() + } else { + this.tableLoading = true + this.quarterRow = quarterTemItems + getQuarter({quarterId: quarterTemItems.quarterId}).then(res => { + this.tableLoading = false + if (res.code === 200) { + this.quarterItems = res.data.quarterItems + this.quarterSampleForm.quarterNo = res.data.quarterNo + this.quarterSampleForm.remark = res.data.remark + this.editForm.quarterId = res.data.quarterId + this.editForm.writeUser = res.data.writeUser + this.editForm.examineUser = res.data.examineUser + this.editForm.ratifyUser = res.data.ratifyUser + if (res.data.countersignUser) { + this.editForm.countersignUser = res.data.countersignUser.split(",").map(Number) + } + } + }) + } + }, + // 鎵嬪姩娣诲姞 + addQuarter () { + this.quarterItems.push({ + productType: '', + dutyUser: JSON.parse(localStorage.getItem("user")).name, + productModel: '', + spotCheckNumber: '', + number: '', + spotCheckTime: '', + result: '', + samplingUser: '', + itemRemark: '', + }) + }, + // 鎻愪氦瀛e害鎶芥牱 + handleSample () { + this.$confirm('鏄惁鎻愪氦璇ユ暟鎹�', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + if (this.operationType === 'add') { + this.quarterSampleForm.quarterItems = JSON.parse(JSON.stringify(this.quarterItems)) + this.quarterSampleForm.quarterItems.forEach(item => { + item.spotCheckNumber = item.spotCheckNumber + ' ' + (item.number == null ? "" : item.number) + }) + addQuarter(this.quarterSampleForm).then(res => { + if (res.code == 200) { + this.$message.success('鎻愪氦鎴愬姛') + this.quarterItems = [] + this.$parent.quarterTemItems = [] + this.closeQuarterSampleDia() + } + }) + } else { + const params = {...this.editForm} + if (params.countersignUser.length > 0) { + params.countersignUser = params.countersignUser.join(',') + } else { + params.countersignUser = '' + } + params.quarterItems = JSON.parse(JSON.stringify(this.quarterItems)) + updateQuarterOnOrder(params).then(res => { + if (res.code == 200) { + this.$message.success('鎻愪氦鎴愬姛') + this.quarterItems = [] + this.closeQuarterSampleDia() + } + }) + } + }).catch(() => { + this.$message({ + type: 'info', + message: '宸插彇娑�' + }); + }); + + }, + // 娓呯┖鎶芥牱璁″垝 + clearTable () { + this.quarterItems = [] + this.$parent.quarterTemItems = [] + }, + // 鎵嬪姩鍒犻櫎 + deleteScope (index) { + this.quarterItems.splice(index, 1) + }, + // 鍏抽棴瀛e害鎶芥牱寮规 + closeQuarterSampleDia () { + this.quarterSampleDia = false + if (this.operationType === 'add') { + this.$parent.handleStockList() + } else { + this.$parent.refreshTable() + } + }, + getUserList(){ + selectUserCondition({ type: 0 }).then((res) => { + this.userList = res.data; + }) + }, + }, +} +function getCurrentMonthTwoDigits() { + const currentDate = new Date(); + const year = currentDate.getFullYear(); + const currentMonth = currentDate.getMonth() + 1; + return year + currentMonth.toString().padStart(2, '0'); +} +</script> + +<style scoped> +</style> diff --git a/src/views/business/productSamplingInfo/index.vue b/src/views/business/productSamplingInfo/index.vue new file mode 100644 index 0000000..a7c2831 --- /dev/null +++ b/src/views/business/productSamplingInfo/index.vue @@ -0,0 +1,647 @@ +<template> + <div class="capacity-scope"> + <div style="display: flex;justify-content: space-between"> + <el-form :model="entity" ref="entity" size="small" :inline="true"> + <el-form-item label="缂栧彿" prop="quarterNo" v-show="tabIndex === 0"> + <el-input v-model="entity.quarterNo" clearable placeholder="璇疯緭鍏�" + size="small" + @keyup.enter.native="refreshTable"> + </el-input> + </el-form-item> + <el-form-item> + <el-button type="primary" icon="el-icon-search" size="mini" @click="refreshTable">鏌� 璇�</el-button> + <el-button icon="el-icon-refresh" size="mini" @click="refresh">閲� 缃�</el-button> + </el-form-item> + </el-form> + <div> + <el-button v-if="tabIndex === 1" size="small" type="primary" @click="yearSample('add')">骞村害鎶芥牱</el-button> + </div> + </div> + <div> + <div class="table"> + <ul class="tab"> + <li v-for="(m,i) in tabList" :key="i" :class="{active:i===tabIndex}" @click="handleTab(m,i)">{{m.label}}</li> + </ul> + <!--瀛e害--> + <lims-table :tableData="tableData" :column="column" v-if="tabIndex === 0" + @pagination="pagination" :height="'calc(100vh - 290px)'" + :page="page" :tableLoading="tableLoading"></lims-table> + <!--骞村害--> + <lims-table :tableData="tableData1" :column="column1" v-if="tabIndex === 1" + @pagination="pagination1" :height="'calc(100vh - 290px)'" + key="tableData1" :page="page1" :tableLoading="tableLoading1"></lims-table> + </div> + </div> + <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" :visible.sync="yearSampleDia" title="骞村害鎶芥牱" width="70%" + @close="closeYearSampleDia"> + <div style="display: flex;align-items: center;justify-content: space-between;margin-bottom: 10px"> + <div style="width: 30%;display: flex;align-items: center;" > + <el-input v-if="operationType !=='view'" v-model="currentYear" size="small"/> + <span v-if="operationType ==='view'" style="width: 160px;font-size: 18px;font-weight: 600">{{currentYear}}</span> + </div> + <div v-if="operationType !== 'view'"> + <el-button size="small" type="primary" @click="addQuarter">娣诲姞</el-button> + <el-button size="small" type="danger" @click="clearTable">娓呯┖</el-button> + </div> + </div> + <div> + <el-table :data="yearItems" border height="450" style="width: 100%"> + <el-table-column label="绫诲埆" prop="yearType" width="240"> + <template slot-scope="{row}"> + <template v-if="operationType !== 'view'"> + <el-input v-model="row.yearType" size="small" type="textarea" :rows="4"/> + </template> + <template v-else> + <span size="small">{{row.yearType}}</span> + </template> + </template> + </el-table-column> + <el-table-column header-align="center" label="1" prop="january" width="160"> + <template slot-scope="{row}"> + <template v-if="operationType !== 'view'"> + <el-input v-model="row.january" size="small" type="textarea" :rows="4"/> + </template> + <template v-else> + <span size="small">{{row.january}}</span> + </template> + </template> + </el-table-column> + <el-table-column header-align="center" label="2" prop="february" width="160"> + <template slot-scope="{row}"> + <template v-if="operationType !== 'view'"> + <el-input v-model="row.february" size="small" type="textarea" :rows="4"/> + </template> + <template v-else> + <span size="small">{{row.february}}</span> + </template> + </template> + </el-table-column> + <el-table-column header-align="center" label="3" prop="march" width="160"> + <template slot-scope="{row}"> + <template v-if="operationType !== 'view'"> + <el-input v-model="row.march" size="small" type="textarea" :rows="4"/> + </template> + <template v-else> + <span size="small">{{row.march}}</span> + </template> + </template> + </el-table-column> + <el-table-column header-align="center" label="4" prop="april" width="160"> + <template slot-scope="{row}"> + <template v-if="operationType !== 'view'"> + <el-input v-model="row.april" size="small" type="textarea" :rows="4"/> + </template> + <template v-else> + <span size="small">{{row.april}}</span> + </template> + </template> + </el-table-column> + <el-table-column header-align="center" label="5" prop="may" width="160"> + <template slot-scope="{row}"> + <template v-if="operationType !== 'view'"> + <el-input v-model="row.may" size="small" type="textarea" :rows="4"/> + </template> + <template v-else> + <span size="small">{{row.may}}</span> + </template> + </template> + </el-table-column> + <el-table-column header-align="center" label="6" prop="june" width="160"> + <template slot-scope="{row}"> + <template v-if="operationType !== 'view'"> + <el-input v-model="row.june" size="small" type="textarea" :rows="4"/> + </template> + <template v-else> + <span size="small">{{row.june}}</span> + </template> + </template> + </el-table-column> + <el-table-column header-align="center" label="7" prop="july" width="160"> + <template slot-scope="{row}"> + <template v-if="operationType !== 'view'"> + <el-input v-model="row.july" size="small" type="textarea" :rows="4"/> + </template> + <template v-else> + <span size="small">{{row.july}}</span> + </template> + </template> + </el-table-column> + <el-table-column header-align="center" label="8" prop="august" width="160"> + <template slot-scope="{row}"> + <template v-if="operationType !== 'view'"> + <el-input v-model="row.august" size="small" type="textarea" :rows="4"/> + </template> + <template v-else> + <span size="small">{{row.august}}</span> + </template> + </template> + </el-table-column> + <el-table-column header-align="center" label="9" prop="september" width="160"> + <template slot-scope="{row}"> + <template v-if="operationType !== 'view'"> + <el-input v-model="row.september" size="small" type="textarea" :rows="4"/> + </template> + <template v-else> + <span size="small">{{row.september}}</span> + </template> + </template> + </el-table-column> + <el-table-column header-align="center" label="10" prop="october" width="160"> + <template slot-scope="{row}"> + <template v-if="operationType !== 'view'"> + <el-input v-model="row.october" size="small" type="textarea" :rows="4"/> + </template> + <template v-else> + <span size="small">{{row.october}}</span> + </template> + </template> + </el-table-column> + <el-table-column header-align="center" label="11" prop="november" width="160"> + <template slot-scope="{row}"> + <template v-if="operationType !== 'view'"> + <el-input v-model="row.november" size="small" type="textarea" :rows="4"/> + </template> + <template v-else> + <span size="small">{{row.november}}</span> + </template> + </template> + </el-table-column> + <el-table-column header-align="center" label="12" prop="december" width="160"> + <template slot-scope="{row}"> + <template v-if="operationType !== 'view'"> + <el-input v-model="row.december" size="small" type="textarea" :rows="4"/> + </template> + <template v-else> + <span size="small">{{row.december}}</span> + </template> + </template> + </el-table-column> + <el-table-column v-if="operationType !== 'view'" fixed="right" label="鎿嶄綔" width="100"> + <template slot-scope="scope"> + <el-button size="small" style="color: #f56c6c" type="text" @click="deleteScope(scope.$index)">鍒犻櫎</el-button> + </template> + </el-table-column> + </el-table> + </div> + <div style="display: flex;align-items: center;margin-top: 10px"> + <span style="width: 70px">娉ㄦ剰浜嬮」锛�</span> + <el-input v-model="yearSampleForm.tableRemark" :disabled="operationType === 'view'" size="small" style="width: 50%" type="textarea"></el-input> + </div> + <div style="display: flex;align-items: center;margin-top: 10px"> + <span style="width: 70px">澶囨敞锛�</span> + <el-input v-model="yearSampleForm.remark" :disabled="operationType === 'view'" size="small" style="width: 50%" type="textarea"></el-input> + </div> + <div v-if="operationType !== 'add'"> + <el-form ref="form" :model="editYearFormRow" label-width="70px"> + <el-col :span="12"> + <el-form-item label="缂栧埗浜猴細"> + <el-select v-model="editYearFormRow.writeUser" :disabled="operationType !=='edit'" placeholder="璇烽�夋嫨" size="small" style="width: 100%"> + <el-option v-for="item in userList" :key="item.id" :label="item.name" :value="item.id"></el-option> + </el-select> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="浼氱浜猴細"> + <el-select v-model="editYearFormRow.countersignUser" :disabled="operationType !=='edit'" multiple placeholder="璇烽�夋嫨" size="small" style="width: 100%"> + <el-option v-for="item in userList" :key="item.id" :label="item.name" :value="item.id"></el-option> + </el-select> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="瀹℃牳浜猴細"> + <el-select v-model="editYearFormRow.examineUser" :disabled="operationType !=='edit'" placeholder="璇烽�夋嫨" size="small" style="width: 100%"> + <el-option v-for="item in userList" :key="item.id" :label="item.name" :value="item.id"></el-option> + </el-select> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鎵瑰噯浜猴細"> + <el-select v-model="editYearFormRow.ratifyUser" :disabled="operationType !=='edit'" placeholder="璇烽�夋嫨" size="small" style="width: 100%"> + <el-option v-for="item in userList" :key="item.id" :label="item.name" :value="item.id"></el-option> + </el-select> + </el-form-item> + </el-col> + </el-form> + </div> + <span slot="footer" class="dialog-footer"> + <el-button @click="closeYearSampleDia">鍙� 娑�</el-button> + <el-button v-if="operationType !== 'view'" type="primary" @click="handleSample">纭� 瀹�</el-button> + </span> + </el-dialog> + <add-quarter-item ref="addQuarterItem"></add-quarter-item> + </div> +</template> + +<script> +import AddQuarterItem from "./components/addQuarterItem.vue"; +import limsTable from "@/components/Table/lims-table.vue"; +import { + addSpotCheckYear, + deleteQuarter, deleteSpotCheckYear, + finalReportQuarter, + finalReportSpotCheckYear, + getQuarterPage, getSpotCheckYear, getSpotCheckYearPage, updateSpotCheckYear +} from "@/api/business/productSamplingInfo"; +import {selectUserCondition} from "@/api/performance/class"; + +export default { + name: "b1-product-sampling-info", + // import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢� + components: {limsTable, AddQuarterItem}, + data() { + // 杩欓噷瀛樻斁鏁版嵁 + return { + upIndex: 0, + tabIndex: 0, + tabList: [ + { + label: '瀛e害', + value: 0 + }, + { + label: '骞村害', + value: 1 + }, + ], + entity: { + quarterNo: null, + }, + tableData: [], + tableLoading: false, + column: [ + {label: '缂栧彿', prop: 'quarterNo'}, + {label: '澶囨敞', prop: 'remark'}, + {label: '鍒涘缓浜�', prop: 'createUserName'}, + {label: '鍒涘缓鏃堕棿', prop: 'createTime'}, + { + dataType: 'action', + label: '鎿嶄綔', + operation: [ + { + name: '缂栬緫', + type: 'text', + clickFun: (row) => { + this.editForm(row); + }, + }, + { + name: '鏌ョ湅', + type: 'text', + clickFun: (row) => { + this.viewQuarterInfo(row); + }, + }, + { + name: '涓嬭浇', + type: 'text', + clickFun: (row) => { + this.handleDown(row); + }, + }, + { + name: '鍒犻櫎', + type: 'text', + clickFun: (row) => { + this.deleteQuarterInfo(row); + }, + } + ] + } + ], + page: { + total:0, + size:10, + current:1 + }, + tableData1: [], + tableLoading1: false, + column1: [ + { label: '鍚嶇О', prop: 'yearHead' }, + { label: '鍒涘缓浜�', prop: 'createUserName' }, + { label: '鍒涘缓鏃堕棿', prop: 'createTime' }, + { + dataType: 'action', + label: '鎿嶄綔', + operation: [ + { + name: '缂栬緫', + type: 'text', + clickFun: (row) => { + this.editYearForm(row); + }, + }, + { + name: '鏌ョ湅', + type: 'text', + clickFun: (row) => { + this.viewYearInfo(row); + }, + }, + { + name: '涓嬭浇', + type: 'text', + clickFun: (row) => { + this.download(row); + }, + }, + { + name: '鍒犻櫎', + type: 'text', + clickFun: (row) => { + this.deleteYearInfo(row); + }, + }, + ] + } + ], + page1: { + total: 0, + size: 10, + current: 1 + }, + yearSampleDia: false, // 骞村害鎶芥牱 + yearSampleForm: { + tableRemark: '', + remark: '' + }, + yearItems: [], + currentYear: '', + operationType: '', + userList: [], + yearRow: {}, + editYearFormRow: { + yearId: '', + writeUser: '', // 缂栧埗浜� + countersignUser: null, // 浼氱浜� + examineUser: '', // 瀹℃牳浜� + ratifyUser: '', // 鎵瑰噯浜� + } + } + }, + mounted() { + this.refreshTable() + }, + // 鏂规硶闆嗗悎 + methods: { + // 鏌ヨ鍥炶皟 + refreshTable(e) { + if (this.tabIndex === 0) { + this.getQuarterPageList() + } else if (this.tabIndex === 1) { + this.getSpotCheckYearPageList() + } + }, + getQuarterPageList () { + this.tableLoading = true + getQuarterPage({ + ...this.page,...this.entity + }).then(res => { + this.tableLoading = false + this.page.total = res.data.total + this.tableData = res.data.records + }).catch(err => { + this.tableLoading = false + }) + }, + getSpotCheckYearPageList () { + this.tableLoading1 = true + getSpotCheckYearPage({ + ...this.page1 + }).then(res => { + this.tableLoading1 = false + this.page1.total = res.data.total + this.tableData1 = res.data.records + }).catch(err => { + this.tableLoading1 = false + }) + }, + // 閲嶇疆 + refresh() { + this.resetForm('entity') + this.refreshTable() + }, + pagination (page) { + this.page.size = page.limit + this.refreshTable() + }, + pagination1 (page) { + this.page1.size = page.limit + this.refreshTable() + }, + // 缂栬緫瀛e害鎶芥牱 + editForm (row) { + this.$refs.addQuarterItem.openDia(row, 'edit') + }, + // 鏌ョ湅瀛e害鎶芥牱 + viewQuarterInfo (row) { + this.$refs.addQuarterItem.openDia(row, 'view') + }, + // 鍒犻櫎瀛e害鎶芥牱 + deleteQuarterInfo (row) { + this.$confirm('鏄惁鍒犻櫎褰撳墠鏁版嵁?', "璀﹀憡", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning" + }).then(() => { + deleteQuarter({quarterId: row.quarterId}).then(res => { + if (res.code === 200) { + this.$message.success('鍒犻櫎鎴愬姛') + this.refreshTable() + } + }) + }).catch(() => {}) + }, + // 瀵煎嚭 + handleDown (row) { + let randomNum = Math.random(); + finalReportQuarter({quarterId: row.quarterId, random: randomNum}).then(res => { + this.outLoading = false + const blob = new Blob([res], { type: 'application/octet-stream' }); + this.$download.saveAs(blob, '瀛e害鎶芥牱淇℃伅瀵煎嚭.docx') + this.$message.success('瀵煎嚭鎴愬姛') + }) + }, + // 骞村害涓嬭浇 + download(row) { + finalReportSpotCheckYear({yearId: row.yearId}).then(res => { + this.outLoading = false + const blob = new Blob([res], { type: 'application/octet-stream' }); + this.$download.saveAs(blob, row.yearHead + '.docx') + this.$message.success('瀵煎嚭鎴愬姛') + }) + }, + // 鍒犻櫎骞村害鎶芥牱 + deleteYearInfo (row) { + this.$confirm('鏄惁鍒犻櫎褰撳墠鏁版嵁?', "璀﹀憡", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning" + }).then(() => { + deleteSpotCheckYear({yearId: row.yearId}).then(res => { + if (res.code === 200) { + this.$message.success('鍒犻櫎鎴愬姛') + this.refreshTable() + } + }) + }).catch(() => {}) + }, + // 鏌ョ湅骞村害璇︽儏 + viewYearInfo (row) { + this.operationType = 'view' + this.getUserList() + this.yearSampleDia = true + this.yearRow = row + getSpotCheckYear({yearId: row.yearId}).then(res => { + if (res.code === 200) { + this.currentYear = res.data.yearHead + this.yearItems = res.data.yearItems + this.yearSampleForm.tableRemark = res.data.tableRemark + this.yearSampleForm.remark = res.data.remark + this.editYearFormRow.yearId = res.data.yearId + this.editYearFormRow.writeUser = res.data.writeUser + this.editYearFormRow.examineUser = res.data.examineUser + this.editYearFormRow.ratifyUser = res.data.ratifyUser + if (res.data.countersignUser) { + this.editYearFormRow.countersignUser = res.data.countersignUser.split(",").map(Number) + } + } + }) + }, + // 缂栬緫骞村害鎶芥牱 + editYearForm (row) { + this.operationType = 'edit' + this.getUserList() + this.yearSampleDia = true + getSpotCheckYear({yearId: row.yearId}).then(res => { + if (res.code === 200) { + this.currentYear = res.data.yearHead + this.yearItems = res.data.yearItems + this.yearSampleForm.tableRemark = res.data.tableRemark + this.yearSampleForm.remark = res.data.remark + this.editYearFormRow.yearId = res.data.yearId + this.editYearFormRow.writeUser = res.data.writeUser + this.editYearFormRow.examineUser = res.data.examineUser + this.editYearFormRow.ratifyUser = res.data.ratifyUser + if (res.data.countersignUser) { + this.editYearFormRow.countersignUser = res.data.countersignUser.split(",").map(Number) + } + } + }) + }, + // 鎻愪氦骞村害璁″垝 + handleSample () { + if (this.operationType === 'add') { + this.yearSampleForm.yearItems = JSON.parse(JSON.stringify(this.yearItems)) + this.yearSampleForm.yearHead = this.currentYear + addSpotCheckYear(this.yearSampleForm).then(res => { + if (res.code == 200) { + this.$message.success('鎻愪氦鎴愬姛') + this.yearSampleForm = {} + this.yearItems = [] + this.closeYearSampleDia() + this.refreshTable() + } + }) + } else { + const params = {...this.editYearFormRow} + if (params.countersignUser != null) { + params.countersignUser = params.countersignUser.join(',') + } + params.yearItems = JSON.parse(JSON.stringify(this.yearItems)) + params.tableRemark = this.yearSampleForm.tableRemark + params.remark = this.yearSampleForm.remark + updateSpotCheckYear(params).then(res => { + if (res.code == 200) { + this.$message.success('淇敼鎴愬姛') + this.yearSampleForm = {} + this.editYearFormRow = { + yearId: '', + writeUser: '', // 缂栧埗浜� + countersignUser: [], // 浼氱浜� + examineUser: '', // 瀹℃牳浜� + ratifyUser: '', // 鎵瑰噯浜� + } + this.yearItems = [] + this.closeYearSampleDia() + this.refreshTable() + } + }) + } + }, + yearSample (type) { + this.operationType = type + const currentDate = new Date(); + this.yearSampleDia = true + this.currentYear = currentDate.getFullYear() + '骞村勾搴︽娊妫�璁″垝' + }, + // 娣诲姞骞村害璁″垝 + addQuarter () { + this.yearItems.push({}) + }, + // 娓呯┖鎶芥牱璁″垝 + clearTable () { + this.yearItems = [] + }, + // 鎵嬪姩鍒犻櫎 + deleteScope (index) { + this.yearItems.splice(index, 1) + }, + // 鍒囨崲涓嬪崟tab琛ㄦ牸 + handleTab(m, i) { + this.tabIndex = i; + if (this.tabIndex === 0) { + this.componentData.entity.quarterNo = this.entity.quarterNo + } + this.refreshTable() + }, + closeYearSampleDia () { + this.yearSampleForm = { + tableRemark: '', + remark: '' + } + this.yearItems = [] + this.yearSampleDia = false + }, + getStyle(){ + return 'height: calc(100% - '+'44'+'px)' + }, + getUserList(){ + selectUserCondition({ type: 0 }).then((res) => { + this.userList = res.data; + }) + }, + }, +} +</script> + +<style scoped> +.tab { + list-style-type: none; + display: flex; + margin-bottom: 12px; + margin-top: 0; + padding-left: 0; +} + +.tab li { + line-height: 24px; + padding: 6px 14px; + font-size: 14px; + color: #333333; + border: 1px solid #EEEEEE; + cursor: pointer; +} + +.tab li:nth-child(1) { + border-radius: 8px 0 0 8px; +} + +.tab li:nth-child(2) { + border-radius: 0 8px 8px 0; +} + +.tab li.active { + border-color: #3A7BFA; + color: #3A7BFA; +} +</style> -- Gitblit v1.9.3