detail.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. <template>
  2. <div>
  3. <basicDetails
  4. ref="details"
  5. :titleText="mainData.name"
  6. :editData="mainData"
  7. :mainAreaData="mainAreaData"
  8. turnPageId="2026051513132402"
  9. idname="sc_workorder_templateid"
  10. ownertable="sc_workorder_template"
  11. tags=""
  12. :tabs="['工序明细', '详细信息']"
  13. :column="4"
  14. @pageChange="pageChange"
  15. @onEditSuccess="queryMainData($route.query.id)"
  16. >
  17. <div slot="tags"></div>
  18. <template slot="customOperation">
  19. <Edit
  20. class="inline-16"
  21. title_btn="编辑"
  22. title_drawer="编辑工单模板"
  23. btn_size="mini"
  24. :data="mainData"
  25. @onSuccess="queryMainData"
  26. ></Edit>
  27. <el-button
  28. v-if="mainData.isused == 0"
  29. type="primary"
  30. size="mini"
  31. :loading="btnLoading"
  32. @click="onToggleUsed(1, '启用')"
  33. >{{ $t("启 用") }}</el-button
  34. >
  35. <el-button
  36. v-if="mainData.isused == 1"
  37. type="warning"
  38. size="mini"
  39. :loading="btnLoading"
  40. @click="onToggleUsed(0, '禁用')"
  41. >{{ $t("禁 用") }}</el-button
  42. >
  43. <el-button type="danger" @click="onDelete" size="mini">{{
  44. $t(`删 除`)
  45. }}</el-button>
  46. </template>
  47. <div slot="slot0">
  48. <taskDetail> </taskDetail>
  49. </div>
  50. <div slot="slot1">
  51. <base-info
  52. v-if="detailInfo"
  53. :detailInfo="detailInfo"
  54. ></base-info>
  55. </div>
  56. </basicDetails>
  57. </div>
  58. </template>
  59. <script>
  60. import Edit from "@/Form/terminalWorkBillModule/add";
  61. import BaseInfo from "@/HDrpManagement/projectChange/modules/modules/baseInfo/baseInfo";
  62. import taskDetail from "./taskDetail/index";
  63. export default {
  64. name: "detail",
  65. data() {
  66. return {
  67. mainData: {},
  68. mainAreaData: [],
  69. detailInfo: "",
  70. processDetailList: [],
  71. btnLoading: false,
  72. };
  73. },
  74. components: { Edit, BaseInfo, taskDetail },
  75. provide() {
  76. return {
  77. isEdit: () => this.mainData.isused == 1,
  78. };
  79. },
  80. methods: {
  81. onToggleUsed(value, actionText) {
  82. this.$confirm(
  83. this.$t(`确认${actionText}当前工单模板吗`) + "?",
  84. this.$t("提示"),
  85. {
  86. confirmButtonText: this.$t("确定"),
  87. cancelButtonText: this.$t("取消"),
  88. type: "warning",
  89. beforeClose: async (action, instance, done) => {
  90. if (action === "confirm") {
  91. instance.confirmButtonLoading = true;
  92. const res = await this.$api.requested({
  93. id: "2026051513140102",
  94. content: {
  95. sc_workorder_templateid:
  96. this.$route.query.id,
  97. isused: value,
  98. },
  99. });
  100. this.tool.showMessage(res, () => {
  101. setTimeout(() => {
  102. instance.confirmButtonLoading = false;
  103. done();
  104. this.queryMainData();
  105. }, 500);
  106. });
  107. } else {
  108. done();
  109. }
  110. },
  111. }
  112. ).catch(() => {});
  113. },
  114. onDelete() {
  115. this.$confirm(
  116. this.$t("是否确认删除此工单模板") + "?",
  117. this.$t("提示"),
  118. {
  119. confirmButtonText: this.$t("确定"),
  120. cancelButtonText: this.$t("取消"),
  121. type: "warning",
  122. }
  123. )
  124. .then(async () => {
  125. const res = await this.$api.requested({
  126. id: "2026051513141202",
  127. content: {
  128. sc_workorder_templateids: [this.$route.query.id],
  129. },
  130. });
  131. if (res.code === 0) {
  132. this.$message.error(res.data[0].errmsg);
  133. } else {
  134. this.$message({
  135. message: this.$t("删除成功"),
  136. type: "success",
  137. });
  138. this.$store.dispatch("changeDetailDrawer", false);
  139. }
  140. })
  141. .catch(() => {
  142. this.$message({
  143. type: "info",
  144. message: this.$t("已取消删除"),
  145. });
  146. });
  147. },
  148. async queryMainData() {
  149. const res = await this.$api.requested({
  150. id: 2026051513132402,
  151. content: {
  152. sc_workorder_templateid: this.$route.query.id,
  153. },
  154. });
  155. this.mainData = res.data;
  156. this.changeDataStructure();
  157. console.log("this.mainData", this.mainData);
  158. },
  159. changeDataStructure() {
  160. let that = this;
  161. this.mainAreaData = [
  162. {
  163. label: "模板名称",
  164. value: this.mainData.name,
  165. },
  166. {
  167. label: "工单类型",
  168. value: this.mainData.type,
  169. },
  170. {
  171. label: "是否启用",
  172. value: this.mainData.isused ? "是" : "否",
  173. style: function () {
  174. let style = {};
  175. switch (that.mainData.isused) {
  176. case 1:
  177. style = { color: "#ff0000" };
  178. break;
  179. case 0:
  180. style = { color: "#666666" };
  181. break;
  182. default:
  183. break;
  184. }
  185. return style;
  186. },
  187. },
  188. {
  189. label: "是否后续工单",
  190. value: this.mainData.isworkorder ? "是" : "否",
  191. style: function () {
  192. let style = {};
  193. switch (that.mainData.isworkorder) {
  194. case 1:
  195. style = { color: "#ff0000" };
  196. break;
  197. case 0:
  198. style = { color: "#666666" };
  199. break;
  200. default:
  201. break;
  202. }
  203. return style;
  204. },
  205. },
  206. {
  207. label: "是否积分计算",
  208. value: this.mainData.ispoints ? "是" : "否",
  209. style: function () {
  210. let style = {};
  211. switch (that.mainData.ispoints) {
  212. case 1:
  213. style = { color: "#ff0000" };
  214. break;
  215. case 0:
  216. style = { color: "#666666" };
  217. break;
  218. default:
  219. break;
  220. }
  221. return style;
  222. },
  223. },
  224. {
  225. label: "是否工单完结时生成质保卡",
  226. value: this.mainData.iswarrantycard ? "是" : "否",
  227. style: function () {
  228. let style = {};
  229. switch (that.mainData.iswarrantycard) {
  230. case 1:
  231. style = { color: "#ff0000" };
  232. break;
  233. case 0:
  234. style = { color: "#666666" };
  235. break;
  236. default:
  237. break;
  238. }
  239. return style;
  240. },
  241. },
  242. ];
  243. this.detailInfo = {
  244. baseInfo: [
  245. {
  246. label: "模板名称",
  247. value: this.mainData.name,
  248. },
  249. {
  250. label: "工单类型",
  251. value: this.mainData.type,
  252. },
  253. {
  254. label: "是否启用",
  255. value: this.mainData.isused ? "是" : "否",
  256. style: function () {
  257. let style = {};
  258. switch (that.mainData.isused) {
  259. case 1:
  260. style = { color: "#ff0000" };
  261. break;
  262. case 0:
  263. style = { color: "#666666" };
  264. break;
  265. default:
  266. break;
  267. }
  268. return style;
  269. },
  270. },
  271. {
  272. label: "是否后续工单",
  273. value: this.mainData.isworkorder ? "是" : "否",
  274. style: function () {
  275. let style = {};
  276. switch (that.mainData.isworkorder) {
  277. case 1:
  278. style = { color: "#ff0000" };
  279. break;
  280. case 0:
  281. style = { color: "#666666" };
  282. break;
  283. default:
  284. break;
  285. }
  286. return style;
  287. },
  288. },
  289. {
  290. label: "是否积分计算",
  291. value: this.mainData.ispoints ? "是" : "否",
  292. style: function () {
  293. let style = {};
  294. switch (that.mainData.ispoints) {
  295. case 1:
  296. style = { color: "#ff0000" };
  297. break;
  298. case 0:
  299. style = { color: "#666666" };
  300. break;
  301. default:
  302. break;
  303. }
  304. return style;
  305. },
  306. },
  307. ],
  308. systemInfo: [
  309. { label: "创建人", value: this.mainData.createby },
  310. { label: "创建时间", value: this.mainData.createdate },
  311. { label: "最近编辑人", value: this.mainData.changeby },
  312. { label: "最近编辑时间", value: this.mainData.changedate },
  313. ],
  314. };
  315. },
  316. // 监听切换数据,上一页,下一页
  317. pageChange(id, rowindex, tabIndex) {
  318. this.flag = false;
  319. tabIndex = this.$route.query.tabIndex;
  320. this.$router.replace({
  321. path: "/serveWorkTaskDetail",
  322. query: { id: id, rowindex: rowindex, tabIndex: tabIndex },
  323. });
  324. this.queryMainData(id);
  325. },
  326. },
  327. mounted() {
  328. this.queryMainData(this.$route.query.id);
  329. },
  330. created() {},
  331. };
  332. </script>
  333. <style scoped></style>