|
@@ -0,0 +1,411 @@
|
|
|
+<template>
|
|
|
+ <a-modal
|
|
|
+ :title="permissionFlag === 1 ? $t('plan.dvp.create-dvp')
|
|
|
+ : permissionFlag === 2 ? $t('plan.dvp.edit-dvp') : ''"
|
|
|
+ :visible="addFlag"
|
|
|
+ :width="800"
|
|
|
+ @ok="save"
|
|
|
+ @cancel="closeModal"
|
|
|
+ :footer="null"
|
|
|
+ >
|
|
|
+ <div>
|
|
|
+ <a-form layout='vertical'>
|
|
|
+ <a-row :gutter='24'>
|
|
|
+ <a-col :md="12" :sm="12">
|
|
|
+ <a-form-item :label="$t('plan.dvp.vehicle-performance-module')">
|
|
|
+ <a-input disabled v-model="performanceModule" :maxLength="128"/>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="12" :sm="12">
|
|
|
+ <a-form-item :required='true' :label="$t('plan.dvp.description-of-the-purpose-of-the-test-vehicle')">
|
|
|
+ <a-input v-model="addFormData.vehicleUse" :maxLength="128" :placeholder="$t('plan.dvp.please_enter-description-of-the-purpose-of-the-test-vehicle')"/>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ </a-row>
|
|
|
+ <a-row :gutter='24'>
|
|
|
+ <a-col :md="12" :sm="12">
|
|
|
+ <a-form-item :required='true' :label="$t('plan.dvp.test-type')">
|
|
|
+ <a-select allowClear v-model="addFormData.testType" :options="testTypeList" @change="handleTestType" :placeholder="$t('plan.dvp.please_select-test-type')">
|
|
|
+ </a-select>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="12" :sm="12">
|
|
|
+ <a-form-item :required='true' :label="$t('plan.dvp.description-of-the-vehicle-status')">
|
|
|
+ <a-input v-model="addFormData.vehicleState" :maxLength="128" :placeholder="$t('plan.dvp.please_enter-description-of-the-vehicle-status')"/>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ </a-row>
|
|
|
+ <a-row :gutter='24'>
|
|
|
+ <a-col :md="12" :sm="12">
|
|
|
+ <a-form-item :required='true' :label="$t('plan.dvp.number-of-vehicles')">
|
|
|
+ <a-select allowClear v-model="addFormData.count" :options="countList" @change="handleCount" :placeholder="$t('plan.dvp.please_select-number-of-vehicles')">
|
|
|
+
|
|
|
+ </a-select>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md='12' :sm='12' v-for="(item,index) in selectDataList">
|
|
|
+ <a-form-item :label="item.name">
|
|
|
+ <a-select allowClear v-model="searchSelectData[item.id]" :options="item.configData" :key="index" :placeholder="$t('global-constant.please-select') + item.name">
|
|
|
+
|
|
|
+ </a-select>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="12" :sm="12">
|
|
|
+ <a-form-item :required='true' :label="$t('plan.dvp.test-location')">
|
|
|
+ <a-input v-model="addFormData.testSite" :maxLength="128" :placeholder="$t('plan.dvp.please_enter-test-location')"/>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="12" :sm="12">
|
|
|
+ <a-form-item :required='true' :label="$t('plan.dvp.study-director')">
|
|
|
+ <a-select allowClear v-model="addFormData.testOwner" :options="testOwnerList" @change="handleTestOwner" :placeholder="$t('plan.dvp.please_select-study-director')">
|
|
|
+ </a-select>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="12" :sm="12">
|
|
|
+ <a-form-item :required='true' :label="$t('plan.dvp.project-node')">
|
|
|
+ <a-select allowClear v-model="addFormData.projectNode" :options="projectNodeList" @change="handleProjectNode" :placeholder="$t('plan.dvp.please_select-project-node')">
|
|
|
+ </a-select>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="12" :sm="12">
|
|
|
+ <a-form-item :required='true' :label="$t('plan.dvp.sample-vehicle-plan-delivery-time')">
|
|
|
+ <a-date-picker v-model="addFormData.prototypePlanTime" style="width: 100%" allowClear @change="handlePlanTime" :placeholder="$t('plan.dvp.please_select-sample-vehicle-plan-delivery-time')"/>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="12" :sm="12">
|
|
|
+ <a-form-item :required='true' :label="$t('plan.dvp.scheduled-start-time')">
|
|
|
+ <a-date-picker v-model="addFormData.planStartTime" style="width: 100%" allowClear @change="handleStartTime" :placeholder="$t('plan.dvp.please_select-scheduled-start-time')"/>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="12" :sm="12">
|
|
|
+ <a-form-item :required='true' :label="$t('plan.dvp.scheduled-end-time')">
|
|
|
+ <a-date-picker v-model="addFormData.planEndTime" style="width: 100%" allowClear @change="handleEndTime" :placeholder="$t('plan.dvp.please_select-scheduled-end-time')"/>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ </a-row>
|
|
|
+ </a-form>
|
|
|
+ <div slot="footer"
|
|
|
+ v-if="permissionFlag !== 3"
|
|
|
+ class="mt10 text-right">
|
|
|
+ <a-button @click="closeModal">
|
|
|
+ {{ $t('global-btn.cancel') }}
|
|
|
+ </a-button>
|
|
|
+ <a-button
|
|
|
+ type="primary"
|
|
|
+ class="ml10"
|
|
|
+ @click="save()"
|
|
|
+ v-preventReClick>
|
|
|
+ {{ $t('global-btn.confirm') }}
|
|
|
+ </a-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </a-modal>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+export default {
|
|
|
+ name: "AddDvpTest",
|
|
|
+ components: {},
|
|
|
+ props: {
|
|
|
+ addFlag: {
|
|
|
+ type: Boolean,
|
|
|
+ default: false
|
|
|
+ },
|
|
|
+ addFormData: {
|
|
|
+ type: Object,
|
|
|
+ default() {
|
|
|
+ return {
|
|
|
+ testId: undefined, // 试验id
|
|
|
+ vehicleUse: undefined, // 试验车用途描述
|
|
|
+ testType: undefined, // 试验类型
|
|
|
+ vehicleState: undefined, // 车辆状态
|
|
|
+ count: undefined, // 车辆数量
|
|
|
+ testSite: undefined, // 试验地点
|
|
|
+ testOwner: undefined, // 试验负责人
|
|
|
+ projectNode: undefined, // 节点
|
|
|
+ prototypePlanTime: undefined, // 样车计划提供时间
|
|
|
+ planStartTime: undefined, // 计划开始时间
|
|
|
+ planEndTime: undefined, // 计划结束时间
|
|
|
+ columnDataModel: [] // 下拉选数据
|
|
|
+ };
|
|
|
+ }
|
|
|
+ },
|
|
|
+ performanceModule: {
|
|
|
+ type: String,
|
|
|
+ default: undefined
|
|
|
+ },
|
|
|
+ dvpId: {
|
|
|
+ type: Number,
|
|
|
+ default: 0
|
|
|
+ },
|
|
|
+ permissionFlag: {
|
|
|
+ type: Number,
|
|
|
+ default: 1
|
|
|
+ }
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ // 功能库功能类型下拉选择
|
|
|
+ functionTypeList: [],
|
|
|
+ selectDataList: [],
|
|
|
+ testTypeList: [
|
|
|
+ {
|
|
|
+ label: "Mule car",
|
|
|
+ value: "0"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "摸底",
|
|
|
+ value: "1"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "调校",
|
|
|
+ value: "2"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "验收",
|
|
|
+ value: "3"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "一致性",
|
|
|
+ value: "4"
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ countList: [],
|
|
|
+ testOwnerList: [],
|
|
|
+ projectNodeList: [],
|
|
|
+ /** 动态下拉选框 选中数据存储 */
|
|
|
+ searchSelectData: {},
|
|
|
+ };
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ // 初始化参数:功能编号
|
|
|
+ addFormData(addFormData) {
|
|
|
+ this.addFormData.vehicleUse = addFormData.vehicleUse;
|
|
|
+ this.addFormData.testType = addFormData.testType;
|
|
|
+ this.addFormData.vehicleState = addFormData.vehicleState;
|
|
|
+ this.addFormData.count = addFormData.count;
|
|
|
+ this.addFormData.testSite = addFormData.testSite;
|
|
|
+ this.addFormData.testOwner = addFormData.testOwner;
|
|
|
+ this.addFormData.projectNode = addFormData.node;
|
|
|
+ this.addFormData.prototypePlanTime = addFormData.prototypePlanTime;
|
|
|
+ this.addFormData.planStartTime = addFormData.planStartTime;
|
|
|
+ this.addFormData.planEndTime = addFormData.planEndTime;
|
|
|
+ this.addFormData.columnDataModel = addFormData.columnDataModel;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ initSearchSelectData() {
|
|
|
+ let searchData = this.addFormData.columnDataModel;
|
|
|
+ if (searchData && searchData.length > 0) {
|
|
|
+ searchData.forEach(item => {
|
|
|
+ this.searchSelectData[item.columnId] = item.columnValueId
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 初始化下拉选数据
|
|
|
+ */
|
|
|
+ initSelectList(dvpId){
|
|
|
+ let data = {
|
|
|
+ dvpId: dvpId
|
|
|
+ };
|
|
|
+ this.$api.initSelectList(data).then(res => {
|
|
|
+ if (res.flag){
|
|
|
+ let selectList = res.data;
|
|
|
+ if (selectList && selectList.length > 0) {
|
|
|
+ selectList.forEach(item => {
|
|
|
+ let config = item.configOption;
|
|
|
+ let selectData = {}
|
|
|
+ selectData.id = item.id;
|
|
|
+ selectData.name = item.name;
|
|
|
+ selectData.configData = [];
|
|
|
+ if (config && config.length > 0) {
|
|
|
+ config.forEach(eachData => {
|
|
|
+ let eachOption = {}
|
|
|
+ eachOption.key = eachData.id;
|
|
|
+ eachOption.value = eachData.id;
|
|
|
+ eachOption.label = eachData.name;
|
|
|
+ selectData.configData.push(eachOption);
|
|
|
+ })
|
|
|
+ };
|
|
|
+ this.selectDataList.push(selectData);
|
|
|
+ this.initSearchSelectData();
|
|
|
+ })
|
|
|
+ };
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 关闭模态框
|
|
|
+ */
|
|
|
+ closeModal() {
|
|
|
+ this.$emit("closeModal");
|
|
|
+ this.selectDataList = [];
|
|
|
+ this.searchSelectData = {};
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 非空校验 判断是否为空
|
|
|
+ * @returns {boolean}
|
|
|
+ */
|
|
|
+ isNull() {
|
|
|
+ let _this = this;
|
|
|
+ let message = [];
|
|
|
+ if (!_this.addFormData.vehicleUse) {
|
|
|
+ message.push(_this.$t('global-constant.please-enter') + _this.$t('plan.dvp.description-of-the-purpose-of-the-test-vehicle'));
|
|
|
+ }
|
|
|
+ if (!_this.addFormData.vehicleState) {
|
|
|
+ message.push(_this.$t('global-constant.please-enter') + _this.$t('plan.dvp.description-of-the-vehicle-status'));
|
|
|
+ }
|
|
|
+ if (!_this.addFormData.testType) {
|
|
|
+ message.push(_this.$t('global-constant.please-select') + _this.$t('plan.dvp.test-type'));
|
|
|
+ }
|
|
|
+ if (!_this.addFormData.count) {
|
|
|
+ message.push(_this.$t('global-constant.please-select') + _this.$t('plan.dvp.number-of-vehicles'));
|
|
|
+ }
|
|
|
+ if (!_this.addFormData.testSite) {
|
|
|
+ message.push(_this.$t('global-constant.please-enter') + _this.$t('plan.dvp.test-location'));
|
|
|
+ }
|
|
|
+ if (!_this.addFormData.testOwner) {
|
|
|
+ message.push(_this.$t('global-constant.please-select') + _this.$t('plan.dvp.study-director'));
|
|
|
+ }
|
|
|
+ if (!_this.addFormData.testOwner) {
|
|
|
+ message.push(_this.$t('global-constant.please-select') + _this.$t('plan.dvp.project-node'));
|
|
|
+ }
|
|
|
+ if (!_this.addFormData.testOwner) {
|
|
|
+ message.push(_this.$t('global-constant.please-select') + _this.$t('plan.dvp.sample-vehicle-plan-delivery-time'));
|
|
|
+ }
|
|
|
+ if (!_this.addFormData.testOwner) {
|
|
|
+ message.push(_this.$t('global-constant.please-select') + _this.$t('plan.dvp.scheduled-start-time'));
|
|
|
+ }
|
|
|
+ if (!_this.addFormData.testOwner) {
|
|
|
+ message.push(_this.$t('global-constant.please-select') + _this.$t('plan.dvp.scheduled-end-time'));
|
|
|
+ }
|
|
|
+ if (message && message.length > 0) {
|
|
|
+ for (let i = 0; i < message.length; i++) {
|
|
|
+ _this.$notification.warning({message: message[i]});
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 新建/编辑 保存
|
|
|
+ * @returns {boolean}
|
|
|
+ */
|
|
|
+ save() {
|
|
|
+ let _this = this;
|
|
|
+ if (!_this.isNull()) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ _this.tableLoading = true;
|
|
|
+ let data = {
|
|
|
+ functionId: _this.addFormData.functionId,
|
|
|
+ functionNo: _this.addFormData.functionNo,
|
|
|
+ functionName: _this.addFormData.functionName,
|
|
|
+ requireName: _this.addFormData.requireName,
|
|
|
+ nodeTypeId: _this.addFormData.nodeTypeId,
|
|
|
+ cpacId: _this.addFormData.cpacId,
|
|
|
+ versionNo: _this.addFormData.versionNo
|
|
|
+ };
|
|
|
+ // 新建
|
|
|
+ if (_this.permissionFlag === 1) {
|
|
|
+ _this.$api.createFunction(data).then(res => {
|
|
|
+ if (res.flag) {
|
|
|
+ _this.$message.success(this.$t('fmeamanager.operation-succeeded'), 1);
|
|
|
+ _this.closeModal();
|
|
|
+ _this.$emit("initData");
|
|
|
+ } else {
|
|
|
+ _this.$notification.error({message: res.message});
|
|
|
+ }
|
|
|
+ }).finally(() => {
|
|
|
+ _this.tableLoading = false;
|
|
|
+ });
|
|
|
+ } else if (_this.permissionFlag === 2) {
|
|
|
+ // 编辑
|
|
|
+ _this.$api.editSaveFunction(data).then(res => {
|
|
|
+ if (res.flag) {
|
|
|
+ _this.$message.success(this.$t('fmeamanager.operation-succeeded'), 1);
|
|
|
+ _this.closeModal();
|
|
|
+ _this.$emit("initData");
|
|
|
+ } else {
|
|
|
+ _this.addFormData.functionNo = res.data.functionNo;
|
|
|
+ _this.addFormData.functionName = res.data.functionName;
|
|
|
+ _this.addFormData.cpacId = res.data.cpacId;
|
|
|
+ _this.addFormData.nodeTypeId = res.data.nodeTypeId;
|
|
|
+ _this.addFormData.requireName = res.data.requireName;
|
|
|
+ _this.addFormData.versionNo = res.data.versionNo;
|
|
|
+ _this.$forceUpdate();
|
|
|
+ _this.$notification.error({message: res.message});
|
|
|
+ }
|
|
|
+ }).finally(() => {
|
|
|
+ _this.tableLoading = false;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 试验类型下拉改变
|
|
|
+ */
|
|
|
+ handleTestType(val) {
|
|
|
+ this.addFormData.testType = val;
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 车辆数量下拉改变
|
|
|
+ * @param val
|
|
|
+ */
|
|
|
+ handleCount(val) {
|
|
|
+ this.addFormData.count = val;
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 试验负责人下拉改变
|
|
|
+ * @param val
|
|
|
+ */
|
|
|
+ handleTestOwner(val) {
|
|
|
+ this.addFormData.testOwner = val;
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 项目节点下拉改变
|
|
|
+ * @param val
|
|
|
+ */
|
|
|
+ handleProjectNode(val) {
|
|
|
+ this.addFormData.projectNode = val;
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 样车提供时间 时间选择器Change方法
|
|
|
+ */
|
|
|
+ handlePlanTime(date, dateString){
|
|
|
+ if (!dateString) {
|
|
|
+ this.addFormData.prototypePlanTime = "";
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.addFormData.prototypePlanTime = dateString;
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 计划开始时间 时间选择器Change方法
|
|
|
+ */
|
|
|
+ handleStartTime(date, dateString){
|
|
|
+ if (!dateString) {
|
|
|
+ this.addFormData.planStartTime = "";
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.addFormData.planStartTime = dateString;
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 计划结束时间 时间选择器Change方法
|
|
|
+ */
|
|
|
+ handleEndTime(date, dateString){
|
|
|
+ if (!dateString) {
|
|
|
+ this.addFormData.planEndTime = "";
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.addFormData.planEndTime = dateString;
|
|
|
+ },
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|
|
|
+<style lang='less' scoped>
|
|
|
+.text-right {
|
|
|
+ text-align: right;
|
|
|
+}
|
|
|
+</style>
|