chuangjianzirenwu
This commit is contained in:
parent
a3e0a0a772
commit
5df8ebc4f0
|
@ -2,7 +2,7 @@
|
|||
ENV = 'development'
|
||||
|
||||
# base api
|
||||
VUE_APP_BASE_API = 'http://localhost:8000/api'
|
||||
VUE_APP_BASE_API = 'http://10.0.11.127:8000/api'
|
||||
|
||||
# vue-cli uses the VUE_CLI_BABEL_TRANSPILE_MODULES environment variable,
|
||||
# to control whether the babel-plugin-dynamic-import-node plugin is enabled.
|
||||
|
|
|
@ -150,24 +150,60 @@
|
|||
<el-input v-model="inspecttask.name" placeholder="子任务名" />
|
||||
</el-form-item>
|
||||
<el-form-item label="选择组长" prop="leader">
|
||||
<el-cascader
|
||||
v-model="inspecttask.leader"
|
||||
:options="typeOptions"
|
||||
:props="{ emitPath: false }"
|
||||
clearable
|
||||
style="width: 100%"
|
||||
></el-cascader>
|
||||
<el-select
|
||||
v-model="inspecttask.leader"
|
||||
multiple
|
||||
filterable
|
||||
style="width: 100%"
|
||||
allow-create
|
||||
default-first-option
|
||||
placeholder="请选择组长">
|
||||
<el-option
|
||||
v-for="item in leaderOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
|
||||
|
||||
</el-form-item>
|
||||
<el-form-item label="选择组员" prop="member">
|
||||
<el-input v-model="inspecttask.member" placeholder="选择组员" >
|
||||
<el-button icon="el-icon-search" slot="append" @click="Createmember"></el-button>
|
||||
</el-input>
|
||||
<el-select
|
||||
v-model="inspecttask.member"
|
||||
multiple
|
||||
filterable
|
||||
style="width: 100%"
|
||||
allow-create
|
||||
default-first-option
|
||||
placeholder="请选择组员">
|
||||
<el-option
|
||||
v-for="item in memberOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
|
||||
|
||||
</el-form-item>
|
||||
<el-form-item label="选择组织" prop="leader">
|
||||
<el-input v-model="inspecttask.leader" placeholder="选择组织" >
|
||||
<el-button icon="el-icon-search" slot="append" @click="CreatOrg"></el-button>
|
||||
</el-input>
|
||||
|
||||
<el-select
|
||||
v-model="inspecttask.dept"
|
||||
multiple
|
||||
filterable
|
||||
style="width: 100%"
|
||||
allow-create
|
||||
default-first-option
|
||||
placeholder="请选择组织">
|
||||
<el-option
|
||||
v-for="item in deptOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
|
@ -176,24 +212,7 @@
|
|||
<el-button type="primary" @click="confirm('Form')">确认</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<!--组织弹框-->
|
||||
<el-dialog
|
||||
:visible.sync="dialogVisibles"
|
||||
:title="选择组织"
|
||||
:close-on-click-modal="false"
|
||||
width="70%"
|
||||
>
|
||||
<orginit ref="leaderinit" @handleChose="chooseComplete" ></orginit>
|
||||
</el-dialog>
|
||||
<!--人员弹框-->
|
||||
<el-dialog
|
||||
:visible.sync="dialogVisibless"
|
||||
:title="选择组织"
|
||||
:close-on-click-modal="false"
|
||||
width="70%"
|
||||
>
|
||||
<leaderinit ref="leaderinit" @handleChose="chooseComplete" ></leaderinit>
|
||||
</el-dialog>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
<style >
|
||||
|
@ -215,33 +234,31 @@
|
|||
}
|
||||
</style>
|
||||
<script>
|
||||
import { getinspecttask, initinspecttask, appendinspecttask } from "@/api/inspectTask";
|
||||
import orginit from "@/views/qualityinspect/orginit";
|
||||
import leaderinit from "@/views/qualityinspect/leaderinit";
|
||||
import {
|
||||
getUserList
|
||||
} from "@/api/user";
|
||||
|
||||
import { getinspecttask, createinspecttask } from "@/api/inspectTask";
|
||||
import { getUserList } from "@/api/user";
|
||||
import { getOrgList } from "@/api/org";
|
||||
import { genTree } from "@/utils";
|
||||
import Pagination from "@/components/Pagination";
|
||||
import checkPermission from "@/utils/permission";
|
||||
|
||||
const defaulttask = {
|
||||
name: "",
|
||||
leader:"",
|
||||
member:"",
|
||||
dept:"",
|
||||
};
|
||||
export default {
|
||||
components: { Pagination,orginit,leaderinit},
|
||||
components: { Pagination},
|
||||
|
||||
data() {
|
||||
return {
|
||||
task: { id: 0 },
|
||||
|
||||
dialogVisibles: false,
|
||||
dialogVisibless: false,
|
||||
inspecttask: defaulttask,
|
||||
dialogVisible: false,
|
||||
listLoading: true,
|
||||
typeOptions:[],
|
||||
leaderOptions:[],
|
||||
memberOptions:[],
|
||||
deptOptions:[],
|
||||
dialogVisible: false,
|
||||
dialogType: "new",
|
||||
data: {},
|
||||
|
@ -250,32 +267,39 @@ export default {
|
|||
},
|
||||
created() {
|
||||
this.task.id = this.$route.params.id;
|
||||
this.getinspecttask();
|
||||
this.getTypeAll();
|
||||
this.getinspecttask();//主任务信息
|
||||
this.getTypeAll();//组长
|
||||
this.getUserList();//组员
|
||||
this.getOrgList();//组织
|
||||
},
|
||||
methods: {
|
||||
checkPermission,
|
||||
//主任务信息展示
|
||||
getinspecttask() {
|
||||
getinspecttask(this.task.id).then((res) => {
|
||||
this.task = res.data;
|
||||
|
||||
});
|
||||
},
|
||||
//组长列表
|
||||
getTypeAll() {
|
||||
getUserList().then((res) => {
|
||||
this.typeOptions = genTree(res.data.results);
|
||||
getUserList({pageoff:true}).then((res) => {
|
||||
this.leaderOptions = genTree(res.data);
|
||||
});
|
||||
},
|
||||
//组员列表
|
||||
getUserList() {
|
||||
getUserList({pageoff:true}).then((res) => {
|
||||
this.memberOptions = genTree(res.data);
|
||||
});
|
||||
},
|
||||
//组织列表
|
||||
getOrgList() {
|
||||
getOrgList({can_supervision:true}).then((res) => {
|
||||
this.deptOptions = genTree(res.data);
|
||||
});
|
||||
},
|
||||
|
||||
Createmember()
|
||||
{
|
||||
|
||||
this.dialogVisibless = true;
|
||||
},
|
||||
CreatOrg()
|
||||
{
|
||||
this.dialogVisibles = true;
|
||||
},
|
||||
handleCreate() {
|
||||
this.inspecttask = Object.assign({}, defaulttask);
|
||||
this.dialogType = "new";
|
||||
|
@ -285,31 +309,13 @@ export default {
|
|||
});
|
||||
},
|
||||
async confirm(form) {
|
||||
this.$refs[form].validate((valid) => {
|
||||
if (valid) {
|
||||
const isEdit = this.dialogType === "edit";
|
||||
if (isEdit) {
|
||||
updateinspecttask(this.inspecttask.id, this.inspecttask).then((res) => {
|
||||
//创建子任务
|
||||
createinspecttask(this.deptOptions).then((res) => {
|
||||
if (res.code >= 200) {
|
||||
this.getList();
|
||||
this.dialogVisible = false;
|
||||
this.$message.success("成功");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
createinspecttask(this.inspecttask).then((res) => {
|
||||
if (res.code >= 200) {
|
||||
this.getList();
|
||||
this.dialogVisible = false;
|
||||
// this.$router.push({name: "Taskdo", params: { id: res.data.id }, })
|
||||
this.$message.success("成功");
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
|
@ -43,8 +43,8 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
getUserList() {
|
||||
getUserList().then((res) => {
|
||||
this.userOptions = res.data.results;
|
||||
getUserList({pageoff:true}).then((res) => {
|
||||
this.userOptions = res.data;
|
||||
});
|
||||
},
|
||||
confirm(){
|
||||
|
|
Loading…
Reference in New Issue