detail.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438
  1. <template>
  2. <div>
  3. <basicDetails
  4. ref="details"
  5. :titleText="mainData.billno"
  6. :oldFormPath="{ edit: 'HDrpManagement/serveWorkBill/components' }"
  7. :editData="mainData"
  8. :mainAreaData="mainAreaData"
  9. turnPageId="20221031141102"
  10. idname="sa_workorderid"
  11. ownertable="sa_workorder"
  12. tags=""
  13. :tabs="
  14. mainData.actiontype == '工序模板'
  15. ? ['工序详情', '确认单', '服务团队', '工单物料', '详细信息']
  16. : ['服务商品', '确认单', '服务团队', '详细信息']
  17. "
  18. @pageChange="pageChange"
  19. @onEditSuccess="queryMainData($route.query.id)"
  20. >
  21. <div slot="tags"></div>
  22. <div slot="customOperation">
  23. <!-- <customBtn
  24. btnName="接单"
  25. message="确认接单当前服务工单吗?"
  26. idName="20230210101103"
  27. keyName="sa_workorderid"
  28. :id="$route.query.id"
  29. @onSuccess="queryMainData"
  30. class="inline-16"
  31. v-if="mainData.status == '新建' && tool.checkAuth($route.name,'join')"
  32. />
  33. <customBtn
  34. btnName="开始"
  35. message="确认开始当前服务工单吗?"
  36. idName="20230209144503"
  37. keyName="sa_workorderid"
  38. :id="$route.query.id"
  39. @onSuccess="queryMainData"
  40. class="inline-16"
  41. v-if="mainData.status == '待开始' && tool.checkAuth($route.name,'start')"
  42. /> -->
  43. <customBtn
  44. btnName="暂停"
  45. message="确认暂停当前服务工单吗?"
  46. idName="20230209144603"
  47. keyName="sa_workorderid"
  48. :id="$route.query.id"
  49. @onSuccess="queryMainData"
  50. class="inline-16"
  51. v-if="
  52. mainData.status == '进行中' && tool.checkAuth($route.name, 'stop')
  53. "
  54. />
  55. <customBtn
  56. btnName="启用"
  57. message="确认启用当前服务工单吗?"
  58. idName="20230209144703"
  59. keyName="sa_workorderid"
  60. :id="$route.query.id"
  61. @onSuccess="queryMainData"
  62. class="inline-16"
  63. v-if="
  64. mainData.status == '暂停' && tool.checkAuth($route.name, 'used')
  65. "
  66. />
  67. <!-- <customBtn
  68. btnName="完结"
  69. message="确认完结当前服务工单吗?"
  70. idName="20230209144903"
  71. keyName="sa_workorderid"
  72. :id="$route.query.id"
  73. @onSuccess="queryMainData"
  74. class="inline-16"
  75. v-if="mainData.status != '新建' && tool.checkAuth($route.name,'complete')"
  76. /> -->
  77. <customBtn
  78. btnName="作废"
  79. message="确认作废当前服务工单吗?"
  80. idName="20230209144803"
  81. keyName="sa_workorderid"
  82. :id="$route.query.id"
  83. @onSuccess="queryMainData"
  84. class="inline-16"
  85. v-if="
  86. mainData.status != '完结' && tool.checkAuth($route.name, 'delete')
  87. "
  88. />
  89. </div>
  90. <div slot="slot0" v-if="mainData.actiontype == '工序模板'">
  91. <taskDetail :data="nodes">
  92. <template v-slot:detail="scope">
  93. <taskListDetail
  94. class="inline-16"
  95. :data="scope.data"
  96. ></taskListDetail>
  97. </template>
  98. <!-- <template v-slot:edit="scope">
  99. <taskListEdit class="inline-16" :data="scope.data"/>
  100. </template> -->
  101. </taskDetail>
  102. </div>
  103. <div slot="slot1" v-if="mainData.actiontype == '工序模板'">
  104. <checkBill ref="checkBillRef">
  105. <template v-slot:download="scope">
  106. <el-button
  107. v-if="tool.checkAuth($route.name, 'checkBillDetail')"
  108. type="text"
  109. size="mini"
  110. @click="downLoadBill(scope.data)"
  111. >{{ $t("单 据 下 载") }}</el-button
  112. >
  113. </template>
  114. </checkBill>
  115. </div>
  116. <div slot="slot2" v-if="mainData.actiontype == '工序模板'">
  117. <teamList
  118. v-if="tool.checkAuth($route.name, 'teamList')"
  119. ref="teamList"
  120. :data="mainData.team"
  121. >
  122. <selectTeam ref="team" @teamChange="teamChange" slot="add">
  123. <el-button
  124. v-if="tool.checkAuth($route.name, 'teamHandle')"
  125. class="button-new-tag"
  126. size="small"
  127. type="primary"
  128. @click="$refs.team.dialogFormVisible = true"
  129. >{{ $t("添 加") }}</el-button
  130. >
  131. </selectTeam>
  132. </teamList>
  133. </div>
  134. <div slot="slot3" v-if="mainData.actiontype == '工序模板'">
  135. <Items :data="mainData"></Items>
  136. </div>
  137. <div slot="slot4" v-if="mainData.actiontype == '工序模板'">
  138. <detailInfo :more="true" :data="detailInfo"></detailInfo>
  139. </div>
  140. <div slot="slot0" v-if="mainData.actiontype != '工序模板'">
  141. <Items :data="mainData"></Items>
  142. </div>
  143. <div slot="slot1" v-if="mainData.actiontype != '工序模板'">
  144. <checkBill>
  145. <template v-slot:download="scope">
  146. <el-button
  147. v-if="tool.checkAuth($route.name, 'checkBillDetail')"
  148. type="text"
  149. size="mini"
  150. @click="downLoadBill(scope.data)"
  151. >{{ $t("单 据 下 载") }}</el-button
  152. >
  153. </template>
  154. </checkBill>
  155. </div>
  156. <div slot="slot2" v-if="mainData.actiontype != '工序模板'">
  157. <teamList
  158. v-if="tool.checkAuth($route.name, 'teamList')"
  159. ref="teamList"
  160. :data="mainData.team"
  161. >
  162. <selectTeam ref="team" @teamChange="teamChange" slot="add">
  163. <el-button
  164. v-if="tool.checkAuth($route.name, 'teamHandle')"
  165. class="button-new-tag"
  166. size="small"
  167. type="primary"
  168. @click="$refs.team.dialogFormVisible = true"
  169. >{{ $t("添 加") }}</el-button
  170. >
  171. </selectTeam>
  172. </teamList>
  173. </div>
  174. <div slot="slot3" v-if="mainData.actiontype != '工序模板'">
  175. <detailInfo :more="true" :data="detailInfo"></detailInfo>
  176. </div>
  177. </basicDetails>
  178. </div>
  179. </template>
  180. <script>
  181. import detailInfo from "@/components/detailInfo/index";
  182. import taskDetail from "./taskDetail/index";
  183. import taskListDetail from "./taskDetail/taskListDetail";
  184. import taskListEdit from "./taskDetail/taskListEdit";
  185. import checkBill from "./checkBill/index";
  186. import teamList from "./teamList/index";
  187. import Items from "./items/index";
  188. import selectTeam from "../components/teamSelect";
  189. import { log } from "@antv/g2plot/lib/utils";
  190. export default {
  191. name: "detail",
  192. data() {
  193. return {
  194. mainData: "",
  195. mainAreaData: {},
  196. detailInfo: "",
  197. nodes: [],
  198. active_accoun:JSON.parse(sessionStorage.getItem('active_account')),
  199. folderid:JSON.parse(sessionStorage.getItem('folderid'))
  200. };
  201. },
  202. components: {
  203. detailInfo,
  204. taskDetail,
  205. taskListDetail,
  206. taskListEdit,
  207. checkBill,
  208. teamList,
  209. Items,
  210. selectTeam,
  211. },
  212. methods: {
  213. async queryMainData(id) {
  214. const res = await this.$api.requested({
  215. id: 20230208140103,
  216. content: {
  217. sa_workorderid: this.$route.query.id,
  218. },
  219. });
  220. this.mainData = res.data;
  221. this.changeDataStructure();
  222. console.log(res.data);
  223. this.nodes = this.createTreeData(res.data.nodes);
  224. console.log(this.nodes);
  225. },
  226. downLoadBill(data) {
  227. let result = data.attinfos.filter(
  228. (item) => item.usetype == "comfirmbill"
  229. );
  230. let http = location.href.substring(0,5) == 'https'?'https://oms.idcgroup.com.cn:8079/yosweb/#/printTable?':'http://61.164.207.46:8000/yosweb/#/printTable?'
  231. let token = 'token=' + this.active_accoun.token
  232. let parentid = '&parentid=' + this.folderid.appfolderid
  233. let ownerid = '&ownerid=' + data.sa_workorder_confirmationid
  234. let action = '&action=1'
  235. let urlNew = http + token + parentid + ownerid + action
  236. if (result.length == 0)
  237. window.open(urlNew);
  238. window.open(result[result.length - 1].url, "_self");
  239. this.$refs.checkBillRef.listData()
  240. },
  241. async teamChange(data) {
  242. let result = data.map((item) => {
  243. return item.userid;
  244. });
  245. const res = await this.$api.requested({
  246. id: 20220930103603,
  247. content: {
  248. ownertable: "sa_workorder",
  249. ownerid: this.$route.query.id,
  250. justuserids: false,
  251. userids: result,
  252. },
  253. });
  254. this.tool.showMessage(res, () => {
  255. this.$refs.team.dialogFormVisible = false;
  256. this.$refs.teamList.listData();
  257. });
  258. },
  259. changeDataStructure() {
  260. let that = this;
  261. this.mainAreaData = [
  262. {
  263. label: "单号",
  264. value: this.mainData.billno,
  265. },
  266. {
  267. label: "服务申请单号",
  268. value: this.mainData.servicebillno,
  269. },
  270. {
  271. label: "工单类型",
  272. value: this.mainData.type,
  273. },
  274. {
  275. label: "负责人",
  276. value: this.mainData.projectleader,
  277. },
  278. {
  279. label: "状态",
  280. value: this.$t(this.mainData.status),
  281. style: function () {
  282. let style = that.tool.getStatusColor(that.mainData.status);
  283. return style;
  284. },
  285. },
  286. {
  287. label: "企业编号",
  288. value: this.mainData.agentnum,
  289. },
  290. {
  291. label: "企业名称",
  292. value: this.mainData.enterprisename,
  293. },
  294. {
  295. label: "省市县",
  296. value:
  297. this.mainData.province + this.mainData.city + this.mainData.county,
  298. },
  299. {
  300. label: "业务员",
  301. value: this.mainData.saler_name,
  302. },
  303. {
  304. label: "业务员电话",
  305. value: this.mainData.salerphonenumber,
  306. },
  307. {
  308. label: "地址",
  309. value: this.mainData.address,
  310. },
  311. {
  312. label: "创建时间",
  313. value: this.mainData.createdate,
  314. },
  315. {
  316. label: "结束时间",
  317. value: this.mainData.enddate,
  318. },
  319. {
  320. label: "操作类型",
  321. value: this.mainData.actiontype,
  322. },
  323. ];
  324. this.detailInfo = [
  325. {
  326. title: "基本信息",
  327. info: [
  328. { label: "单号", value: this.mainData.billno },
  329. { label: "申请单号", value: this.mainData.servicebillno },
  330. {
  331. label: "状态",
  332. value: this.$t(this.mainData.status),
  333. style: function () {
  334. let style = that.tool.getStatusColor(that.mainData.status);
  335. return style;
  336. },
  337. },
  338. { label: "企业编号", value: this.mainData.agentnum },
  339. { label: "企业名称", value: this.mainData.enterprise },
  340. { label:'客诉大类', value: this.mainData.class2},
  341. { label:'申请原因', value: this.mainData.reason},
  342. { label: "服务联系人", value: this.mainData.scenecontact },
  343. {
  344. label: "联系人电话",
  345. value: this.mainData.scenecontactphonenumber,
  346. },
  347. { label: "工单负责人", value: this.mainData.projectleader },
  348. { label: "工单类型", value: this.mainData.type },
  349. { label: "工单模板", value: this.mainData.name },
  350. {
  351. label: "省市县",
  352. value: `${this.mainData.province}-${this.mainData.city}-${this.mainData.county}`,
  353. },
  354. { label: "地址", value: this.mainData.address },
  355. { label: "创建人", value: this.mainData.createby },
  356. { label: "创建时间", value: this.mainData.createdate },
  357. ],
  358. },
  359. ];
  360. },
  361. createTreeData(array) {
  362. var that = this;
  363. let arr = [];
  364. function convertToElementTree(node) {
  365. // 新节点
  366. var elNode = {
  367. amount: node["amount"],
  368. attinfos: node["attinfos"],
  369. changeby: node["changeby"],
  370. changedate: node["changedate"],
  371. changeuserid: node["changeuserid"],
  372. confirm_value: node["confirm_value"],
  373. finishby: node["finishby"],
  374. parentid: node["parentid"],
  375. remarks: node["remarks"],
  376. sa_workorder_nodeid: node["sa_workorder_nodeid"],
  377. sa_workorderid: node["sa_workorderid"],
  378. sequence: node["sequence"],
  379. status: node["status"],
  380. textcontent: node["textcontent"],
  381. workname: node["workpresetjson"].workname,
  382. additem: node["workpresetjson"].additem,
  383. addperson: node["workpresetjson"].amountpay,
  384. confirm_options: node["workpresetjson"].confirm_options,
  385. confirm: node["workpresetjson"].confirm,
  386. contractupload: node["workpresetjson"].contractupload,
  387. fileupload: node["workpresetjson"].fileupload,
  388. itemtype: node["workpresetjson"].itemtype,
  389. remarks: node["workpresetjson"].remarks,
  390. required: node["workpresetjson"].required,
  391. textedit: node["workpresetjson"].textedit,
  392. children: [],
  393. };
  394. if (node.child && node.child.length > 0) {
  395. // 如果存在子节点
  396. for (var index = 0; index < node.child.length; index++) {
  397. // 遍历子节点, 把每个子节点看做一颗独立的树, 传入递归构造子树, 并把结果放回到新node的children中
  398. elNode.children.push(convertToElementTree(node.child[index]));
  399. }
  400. }
  401. return elNode;
  402. }
  403. array.forEach((element) => {
  404. arr.push(convertToElementTree(element));
  405. });
  406. return arr;
  407. },
  408. // 监听切换数据,上一页,下一页
  409. pageChange(id, rowindex, tabIndex) {
  410. this.flag = false;
  411. tabIndex = this.$route.query.tabIndex;
  412. this.$router.replace({
  413. path: "/workorderDetail",
  414. query: { id: id, rowindex: rowindex, tabIndex: tabIndex },
  415. });
  416. this.queryMainData(id);
  417. },
  418. onSuccess() {
  419. this.visible = false;
  420. this.queryMainData(this.$route.query.id);
  421. this.$emit("onSuccess");
  422. },
  423. },
  424. mounted() {
  425. this.queryMainData(this.$route.query.id);
  426. },
  427. created() {},
  428. };
  429. </script>
  430. <style scoped>
  431. </style>