chuangjianzirenwu

This commit is contained in:
shilixia 2021-04-13 17:03:28 +08:00
parent a3e0a0a772
commit 5df8ebc4f0
3 changed files with 85 additions and 79 deletions

View File

@ -2,7 +2,7 @@
ENV = 'development' ENV = 'development'
# base api # 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, # vue-cli uses the VUE_CLI_BABEL_TRANSPILE_MODULES environment variable,
# to control whether the babel-plugin-dynamic-import-node plugin is enabled. # to control whether the babel-plugin-dynamic-import-node plugin is enabled.

View File

@ -150,24 +150,60 @@
<el-input v-model="inspecttask.name" placeholder="子任务名" /> <el-input v-model="inspecttask.name" placeholder="子任务名" />
</el-form-item> </el-form-item>
<el-form-item label="选择组长" prop="leader"> <el-form-item label="选择组长" prop="leader">
<el-cascader <el-select
v-model="inspecttask.leader" v-model="inspecttask.leader"
:options="typeOptions" multiple
:props="{ emitPath: false }" filterable
clearable style="width: 100%"
style="width: 100%" allow-create
></el-cascader> 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>
<el-form-item label="选择组员" prop="member"> <el-form-item label="选择组员" prop="member">
<el-input v-model="inspecttask.member" placeholder="选择组员" > <el-select
<el-button icon="el-icon-search" slot="append" @click="Createmember"></el-button> v-model="inspecttask.member"
</el-input> 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>
<el-form-item label="选择组织" prop="leader"> <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-select
</el-input> 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-item>
</el-form> </el-form>
@ -176,24 +212,7 @@
<el-button type="primary" @click="confirm('Form')">确认</el-button> <el-button type="primary" @click="confirm('Form')">确认</el-button>
</div> </div>
</el-dialog> </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> </div>
</template> </template>
<style > <style >
@ -215,33 +234,31 @@
} }
</style> </style>
<script> <script>
import { getinspecttask, initinspecttask, appendinspecttask } from "@/api/inspectTask"; import { getinspecttask, createinspecttask } from "@/api/inspectTask";
import orginit from "@/views/qualityinspect/orginit"; import { getUserList } from "@/api/user";
import leaderinit from "@/views/qualityinspect/leaderinit"; import { getOrgList } from "@/api/org";
import {
getUserList
} from "@/api/user";
import { genTree } from "@/utils"; import { genTree } from "@/utils";
import Pagination from "@/components/Pagination"; import Pagination from "@/components/Pagination";
import checkPermission from "@/utils/permission"; import checkPermission from "@/utils/permission";
const defaulttask = { const defaulttask = {
name: "", name: "",
leader:"",
member:"",
dept:"",
}; };
export default { export default {
components: { Pagination,orginit,leaderinit}, components: { Pagination},
data() { data() {
return { return {
task: { id: 0 }, task: { id: 0 },
dialogVisibles: false,
dialogVisibless: false,
inspecttask: defaulttask, inspecttask: defaulttask,
dialogVisible: false, dialogVisible: false,
listLoading: true, listLoading: true,
typeOptions:[], leaderOptions:[],
memberOptions:[],
deptOptions:[],
dialogVisible: false, dialogVisible: false,
dialogType: "new", dialogType: "new",
data: {}, data: {},
@ -250,32 +267,39 @@ export default {
}, },
created() { created() {
this.task.id = this.$route.params.id; this.task.id = this.$route.params.id;
this.getinspecttask(); this.getinspecttask();//主任务信息
this.getTypeAll(); this.getTypeAll();//组长
this.getUserList();//组员
this.getOrgList();//组织
}, },
methods: { methods: {
checkPermission, checkPermission,
//主任务信息展示
getinspecttask() { getinspecttask() {
getinspecttask(this.task.id).then((res) => { getinspecttask(this.task.id).then((res) => {
this.task = res.data; this.task = res.data;
}); });
}, },
//组长列表
getTypeAll() { getTypeAll() {
getUserList().then((res) => { getUserList({pageoff:true}).then((res) => {
this.typeOptions = genTree(res.data.results); 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() { handleCreate() {
this.inspecttask = Object.assign({}, defaulttask); this.inspecttask = Object.assign({}, defaulttask);
this.dialogType = "new"; this.dialogType = "new";
@ -285,31 +309,13 @@ export default {
}); });
}, },
async confirm(form) { async confirm(form) {
this.$refs[form].validate((valid) => { //创建子任务
if (valid) { createinspecttask(this.deptOptions).then((res) => {
const isEdit = this.dialogType === "edit";
if (isEdit) {
updateinspecttask(this.inspecttask.id, this.inspecttask).then((res) => {
if (res.code >= 200) { if (res.code >= 200) {
this.getList();
this.dialogVisible = false; this.dialogVisible = false;
this.$message.success("成功"); 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;
}
});
}, },
}, },
}; };

View File

@ -43,8 +43,8 @@ export default {
}, },
methods: { methods: {
getUserList() { getUserList() {
getUserList().then((res) => { getUserList({pageoff:true}).then((res) => {
this.userOptions = res.data.results; this.userOptions = res.data;
}); });
}, },
confirm(){ confirm(){