|
@@ -231,6 +231,117 @@
|
|
|
></el-pagination>
|
|
|
</div>
|
|
|
</div>
|
|
|
+ <el-dialog
|
|
|
+ :title="'信息 - ' + (dialog.editorBox.type === 'add' ? '新增' : '修改')"
|
|
|
+ :visible.sync="dialog.editorBox.show"
|
|
|
+ width="600px"
|
|
|
+ :close-on-click-modal="false"
|
|
|
+ :show-close="!loading"
|
|
|
+ >
|
|
|
+ <div>
|
|
|
+ <el-form
|
|
|
+ ref="dialog_form"
|
|
|
+ :model="dialog.editorBox.form.data"
|
|
|
+ :rules="dialog.editorBox.form.rules"
|
|
|
+ size="mini"
|
|
|
+ label-width="90px"
|
|
|
+ >
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item
|
|
|
+ label="监测部门"
|
|
|
+ prop="powerdetecdepartment"
|
|
|
+ >
|
|
|
+ <el-select
|
|
|
+ filterable clearable
|
|
|
+ style="width: 100%;"
|
|
|
+ v-model="dialog.editorBox.form.data.powerdetecdepartment"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item of nameObj.powerdetecdepartment.arr"
|
|
|
+ :key="item.id"
|
|
|
+ :value="item.id"
|
|
|
+ :label="item.name"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item
|
|
|
+ label="动力系统代码"
|
|
|
+ prop="powercode"
|
|
|
+ >
|
|
|
+ <el-input clearable
|
|
|
+ style="width: 100%;"
|
|
|
+ v-model="dialog.editorBox.form.data.powercode"
|
|
|
+ :disabled="dialog.editorBox.type !== 'add'"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item
|
|
|
+ label="动力系统名称"
|
|
|
+ prop="powername"
|
|
|
+ >
|
|
|
+ <el-input clearable
|
|
|
+ style="width: 100%;"
|
|
|
+ v-model="dialog.editorBox.form.data.powername"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item
|
|
|
+ label="使用状态"
|
|
|
+ prop="usestate"
|
|
|
+ >
|
|
|
+ <el-select
|
|
|
+ filterable clearable
|
|
|
+ style="width: 100%;"
|
|
|
+ v-model="dialog.editorBox.form.data.usestate"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item of nameObj.usestate.arr"
|
|
|
+ :key="item.id"
|
|
|
+ :value="item.id"
|
|
|
+ :label="item.name"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item
|
|
|
+ label="排序"
|
|
|
+ prop="sort"
|
|
|
+ >
|
|
|
+ <el-input clearable
|
|
|
+ style="width: 100%;"
|
|
|
+ v-model="dialog.editorBox.form.data.sort"
|
|
|
+ >
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-form>
|
|
|
+ </div>
|
|
|
+ <span
|
|
|
+ slot="footer"
|
|
|
+ class="dialog-footer"
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ @click="dialog.editorBox.show = false"
|
|
|
+ :loading="loading"
|
|
|
+ >取 消</el-button>
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ @click="dataSave"
|
|
|
+ :loading="loading"
|
|
|
+ >保 存</el-button>
|
|
|
+ </span>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -467,8 +578,67 @@ export default {
|
|
|
that.dialog.editorBox.type = 'add';
|
|
|
that.dialog.editorBox.show = true;
|
|
|
setTimeout(() => {
|
|
|
- that.$refs['dialog_form_arr'].clearValidate();
|
|
|
+ that.$refs['dialog_form'].clearValidate();
|
|
|
}, 100);
|
|
|
+ },
|
|
|
+ dataSave () {
|
|
|
+ let that = this;
|
|
|
+ let SubmitData = {
|
|
|
+ powerdetecdepartment: that.dialog.editorBox.form.data.powerdetecdepartment,
|
|
|
+ powercode: that.dialog.editorBox.form.data.powercode,
|
|
|
+ powername: that.dialog.editorBox.form.data.powername,
|
|
|
+ usestate: that.dialog.editorBox.form.data.usestate,
|
|
|
+ sort: that.dialog.editorBox.form.data.sort
|
|
|
+ };
|
|
|
+ that.$refs['dialog_form'].validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ if (that.dialog.editorBox.type === 'add') {
|
|
|
+ let foorData = new FormData();
|
|
|
+ for (let key in SubmitData) {
|
|
|
+ foorData.append(key, SubmitData[key]);
|
|
|
+ }
|
|
|
+ that.loading = true;
|
|
|
+ that.axios.post('pass/ems/v1/tcm0325s/', foorData, {
|
|
|
+ headers: {
|
|
|
+ 'Content-Type': 'multipart/form-data'
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .then(function (res) {
|
|
|
+ if (res.code === '0') {
|
|
|
+ that.$message({
|
|
|
+ message: '新增成功',
|
|
|
+ type: 'success'
|
|
|
+ });
|
|
|
+ that.getTableData();
|
|
|
+ that.dialog.editorBox.show = false;
|
|
|
+ } else {
|
|
|
+ that.$message.error(res.message);
|
|
|
+ }
|
|
|
+ that.loading = false;
|
|
|
+ }).catch(function () {
|
|
|
+ that.loading = false;
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ that.loading = true;
|
|
|
+ that.axios.put('pass/ems/v1/tcm0325s/' + SubmitData.powercode, SubmitData)
|
|
|
+ .then(function (res) {
|
|
|
+ if (res.code === '0') {
|
|
|
+ that.$message({
|
|
|
+ message: '修改成功',
|
|
|
+ type: 'success'
|
|
|
+ });
|
|
|
+ that.getTableData();
|
|
|
+ that.dialog.editorBox.show = false;
|
|
|
+ } else {
|
|
|
+ that.$message.error(res.message);
|
|
|
+ }
|
|
|
+ that.loading = false;
|
|
|
+ }).catch(function () {
|
|
|
+ that.loading = false;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
},
|
|
|
// but_edit (row) {
|
|
|
// let that = this;
|