|
|
@@ -23,29 +23,21 @@
|
|
|
:data="mainData"
|
|
|
@onSuccess="queryMainData"
|
|
|
></Edit>
|
|
|
- <customBtn
|
|
|
- :btnName="$t('启 用')"
|
|
|
- :message="$t('确认启用当前工单模板吗') + '?'"
|
|
|
- idName="2026051513140102"
|
|
|
- keyName="sc_workorder_templateid"
|
|
|
- :id="$route.query.id"
|
|
|
- @onSuccess="queryMainData"
|
|
|
- class="inline-16"
|
|
|
- :paramData="[{ key: 'isused', value: 1 }]"
|
|
|
+ <el-button
|
|
|
v-if="mainData.isused == 0"
|
|
|
- />
|
|
|
- <customBtn
|
|
|
- :btnName="$t('禁 用')"
|
|
|
- :message="$t('确认禁用当前工单模板吗') + '?'"
|
|
|
- idName="2026051513140102"
|
|
|
- keyName="sc_workorder_templateid"
|
|
|
- :id="$route.query.id"
|
|
|
- @onSuccess="queryMainData"
|
|
|
- class="inline-16"
|
|
|
- :paramData="[{ key: 'isused', value: 0 }]"
|
|
|
+ type="primary"
|
|
|
+ size="mini"
|
|
|
+ :loading="btnLoading"
|
|
|
+ @click="onToggleUsed(1, '启用')"
|
|
|
+ >{{ $t('启 用') }}</el-button>
|
|
|
+ <el-button
|
|
|
v-if="mainData.isused == 1"
|
|
|
- />
|
|
|
- <el-button type="primary" @click="onDelete" size="mini">{{ $t(`删 除`) }}</el-button>
|
|
|
+ type="warning"
|
|
|
+ size="mini"
|
|
|
+ :loading="btnLoading"
|
|
|
+ @click="onToggleUsed(0, '禁用')"
|
|
|
+ >{{ $t('禁 用') }}</el-button>
|
|
|
+ <el-button type="danger" @click="onDelete" size="mini">{{ $t(`删 除`) }}</el-button>
|
|
|
</template>
|
|
|
<div slot="slot0">
|
|
|
<taskDetail> </taskDetail>
|
|
|
@@ -69,6 +61,7 @@ export default {
|
|
|
mainAreaData: [],
|
|
|
detailInfo: '',
|
|
|
processDetailList: [],
|
|
|
+ btnLoading: false,
|
|
|
};
|
|
|
},
|
|
|
components: { Edit, BaseInfo, taskDetail },
|
|
|
@@ -78,6 +71,34 @@ export default {
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
|
+ onToggleUsed(value, actionText) {
|
|
|
+ this.$confirm(this.$t(`确认${actionText}当前工单模板吗`) + '?', this.$t('提示'), {
|
|
|
+ confirmButtonText: this.$t('确定'),
|
|
|
+ cancelButtonText: this.$t('取消'),
|
|
|
+ type: 'warning',
|
|
|
+ beforeClose: async (action, instance, done) => {
|
|
|
+ if (action === 'confirm') {
|
|
|
+ instance.confirmButtonLoading = true;
|
|
|
+ const res = await this.$api.requested({
|
|
|
+ id: '2026051513140102',
|
|
|
+ content: {
|
|
|
+ sc_workorder_templateid: this.$route.query.id,
|
|
|
+ isused: value,
|
|
|
+ },
|
|
|
+ });
|
|
|
+ this.tool.showMessage(res, () => {
|
|
|
+ setTimeout(() => {
|
|
|
+ instance.confirmButtonLoading = false;
|
|
|
+ done();
|
|
|
+ this.queryMainData();
|
|
|
+ }, 500);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ done();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ }).catch(() => {});
|
|
|
+ },
|
|
|
onDelete() {
|
|
|
this.$confirm(this.$t('是否确认删除此工单模板') + '?', this.$t('提示'), {
|
|
|
confirmButtonText: this.$t('确定'),
|