|
|
@@ -5,7 +5,7 @@
|
|
|
:label-col="{span: 6}"
|
|
|
:wrapper-col="{span: 18}"
|
|
|
:rules="rules"
|
|
|
- ref="problemForm">
|
|
|
+ ref="formRef">
|
|
|
<a-form-item>
|
|
|
<a-button type="link" @click="selectPblm" style="float: left;">选择问题</a-button>
|
|
|
</a-form-item>
|
|
|
@@ -48,15 +48,15 @@
|
|
|
<upload ref="uploadFile" :url="`/file/insert?bizId=`" @uploadOver="removeNewSupervision"></upload>
|
|
|
</a-form-item>
|
|
|
<a-form-item :wrapper-col="{ span: 18, offset: 6 }" style="margin-top: 50px">
|
|
|
- <a-button type="primary" @click="onSubmit('problemForm')" style="width: 100px;float:right">保存</a-button>
|
|
|
+ <a-button type="primary" @click="onSubmit" style="width: 100px;float:right">保存</a-button>
|
|
|
</a-form-item>
|
|
|
</a-form>
|
|
|
- <a-modal :open="pblmEascaderVisible" class="pblmEascader" title="选择问题" width="60%">
|
|
|
+ <a-modal v-model:open="pblmEascaderVisible" class="pblmEascader" title="选择问题" width="60%">
|
|
|
<pblmEascader :objType="rowData.type" @modelData="modelData" :vmodelData="newPblmValue" :t3="t3"></pblmEascader>
|
|
|
- <span slot="footer">
|
|
|
+ <template #footer>
|
|
|
<a-button @click="pblmEascaderVisible=false">返 回</a-button>
|
|
|
<a-button type="primary" @click="submitEascader">确 定</a-button>
|
|
|
- </span>
|
|
|
+ </template>
|
|
|
</a-modal>
|
|
|
</div>
|
|
|
</template>
|
|
|
@@ -160,15 +160,22 @@ export default {
|
|
|
},
|
|
|
},
|
|
|
mounted() {
|
|
|
- this.newPblmValue = this.newModelData;
|
|
|
- if (this.newPblmValue) {
|
|
|
- this.t1 = this.newPblmValue.model[0];
|
|
|
- this.t2 = this.newPblmValue.model[1];
|
|
|
- this.t3 = this.newPblmValue.label;
|
|
|
- this.getYanZhongChengDu();
|
|
|
- }
|
|
|
+ this.syncNewModel(this.newModelData);
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ newModelData(val) {
|
|
|
+ this.syncNewModel(val);
|
|
|
+ },
|
|
|
},
|
|
|
methods: {
|
|
|
+ syncNewModel(data) {
|
|
|
+ if (!data) return;
|
|
|
+ this.newPblmValue = data;
|
|
|
+ this.t1 = data.model[0];
|
|
|
+ this.t2 = data.model[1];
|
|
|
+ this.t3 = data.label;
|
|
|
+ this.getYanZhongChengDu();
|
|
|
+ },
|
|
|
disabledDate(current) {
|
|
|
return current && current < moment().endOf('day').add(11, 'days');
|
|
|
},
|
|
|
@@ -186,51 +193,58 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- onSubmit(problemForm) {
|
|
|
- this.$refs[problemForm].validate((valid) => {
|
|
|
- if (valid) {
|
|
|
- this.problemForm.villType = '0';
|
|
|
- this.problemForm.recPers = this.recPers;
|
|
|
- this.problemForm.objId = this.objId;
|
|
|
- this.problemForm.regid = this.currentObjectRgstrId;
|
|
|
- this.problemForm.nm = this.objName;
|
|
|
- this.problemForm.objType = this.objType;
|
|
|
- this.problemForm.pblmStat = '0';
|
|
|
- this.problemForm.cwsCode = this.rowData.type;
|
|
|
- this.problemForm['inspPblmName'] = this.t1;
|
|
|
- this.problemForm['inspPblmDesc'] = this.problemForm.inspPblmDesc;
|
|
|
- this.problemForm['inspPlbmType'] = this.t2;
|
|
|
- // this.problemForm['inspPblmName'] = this.t3.pblmDesc;
|
|
|
- this.problemForm['inspPblmCode'] = this.t3;
|
|
|
- this.problemForm['pblmsTypeId'] = this.newPblmValue.model[2];
|
|
|
- this.problemForm.inspPblmCate = this.inspPblmCate;
|
|
|
- if (!this.problemForm.inspPblmName) {
|
|
|
- this.$message.info('问题类别不能为空');
|
|
|
- return;
|
|
|
- }
|
|
|
- if (!this.problemForm.inspPlbmType) {
|
|
|
- this.$message.info('检查项目不能为空');
|
|
|
- return;
|
|
|
- }
|
|
|
- if (!this.problemForm.inspPblmCode) {
|
|
|
- this.$message.info('问题描述不能为空');
|
|
|
- return;
|
|
|
+ async onSubmit() {
|
|
|
+ const form = this.$refs.formRef;
|
|
|
+ if (!form || !form.validate) {
|
|
|
+ this.$refs.formRef = form;
|
|
|
+ this.doSubmit();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ await form.validate();
|
|
|
+ this.doSubmit();
|
|
|
+ } catch (e) {
|
|
|
+ // validation failed
|
|
|
+ }
|
|
|
+ },
|
|
|
+ doSubmit() {
|
|
|
+ this.problemForm.villType = '0';
|
|
|
+ this.problemForm.recPers = this.recPers;
|
|
|
+ this.problemForm.objId = this.objId;
|
|
|
+ this.problemForm.regid = this.currentObjectRgstrId;
|
|
|
+ this.problemForm.nm = this.objName;
|
|
|
+ this.problemForm.objType = this.objType;
|
|
|
+ this.problemForm.pblmStat = '0';
|
|
|
+ this.problemForm.cwsCode = this.rowData.type;
|
|
|
+ this.problemForm['inspPblmName'] = this.t1;
|
|
|
+ this.problemForm['inspPblmDesc'] = this.problemForm.inspPblmDesc;
|
|
|
+ this.problemForm['inspPlbmType'] = this.t2;
|
|
|
+ this.problemForm['inspPblmCode'] = this.t3;
|
|
|
+ this.problemForm['pblmsTypeId'] = this.newPblmValue.model[2];
|
|
|
+ this.problemForm.inspPblmCate = this.inspPblmCate;
|
|
|
+ if (!this.problemForm.inspPblmName) {
|
|
|
+ this.$message.info('问题类别不能为空');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (!this.problemForm.inspPlbmType) {
|
|
|
+ this.$message.info('检查项目不能为空');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (!this.problemForm.inspPblmCode) {
|
|
|
+ this.$message.info('问题描述不能为空');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ request.post('/dc/insp/pblm', this.problemForm).then((res) => {
|
|
|
+ if (res.success) {
|
|
|
+ const pblmId = res.data.pblmId;
|
|
|
+ console.log('[commonwenti] doSubmit success, pblmId:', pblmId, 'uploadFile:', this.$refs.uploadFile);
|
|
|
+ this.pblmId = pblmId;
|
|
|
+ this.gwComFiles = [];
|
|
|
+ this.pblmStat = res.data.pblmStat;
|
|
|
+ if (this.$refs.uploadFile.submitUpload(pblmId)) {
|
|
|
+ this.removeNewSupervision();
|
|
|
}
|
|
|
- // this.problemForm.zgDate = this.problemForm.zgDate ? moment(this.problemForm.zgDate).format('YYYY-MM-DD') : null
|
|
|
- // this.problemForm.proposeZgDate = this.problemForm.zgDate
|
|
|
- // this.problemForm.proposeZgZgxx = this.problemForm.pblmSggtn
|
|
|
- request.post('/dc/insp/pblm', this.problemForm).then((res) => {
|
|
|
- if (res.success) {
|
|
|
- this.pblmId = res.data.pblmId;
|
|
|
- this.gwComFiles = [];
|
|
|
- this.pblmStat = res.data.pblmStat;
|
|
|
- if (this.$refs.uploadFile.submitUpload(res.data.pblmId)) {
|
|
|
- this.removeNewSupervision();
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- } else {
|
|
|
- return false;
|
|
|
+ this.$emit('closeDialog');
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
@@ -266,11 +280,7 @@ export default {
|
|
|
this.currentProblemDescList = item.pblmDescs;
|
|
|
},
|
|
|
modelData(val) {
|
|
|
- this.newPblmValue = val;
|
|
|
- this.t1 = this.newPblmValue.model[0];
|
|
|
- this.t2 = this.newPblmValue.model[1];
|
|
|
- this.t3 = this.newPblmValue.label;
|
|
|
- this.getYanZhongChengDu();
|
|
|
+ this.syncNewModel(val);
|
|
|
},
|
|
|
selectPblm() {
|
|
|
this.pblmEascaderVisible = true;
|