|
|
@@ -1,8 +1,8 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
- <el-tabs type="border-card" v-model="activeName" v-if="mainData.actiontype == '工序模板'">
|
|
|
+ <el-tabs type="border-card" v-model="activeName" v-if="internalData.actiontype == '工序模板'" @tab-click="handleClick">
|
|
|
<el-tab-pane label="工序详情" name="工序详情">
|
|
|
- <taskDetail :data="nodes">
|
|
|
+ <taskDetail :data="nodes" :nodesData="internalData" :newQuery="newQuery">
|
|
|
<template v-slot:detail="scope">
|
|
|
<taskListDetail
|
|
|
class="inline-16"
|
|
|
@@ -18,11 +18,12 @@
|
|
|
<materials :data="mainData"></materials>
|
|
|
</el-tab-pane>
|
|
|
<el-tab-pane label="服务确认单" name="服务确认单">
|
|
|
- <checkBill ref="checkBillRef" :mainData="mainData">
|
|
|
+ <checkBill ref="checkBillRef" :mainData="internalData" :sa_workorderid="mainData.sa_workorderid">
|
|
|
<template v-slot:download="scope">
|
|
|
<el-button
|
|
|
type="text"
|
|
|
size="mini"
|
|
|
+ class="inline-16"
|
|
|
@click="downLoadBill(scope.data)"
|
|
|
>{{ $t("单 据 下 载") }}</el-button
|
|
|
>
|
|
|
@@ -31,13 +32,13 @@
|
|
|
</el-tab-pane>
|
|
|
<el-tab-pane label="服务团队" name="服务团队">
|
|
|
<teamList
|
|
|
- v-if="tool.checkAuth($route.name, 'teamList')"
|
|
|
ref="teamList"
|
|
|
- :data="mainData.team"
|
|
|
+ :data="internalData.team"
|
|
|
+ :mainData="internalData"
|
|
|
>
|
|
|
<selectTeam ref="team" @teamChange="teamChange" slot="add">
|
|
|
<el-button
|
|
|
- v-if="(mainData.isServerMag || mainData.isleader) && mainData.status == '进行中'"
|
|
|
+ v-if="(internalData.isServerMag || internalData.isleader) && internalData.status == '进行中'"
|
|
|
class="button-new-tag"
|
|
|
size="small"
|
|
|
type="primary"
|
|
|
@@ -51,18 +52,19 @@
|
|
|
<detailInfo :more="true" :data="detailInfo"></detailInfo>
|
|
|
</el-tab-pane>
|
|
|
</el-tabs>
|
|
|
- <el-tabs type="border-card" v-model="activeName" v-else>
|
|
|
+ <el-tabs type="border-card" v-model="activeName" v-else @tab-click="handleClick">
|
|
|
<el-tab-pane label="服务商品" name="服务商品">
|
|
|
- <Items :data="mainData"></Items>
|
|
|
+ <Items :data="internalData" :sa_workorderid="newQuery?mainData.sa_workorderid:$route.query.id"></Items>
|
|
|
</el-tab-pane>
|
|
|
<el-tab-pane label="服务确认单" name="服务确认单">
|
|
|
- <checkBill ref="checkBillRef" :mainData="mainData">
|
|
|
+ <checkBill ref="checkBillRef" :mainData="internalData" :sa_workorderid="mainData.sa_workorderid">
|
|
|
<template v-slot:download="scope">
|
|
|
<el-button
|
|
|
type="text"
|
|
|
size="mini"
|
|
|
+ class="inline-16"
|
|
|
@click="downLoadBill(scope.data)"
|
|
|
- >{{ $t("单 据 下 载") }}</el-button
|
|
|
+ >{{ $t("单据下载") }}</el-button
|
|
|
>
|
|
|
</template>
|
|
|
</checkBill>
|
|
|
@@ -70,12 +72,12 @@
|
|
|
<el-tab-pane label="服务团队" name="服务团队">
|
|
|
<teamList
|
|
|
ref="teamList"
|
|
|
- :data="mainData.team"
|
|
|
- :mainData="mainData"
|
|
|
+ :data="internalData.team"
|
|
|
+ :mainData="internalData"
|
|
|
>
|
|
|
<selectTeam ref="team" @teamChange="teamChange" slot="add">
|
|
|
<el-button
|
|
|
- v-if="(mainData.isServerMag || mainData.isleader) && mainData.status == '进行中'"
|
|
|
+ v-if="(internalData.isServerMag || internalData.isleader) && internalData.status == '进行中'"
|
|
|
class="button-new-tag"
|
|
|
size="small"
|
|
|
type="primary"
|
|
|
@@ -104,22 +106,66 @@ import selectTeam from "../../components/teamSelect";
|
|
|
import materials from '../Materials/index'
|
|
|
export default {
|
|
|
name: "index",
|
|
|
- props:['mainData','nodes','team_name','team_phone_number'],
|
|
|
+ props:['mainData','nodes','team_name','team_phone_number','newQuery'],
|
|
|
components:{detailInfo,taskDetail,taskListDetail,taskListEdit,Items,checkBill,teamList,selectTeam,materials},
|
|
|
data(){
|
|
|
return {
|
|
|
activeName:'服务商品',
|
|
|
active_accoun:JSON.parse(sessionStorage.getItem('active_account')),
|
|
|
folderid:JSON.parse(sessionStorage.getItem('folderid')),
|
|
|
- internalData:{ ...this.mainData },
|
|
|
- detailInfo:{}
|
|
|
+ internalData:{ isServerMag:false,isleader:false },
|
|
|
+ detailInfo:{},
|
|
|
+ nodesNow:[]
|
|
|
}
|
|
|
},
|
|
|
methods:{
|
|
|
+ async queryMainData(id) {
|
|
|
+ console.log('输出mainData')
|
|
|
+ this.internalData.isServerMag = false
|
|
|
+ this.internalData.isleader = false
|
|
|
+ if (this.hrid !== 0){
|
|
|
+ const res_hrid = await this.$api.requested({
|
|
|
+ id:2025062416033402,
|
|
|
+ content: {
|
|
|
+ userid: this.userid,
|
|
|
+ sa_workorderid:this.mainData.sa_workorderid
|
|
|
+ },
|
|
|
+ })
|
|
|
+ if (res_hrid.data.isworkleader){
|
|
|
+ this.internalData.isServerMag = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ const res = await this.$api.requested({
|
|
|
+ id: 20230208140103,
|
|
|
+ content: {
|
|
|
+ sa_workorderid: this.mainData.sa_workorderid,
|
|
|
+ },
|
|
|
+ });
|
|
|
+ this.internalData = Object.assign({}, this.internalData, res.data);
|
|
|
+ console.log(this.internalData,'internalData3434')
|
|
|
+
|
|
|
+ if (res.data.length > 0){
|
|
|
+ res.data.team.forEach(item => {
|
|
|
+ if (item.isleader){
|
|
|
+ this.team_name = item.name
|
|
|
+ this.team_phone_number = item.phonenumber
|
|
|
+ this.team_userid = item.userid
|
|
|
+ if (item.userid == this.userid){
|
|
|
+ this.internalData.isleader = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ // this.nodes = this.createTreeData(res.data.nodes);
|
|
|
+ console.log(this.nodes,'nodes的数据1222')
|
|
|
+ }
|
|
|
+ this.changeDataStructure(this.internalData)
|
|
|
+ },
|
|
|
changeDataStructure(newData){
|
|
|
if (newData){
|
|
|
this.internalData = { ...newData }
|
|
|
}else {
|
|
|
+ console.log(this.nodes,'nodes的数据')
|
|
|
+ this.nodes = this.nodes
|
|
|
this.internalData = { ...this.mainData }
|
|
|
}
|
|
|
this.internalData.actiontype == '工序模板'?this.activeName = '工序详情' : this.activeName = '服务商品'
|
|
|
@@ -151,7 +197,7 @@ export default {
|
|
|
{ label: "项目名称", value: this.internalData.projectname},
|
|
|
{
|
|
|
label: "省市县",
|
|
|
- value: `${this.internalData.province}-${this.internalData.city}-${this.internalData.county}`,
|
|
|
+ value: this.internalData.province?`${this.internalData.province}-${this.internalData.city}-${this.internalData.county}`:'--',
|
|
|
},
|
|
|
{ label:'详细地址',value:this.internalData.address ? this.internalData.address : ''},
|
|
|
{ label: "现场联系人", value: this.internalData.scenecontact },
|
|
|
@@ -203,6 +249,53 @@ export default {
|
|
|
}
|
|
|
];
|
|
|
},
|
|
|
+ createTreeData(array) {
|
|
|
+ var that = this;
|
|
|
+ let arr = [];
|
|
|
+ function convertToElementTree(node) {
|
|
|
+ // 新节点
|
|
|
+ var elNode = {
|
|
|
+ amount: node["amount"],
|
|
|
+ attinfos: node["attinfos"],
|
|
|
+ changeby: node["changeby"],
|
|
|
+ changedate: node["changedate"],
|
|
|
+ changeuserid: node["changeuserid"],
|
|
|
+ confirm_value: node["confirm_value"],
|
|
|
+ finishby: node["finishby"],
|
|
|
+ parentid: node["parentid"],
|
|
|
+ sa_workorder_nodeid: node["sa_workorder_nodeid"],
|
|
|
+ sa_workorderid: node["sa_workorderid"],
|
|
|
+ sequence: node["sequence"],
|
|
|
+ status: node["status"],
|
|
|
+ textcontent: node["textcontent"],
|
|
|
+ workname: node["workpresetjson"].workname,
|
|
|
+ additem: node["workpresetjson"].additem,
|
|
|
+ addperson: node["workpresetjson"].amountpay,
|
|
|
+ confirm_options: node["workpresetjson"].confirm_options,
|
|
|
+ confirm: node["workpresetjson"].confirm,
|
|
|
+ contractupload: node["workpresetjson"].contractupload,
|
|
|
+ fileupload: node["workpresetjson"].fileupload,
|
|
|
+ itemtype: node["workpresetjson"].itemtype,
|
|
|
+ remarks: node["workpresetjson"].remarks,
|
|
|
+ required: node["workpresetjson"].required,
|
|
|
+ textedit: node["workpresetjson"].textedit,
|
|
|
+ children: [],
|
|
|
+ };
|
|
|
+
|
|
|
+ if (node.child && node.child.length > 0) {
|
|
|
+ // 如果存在子节点
|
|
|
+ for (var index = 0; index < node.child.length; index++) {
|
|
|
+ // 遍历子节点, 把每个子节点看做一颗独立的树, 传入递归构造子树, 并把结果放回到新node的children中
|
|
|
+ elNode.children.push(convertToElementTree(node.child[index]));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return elNode;
|
|
|
+ }
|
|
|
+ array.forEach((element) => {
|
|
|
+ arr.push(convertToElementTree(element));
|
|
|
+ });
|
|
|
+ return arr;
|
|
|
+ },
|
|
|
downLoadBill(data) {
|
|
|
let result = data.attinfos.filter(
|
|
|
(item) => item.usetype == "comfirmbill"
|
|
|
@@ -216,7 +309,7 @@ export default {
|
|
|
if (result.length == 0)
|
|
|
window.open(urlNew);
|
|
|
window.open(result[result.length - 1].url, "_self");
|
|
|
- this.$refs.checkBillRef.listData()
|
|
|
+ // this.$refs.checkBillRef.listData()
|
|
|
},
|
|
|
async teamChange(data) {
|
|
|
let result = data.map((item) => {
|
|
|
@@ -236,9 +329,24 @@ export default {
|
|
|
this.$refs.teamList.listData();
|
|
|
});
|
|
|
},
|
|
|
+ handleClick(){
|
|
|
+ console.log(this.internalData,'输出internalData')
|
|
|
+ if (this.activeName == '服务确认单'){
|
|
|
+ let id = this.internalData.sa_workorderid ? this.internalData.sa_workorderid : -1
|
|
|
+ this.$refs.checkBillRef.listData(id)
|
|
|
+ }else if (this.activeName == '服务团队'){
|
|
|
+ let id = this.internalData.sa_workorderid ? this.internalData.sa_workorderid : -1
|
|
|
+ this.$refs.teamList.listData(id)
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
mounted() {
|
|
|
- this.changeDataStructure()
|
|
|
+ if (this.newQuery){
|
|
|
+ this.queryMainData()
|
|
|
+ }else {
|
|
|
+
|
|
|
+ this.changeDataStructure()
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
}
|