Merge branch 'master' of http://gitea.xxhhcty.xyz:8080/zcdsj/factory_web
This commit is contained in:
commit
d26c8d776d
|
|
@ -1,6 +1,38 @@
|
||||||
import config from "@/config"
|
import config from "@/config"
|
||||||
import http from "@/utils/request"
|
import http from "@/utils/request"
|
||||||
export default {
|
export default {
|
||||||
|
warehouse: {
|
||||||
|
list: {
|
||||||
|
name: "库房列表",
|
||||||
|
req: async function(data){
|
||||||
|
return await http.get(`${config.API_URL}/mpr/warehouse/`, data);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
create: {
|
||||||
|
name: "创建库房",
|
||||||
|
req: async function(data){
|
||||||
|
return await http.post(`${config.API_URL}/mpr/warehouse/`, data);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
item: {
|
||||||
|
name: "获取库房详情",
|
||||||
|
req: async function(id){
|
||||||
|
return await http.get(`${config.API_URL}/mpr/warehouse/${id}/`);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
update: {
|
||||||
|
name: "更新库房",
|
||||||
|
req: async function(id, data){
|
||||||
|
return await http.put(`${config.API_URL}/mpr/warehouse/${id}/`, data);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
delete: {
|
||||||
|
name: "删除库房",
|
||||||
|
req: async function(id){
|
||||||
|
return await http.delete(`${config.API_URL}/mpr/warehouse/${id}/`);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
requisition: {
|
requisition: {
|
||||||
list: {
|
list: {
|
||||||
name: "申购单列表",
|
name: "申购单列表",
|
||||||
|
|
|
||||||
|
|
@ -2102,6 +2102,15 @@ const routes = [
|
||||||
perms: ["mpr"],
|
perms: ["mpr"],
|
||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
|
{
|
||||||
|
name: "mpr_warehouse",
|
||||||
|
path: "/mpr/warehouse",
|
||||||
|
meta: {
|
||||||
|
title: "库房管理",
|
||||||
|
perms: ["mpr_warehouse"],
|
||||||
|
},
|
||||||
|
component: "mpr/warehouse",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "requisition",
|
name: "requisition",
|
||||||
path: "/mpr/requisition",
|
path: "/mpr/requisition",
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -9,7 +9,9 @@
|
||||||
<el-main class="nopadding">
|
<el-main class="nopadding">
|
||||||
<scTable ref="table" :apiObj="API.hrm.empjoin.list" row-key="id" stripe
|
<scTable ref="table" :apiObj="API.hrm.empjoin.list" row-key="id" stripe
|
||||||
@row-click="(row)=>{t_id=row.id;mode='show';drawerVisible=true;}">
|
@row-click="(row)=>{t_id=row.id;mode='show';drawerVisible=true;}">
|
||||||
<el-table-column label="部门" prop="dept_need_name" min-width="100" show-overflow-tooltip></el-table-column>
|
<el-table-column label="部门" min-width="100" show-overflow-tooltip>
|
||||||
|
<template #default="scope">{{ deptMap[scope.row.dept_need] || '' }}</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column label="入职日期" prop="join_date" min-width="100" show-overflow-tooltip></el-table-column>
|
<el-table-column label="入职日期" prop="join_date" min-width="100" show-overflow-tooltip></el-table-column>
|
||||||
<el-table-column label="审批状态" min-width="180">
|
<el-table-column label="审批状态" min-width="180">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
|
|
@ -25,7 +27,7 @@
|
||||||
</el-drawer>
|
</el-drawer>
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from 'vue'
|
import { ref, onMounted } from 'vue'
|
||||||
import API from '@/api'
|
import API from '@/api'
|
||||||
import empjoin_form from './empjoin_form.vue'
|
import empjoin_form from './empjoin_form.vue'
|
||||||
import ExportBtn from '@/components/scExportBtn/index.vue'
|
import ExportBtn from '@/components/scExportBtn/index.vue'
|
||||||
|
|
@ -33,9 +35,15 @@ import { actStateEnum } from "@/utils/enum.js"
|
||||||
const drawerVisible = ref(false)
|
const drawerVisible = ref(false)
|
||||||
const mode = ref('add')
|
const mode = ref('add')
|
||||||
const t_id = ref(null)
|
const t_id = ref(null)
|
||||||
|
const deptMap = ref({})
|
||||||
const handleAdd = () => { mode.value = 'add'; t_id.value = null; drawerVisible.value = true; }
|
const handleAdd = () => { mode.value = 'add'; t_id.value = null; drawerVisible.value = true; }
|
||||||
|
onMounted(async () => {
|
||||||
|
const res = await API.system.dept.list.req({ page: 0 })
|
||||||
|
const list = Array.isArray(res) ? res : (res.results || res.data || [])
|
||||||
|
list.forEach(d => { deptMap.value[d.id] = d.name })
|
||||||
|
})
|
||||||
const exportCols = [
|
const exportCols = [
|
||||||
{ header: "部门", key: "dept_need_name", wch: 15 },
|
{ header: "部门", key: "_dept_name", wch: 15 },
|
||||||
{ header: "入职日期", key: "join_date", wch: 12 },
|
{ header: "入职日期", key: "join_date", wch: 12 },
|
||||||
{ header: "审批状态", key: "_act_state_text", wch: 10 },
|
{ header: "审批状态", key: "_act_state_text", wch: 10 },
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -202,6 +202,18 @@ export default {
|
||||||
async getTid() {
|
async getTid() {
|
||||||
try {
|
try {
|
||||||
let res = await this.$API.hrm.empjoin.item.req(this.t_id);
|
let res = await this.$API.hrm.empjoin.item.req(this.t_id);
|
||||||
|
// 获取岗位列表,填充 post_name
|
||||||
|
if (res.person && res.person.length > 0) {
|
||||||
|
const postRes = await this.$API.system.post.list.req({ page: 0 });
|
||||||
|
const postList = Array.isArray(postRes) ? postRes : (postRes.results || postRes.data || []);
|
||||||
|
const postMap = {};
|
||||||
|
postList.forEach(p => { postMap[p.id] = p.name; });
|
||||||
|
res.person.forEach(p => {
|
||||||
|
if (p.post && !p.post_name) {
|
||||||
|
p.post_name = postMap[p.post] || '';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
this.formData = res;
|
this.formData = res;
|
||||||
if (res.ticket_ && res.ticket_.state_.type == 1 && res.create_by == this.$TOOL.data.get("USER_INFO").id) {
|
if (res.ticket_ && res.ticket_.state_.type == 1 && res.create_by == this.$TOOL.data.get("USER_INFO").id) {
|
||||||
this.localMode = "edit";
|
this.localMode = "edit";
|
||||||
|
|
|
||||||
|
|
@ -130,7 +130,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style="text-align: right; margin-top: 15px; font-size: 14px;">
|
<div style="text-align: right; margin-top: 15px; font-size: 14px;">
|
||||||
<span style="margin-right: 30px;">部门负责人:___________</span>
|
<span style="margin-right: 30px;">部门负责人:{{ deptHeadName || '___________' }}</span>
|
||||||
<span>领取人:{{ formData.collector || '___________' }}</span>
|
<span>领取人:{{ formData.collector || '___________' }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -212,6 +212,7 @@ export default {
|
||||||
stockSearch: '',
|
stockSearch: '',
|
||||||
stockList: [],
|
stockList: [],
|
||||||
selectedStocks: [],
|
selectedStocks: [],
|
||||||
|
deptHeadName: '',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
@ -241,6 +242,21 @@ export default {
|
||||||
if (res.ticket_ && res.ticket_.state_.type === 1 && res.create_by === this.currentUser.id) {
|
if (res.ticket_ && res.ticket_.state_.type === 1 && res.create_by === this.currentUser.id) {
|
||||||
this.localMode = 'edit'
|
this.localMode = 'edit'
|
||||||
}
|
}
|
||||||
|
// 从审批流程日志中获取部门负责人(非"开始"和"结束"状态的审批人)
|
||||||
|
if (res.ticket_ && res.ticket_.id) {
|
||||||
|
try {
|
||||||
|
const logs = await this.$API.wf.ticket.ticketFlowlogs.req(res.ticket_.id)
|
||||||
|
const approveLog = logs.find(log =>
|
||||||
|
log.state_?.name !== '开始' &&
|
||||||
|
log.state_?.name !== '结束' &&
|
||||||
|
log.transition_?.attribute_type === 1 &&
|
||||||
|
log.participant_
|
||||||
|
)
|
||||||
|
if (approveLog) {
|
||||||
|
this.deptHeadName = approveLog.participant_.name
|
||||||
|
}
|
||||||
|
} catch (e) {}
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.$message.error('加载失败')
|
this.$message.error('加载失败')
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,82 @@
|
||||||
|
<template>
|
||||||
|
<el-container>
|
||||||
|
<el-header>
|
||||||
|
<div class="left-panel">
|
||||||
|
<el-button type="primary" icon="el-icon-plus" @click="add" v-auth="'warehouse.create'">新增</el-button>
|
||||||
|
</div>
|
||||||
|
</el-header>
|
||||||
|
<el-main class="nopadding">
|
||||||
|
<scTable ref="table" :apiObj="apiObj" row-key="id" stripe :params="query">
|
||||||
|
<el-table-column type="index" width="50" />
|
||||||
|
<el-table-column label="库房名称" prop="name" show-overflow-tooltip>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="库房编号" prop="number">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="库房地点" prop="place">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="创建时间" prop="create_time" show-overflow-tooltip>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" fixed="right" align="center" width="150px">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button link type="primary" @click="table_edit(scope.row)" v-auth="'warehouse.update'">
|
||||||
|
编辑
|
||||||
|
</el-button>
|
||||||
|
<el-button link type="danger" @click="table_del(scope.row)" v-auth="'warehouse.delete'">
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</scTable>
|
||||||
|
</el-main>
|
||||||
|
</el-container>
|
||||||
|
<save-dialog v-if="dialog.save" ref="saveDialog" @success="handleSaveSuccess"
|
||||||
|
@closed="dialog.save = false"></save-dialog>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import saveDialog from "./warehouse_form2.vue";
|
||||||
|
export default {
|
||||||
|
name: "mprWarehouse",
|
||||||
|
components: {
|
||||||
|
saveDialog,
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
dialog: {
|
||||||
|
save: false,
|
||||||
|
},
|
||||||
|
apiObj: this.$API.mpr.warehouse.list,
|
||||||
|
query: {
|
||||||
|
page: 1,
|
||||||
|
page_size: 20,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
add() {
|
||||||
|
this.dialog.save = true;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.saveDialog.open("add");
|
||||||
|
});
|
||||||
|
},
|
||||||
|
table_edit(row) {
|
||||||
|
this.dialog.save = true;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.saveDialog.open("edit").setData(row);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
table_del(row) {
|
||||||
|
this.$confirm(`确定删除吗?`, "提示", {
|
||||||
|
type: "warning",
|
||||||
|
}).then(() => {
|
||||||
|
this.$API.mpr.warehouse.delete.req(row.id).then(() => {
|
||||||
|
this.$message.success("删除成功");
|
||||||
|
this.$refs.table.refresh();
|
||||||
|
});
|
||||||
|
}).catch(() => { });
|
||||||
|
},
|
||||||
|
handleSaveSuccess(data, mode) {
|
||||||
|
this.$refs.table.refresh();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
@ -85,7 +85,7 @@ const t_id = ref(null)
|
||||||
const warehouseOptions = ref([])
|
const warehouseOptions = ref([])
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
let res = await API.inm.warehouse.list.req({ page: 0 })
|
let res = await API.mpr.warehouse.list.req({ page: 0 })
|
||||||
warehouseOptions.value = res
|
warehouseOptions.value = res
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -192,7 +192,7 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async mounted() {
|
async mounted() {
|
||||||
let res = await this.$API.inm.warehouse.list.req({ page: 0 })
|
let res = await this.$API.mpr.warehouse.list.req({ page: 0 })
|
||||||
this.warehouseOptions = res
|
this.warehouseOptions = res
|
||||||
if (this.t_id) {
|
if (this.t_id) {
|
||||||
this.loadData()
|
this.loadData()
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,96 @@
|
||||||
|
<template>
|
||||||
|
<el-dialog
|
||||||
|
:title="titleMap[mode]"
|
||||||
|
v-model="visible"
|
||||||
|
:size="1000"
|
||||||
|
destroy-on-close
|
||||||
|
@closed="$emit('closed')"
|
||||||
|
>
|
||||||
|
<el-container v-loading="loading">
|
||||||
|
<el-main style="padding: 0 20px 20px 20px">
|
||||||
|
<el-form
|
||||||
|
ref="dialogForm"
|
||||||
|
:model="form"
|
||||||
|
:rules="rules"
|
||||||
|
label-width="100px"
|
||||||
|
>
|
||||||
|
<el-row>
|
||||||
|
<el-col :md="12" :sm="24">
|
||||||
|
<el-form-item label="库房名称" prop="name">
|
||||||
|
<el-input v-model="form.name" placeholder="库房名称"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :md="12" :sm="24">
|
||||||
|
<el-form-item label="库房编号" prop="number">
|
||||||
|
<el-input v-model="form.number" placeholder="库房编号"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :md="12" :sm="24">
|
||||||
|
<el-form-item label="库房地点" prop="place">
|
||||||
|
<el-input v-model="form.place" placeholder="库房地点"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
</el-main>
|
||||||
|
<el-footer>
|
||||||
|
<el-button type="primary" :loading="isSaveing" @click="submit">保存</el-button>
|
||||||
|
<el-button @click="visible = false">取消</el-button>
|
||||||
|
</el-footer>
|
||||||
|
</el-container>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
emits: ["success", "closed"],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
loading: false,
|
||||||
|
mode: "add",
|
||||||
|
titleMap: {
|
||||||
|
add: "新增库房",
|
||||||
|
edit: "编辑库房",
|
||||||
|
},
|
||||||
|
form: {},
|
||||||
|
rules: {
|
||||||
|
name: [{required: true, message: "请输入库房名称", trigger: "blur"}],
|
||||||
|
number: [{required: true, message: "请输入库房编号", trigger: "blur"}],
|
||||||
|
place: [{required: true, message: "请输入库房地点", trigger: "blur"}],
|
||||||
|
},
|
||||||
|
visible: false,
|
||||||
|
isSaveing: false,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
open(mode = "add") {
|
||||||
|
this.mode = mode;
|
||||||
|
this.visible = true;
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
submit() {
|
||||||
|
this.$refs.dialogForm.validate(async (valid) => {
|
||||||
|
if (valid) {
|
||||||
|
this.isSaveing = true;
|
||||||
|
try {
|
||||||
|
if (this.mode == "add") {
|
||||||
|
await this.$API.mpr.warehouse.create.req(this.form);
|
||||||
|
} else if (this.mode == "edit") {
|
||||||
|
await this.$API.mpr.warehouse.update.req(this.form.id, this.form);
|
||||||
|
}
|
||||||
|
this.isSaveing = false;
|
||||||
|
this.$emit("success", this.form, this.mode);
|
||||||
|
this.visible = false;
|
||||||
|
this.$message.success("操作成功");
|
||||||
|
} catch (err) {
|
||||||
|
this.isSaveing = false;
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
setData(data) {
|
||||||
|
Object.assign(this.form, data);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
@ -91,7 +91,7 @@ const dateRange = ref(null)
|
||||||
const warehouseOptions = ref([])
|
const warehouseOptions = ref([])
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
let res = await API.inm.warehouse.list.req({ page: 0 })
|
let res = await API.mpr.warehouse.list.req({ page: 0 })
|
||||||
warehouseOptions.value = res
|
warehouseOptions.value = res
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -134,17 +134,31 @@ export default {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
handleSave() {
|
handleSave() {
|
||||||
|
// 过滤掉 _ 后缀的对象字段,只发送后端需要的数据
|
||||||
|
let data = {};
|
||||||
|
for (let key in this.formData) {
|
||||||
|
if (!key.endsWith('_')) {
|
||||||
|
data[key] = this.formData[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
if (this.localMode == "add") {
|
if (this.localMode == "add") {
|
||||||
this.saveLoading = true;
|
this.saveLoading = true;
|
||||||
this.$API.pum.supplieraudit.create.req(this.formData).then(res=>{
|
this.$API.pum.supplieraudit.create.req(data).then(res=>{
|
||||||
this.saveLoading = true;
|
this.saveLoading = false;
|
||||||
this.$message.success("提交成功");
|
this.$message.success("提交成功");
|
||||||
this.$emit('success', this.localMode);
|
this.$emit('success', this.localMode);
|
||||||
}).catch(e=>{
|
}).catch(e=>{
|
||||||
this.saveLoading = false;
|
this.saveLoading = false;
|
||||||
})
|
})
|
||||||
} else if (this.localMode == "edit") {
|
} else if (this.localMode == "edit") {
|
||||||
this.$message.error("不支持编辑!")
|
this.saveLoading = true;
|
||||||
|
this.$API.pum.supplieraudit.update.req(this.formData.id, data).then(res=>{
|
||||||
|
this.saveLoading = false;
|
||||||
|
this.$message.success("更新成功");
|
||||||
|
this.$emit('success', this.localMode);
|
||||||
|
}).catch(e=>{
|
||||||
|
this.saveLoading = false;
|
||||||
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue