xy 2 years ago
parent 95f2e1ba8a
commit 47b49c9bd9

@ -15,11 +15,12 @@ export function listdept() {
}) })
} }
export function listdeptNoAuth(params = {show_tree:1}){ export function listdeptNoAuth(params = {show_tree:1},noloading){
return request({ return request({
url:'/api/admin/other/admin-department-list', url:'/api/admin/other/admin-department-list',
method:'get', method:'get',
params params,
noloading: true
}) })
} }

@ -8,14 +8,52 @@
<div style="padding: 20px"> <div style="padding: 20px">
<div v-show="step === 1"> <div v-show="step === 1">
<Input <div style="display: flex;justify-content: space-between;align-items: center;">
v-model="planSelect.name" <DatePicker
search :value="planSelect.year"
enter-button="搜 索" placeholder="选择所属年份"
clearable placement="bottom"
placeholder="搜索预算计划.." style="width: 180px;margin-right: 10px;"
@on-search="getBudgets" type="year"
/> @on-change="(e) => (planSelect.year = e)"
></DatePicker>
<el-select
placeholder="科室选择"
clearable
size="small"
v-model="planSelect.plan_department_id"
style="width: 180px;margin-right: 10px;"
>
<el-option
v-for="item in departments"
:label="item.name"
:value="item.id"
:key="item.id"
>
</el-option>
</el-select>
<el-cascader
:options="planTypes"
:props="{
checkStrictly: false,
label: 'name',
value: 'id',
}"
:value="planSelect.type"
clearable
size="small"
style="width: 180px;margin-right: 10px;"
@change="(e) => (planSelect.type = e[e.length - 1] || '')"
/>
<Input
v-model="planSelect.name"
search
enter-button="搜 索"
clearable
placeholder="搜索预算计划.."
@on-search="getBudgets"
/>
</div>
<xy-table <xy-table
:list="plans" :list="plans"
@ -211,7 +249,7 @@
style="width: 100%" style="width: 100%"
> >
<el-option <el-option
v-for="item in purchaseWay" v-for="item in purchaseWayFormat()"
:label="item.value" :label="item.value"
:value="item.id" :value="item.id"
></el-option> ></el-option>
@ -761,7 +799,7 @@
</template> </template>
<script> <script>
import { getparameter } from "@/api/system/dictionary"; import { getparameter, getparameterTree } from '@/api/system/dictionary'
import { import {
addContrant, addContrant,
editorContract, editorContract,
@ -772,9 +810,16 @@ import {
import { getBudget } from "@/api/budget/budget"; import { getBudget } from "@/api/budget/budget";
import { getInfo } from "@/api/user.js"; import { getInfo } from "@/api/user.js";
import { listdeptNoAuth } from '@/api/system/department'
export default { export default {
data() { data() {
return { return {
window: {
width: 0,
height: 0,
top: 0,
left: 0,
},
btnLoading: false, btnLoading: false,
type: "add", type: "add",
contractId: "", contractId: "",
@ -808,6 +853,8 @@ export default {
content: "", content: "",
contract_to_contracts: [], contract_to_contracts: [],
}, },
planTypes: [],
departments: [],
purchaseType: [], purchaseType: [],
moneyWay: [], moneyWay: [],
purchaseWay: [], purchaseWay: [],
@ -1015,6 +1062,9 @@ export default {
page_size: 20, page_size: 20,
page: 1, page: 1,
is_tree: 1, is_tree: 1,
year: "",
plan_department_id: "",
type: ""
}, },
planTable: [ planTable: [
{ {
@ -1166,6 +1216,30 @@ export default {
}) })
)?.detail || []; )?.detail || [];
}, },
getDepartment() {
listdeptNoAuth().then((res) => {
this.departments = res;
});
},
async getPlanTypes() {
const res = await getparameterTree({
id: 3
});
const dataHandler = (data) => {
data.forEach(i => {
if (i.hasOwnProperty('detail')) {
i.children = i.detail.map(j => {
j.name = j.value
return j;
})
} else {
dataHandler(i['children'])
}
})
return data;
}
this.planTypes = dataHandler(res?.children) || []
},
forwardStep() { forwardStep() {
if (this.step > 1) { if (this.step > 1) {
@ -1213,6 +1287,7 @@ export default {
}); });
} }
} else if (this.step === 2) { } else if (this.step === 2) {
//submit
this.$refs["form"].validate((valid) => { this.$refs["form"].validate((valid) => {
if (valid) { if (valid) {
this.btnLoading = true this.btnLoading = true
@ -1223,6 +1298,25 @@ export default {
addContrant(this.form,true).then(res => { addContrant(this.form,true).then(res => {
this.btnLoading = false this.btnLoading = false
this.step = 3; this.step = 3;
getContract({
page: 1,
page_size: 1,
sort_name: "created_at"
},true).then(res => {
const openData = res.list.data[0]
if (openData) {
if (
openData.is_simple !== 1 &&
openData.purchase_status === 1 &&
((openData.req_status === 3 && openData.is_plan === 0) ||
openData.is_plan === 1) &&
!openData.is_substitute
) {
this.buyProcess(openData)
}
}
})
}).catch(_ => this.btnLoading = false) }).catch(_ => this.btnLoading = false)
} }
if (this.type === 'edit') { if (this.type === 'edit') {
@ -1239,6 +1333,29 @@ export default {
} }
}, },
async buyProcess(row) {
let baseInfo = {
title: row?.name,
iszhengfucaigou:
(row.purchase_type?.value === "政府采购") ? "政府采购" : "否",
out_caigou_id: row.id,
type: this.types.find((item) => {
return item.value === row.type;
})?.label,
yusuan: row?.plan_price?.toString(),
zijinlaiyuan: row.money_way_detail?.value,
zijinlaiyuanjuti: row?.plans.reduce((pre,cur,index)=>(index === 0 ? cur?.name : pre+cur?.name+""),"")
};
let url = `${process.env.VUE_APP_OUT_OLD}?s=/flow/add/modid/8&auth_token=${this.$store.getters.oa_token}&out_caigou_id=${
row.id
}&contract_json=${JSON.stringify(baseInfo)}`;
window.open(
url,
"buyProcess",
`top=${this.window.top},left=${this.window.left},width=${this.window.width},height=${this.window.height},location=0`
);
},
// //
async getBudgets() { async getBudgets() {
let res = await getBudget(this.planSelect); let res = await getBudget(this.planSelect);
@ -1347,10 +1464,21 @@ export default {
content: res?.content, content: res?.content,
contract_to_contracts: [], contract_to_contracts: [],
} }
console.log(this.form)
} }
}, },
computed: { computed: {
purchaseWayFormat() {
return function () {
if (!this.form.purchase_type_id) {
return this.purchaseWay;
} else {
let temp = this.purchaseType.find((i) => i.id === this.form.purchase_type_id);
let arr = temp?.remark?.split(",")?.map((i) => Number(i));
return this.purchaseWay.filter((i) => arr.indexOf(i.id) !== -1);
}
};
},
isLedger () { isLedger () {
return this.$route.query.isLedger; return this.$route.query.isLedger;
}, },
@ -1610,6 +1738,12 @@ export default {
} }
}, },
created() { created() {
this.window.width = screen.availWidth * 0.95;
this.window.height = screen.availHeight * 0.95;
this.window.top = (window.screen.height - 30 - this.window.height) / 2;
this.window.left = (window.screen.width - 10 - this.window.width) / 2;
this.getPlanTypes();
this.getDepartment();
this.getBudgets(); this.getBudgets();
this.getMoneyWay(); this.getMoneyWay();
this.getPurchaseType(); this.getPurchaseType();

Loading…
Cancel
Save