From f74325f26ac9d7d8a217d097e0f3ec51f6c08c33 Mon Sep 17 00:00:00 2001 From: zty Date: Tue, 2 Apr 2024 09:15:46 +0800 Subject: [PATCH] =?UTF-8?q?feature:=20fix:=E8=83=BD=E5=8A=9B?= =?UTF-8?q?=E9=AA=8C=E8=AF=81=E7=BB=93=E6=9E=9C=E5=A2=9E=E5=8A=A0=20'/'?= =?UTF-8?q?=EF=BC=8C=E5=A4=96=E9=83=A8=E7=9B=91=E7=9D=A3=E7=BB=93=E6=9E=9C?= =?UTF-8?q?=E5=8F=AF=E4=BB=A5=E4=B8=BAnull?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/api/qc.js | 57 +++++ client/src/router/index.js | 92 ++++---- .../informatiomCollect/qualityActive.vue | 220 +++++++++++++----- .../informatiomCollect/qualityCommend.vue | 198 ++++++---------- client/src/views/supervisionNew/mytask.vue | 4 + .../views/supervisionNew/oinspect_form.vue | 14 +- client/src/views/supervisionNew/pt_form.vue | 1 + server/apps/information/views.py | 5 +- .../migrations/0065_auto_20240401_1619.py | 30 +++ .../migrations/0066_auto_20240401_1641.py | 25 ++ server/apps/supervision/models.py | 5 +- 11 files changed, 424 insertions(+), 227 deletions(-) create mode 100644 client/src/api/qc.js create mode 100644 server/apps/supervision/migrations/0065_auto_20240401_1619.py create mode 100644 server/apps/supervision/migrations/0066_auto_20240401_1641.py diff --git a/client/src/api/qc.js b/client/src/api/qc.js new file mode 100644 index 0000000..f123b74 --- /dev/null +++ b/client/src/api/qc.js @@ -0,0 +1,57 @@ +import request from '@/utils/request' + + + +export function getRcs(query) { + return request({ + url: '/info/qc/', + method: 'get', + params: query + }) + } + +export function getMyRcs(query) { + return request({ + url: '/info/qc/commentdation_info/', + method: 'get', + params: query + }) +} + + export function getRc(id) { + return request({ + url: `/info/qc/${id}/`, + method: 'get' + }) + } + + + export function updateRc(id, data) { + return request({ + url: `/info/qc/${id}/`, + method: 'put', + data + }) + } + + export function createRc(data) { + return request({ + url: `/info/qc/`, + method: 'post', + data + }) + } + +export function getRc_activate() { + return request({ + url: `/info/qc/activate_info/`, + method: 'get' + }) + } + + export function del_commend(id) { + return request({ + url: `/info/qc/${id}/`, + method: 'delete' + }) + } diff --git a/client/src/router/index.js b/client/src/router/index.js index e2dbd6d..8f0a33a 100644 --- a/client/src/router/index.js +++ b/client/src/router/index.js @@ -407,52 +407,52 @@ export const asyncRoutes = [ ] }, //信息收集 - { - path: '/infoCollect', - component: Layout, - redirect: '/infoCollect/', - name: 'informationCollect', - meta: { title: '信息收集', icon: 'PT', perms: ['infoCollect'] }, - alwaysShow: true, - children: [ - { - path: 'reviewStatus', - name: 'reviewStatus', - component: () => import('@/views/informatiomCollect/reviewStatus.vue'), - meta: { title: '评审情况', perms: ['infoCollect_RS'] } - }, - { - path: 'qualityCommend', - name: 'qualityCommend', - component: () => import('@/views/informatiomCollect/qualityCommend.vue'), - meta: { title: '质量活动', perms: ['infoCollect_QC'] } - }, - { - path: 'qualityActive.', - name: 'qualityActive.', - component: () => import('@/views/informatiomCollect/qualityActive.vue'), - meta: { title: '质量表彰', perms: ['infoCollect_QA'] } - }, - { - path: 'laboratoryContact', - name: 'laboratoryContact', - component: () => import('@/views/informatiomCollect/laboratoryContact.vue'), - meta: { title: '实验室联系方式', perms: ['infoCollect_LC'] } - }, - { - path: 'externalAuditor', - name: 'externalAuditor', - component: () => import('@/views/informatiomCollect/externalAuditor.vue'), - meta: { title: '外审员情况', perms: ['infoCollect_EA'] } - }, - { - path: 'inspectionStats', - name: 'inspectionStats', - component: () => import('@/views/informatiomCollect/inspectionStats.vue'), - meta: { title: '检验检测统计', perms: ['infoCollect_IS'] } - }, - ] - }, + // { + // path: '/infoCollect', + // component: Layout, + // redirect: '/infoCollect/', + // name: 'informationCollect', + // meta: { title: '信息收集', icon: 'PT', perms: ['infoCollect'] }, + // alwaysShow: true, + // children: [ + // { + // path: 'reviewStatus', + // name: 'reviewStatus', + // component: () => import('@/views/informatiomCollect/reviewStatus.vue'), + // meta: { title: '评审情况', perms: ['infoCollect_RS'] } + // }, + // { + // path: 'qualityCommend', + // name: 'qualityCommend', + // component: () => import('@/views/informatiomCollect/qualityCommend.vue'), + // meta: { title: '质量活动', perms: ['infoCollect_QC'] } + // }, + // { + // path: 'qualityActive.', + // name: 'qualityActive.', + // component: () => import('@/views/informatiomCollect/qualityActive.vue'), + // meta: { title: '质量表彰', perms: ['infoCollect_QA'] } + // }, + // { + // path: 'laboratoryContact', + // name: 'laboratoryContact', + // component: () => import('@/views/informatiomCollect/laboratoryContact.vue'), + // meta: { title: '实验室联系方式', perms: ['infoCollect_LC'] } + // }, + // { + // path: 'externalAuditor', + // name: 'externalAuditor', + // component: () => import('@/views/informatiomCollect/externalAuditor.vue'), + // meta: { title: '外审员情况', perms: ['infoCollect_EA'] } + // }, + // { + // path: 'inspectionStats', + // name: 'inspectionStats', + // component: () => import('@/views/informatiomCollect/inspectionStats.vue'), + // meta: { title: '检验检测统计', perms: ['infoCollect_IS'] } + // }, + // ] + // }, { path: '/test', component: Layout, diff --git a/client/src/views/informatiomCollect/qualityActive.vue b/client/src/views/informatiomCollect/qualityActive.vue index c7a3911..d943632 100644 --- a/client/src/views/informatiomCollect/qualityActive.vue +++ b/client/src/views/informatiomCollect/qualityActive.vue @@ -4,23 +4,28 @@ 新增 - - - + + + - - - - - - - + + + + + + + + +
+ 质量活动 +
+ +
- + - - + + - - - + + + + + - + + + + + + + + + + + + + + + + + + + + + + + +
取消 @@ -66,16 +121,36 @@ import Pagination from "@/components/Pagination"; // secondary package based on import Treeselect from "@riophae/vue-treeselect"; import "@riophae/vue-treeselect/dist/vue-treeselect.css"; import { getDictList, getDictTypeList } from "@/api/dict"; +import { getRcs, createRc, del_activate, updateRc, getMyRcs } from "@/api/qa"; import { upUrl, upHeaders } from "@/api/file"; + const defaultContent = { - name: "", - description: "", - file: null -}; + name: "", + roles: "", + collaborators: "", + orgunits: "", + place: "", + activate_time: "", + participations: "", + function: "", + earnings: "" + }; + export default { components: { Pagination, Treeselect }, - data() { + data(){ return { + form: { + name: "", + roles: "", + collaborators: "", + orgunits: "", + place: "", + activate_time: "", + participations: "", + function: "", + earnings: "", + }, upHeaders: upHeaders(), upUrl: upUrl(), fileList: [], @@ -95,30 +170,43 @@ export default { name: [{ required: true, message: "请输入名称", trigger: "blur" }], }, filterOrgText: "", - tableHeight: null, - }; - }, - computed: {}, - watch: { - filterOrgText(val) { - this.$refs.tree.filter(val); - }, - }, - created() { - + // tableHeight: '300px', + activateOptions:[ + {key:'组织方',value:0}, + {key:'参与方',value:1} + ], + ac_options:{0:'组织方', 1:'参与方'} + } }, mounted() { - let that = this; - let height1 = document.getElementsByClassName('app-main')[0].clientHeight; - let height2 = document.getElementsByClassName('elHeader')[0].clientHeight; - that.tableHeight = height1 - height2 - 70; - console.log(that.tableHeight) - that.getList(); + let that = this; + let height1 = document.getElementsByClassName('app-main')[0].clientHeight; + let height2 = document.getElementsByClassName('elHeader')[0].clientHeight; + that.tableHeight = height1 - height2 - 70; + console.log(that.tableHeight) + that.getList(); - }, + }, methods: { - getTableList() { - this.getList(); + + //提交表单 + submitForm(formName) { + this.$refs[formName].validate((valid) => { + if (valid) { + if (this.dialogType == "new") { + this.addData(); + } else { + this.editData(); + } + } else { + console.log("error submit!!"); + return false; + } + }); + }, + getTableList(){ + this.getList() + }, handlePreview(file) { if ("url" in file) { @@ -142,8 +230,18 @@ export default { }, getList() { - }, + this.listLoading = true; + this.tableData.results =[]; + this.tableData.count =0; + getMyRcs(this.listQuery).then((response) => { + console.log(response); + if (response.data) { + this.tableData = response.data; + } + this.listLoading = false; + }); + }, handleFilter() { this.listQuery.page = 1; @@ -181,9 +279,12 @@ export default { type: "error", }) .then(async () => { - // await deleteDoc(scope.row.id); - // this.getList(); - // this.$message.success("成功"); + await del_activate(scope.row.id).then(() => { + this.getList(); + this.$message.success("成功"); + this.getTableList(); + }) + }) .catch((err) => { console.error(err); @@ -195,9 +296,23 @@ export default { const isEdit = this.dialogType === "edit"; if (isEdit) { console.log(this.Content) - + updateRc(this.Content.id, this.Content).then((response) => { + if (response.data) { + this.tableData = response.data; + } + this.listLoading = false; + this.dialogVisible = false; + this.getTableList(); + }); } else { - + createRc(this.Content).then((response) => { + if (response.data) { + this.tableData = response.data; + } + this.listLoading = false; + this.dialogVisible = false; + this.getTableList(); + }); } } else { return false; @@ -205,6 +320,7 @@ export default { }); }, }, + }; - + \ No newline at end of file diff --git a/client/src/views/informatiomCollect/qualityCommend.vue b/client/src/views/informatiomCollect/qualityCommend.vue index 1ea4bd6..0c61b8b 100644 --- a/client/src/views/informatiomCollect/qualityCommend.vue +++ b/client/src/views/informatiomCollect/qualityCommend.vue @@ -4,23 +4,31 @@ 新增 - - - - + + - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - + - + > - 上传文件
- 取消 + 取消 确认
@@ -145,12 +145,20 @@ this.dialogVisible = true; return this; }, + + close_dialog(){ + this.impDialogVisible = false; + this.$emit('close_dialog'); + }, //表单注入数据 setData(data) { + console.log(data); + console.log("111111111111111") Object.assign(this.form, data); if(data.notification_form){ this.fileList = [{ name: data.notification_form.split('/')[5], value: data.notification_form }]; }else if(data.result_form){ + console.log(data.result_form.split('/')) this.fileList_res = [{ name: data.result_form.split('/')[5], value: data.result_form }]; } }, diff --git a/client/src/views/supervisionNew/pt_form.vue b/client/src/views/supervisionNew/pt_form.vue index e316404..361aa7d 100644 --- a/client/src/views/supervisionNew/pt_form.vue +++ b/client/src/views/supervisionNew/pt_form.vue @@ -122,6 +122,7 @@ import { options } from "runjs"; edit: "能力验证结果编辑", }, options:[ + {key:'/',value:0}, {key:'满意',value:10}, {key:'有问题',value:20}, {key:'不满意',value:30} diff --git a/server/apps/information/views.py b/server/apps/information/views.py index bd9230d..9b1d295 100644 --- a/server/apps/information/views.py +++ b/server/apps/information/views.py @@ -150,7 +150,8 @@ class QualityCommendationViewSet(ImpMixin, ModelViewSet): child_dept = get_child_queryset2(father_dept) query = QualityCommendation.objects.filter(department__in=child_dept) serializer = QualityCommendationSerializer(query, many=True) - return Response(serializer.data) + data = {'count':len(serializer.data), 'results':serializer.data} + return Response(data, status = status.HTTP_200_OK) # 质量活动 @@ -159,7 +160,6 @@ class QualityActivitiesViewSet(ModelViewSet): serializer_class = QualityActivitiesSerializer def create(self, request): - print("---------------------", self.request.data) if Organization.objects.filter(name=self.request.data['orgunits']).exists(): department_id = Organization.objects.filter(name=self.request.data['orgunits']).first().id self.request.data['department'] = department_id @@ -177,7 +177,6 @@ class QualityActivitiesViewSet(ModelViewSet): query = QualityActivities.objects.filter(department__in=child_dept) serializer = QualityActivitiesSerializer(query, many=True) data = {'count':len(serializer.data), 'results':serializer.data} - print("return Response(serializer.data)", data) return Response(data, status = status.HTTP_200_OK) diff --git a/server/apps/supervision/migrations/0065_auto_20240401_1619.py b/server/apps/supervision/migrations/0065_auto_20240401_1619.py new file mode 100644 index 0000000..ed5659f --- /dev/null +++ b/server/apps/supervision/migrations/0065_auto_20240401_1619.py @@ -0,0 +1,30 @@ +# Generated by Django 3.2.12 on 2024-04-01 08:19 + +import datetime +from django.db import migrations, models +from django.utils.timezone import utc + + +class Migration(migrations.Migration): + + dependencies = [ + ('supervision', '0064_auto_20240326_1004'), + ] + + operations = [ + migrations.AlterField( + model_name='oinspect', + name='result', + field=models.TextField(blank=True, default='', null=True, verbose_name='检查结果'), + ), + migrations.AlterField( + model_name='oinspect', + name='result_date', + field=models.DateField(default=datetime.datetime(2024, 4, 1, 8, 19, 8, 965907, tzinfo=utc), verbose_name='检查结果日期'), + ), + migrations.AlterField( + model_name='pt', + name='result', + field=models.PositiveSmallIntegerField(blank=True, choices=[(10, '满意'), (20, '有问题'), (30, '不满意')], default=None, help_text="((10, '满意'), (20, '有问题'), (30, '不满意'))", null=True, verbose_name='结果'), + ), + ] diff --git a/server/apps/supervision/migrations/0066_auto_20240401_1641.py b/server/apps/supervision/migrations/0066_auto_20240401_1641.py new file mode 100644 index 0000000..03c8e4f --- /dev/null +++ b/server/apps/supervision/migrations/0066_auto_20240401_1641.py @@ -0,0 +1,25 @@ +# Generated by Django 3.2.12 on 2024-04-01 08:41 + +import datetime +from django.db import migrations, models +from django.utils.timezone import utc + + +class Migration(migrations.Migration): + + dependencies = [ + ('supervision', '0065_auto_20240401_1619'), + ] + + operations = [ + migrations.AlterField( + model_name='oinspect', + name='result_date', + field=models.DateField(default=datetime.datetime(2024, 4, 1, 8, 41, 22, 34090, tzinfo=utc), verbose_name='检查结果日期'), + ), + migrations.AlterField( + model_name='pt', + name='result', + field=models.PositiveSmallIntegerField(choices=[(0, '/'), (10, '满意'), (20, '有问题'), (30, '不满意')], default=0, help_text="((0, '/'), (10, '满意'), (20, '有问题'), (30, '不满意'))", verbose_name='结果'), + ), + ] diff --git a/server/apps/supervision/models.py b/server/apps/supervision/models.py index 524f085..7bd4feb 100644 --- a/server/apps/supervision/models.py +++ b/server/apps/supervision/models.py @@ -235,6 +235,7 @@ class Pt(CommonBDModel): """能力验证 """ pt_result_choices = ( + (0, '/'), (10, '满意'), (20, '有问题'), (30, '不满意') @@ -253,7 +254,7 @@ class Pt(CommonBDModel): number = models.CharField('编号', max_length=100) organizer = models.CharField('组织方', max_length=100) params = models.TextField('参加参数名称') - result = models.PositiveSmallIntegerField('结果', choices=pt_result_choices, default=10, help_text=str(pt_result_choices)) + result = models.PositiveSmallIntegerField('结果', choices=pt_result_choices, default=0, help_text=str(pt_result_choices)) handle_result = models.PositiveSmallIntegerField('处理结果', choices = pt_hresult_choices, default=0, help_text=str(pt_hresult_choices)) certificate_date = models.DateField('证书日期') field = models.PositiveSmallIntegerField('领域', choices=field_choices, help_text=str(field_choices),default=0) @@ -292,7 +293,7 @@ class Oinspect(CommonBDModel): cate = models.PositiveSmallIntegerField('检查分类', choices=oinspect_cate_choices, default=30, help_text=str(oinspect_cate_choices)) checker = models.CharField('检查方', max_length=100) date_inspect = models.DateField('检查日期') - result = models.TextField('检查结果') + result = models.TextField('检查结果', null=True, blank=True, default='') result_date = models.DateField('检查结果日期', default=timezone.now()) notification_form = models.CharField('检查通知单', max_length=100, null=True) result_form = models.CharField('检查结果告知单', max_length=100, null=True)