|
@@ -27,7 +27,7 @@ import newTable from '@/components/new-table';
|
|
|
import searchBar from '@/components/search-bar';
|
|
|
import operateBar from '@/components/operate-bar';
|
|
|
import { searchOpt, addEditOpt } from '@/mixins/page-opt';
|
|
|
-import { authUserTableUrl } from '@/api/data-auth';
|
|
|
+import * as Api from '@/api/environment-manage';
|
|
|
const labelWidth = '120px';
|
|
|
const area = ['500px', '400px'];
|
|
|
export default {
|
|
@@ -39,7 +39,7 @@ export default {
|
|
|
mixins: [searchOpt, addEditOpt],
|
|
|
data() {
|
|
|
return {
|
|
|
- tableUrl: authUserTableUrl,
|
|
|
+ tableUrl: Api.tableUrl,
|
|
|
tableHeader: [
|
|
|
{
|
|
|
prop: 'envElementType',
|
|
@@ -108,15 +108,50 @@ export default {
|
|
|
if (opt == '新增') {
|
|
|
this.handleOpenEditForm('新增', 'add', otherParams);
|
|
|
} else if (opt == '修改') {
|
|
|
- this.handleOpenEditForm('修改', 'update', otherParams);
|
|
|
+ this.handleOpenEditForm('修改', 'update', { ...otherParams, detailInfo: row });
|
|
|
} else if (opt == '删除') {
|
|
|
this.handleDelete(row);
|
|
|
}
|
|
|
},
|
|
|
handleDelete(row) {
|
|
|
- this.$dgConfirm(`是否确定删除这条数据!`, '提示', {}).then(() => {});
|
|
|
+ this.$dgConfirm(`是否确定删除这条数据!`, '提示', {}).then(() => {
|
|
|
+ Api.deleteEnvElement(row.id).then((res) => {
|
|
|
+ this.$message.success('删除成功!');
|
|
|
+ this.handleSearch();
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @description: 保存表单
|
|
|
+ * @param { 表单数据 } form
|
|
|
+ * @param { 新增还是编辑 } type
|
|
|
+ * @param { 弹框 } layer
|
|
|
+ */
|
|
|
+ async saveForm(form, type, layer) {
|
|
|
+ const res = type == 'update' ? await this.update(form) : await this.add(form);
|
|
|
+ if (res.data.result == '200') {
|
|
|
+ this.$message.success('保存成功');
|
|
|
+ layer.close(layer.dialogIndex);
|
|
|
+ this.handleSearch();
|
|
|
+ } else {
|
|
|
+ this.$message.warning(res.data.msg);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ add(form) {
|
|
|
+ return new Promise((resolve) => {
|
|
|
+ Api.saveEnvElement(form).then((res) => {
|
|
|
+ resolve(res);
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ update(form) {
|
|
|
+ return new Promise((resolve) => {
|
|
|
+ const { createTime, ...otherInfo } = form;
|
|
|
+ Api.updateEnvElement({ ...otherInfo }).then((res) => {
|
|
|
+ resolve(res);
|
|
|
+ });
|
|
|
+ });
|
|
|
}
|
|
|
-
|
|
|
},
|
|
|
created() {},
|
|
|
mounted() {}
|